Skip to content

Commit

Permalink
Merge pull request #32 from a-0vi/feat/flyctl
Browse files Browse the repository at this point in the history
feat: add flyctl
  • Loading branch information
a-ovi authored Aug 15, 2024
2 parents 2ca97d0 + 0cad0b4 commit 4d4df65
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ jobs:
- mirrord
- aws-sam-cli
- localstack
- flyctl
steps:
- uses: actions/checkout@v3
- name: "Install latest devcontainer CLI"
Expand Down
16 changes: 16 additions & 0 deletions src/flyctl/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "Fly.io CLI",
"id": "flyctl",
"version": "1.0.0",
"description": "Install [flyctl](https://github.com/superfly/flyctl) - Command line tools for [fly.io services](https://fly.io/)",
"installsAfter": [
"ghcr.io/devcontainers/features/common-utils"
],
"options": {
"version": {
"type": "string",
"default": "latest",
"description": "The version of flyctl to install. Valid values are 'latest' or a specific version number, e.g. '0.2.111'"
}
}
}
22 changes: 22 additions & 0 deletions src/flyctl/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

set -eax

ARCH=amd64
if [ "$(uname -m)" = "aarch64" ]; then ARCH=arm64; fi

echo "Installing flyctl..."

# get the download link of github release from the api
URL=$(curl -s https://api.fly.io/app/flyctl_releases/linux/$ARCH/$VERSION)

# download and extract the binary
curl -fL $URL | tar -xz

# make the binary executable and create a symlink
chmod +x flyctl
ln -s flyctl fly

# move the binary and symlink to /usr/local/bin
mv fly /usr/local/bin/fly
mv flyctl /usr/local/bin/flyctl
17 changes: 17 additions & 0 deletions test/flyctl/available_for_nonroot_user.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

set -e

source dev-container-features-test-lib

check "user is vscode" grep vscode <(whoami)

bins=(
flyctl
)

for bin in "${bins[@]}"; do
check "$bin" command -v "$bin"
done

reportResults
12 changes: 12 additions & 0 deletions test/flyctl/scenarios.json
Original file line number Diff line number Diff line change
@@ -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"
},
"flyctl": {}
}
}
}

0 comments on commit 4d4df65

Please sign in to comment.