Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions mitamae/cookbooks/cargo-lambda/default.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# cargo-lambda: build, test, and deploy AWS Lambda functions written in Rust.
#
# cargo-lambda is a Rust crate, but `cargo install cargo-lambda` compiles a huge
# dependency tree (aws-sdk, gix, watchexec, ...) from source and runs the CI
# containers out of disk ("No space left on device"). Install the prebuilt
# release binary instead -- it is small and fast on every platform.
#
# It runs as a Cargo subcommand (`cargo lambda`), so it still needs cargo on
# PATH: depend on the rust cookbook and drop the binary into ~/.cargo/bin, which
# rust already creates, exports on PATH, and goss validation picks up.
include_recipe File.expand_path('../rust', File.dirname(__FILE__))

version = '1.9.1' # Latest release -- verify against github.com/cargo-lambda/cargo-lambda/releases
home = ENV['HOME']
arch = node[:os_arch] == 'arm64' ? 'aarch64' : 'x86_64'

target =
if node[:platform] == 'darwin'
"#{arch}-apple-darwin"
elsif %w[ubuntu debian].include?(node[:platform])
# musl builds are statically linked, so they run on any glibc version.
"#{arch}-unknown-linux-musl"
else
unsupported_platform! node[:platform]
end

archive = "cargo-lambda-v#{version}.#{target}.tar.gz"
url = "https://github.com/cargo-lambda/cargo-lambda/releases/download/v#{version}/#{archive}"

execute "install cargo-lambda #{version}" do
command <<~INSTALL
set -e
tmp="$(mktemp -d)"
curl -fsSL "#{url}" -o "$tmp/#{archive}"
tar xzf "$tmp/#{archive}" -C "$tmp"
bin="$(find "$tmp" -type f -name cargo-lambda | head -n 1)"
install -m 0755 "$bin" "#{home}/.cargo/bin/cargo-lambda"
rm -rf "$tmp"
INSTALL
not_if "cargo lambda --version 2>/dev/null | grep -q '#{version}'"
end
4 changes: 4 additions & 0 deletions mitamae/cookbooks/cargo-lambda/goss.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
command:
cargo lambda --version:
exit-status: 0
timeout: 10000
1 change: 1 addition & 0 deletions mitamae/roles/bamboo/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

# Cloud & DevOps
include_recipe '../../cookbooks/awscli'
include_recipe '../../cookbooks/cargo-lambda'
include_recipe '../../cookbooks/gh'
include_recipe '../../cookbooks/docker'
include_recipe '../../cookbooks/devcontainer-cli'
Expand Down
1 change: 1 addition & 0 deletions mitamae/roles/bamboo/goss.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ gossfile:
../../cookbooks/starship/goss.yaml: {}
../../cookbooks/lazygit/goss.yaml: {}
../../cookbooks/awscli/goss.yaml: {}
../../cookbooks/cargo-lambda/goss.yaml: {}
../../cookbooks/gh/goss.yaml: {}
../../cookbooks/docker/goss.yaml: {}
../../cookbooks/devcontainer-cli/goss.yaml: {}
Expand Down
1 change: 1 addition & 0 deletions mitamae/roles/belle/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@

# Cloud & DevOps
include_recipe '../../cookbooks/awscli'
include_recipe '../../cookbooks/cargo-lambda'
include_recipe '../../cookbooks/cfn-lint'
include_recipe '../../cookbooks/gh'
include_recipe '../../cookbooks/docker'
Expand Down
1 change: 1 addition & 0 deletions mitamae/roles/belle/goss.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ gossfile:
../../cookbooks/nmap/goss.yaml: {}
../../cookbooks/nikto/goss.yaml: {}
../../cookbooks/awscli/goss.yaml: {}
../../cookbooks/cargo-lambda/goss.yaml: {}
../../cookbooks/cfn-lint/goss.yaml: {}
../../cookbooks/gh/goss.yaml: {}
../../cookbooks/docker/goss.yaml: {}
Expand Down
1 change: 1 addition & 0 deletions mitamae/roles/hercules/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@

# Cloud & DevOps
include_recipe '../../cookbooks/awscli'
include_recipe '../../cookbooks/cargo-lambda'
include_recipe '../../cookbooks/cfn-lint'
include_recipe '../../cookbooks/gh'
include_recipe '../../cookbooks/docker'
Expand Down
1 change: 1 addition & 0 deletions mitamae/roles/hercules/goss.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ gossfile:
../../cookbooks/cloudflared/goss.yaml: {}
../../cookbooks/nmap/goss.yaml: {}
../../cookbooks/awscli/goss.yaml: {}
../../cookbooks/cargo-lambda/goss.yaml: {}
../../cookbooks/cfn-lint/goss.yaml: {}
../../cookbooks/gh/goss.yaml: {}
../../cookbooks/docker/goss.yaml: {}
Expand Down
1 change: 1 addition & 0 deletions mitamae/roles/palm/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
# Cloud & DevOps
include_recipe '../../cookbooks/docker'
include_recipe '../../cookbooks/awscli'
include_recipe '../../cookbooks/cargo-lambda'
include_recipe '../../cookbooks/gh'
include_recipe '../../cookbooks/google-cloud-sdk'
include_recipe '../../cookbooks/cfn-lint'
Expand Down
1 change: 1 addition & 0 deletions mitamae/roles/palm/goss.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ gossfile:
../../cookbooks/kotlin-lsp/goss.yaml: {}
../../cookbooks/docker/goss.yaml: {}
../../cookbooks/awscli/goss.yaml: {}
../../cookbooks/cargo-lambda/goss.yaml: {}
../../cookbooks/gh/goss.yaml: {}
../../cookbooks/google-cloud-sdk/goss.yaml: {}
../../cookbooks/cfn-lint/goss.yaml: {}
Expand Down
1 change: 1 addition & 0 deletions mitamae/roles/pc137/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

# Cloud & DevOps
include_recipe '../../cookbooks/awscli'
include_recipe '../../cookbooks/cargo-lambda'
include_recipe '../../cookbooks/google-cloud-sdk'
include_recipe '../../cookbooks/cfn-lint'
include_recipe '../../cookbooks/gh'
Expand Down
1 change: 1 addition & 0 deletions mitamae/roles/pc137/goss.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ gossfile:
../../cookbooks/fastfetch/goss.yaml: {}
../../cookbooks/cloudflared/goss.yaml: {}
../../cookbooks/awscli/goss.yaml: {}
../../cookbooks/cargo-lambda/goss.yaml: {}
../../cookbooks/google-cloud-sdk/goss.yaml: {}
../../cookbooks/cfn-lint/goss.yaml: {}
../../cookbooks/gh/goss.yaml: {}
Expand Down
Loading