|
| 1 | +--- |
| 2 | +name: runner-add-tool |
| 3 | +description: >- |
| 4 | + Add or update a CLI/tool in the Deerhide python-github-runner image (Containerfile, |
| 5 | + manifest.yaml pins, Renovate, OpenAPI npm overrides, README). Use when adding a binary, |
| 6 | + apt package, OpenAPI npm CLI, changing an install RUN layer, or wiring a new *_VERSION pin. |
| 7 | +--- |
| 8 | + |
| 9 | +# Add a tool to the runner image |
| 10 | + |
| 11 | +## When to use |
| 12 | + |
| 13 | +- New CLI or runtime in the image |
| 14 | +- Change how an existing tool is installed |
| 15 | +- OpenAPI npm tool / CVE override in `openapi-tools/` |
| 16 | +- Keywords: Containerfile, manifest.yaml, Renovate, `*_VERSION`, redocly, spectral, portman, newman, oasdiff |
| 17 | + |
| 18 | +## Install method |
| 19 | + |
| 20 | +| Method | When | |
| 21 | +| --- | --- | |
| 22 | +| GitHub release binary (curl + install to `/usr/local/bin`) | Default for pin-able CLIs | |
| 23 | +| apt | OS packages only (skopeo, buildah, jq, trivy repo, deadsnakes) | |
| 24 | +| npm via `openapi-tools/` | OpenAPI JS CLIs sharing one prefix + CVE overrides | |
| 25 | +| pip | Rare (e.g. pre-commit); prefer binary otherwise | |
| 26 | + |
| 27 | +## Checklist |
| 28 | + |
| 29 | +Copy and track: |
| 30 | + |
| 31 | +``` |
| 32 | +Task progress: |
| 33 | +- [ ] 1. Choose install method |
| 34 | +- [ ] 2. Pin FOO_VERSION in manifest.yaml + Containerfile ARG |
| 35 | +- [ ] 3. Add RUN install layer (root, before USER runner) |
| 36 | +- [ ] 4. OpenAPI npm only: package + symlink + overrides if needed |
| 37 | +- [ ] 5. Renovate customManagers entry for the new pin |
| 38 | +- [ ] 6. Update README "What's included" |
| 39 | +- [ ] 7. Validate (hadolint / pre-commit / build-scan) |
| 40 | +``` |
| 41 | + |
| 42 | +### 1–2. Pin versions |
| 43 | + |
| 44 | +Add the same value in both places: |
| 45 | + |
| 46 | +```yaml |
| 47 | +# manifest.yaml → build.args |
| 48 | +- FOO_VERSION=1.2.3 |
| 49 | +``` |
| 50 | +
|
| 51 | +```dockerfile |
| 52 | +# Containerfile |
| 53 | +ARG FOO_VERSION=1.2.3 |
| 54 | +``` |
| 55 | + |
| 56 | +### 3. Binary install example |
| 57 | + |
| 58 | +```dockerfile |
| 59 | +ARG FOO_VERSION=1.2.3 |
| 60 | +RUN curl -sSL -o /usr/local/bin/foo \ |
| 61 | + "https://github.com/org/foo/releases/download/v${FOO_VERSION}/foo-linux-amd64" \ |
| 62 | + && chmod +x /usr/local/bin/foo |
| 63 | +``` |
| 64 | + |
| 65 | +Install as root in the `base` stage. Do not leave the final stage as root. |
| 66 | + |
| 67 | +**Bun:** use `bun-linux-x64-baseline.zip` (no AVX2 on some runner CPUs). |
| 68 | + |
| 69 | +### 4. OpenAPI npm tools |
| 70 | + |
| 71 | +Versions come from build args. CVE overrides only in `openapi-tools/package.json` (no lockfile). |
| 72 | + |
| 73 | +1. Add `FOO_VERSION` to `manifest.yaml` and `ARG` in Containerfile. |
| 74 | +2. Extend the `npm install --prefix /tmp/openapi-tools` line with `"@scope/pkg@${FOO_VERSION}"`. |
| 75 | +3. Add the binary name to the symlink `for bin in ...` loop. |
| 76 | +4. Add `overrides` only when Trivy reports a fixable transitive CVE. |
| 77 | + |
| 78 | +`oasdiff` is a standalone Go binary — do **not** put it in the npm prefix. |
| 79 | + |
| 80 | +### 5. Renovate |
| 81 | + |
| 82 | +Mirror existing managers in `renovate.json`: |
| 83 | + |
| 84 | +```json |
| 85 | +{ |
| 86 | + "customType": "regex", |
| 87 | + "description": "Update Foo version", |
| 88 | + "fileMatch": ["^Containerfile$", "^manifest\\.yaml$"], |
| 89 | + "matchStrings": ["FOO_VERSION=(?<currentValue>\\S+)"], |
| 90 | + "depNameTemplate": "org/foo", |
| 91 | + "datasourceTemplate": "github-releases", |
| 92 | + "extractVersionTemplate": "^v?(?<version>.+)$" |
| 93 | +} |
| 94 | +``` |
| 95 | + |
| 96 | +Adjust `extractVersionTemplate` / `datasourceTemplate` to match upstream tags (see Node / Bun managers). |
| 97 | + |
| 98 | +### 6–7. Docs and validate |
| 99 | + |
| 100 | +- Update the matching table in [README.md](../../../README.md). |
| 101 | +- Run `pre-commit run --all-files` (includes hadolint). |
| 102 | +- Prefer a full build-scan via the [`runner-build-release`](../runner-build-release/SKILL.md) skill before merge. |
0 commit comments