Skip to content

Commit a5279ba

Browse files
authored
feat: add Lambroll devcontainer feature (#7)
* add nodenv versioning * add lambroll * update test
1 parent 8e8737d commit a5279ba

File tree

10 files changed

+139
-3
lines changed

10 files changed

+139
-3
lines changed

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"image": "mcr.microsoft.com/devcontainers/javascript-node:1-20-bookworm",
2+
"image": "mcr.microsoft.com/devcontainers/javascript-node:dev-24-bookworm",
33
"customizations": {
44
"vscode": {
55
"settings": {

.github/workflows/test.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ jobs:
1414
matrix:
1515
features:
1616
- cargo-lambda
17+
- lambroll
1718
baseImage:
1819
- debian:latest
1920
- ubuntu:latest
@@ -33,6 +34,7 @@ jobs:
3334
matrix:
3435
features:
3536
- cargo-lambda
37+
- lambroll
3638
steps:
3739
- uses: actions/checkout@v4
3840

.node-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
24.7.0

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
# Dev Container Features: Cargo Lambda
1+
# Dev Container Features
22

3-
> This repository contains a feature of devcontainer to install [cargo-lambda](https://www.cargo-lambda.info/)
3+
> This repository contains features of devcontainer to install of following
4+
>
5+
> - [cargo-lambda](https://www.cargo-lambda.info/)
6+
> - [lambroll](https://github.com/fujiwara/lambroll)
47
58

69
# How to use
@@ -9,3 +12,5 @@ cargo-lambda: [Readme](src/cargo-lambda/README.md)
912
note:
1013
- This will install zig to latest version via (ghcr.io/devcontainers-extra/features/zig:1)
1114
- `rust` and `binstall` when not available, will be downloaded
15+
16+
Lambroll: [Readme](src/lambroll/README.md)

src/lambroll/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
2+
# Lambroll
3+
4+
[Lambroll](https://github.com/fujiwara/lambroll) is is a simple deployment tool for AWS Lambda.
5+
6+
## Example Usage
7+
8+
```json
9+
"features": {
10+
"ghcr.io/tokidoki11/devcontainer-feature/lambroll:1": {}
11+
}
12+
```
13+
14+
## Options
15+
16+
| Options Id | Description | Type | Default Value |
17+
|-----|-----|-----|-----|
18+
| version | Version of lambroll | string | latest |
19+
20+
21+
22+
---
23+
24+
_Note: This file was auto-generated from the [devcontainer-feature.json](https://github.com/tokidoki11/cargo-lambda-devcontainer-feature/blob/main/src/cargo-lambda/devcontainer-feature.json). Add additional notes to a `NOTES.md`._
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "lambroll",
3+
"id": "lambroll",
4+
"version": "1.0.0",
5+
"description": "Install lambroll AWS Lambda deployment tool",
6+
"options": {
7+
"version": {
8+
"type": "string",
9+
"default": "latest",
10+
"description": "Version of lambroll to install"
11+
}
12+
}
13+
}

src/lambroll/install.sh

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Get version from options
5+
VERSION=${VERSION:-"latest"}
6+
7+
# Detect architecture
8+
ARCH=$(dpkg --print-architecture)
9+
case $ARCH in
10+
amd64) LAMBROLL_ARCH="linux_amd64" ;;
11+
arm64) LAMBROLL_ARCH="linux_arm64" ;;
12+
*) echo "Unsupported architecture: $ARCH"; exit 1 ;;
13+
esac
14+
15+
# Create temporary directory
16+
TEMP_DIR=$(mktemp -d)
17+
cd "$TEMP_DIR"
18+
19+
which wget > /dev/null || (apt update && apt install wget -y -qq)
20+
21+
# If version is "latest", fetch the latest version tag from GitHub
22+
if [ "$VERSION" = "latest" ]; then
23+
wget -q https://api.github.com/repos/fujiwara/lambroll/releases -O releases.json
24+
VERSION=$(grep -oP '"tag_name": "\K(.*)(?=")' releases.json | head -n 1)
25+
if [ -z "$VERSION" ]; then
26+
echo "Failed to fetch the latest version"
27+
exit 1
28+
fi
29+
fi
30+
31+
32+
# Download pre-built binary
33+
DOWNLOAD_URL="https://github.com/fujiwara/lambroll/releases/download/${VERSION}/lambroll_${VERSION}_${LAMBROLL_ARCH}.tar.gz"
34+
echo "Downloading lambroll from: $DOWNLOAD_URL"
35+
wget -q "$DOWNLOAD_URL" -O lambroll.tar.gz
36+
37+
# Extract binary
38+
tar xf lambroll.tar.gz
39+
40+
# Install binary
41+
chmod +x lambroll
42+
mv lambroll /usr/local/bin/lambroll
43+
44+
# Cleanup
45+
rm -rf "$TEMP_DIR"
46+
47+
echo "lambroll ${VERSION} installed successfully"

test/lambroll/scenarios.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"versioned": {
3+
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
4+
"features": {
5+
"lambroll": {
6+
"version": "v1.3.1"
7+
}
8+
}
9+
}
10+
}

test/lambroll/test.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
# Optional: Import test library bundled with the devcontainer CLI
6+
# See https://github.com/devcontainers/cli/blob/HEAD/docs/features/test.md#dev-container-features-test-lib
7+
# Provides the 'check' and 'reportResults' commands.
8+
source dev-container-features-test-lib
9+
10+
# Feature-specific tests
11+
# The 'check' command comes from the dev-container-features-test-lib. Syntax is...
12+
# check <LABEL> <cmd> [args...]
13+
check "lambroll installed with version" bash -c "lambroll version | grep -oP 'v\d+\.\d+\.\d+' | sed 's/v//'"
14+
15+
# Report results
16+
# If any of the checks above exited with a non-zero exit code, the test will fail.
17+
reportResults

test/lambroll/versioned.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
# Optional: Import test library bundled with the devcontainer CLI
6+
# See https://github.com/devcontainers/cli/blob/HEAD/docs/features/test.md#dev-container-features-test-lib
7+
# Provides the 'check' and 'reportResults' commands.
8+
source dev-container-features-test-lib
9+
10+
# Feature-specific tests
11+
# The 'check' command comes from the dev-container-features-test-lib.
12+
# check <LABEL> <cmd> [args...]
13+
check "lambroll installed with 1.3.1" bash -c "lambroll version | grep -oP 'v\d+\.\d+\.\d+' | sed 's/v//' | grep 1.3.1"
14+
15+
# Report results
16+
# If any of the checks above exited with a non-zero exit code, the test will fail.
17+
reportResults

0 commit comments

Comments
 (0)