Skip to content

Commit 267e817

Browse files
committed
feat: add node, gcloud-cli, and dataform-cli features with tests
1 parent e09b803 commit 267e817

11 files changed

Lines changed: 203 additions & 8 deletions

File tree

README.md

Lines changed: 47 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,68 @@ Custom devcontainer features for Antigravity IDE development environments.
66

77
### `antigravity-nix`
88

9-
A consolidated feature that provides:
9+
Foundation feature that provides:
1010
- **vscode user** (uid/gid 1000) with passwordless sudo
1111
- **Nix package manager** (single-user mode with flakes enabled)
12-
- **Essential tools**: wget, git, curl, sudo, ca-certificates
12+
- **Essential tools**: wget, git, curl, sudo, ca-certificates, procps
1313

14-
#### Usage
14+
```json
15+
"ghcr.io/duizendstra/devcontainer-features/antigravity-nix:1": {}
16+
```
17+
18+
---
19+
20+
### `node`
21+
22+
Installs Node.js from NodeSource with version selection.
1523

1624
```json
17-
{
18-
"features": {
19-
"ghcr.io/duizendstra/devcontainer-features/antigravity-nix:1": {}
20-
}
25+
"ghcr.io/duizendstra/devcontainer-features/node:1": {
26+
"version": "lts"
2127
}
2228
```
2329

30+
**Options:**
31+
- `version`: `lts`, `20`, `22`, `24`, or `latest`
32+
33+
---
34+
35+
### `gcloud-cli`
36+
37+
Installs Google Cloud CLI via official Debian packages.
38+
39+
```json
40+
"ghcr.io/duizendstra/devcontainer-features/gcloud-cli:1": {}
41+
```
42+
43+
---
44+
45+
### `dataform-cli`
46+
47+
Installs Dataform CLI (@dataform/cli) via npm. Requires `node` feature.
48+
49+
```json
50+
"ghcr.io/duizendstra/devcontainer-features/dataform-cli:1": {}
51+
```
52+
53+
## Dependency Chain
54+
55+
```
56+
antigravity-nix → node → dataform-cli
57+
→ gcloud-cli
58+
```
59+
2460
## Publishing
2561

2662
Features are automatically published to `ghcr.io/duizendstra/devcontainer-features/` when pushed to main.
2763

2864
## Development
2965

30-
To test features locally, use the dev container CLI:
66+
Test features locally:
3167

3268
```bash
3369
devcontainer features test -f antigravity-nix
70+
devcontainer features test -f node
71+
devcontainer features test -f gcloud-cli
72+
devcontainer features test -f dataform-cli
3473
```

src/antigravity-nix/install.sh

100644100755
File mode changed.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"id": "dataform-cli",
3+
"version": "1.0.0",
4+
"name": "Dataform CLI",
5+
"description": "Installs the Dataform CLI (@dataform/cli) via npm",
6+
"options": {},
7+
"installsAfter": [
8+
"ghcr.io/duizendstra/devcontainer-features/node"
9+
]
10+
}

src/dataform-cli/install.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
echo "=== Dataform CLI Feature ==="
5+
6+
# Check if npm is available
7+
if ! command -v npm &> /dev/null; then
8+
echo "Error: npm is not installed. This feature depends on the Node.js feature."
9+
exit 1
10+
fi
11+
12+
# Install Dataform CLI globally
13+
npm install -g @dataform/cli
14+
15+
echo "Dataform CLI installed successfully!"
16+
dataform --version
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"id": "gcloud-cli",
3+
"version": "1.0.0",
4+
"name": "Google Cloud CLI",
5+
"description": "Installs the Google Cloud CLI (gcloud) via official Debian packages",
6+
"options": {},
7+
"installsAfter": [
8+
"ghcr.io/duizendstra/devcontainer-features/antigravity-nix"
9+
]
10+
}

src/gcloud-cli/install.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
echo "=== Google Cloud CLI Feature ==="
5+
6+
# Ensure prerequisites are installed
7+
apt-get update
8+
apt-get install -y apt-transport-https ca-certificates gnupg curl
9+
10+
# Trust Google Cloud public key
11+
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg
12+
13+
# Add distribution URI as a package source
14+
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
15+
16+
# Install the CLI
17+
apt-get update
18+
apt-get install -y google-cloud-cli
19+
20+
# Cleanup
21+
apt-get clean
22+
rm -rf /var/lib/apt/lists/*
23+
24+
echo "Google Cloud CLI installed successfully!"
25+
gcloud --version

src/node/devcontainer-feature.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"id": "node",
3+
"version": "1.0.0",
4+
"name": "Node.js (NodeSource)",
5+
"description": "Installs Node.js from NodeSource with version selection",
6+
"options": {
7+
"version": {
8+
"type": "string",
9+
"proposals": [
10+
"lts",
11+
"20",
12+
"22",
13+
"24",
14+
"latest"
15+
],
16+
"default": "lts",
17+
"description": "Node.js version to install"
18+
}
19+
},
20+
"installsAfter": [
21+
"ghcr.io/duizendstra/devcontainer-features/antigravity-nix"
22+
]
23+
}

src/node/install.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
NODE_VERSION="${VERSION:-lts}"
5+
6+
echo "=== Node.js Feature ==="
7+
echo "Installing Node.js version '${NODE_VERSION}' via NodeSource..."
8+
9+
# Install dependencies if missing
10+
if ! command -v curl >/dev/null 2>&1; then
11+
apt-get update && apt-get install -y curl gnupg
12+
fi
13+
14+
# Determine setup URL based on version
15+
if [ "${NODE_VERSION}" = "lts" ]; then
16+
SETUP_URL="https://deb.nodesource.com/setup_lts.x"
17+
elif [ "${NODE_VERSION}" = "latest" ]; then
18+
SETUP_URL="https://deb.nodesource.com/setup_current.x"
19+
else
20+
SETUP_URL="https://deb.nodesource.com/setup_${NODE_VERSION}.x"
21+
fi
22+
23+
echo "Fetching setup script from ${SETUP_URL}..."
24+
curl -fsSL "${SETUP_URL}" | bash -
25+
26+
echo "Installing nodejs package..."
27+
apt-get install -y nodejs
28+
29+
echo "Node.js installed successfully!"
30+
node --version
31+
npm --version

test/dataform-cli/test.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
set -e
3+
4+
echo "=== Testing dataform-cli feature ==="
5+
6+
# Test: Check dataform is installed
7+
echo "Test: Checking Dataform CLI installation..."
8+
dataform --version || (echo "FAIL: dataform not found" && exit 1)
9+
echo "PASS: Dataform CLI is installed"
10+
11+
echo ""
12+
echo "=== All tests passed! ==="

test/gcloud-cli/test.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
set -e
3+
4+
echo "=== Testing gcloud-cli feature ==="
5+
6+
# Test: Check gcloud is installed
7+
echo "Test: Checking gcloud installation..."
8+
gcloud --version || (echo "FAIL: gcloud not found" && exit 1)
9+
echo "PASS: gcloud is installed"
10+
11+
echo ""
12+
echo "=== All tests passed! ==="

0 commit comments

Comments
 (0)