From 62f60713acc3a698dcbbe0170761c7e042a0e10c Mon Sep 17 00:00:00 2001 From: Tanjim Hossain Date: Mon, 8 Jan 2024 13:33:09 +0000 Subject: [PATCH] add aws sam --- .github/workflows/test.yaml | 1 + src/aws-sam-cli/devcontainer-feature.json | 9 +++++++++ src/aws-sam-cli/install.sh | 19 +++++++++++++++++++ src/knative/devcontainer-feature.json | 2 +- src/knative/install.sh | 1 - .../aws-sam-cli/available_for_nonroot_user.sh | 17 +++++++++++++++++ test/aws-sam-cli/scenarios.json | 12 ++++++++++++ 7 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 src/aws-sam-cli/devcontainer-feature.json create mode 100755 src/aws-sam-cli/install.sh create mode 100644 test/aws-sam-cli/available_for_nonroot_user.sh create mode 100644 test/aws-sam-cli/scenarios.json diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 621263c..dbfa7aa 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -49,6 +49,7 @@ jobs: - ebort - pack-cli - mirrord + - aws-sam-cli steps: - uses: actions/checkout@v3 - name: "Install latest devcontainer CLI" diff --git a/src/aws-sam-cli/devcontainer-feature.json b/src/aws-sam-cli/devcontainer-feature.json new file mode 100644 index 0000000..30f2d29 --- /dev/null +++ b/src/aws-sam-cli/devcontainer-feature.json @@ -0,0 +1,9 @@ +{ + "name": "AWS SAM CLI", + "id": "aws-sam-cli", + "version": "1.0.0", + "description": "SAM CLI with ARM64 support", + "installsAfter": [ + "ghcr.io/devcontainers/features/common-utils" + ] +} diff --git a/src/aws-sam-cli/install.sh b/src/aws-sam-cli/install.sh new file mode 100755 index 0000000..53f23ed --- /dev/null +++ b/src/aws-sam-cli/install.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +set -eax + +ARCH=$(uname -m) +if [ "$ARCH" = "aarch64" ]; then ARCH=arm64; fi + +install_sam_cli(){ + echo "Installing AWS SAM cli..." + + local artifact="aws-sam-cli-linux-${ARCH?}.zip" + + curl -sLO "https://github.com/aws/aws-sam-cli/releases/latest/download/$artifact" + + unzip $artifact + ./install +} + +install_sam_cli \ No newline at end of file diff --git a/src/knative/devcontainer-feature.json b/src/knative/devcontainer-feature.json index 7243df7..4f342e7 100644 --- a/src/knative/devcontainer-feature.json +++ b/src/knative/devcontainer-feature.json @@ -1,7 +1,7 @@ { "name": "Knative", "id": "knative", - "version": "1.0.0", + "version": "1.0.1", "description": "Installs Knative CLI (kn and kn func)", "installsAfter": [ "ghcr.io/devcontainers/features/common-utils" diff --git a/src/knative/install.sh b/src/knative/install.sh index 09559cc..1e35611 100755 --- a/src/knative/install.sh +++ b/src/knative/install.sh @@ -21,7 +21,6 @@ install_knative_func_cli(){ echo "Installing knative func cli..." local artifact="func_linux_${ARCH?}" - local version="1.11.0" curl -sLO "https://github.com/knative/func/releases/latest/download/$artifact" diff --git a/test/aws-sam-cli/available_for_nonroot_user.sh b/test/aws-sam-cli/available_for_nonroot_user.sh new file mode 100644 index 0000000..4925365 --- /dev/null +++ b/test/aws-sam-cli/available_for_nonroot_user.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +set -e + +source dev-container-features-test-lib + +check "user is vscode" grep vscode <(whoami) + +bins=( + sam +) + +for bin in "${bins[@]}"; do + check "$bin" command -v "$bin" +done + +reportResults diff --git a/test/aws-sam-cli/scenarios.json b/test/aws-sam-cli/scenarios.json new file mode 100644 index 0000000..28687f2 --- /dev/null +++ b/test/aws-sam-cli/scenarios.json @@ -0,0 +1,12 @@ +{ + "available_for_nonroot_user": { + "image": "mcr.microsoft.com/devcontainers/base:ubuntu", + "remoteUser": "vscode", + "features": { + "ghcr.io/devcontainers/features/common-utils:2": { + "username": "vscode" + }, + "aws-sam-cli": {} + } + } +}