-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adding air live reload command
- Loading branch information
1 parent
416d26e
commit d8dfefc
Showing
6 changed files
with
161 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,7 +34,8 @@ jobs: | |
matrix: | ||
features: | ||
- clusterctl | ||
|
||
- air | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
|
||
# clusterctl CLI (clusterctl) | ||
|
||
The clusterctl CLI tool handles the lifecycle of a Cluster API management cluster. | ||
|
||
## Example Usage | ||
|
||
```json | ||
"features": { | ||
"ghcr.io/ZEISS/devcontainer-features/clusterctl:1": {} | ||
} | ||
``` | ||
|
||
## Options | ||
|
||
| Options Id | Description | Type | Default Value | | ||
|-----|-----|-----|-----| | ||
| version | Select or enter clusterctl version to install. | string | v1.8.3 | | ||
|
||
|
||
|
||
--- | ||
|
||
_Note: This file was auto-generated from the [devcontainer-feature.json](https://github.com/ZEISS/devcontainer-features/blob/main/src/clusterctl/devcontainer-feature.json). Add additional notes to a `NOTES.md`._ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"name": "Air - Live reload for Go apps", | ||
"id": "air", | ||
"version": "1.0.0", | ||
"description": "Air - Live reload for Go apps", | ||
"options": { | ||
"version": { | ||
"type": "string", | ||
"proposals": [ | ||
"1.61.0" | ||
], | ||
"default": "1.61.0", | ||
"description": "Select or enter air version to install." | ||
} | ||
}, | ||
"installsAfter": [ | ||
"ghcr.io/devcontainers/features/common-utils" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
echo "Activating feature 'air'" | ||
|
||
# Default version | ||
VERSION=${VERSION:-"latest"} | ||
|
||
# Defailt install path | ||
BIN=${BIN:-/usr/local/bin} | ||
|
||
echo "Installing air version $VERSION" | ||
|
||
# Clean up | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
echo "Step 1, check if user is root" | ||
if [ "$(id -u)" -ne 0 ]; then | ||
echo -e 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.' | ||
exit 1 | ||
fi | ||
|
||
echo "Step 2, check if architecture is supported" | ||
ARCHITECTURE="$(uname -m | sed s/aarch64/arm64/ | sed s/x86_64/amd64/)" | ||
if [ "${ARCHITECTURE}" != "amd64" ] && [ "${ARCHITECTURE}" != "x86_64" ] && [ "${ARCHITECTURE}" != "arm64" ] && [ "${ARCHITECTURE}" != "aarch64" ]; then | ||
echo "(!) Architecture $ARCHITECTURE unsupported" | ||
exit 1 | ||
fi | ||
|
||
echo "Step 3, check the os in small case" | ||
OS="$(uname -s | tr '[:upper:]' '[:lower:]')" | ||
|
||
apt_get_update() | ||
{ | ||
if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then | ||
echo "Running apt-get update..." | ||
apt-get update -y | ||
fi | ||
} | ||
|
||
# Checks if packages are installed and installs them if not | ||
check_packages() { | ||
if ! dpkg -s "$@" > /dev/null 2>&1; then | ||
apt_get_update | ||
apt-get -y install --no-install-recommends "$@" | ||
fi | ||
} | ||
|
||
export DEBIAN_FRONTEND=noninteractive | ||
|
||
# Install dependencies | ||
check_packages ca-certificates curl unzip | ||
|
||
# Install air | ||
|
||
curl -sSL "https://github.com/air-verse/air/releases/download/v${VERSION}/air_${VERSION}_${OS}_${ARCHITECTURE}" -o "${BIN}/air" | ||
chmod +x "${BIN}/air" | ||
|
||
# Clean up | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
echo "Done!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
# Clean up | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
if [ "$(id -u)" -ne 0 ]; then | ||
echo -e 'Script must be run as root to be able to installe dependencies, changing to sudo when installing.' | ||
fi | ||
|
||
apt_get_update() { | ||
if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then | ||
echo "Running apt-get update..." | ||
if [ "$(id -u)" -ne 0 ]; then | ||
sudo apt-get update -y | ||
else | ||
apt-get update -y | ||
fi | ||
fi | ||
} | ||
|
||
check_packages() { | ||
if ! dpkg -s "$@" >/dev/null 2>&1; then | ||
apt_get_update | ||
if [ "$(id -u)" -ne 0 ]; then | ||
sudo apt-get -y install --no-install-recommends "$@" | ||
else | ||
apt-get -y install --no-install-recommends "$@" | ||
fi | ||
fi | ||
} | ||
export DEBIAN_FRONTEND=noninteractive | ||
|
||
check_packages ca-certificates curl unzip | ||
|
||
# Optional: Import test library bundled with the devcontainer CLI | ||
source dev-container-features-test-lib | ||
|
||
# Feature-specific tests | ||
# The 'check' command comes from the dev-container-features-test-lib. | ||
check "version" air -v | ||
|
||
# Report results | ||
# If any of the checks above exited with a non-zero exit code, the test will fail. | ||
reportResults |