Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devcontainer/scripts/postCreate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -euo pipefail
echo "🔧 Installing devcontainer CLI..."
npm install -g @devcontainers/cli

FEATURES=("ag" "amazon-q-cli" "zip")
FEATURES=("ag" "amazon-q-cli" "gcloud-cli" "zip")
BASE_IMAGES=("debian:latest" "ubuntu:latest" "mcr.microsoft.com/devcontainers/base:ubuntu")

# Run autogenerated tests for each image
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
features:
- ag
- amazon-q-cli
- gcloud-cli
- zip
baseImage:
- debian:latest
Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ This repository contains following features:

- [ag](./src/ag/README.md): Installs ag (The Silver Searcher), a fast grep-like text search tool
- [amazon-q-cli](./src/amazon-q-cli/README.md): Install Amazon Q CLI for AWS development
- [gcloud-cli](./src/gcloud-cli/README.md): Installs Google Cloud CLI (gcloud) for Google Cloud Platform development
- [zip](./src/zip/README.md): Installs zip and unzip CLI tools for compression and extraction

## Usage
Expand All @@ -20,6 +21,7 @@ These examples show how to use features from this repository in a devcontainer:
"features": {
"ghcr.io/jajera/features/ag:1": {},
"ghcr.io/jajera/features/amazon-q-cli:1": {},
"ghcr.io/jajera/features/gcloud-cli:1": {},
"ghcr.io/jajera/features/zip:1": {}
}
}
Expand All @@ -31,7 +33,7 @@ Or use individual features:
{
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"features": {
"ghcr.io/jajera/features/ag:1": {}
"ghcr.io/jajera/features/gcloud-cli:1": {}
}
}
```
Expand All @@ -50,13 +52,18 @@ Similar to the [`devcontainers/features`](https://github.com/devcontainers/featu
│ │ ├── devcontainer-feature.json
│ │ ├── install.sh
│ │ └── README.md
│ ├── gcloud-cli
│ │ ├── devcontainer-feature.json
│ │ ├── install.sh
│ │ └── README.md
│ ├── zip
│ │ ├── devcontainer-feature.json
│ │ ├── install.sh
│ │ └── README.md
├── test
│ ├── ag
│ ├── amazon-q-cli
│ ├── gcloud-cli
│ └── zip
...
```
Expand Down
96 changes: 96 additions & 0 deletions src/gcloud-cli/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# Google Cloud CLI (gcloud-cli)

Installs `gcloud` (Google Cloud CLI), the command-line interface for Google Cloud Platform.

## Example Usage

```json
"features": {
"ghcr.io/jajera/features/gcloud-cli:1": {}
}
```

## Options

This feature has no configurable options.

## Description

This feature installs `gcloud` (Google Cloud CLI), the command-line interface for Google Cloud Platform. The installation is compatible with multiple Linux distributions and package managers including:

- **Debian/Ubuntu**: Uses `apt-get`
- **RHEL/CentOS/Fedora**: Uses `yum`/`dnf`
- **Alpine Linux**: Uses `apk`
- **Arch Linux**: Uses `pacman`
- **openSUSE**: Uses `zypper`

## Features

- ✅ Cross-platform support for major Linux distributions
- ✅ Automatic package manager detection
- ✅ Retry logic for package updates
- ✅ Privilege escalation handling (sudo when needed)
- ✅ Comprehensive error handling
- ✅ Installation verification
- ✅ Automatic shell completion setup (bash and zsh)
- ✅ Symlinks for gcloud, gsutil, and bq binaries
- ✅ Non-interactive initialization
- ✅ Support for x86_64 and ARM64 architectures

### Package Names by Platform

Dependencies installed by platform:

- Debian/Ubuntu: `curl`, `gnupg`, `lsb-release`
- RHEL/CentOS/Fedora: `curl`, `gnupg2`
- Alpine: `curl`, `gnupg`
- Arch: `curl`, `gnupg`
- openSUSE: `curl`, `gnupg2`

## Usage Examples

After installation, you can use the Google Cloud CLI tools:

```bash
# Check gcloud version
gcloud version

# Initialize gcloud (if not done automatically)
gcloud init

# List available projects
gcloud projects list

# Set active project
gcloud config set project PROJECT_ID

# List compute instances
gcloud compute instances list

# Use gsutil for Cloud Storage operations
gsutil ls gs://

# Use bq for BigQuery operations
bq ls
```

## Verification

The feature automatically verifies successful installation by:

- Checking if `gcloud` command is available
- Running version check for the utility
- Verifying `gsutil` and `bq` binaries are accessible
- Testing basic gcloud functionality
- Setting up shell completion for bash and zsh

## Shell Completion

The feature automatically sets up shell completion:

- **Bash**: Completion is installed to `/etc/bash_completion.d/` (system-wide) or `~/.bash_completion.d/` (user-specific)
- **Zsh**: Completion is sourced in `~/.zshrc` or `/etc/zsh/zshrc`

---

_Note, this file was auto-generated from the [devcontainer-feature.json](https://github.com/jajera/features/blob/main/src/gcloud-cli/devcontainer-feature.json). Add additional notes to a `NOTES.md`._
7 changes: 7 additions & 0 deletions src/gcloud-cli/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "Google Cloud CLI",
"id": "gcloud-cli",
"version": "1.0.0",
"description": "Installs Google Cloud CLI (gcloud) for Google Cloud Platform development.",
"documentationURL": "https://cloud.google.com/sdk/docs/install"
}
Loading