Skip to content

Commit 3c41ec1

Browse files
committed
feat(image): add GitHub CLI for gh api workflow steps
Workflow steps calling 'gh api' (dependency-graph snapshot submission in fastapi_factory_utilities CI) failed with 'gh: command not found' because the runner image never shipped the GitHub CLI.
1 parent ba308a3 commit 3c41ec1

4 files changed

Lines changed: 21 additions & 0 deletions

File tree

Containerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,16 @@ RUN curl -sSL -o /usr/local/bin/kubectl \
110110
"https://dl.k8s.io/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl" \
111111
&& chmod +x /usr/local/bin/kubectl
112112

113+
# Install GitHub CLI (workflows calling `gh api`, e.g. dependency-graph snapshots)
114+
ARG GH_CLI_VERSION=2.96.0
115+
RUN curl -sSL -o /tmp/gh.tgz \
116+
"https://github.com/cli/cli/releases/download/v${GH_CLI_VERSION}/gh_${GH_CLI_VERSION}_linux_amd64.tar.gz" \
117+
&& tar -xzf /tmp/gh.tgz -C /tmp "gh_${GH_CLI_VERSION}_linux_amd64/bin/gh" \
118+
&& mv "/tmp/gh_${GH_CLI_VERSION}_linux_amd64/bin/gh" /usr/local/bin/gh \
119+
&& chmod +x /usr/local/bin/gh \
120+
&& rm -rf /tmp/gh.tgz "/tmp/gh_${GH_CLI_VERSION}_linux_amd64" \
121+
&& gh --version
122+
113123
# Install pack (Cloud Native Buildpacks CLI)
114124
ARG PACK_VERSION=0.40.8
115125
RUN curl -sSL -o /tmp/pack.tgz \

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Container image based on the [GitHub Actions Runner](https://github.com/actions/
2323
| [Argo Workflows CLI](https://github.com/argoproj/argo-workflows) | Workflow orchestration on Kubernetes |
2424
| [Kargo CLI](https://github.com/akuity/kargo) | Application lifecycle orchestration |
2525
| [kubectl](https://kubernetes.io/docs/reference/kubectl/) | Kubernetes CLI (in-cluster kpack builds from green ARC runners) |
26+
| [gh](https://cli.github.com/) | GitHub CLI (`gh api` calls from workflows, e.g. dependency-graph snapshots) |
2627
| [jq](https://jqlang.org/) | JSON processor (kpack git-token refresher CronJob) |
2728
| [pack](https://github.com/buildpacks/pack) | Cloud Native Buildpacks CLI |
2829
| [skopeo](https://github.com/containers/skopeo) | Container image registry operations |

manifest.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ build:
1010
- KARGO_VERSION=1.10.8
1111
- PACK_VERSION=0.40.8
1212
- KUBECTL_VERSION=1.36.2
13+
- GH_CLI_VERSION=2.96.0
1314
- DIVE_VERSION=0.13.1
1415
- SYFT_VERSION=1.46.0
1516
- GRYPE_VERSION=0.115.0

renovate.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,15 @@
7676
"datasourceTemplate": "github-releases",
7777
"extractVersionTemplate": "^v?(?<version>.+)$"
7878
},
79+
{
80+
"customType": "regex",
81+
"description": "Update GitHub CLI version",
82+
"fileMatch": ["^Containerfile$", "^manifest\\.yaml$"],
83+
"matchStrings": ["GH_CLI_VERSION=(?<currentValue>\\S+)"],
84+
"depNameTemplate": "cli/cli",
85+
"datasourceTemplate": "github-releases",
86+
"extractVersionTemplate": "^v?(?<version>.+)$"
87+
},
7988
{
8089
"customType": "regex",
8190
"description": "Update pack (Buildpacks) CLI version",

0 commit comments

Comments
 (0)