From 1f0d58e687694ac024a4d1be97cea70607e1b410 Mon Sep 17 00:00:00 2001 From: unkin-agent Date: Fri, 20 Nov 2026 22:11:39 +1100 Subject: [PATCH 1/4] Add GitHub Actions CI and GoReleaser release --- .github/CODEOWNERS | 1 + .github/workflows/ci.yml | 65 +++++++++++++++++++++++++++ .github/workflows/release.yml | 39 ++++++++++++++++ .goreleaser.yml | 75 +++++++++++++++++++++++++++++++ .woodpecker/docker.yaml | 18 -------- .woodpecker/release.yaml | 85 ----------------------------------- Makefile | 10 ++--- README.md | 11 ++--- packaging/nfpm.yaml | 52 --------------------- scripts/build-rpm.sh | 34 -------------- scripts/sign.sh | 9 ++++ 11 files changed, 199 insertions(+), 200 deletions(-) create mode 100644 .github/CODEOWNERS create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml create mode 100644 .goreleaser.yml delete mode 100644 .woodpecker/docker.yaml delete mode 100644 .woodpecker/release.yaml delete mode 100644 packaging/nfpm.yaml delete mode 100755 scripts/build-rpm.sh create mode 100755 scripts/sign.sh diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..711107c --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @IUCLabs/maintainers diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..5ce0cb8 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,65 @@ +name: ci + +on: + pull_request: + push: + branches: [main] + +permissions: + contents: read + +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +jobs: + pre-commit: + runs-on: iuclabs-k8s + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: actions/setup-go@d8cbb8045d7f43706b9177cceb36c1f91a6644d5 # v7.1.0 + with: + go-version-file: go.mod + - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 + - run: uvx pre-commit run --all-files --show-diff-on-failure + + lint: + runs-on: iuclabs-k8s + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: actions/setup-go@d8cbb8045d7f43706b9177cceb36c1f91a6644d5 # v7.1.0 + with: + go-version-file: go.mod + - run: go vet ./... + + test: + runs-on: iuclabs-k8s + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: actions/setup-go@d8cbb8045d7f43706b9177cceb36c1f91a6644d5 # v7.1.0 + with: + go-version-file: go.mod + # runner image has no C toolchain, so no -race + - run: go test -count=1 ./... + + build: + runs-on: iuclabs-k8s + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: actions/setup-go@d8cbb8045d7f43706b9177cceb36c1f91a6644d5 # v7.1.0 + with: + go-version-file: go.mod + - run: go build -trimpath -ldflags="-s -w" ./... + + image: + runs-on: iuclabs-k8s + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: actions/setup-go@d8cbb8045d7f43706b9177cceb36c1f91a6644d5 # v7.1.0 + with: + go-version-file: go.mod + - run: go run github.com/google/ko@v0.19.1 build --push=false --bare ./cmd/encapi + env: + GOTOOLCHAIN: auto + KO_DOCKER_REPO: ghcr.io/iuclabs/encapi + KO_DEFAULTBASEIMAGE: gcr.io/distroless/static-debian12:nonroot diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..77e5804 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,39 @@ +name: release + +on: + push: + tags: ["v*"] + +permissions: + contents: write + id-token: write + packages: write + +env: + VAULT_ADDR: https://vault.service.consul:8200 + +jobs: + release: + runs-on: iuclabs-release + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: 0 + - uses: actions/setup-go@d8cbb8045d7f43706b9177cceb36c1f91a6644d5 # v7.1.0 + with: + go-version-file: go.mod + - uses: hashicorp/vault-action@892a26828f195e65540a40b4768ae4571f51ebfc # v4.0.0 + with: + url: ${{ env.VAULT_ADDR }} + method: jwt + path: jwt/github/iuclabs + role: release + jwtGithubAudience: ${{ env.VAULT_ADDR }} + exportToken: true + - uses: goreleaser/goreleaser-action@a4f02ab5355a589de60d917a659ce617ed19b3de # v7.3.0 + with: + distribution: goreleaser + version: v2.20.2 + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..8682b22 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,75 @@ +version: 2 +project_name: encapi + +builds: + - &build + id: encapi-cli + main: ./cmd/encapi-cli + binary: encapi-cli + env: + - CGO_ENABLED=0 + mod_timestamp: "{{ .CommitTimestamp }}" + flags: + - -trimpath + ldflags: + - -s -w -X main.version={{ .Tag }} + goos: [linux] + goarch: [amd64] + - <<: *build + id: encapi + main: ./cmd/encapi + binary: encapi + +archives: + - formats: [none] + +nfpms: + - package_name: encapi-cli + ids: [encapi-cli] + bindir: /usr/local/bin + formats: [rpm] + file_name_template: "{{ .ConventionalFileName }}" + release: "1" + section: default + priority: extra + description: CLI + Puppet ENC entrypoint for encapi (External Node Classifier) + maintainer: Ben Vincent + homepage: https://git.unkin.net/unkin/encapi + license: MIT + replaces: [encapi-cli] + provides: [encapi-cli] + contents: + - src: packaging/encapi-enc + dst: /usr/local/bin/encapi-enc + file_info: + mode: 0755 + - src: packaging/enc.conf + dst: /etc/encapi/enc.conf + type: config|noreplace + file_info: + mode: 0644 + scripts: + preinstall: packaging/scripts/preinstall.sh + +kos: + - build: encapi + base_image: gcr.io/distroless/static-debian12:nonroot + repositories: [ghcr.io/iuclabs/encapi] + tags: ["{{ .Tag }}", latest] + bare: true + platforms: [linux/amd64] + sbom: none + labels: + org.opencontainers.image.source: https://github.com/IUCLabs/encapi + +checksum: + name_template: "{{ .ProjectName }}_{{ .Version }}_SHA256SUMS" + algorithm: sha256 + +signs: + - artifacts: checksum + cmd: scripts/sign.sh + args: ["${artifact}", "${signature}"] + +changelog: + disable: true diff --git a/.woodpecker/docker.yaml b/.woodpecker/docker.yaml deleted file mode 100644 index c4ee4c3..0000000 --- a/.woodpecker/docker.yaml +++ /dev/null @@ -1,18 +0,0 @@ -when: - - event: tag - ref: refs/tags/v* - -steps: - - name: docker-encapi - image: artifactapi.k8s.syd1.au.unkin.net/docker-internal/plugin-docker-buildx:latest - settings: - registry: artifactapi.k8s.syd1.au.unkin.net - repo: artifactapi.k8s.syd1.au.unkin.net/docker-internal/encapi - build_args: - VERSION: ${CI_COMMIT_TAG} - buildkit_config: | - [registry."artifactapi.k8s.syd1.au.unkin.net"] - ca = ["/etc/docker/certs.d/artifactapi.k8s.syd1.au.unkin.net/ca.crt"] - tags: - - ${CI_COMMIT_TAG} - - latest diff --git a/.woodpecker/release.yaml b/.woodpecker/release.yaml deleted file mode 100644 index 34314f7..0000000 --- a/.woodpecker/release.yaml +++ /dev/null @@ -1,85 +0,0 @@ -when: - - event: tag - -# Builds the encapi-cli RPM and publishes it to the ArtifactAPI rpm-internal -# repo. The server image is built separately by docker.yaml. -steps: - - name: build - image: artifactapi.k8s.syd1.au.unkin.net/docker-internal/gobuilder:0.1.2-alma9 - commands: - - make build-cli VERSION=${CI_COMMIT_TAG} - environment: - GOCACHE_S3_BUCKET: gocache - GOCACHE_S3_REGION: us-east-1 - GOCACHE_S3_ENDPOINT_URL: https://s3.ceph.unkin.net - GOCACHE_S3_PATH_STYLE: "true" - GOCACHE_KEY_PREFIX: ci-encapi - GOCACHEPROG: go-cache-plugin --cache-dir=/tmp/gocache - AWS_ACCESS_KEY_ID: - from_secret: GOCACHE_AWS_ACCESS_KEY_ID - AWS_SECRET_ACCESS_KEY: - from_secret: GOCACHE_AWS_SECRET_ACCESS_KEY - backend_options: - kubernetes: - serviceAccountName: default - resources: - requests: - memory: 1Gi - cpu: 1 - limits: - memory: 3Gi - cpu: 2 - - - name: package - image: artifactapi.k8s.syd1.au.unkin.net/docker-internal/rpmbuilder:0.1.0-alma9 - commands: - - ./scripts/build-rpm.sh ${CI_COMMIT_TAG} - depends_on: [build] - backend_options: - kubernetes: - serviceAccountName: default - resources: - requests: - memory: 512Mi - cpu: 1 - limits: - memory: 2Gi - cpu: 2 - - - name: upload - image: git.unkin.net/unkin/almalinux9-base:20260606 - commands: - - | - HOST="https://artifactapi.k8s.syd1.au.unkin.net" - REPO="rpm-internal" - set -o pipefail - VAULT="https://vault.service.consul:8200" - AUTH=$$(mktemp) - VT=$$(jq -n --rawfile jwt /var/run/secrets/kubernetes.io/serviceaccount/token '{role:"woodpecker_artifactapi_writer",jwt:$$jwt}' \ - | curl -sf -d @- "$$VAULT/v1/auth/k8s/au/syd1/login" | jq -er .auth.client_token) || exit 1 - printf 'X-Vault-Token: %s\n' "$$VT" | curl -sf -H @- "$$VAULT/v1/identity/oidc/token/artifactapi-writer" \ - | jq -er '"Authorization: Bearer " + .data.token' > "$$AUTH" || exit 1 - for rpm in dist/*.rpm; do - FILE=$$(basename "$$rpm") - code=$$(curl -s -o /dev/null -w '%{http_code}' "$$HOST/api/v2/remotes/$$REPO/files/Packages/$$FILE" || true) - if [ "$$code" = "200" ]; then - echo "$$FILE already exists in $$REPO (HTTP $$code); skipping upload" - continue - fi - echo "Uploading $$FILE to $$REPO (existence probe returned $$code)" - curl -f -X PUT \ - "$$HOST/api/v2/remotes/$$REPO/files/$$FILE" \ - -H "Content-Type: application/x-rpm" -H @"$$AUTH" \ - --data-binary @"$$rpm" - done - depends_on: [package] - backend_options: - kubernetes: - serviceAccountName: default - resources: - requests: - memory: 128Mi - cpu: 100m - limits: - memory: 512Mi - cpu: 500m diff --git a/Makefile b/Makefile index d5ce444..ac67ac6 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: build build-server build-cli test test-short lint fmt e2e docker compose clean tidy rpm rpm-package check-go patch minor major +.PHONY: build build-server build-cli test test-short lint fmt e2e docker compose clean tidy rpm check-go patch minor major MODULE := git.unkin.net/unkin/encapi VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo "0.0.0-dev") @@ -42,11 +42,9 @@ docker: compose: docker compose up -d -# --- CLI RPM (encapi-cli + the puppet ENC wrapper) --- -rpm: build-cli rpm-package - -rpm-package: - ./scripts/build-rpm.sh $(VERSION) +# Local snapshot of the release: encapi-cli RPM + encapi image (needs Docker). +rpm: + GOTOOLCHAIN=auto go run github.com/goreleaser/goreleaser/v2@v2.20.2 release --snapshot --clean --skip=sign clean: rm -rf bin/ $(DIST)/ diff --git a/README.md b/README.md index 3787f9b..dd89208 100644 --- a/README.md +++ b/README.md @@ -130,8 +130,9 @@ make test-short # skip container-backed DB tests ## Releases -- **`encapi` server image** — tagging `vX.Y.Z` builds and pushes - `artifactapi.k8s.syd1.au.unkin.net/docker-internal/encapi:{tag,latest}` (distroless). -- **`encapi-cli` RPM** — the same tag builds an RPM (nfpm) and publishes it to - the ArtifactAPI `rpm-internal` repo. Installs `encapi-cli`, the `encapi-enc` - Puppet wrapper, and `/etc/encapi/enc.conf`. +Tagging `vX.Y.Z` (`make patch|minor|major`) runs GoReleaser on GitHub Actions: + +- **`encapi` server image** — `ghcr.io/iuclabs/encapi:{tag,latest}` (distroless, built with ko). +- **`encapi-cli` RPM** — attached to the GitHub release with a signed + `SHA256SUMS`. Installs `encapi-cli`, the `encapi-enc` Puppet wrapper, and + `/etc/encapi/enc.conf`. diff --git a/packaging/nfpm.yaml b/packaging/nfpm.yaml deleted file mode 100644 index 54e4ea7..0000000 --- a/packaging/nfpm.yaml +++ /dev/null @@ -1,52 +0,0 @@ ---- -# nfpm config for the encapi-cli RPM. -# Rendered through envsubst (see scripts/build-rpm.sh) then fed to `nfpm pkg`. - -name: ${PACKAGE_NAME} -version: ${PACKAGE_VERSION} -release: ${PACKAGE_RELEASE} -arch: ${PACKAGE_ARCH} -platform: ${PACKAGE_PLATFORM} -section: default -priority: extra -description: "${PACKAGE_DESCRIPTION}" - -maintainer: ${PACKAGE_MAINTAINER} -homepage: ${PACKAGE_HOMEPAGE} -license: ${PACKAGE_LICENSE} - -disable_globbing: false - -replaces: - - encapi-cli -provides: - - encapi-cli - -contents: - # The CLI itself. - - src: dist/encapi-cli - dst: /usr/local/bin/encapi-cli - file_info: - mode: 0755 - owner: root - group: root - - # Puppet ENC entrypoint (external_nodes = /usr/local/bin/encapi-enc). - - src: packaging/encapi-enc - dst: /usr/local/bin/encapi-enc - file_info: - mode: 0755 - owner: root - group: root - - # Sample config; marked noreplace so local edits survive upgrades. - - src: packaging/enc.conf - dst: /etc/encapi/enc.conf - type: config|noreplace - file_info: - mode: 0644 - owner: root - group: root - -scripts: - preinstall: packaging/scripts/preinstall.sh diff --git a/scripts/build-rpm.sh b/scripts/build-rpm.sh deleted file mode 100755 index 9efec26..0000000 --- a/scripts/build-rpm.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env bash -# -# Package the (already built) encapi-cli binary into an RPM with nfpm. -# Usage: scripts/build-rpm.sh [version] (version defaults to $CI_COMMIT_TAG) -# -set -euo pipefail - -ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" -cd "${ROOT_DIR}" - -VERSION="${1:-${CI_COMMIT_TAG:-0.0.0-dev}}" -VERSION="${VERSION#v}" # strip a leading v -DIST="dist" - -if [ ! -f "${DIST}/encapi-cli" ]; then - echo "ERROR: ${DIST}/encapi-cli not found; run 'make build-cli' first" >&2 - exit 1 -fi - -export PACKAGE_NAME="encapi-cli" -export PACKAGE_VERSION="${VERSION}" -export PACKAGE_RELEASE="1" -export PACKAGE_ARCH="amd64" -export PACKAGE_PLATFORM="linux" -export PACKAGE_DESCRIPTION="CLI + Puppet ENC entrypoint for encapi (External Node Classifier)" -export PACKAGE_MAINTAINER="Ben Vincent " -export PACKAGE_HOMEPAGE="https://git.unkin.net/unkin/encapi" -export PACKAGE_LICENSE="MIT" - -envsubst < packaging/nfpm.yaml > "${DIST}/nfpm.yaml" -nfpm pkg --config "${DIST}/nfpm.yaml" --target "${DIST}" --packager rpm - -echo "Built:" -ls -1 "${DIST}"/*.rpm diff --git a/scripts/sign.sh b/scripts/sign.sh new file mode 100755 index 0000000..e95575d --- /dev/null +++ b/scripts/sign.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +# Detached binary signature of $1 into $2 via the Vault gpg engine. +set -euo pipefail +b=$(base64 -w0 "$1") +jq -n --arg input "$b" '{input: $input, format: "base64"}' \ + | curl -sSf --cacert "${VAULT_CACERT:-/etc/vault-ca/ca.crt}" \ + -H "X-Vault-Token: ${VAULT_TOKEN}" -d @- \ + "${VAULT_ADDR}/v1/gpg/sign/iuclabs-release" \ + | jq -er .data.signature | base64 -d > "$2" From 4e7087852c2f894886b7b450bf9e770db5d8e608 Mon Sep 17 00:00:00 2001 From: unkin-agent Date: Fri, 20 Nov 2026 23:05:15 +1100 Subject: [PATCH 2/4] Release only the encapi image with ko --- .github/workflows/ci.yml | 1 - .github/workflows/release.yml | 35 +++++++--------- .goreleaser.yml | 75 ----------------------------------- .ko.yaml | 6 +++ Makefile | 6 +-- README.md | 11 ++--- scripts/sign.sh | 9 ----- 7 files changed, 25 insertions(+), 118 deletions(-) delete mode 100644 .goreleaser.yml create mode 100644 .ko.yaml delete mode 100755 scripts/sign.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5ce0cb8..25a436f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -62,4 +62,3 @@ jobs: env: GOTOOLCHAIN: auto KO_DOCKER_REPO: ghcr.io/iuclabs/encapi - KO_DEFAULTBASEIMAGE: gcr.io/distroless/static-debian12:nonroot diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 77e5804..1267228 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,38 +2,31 @@ name: release on: push: - tags: ["v*"] + tags: ["v[0-9]*"] permissions: - contents: write - id-token: write + contents: read packages: write -env: - VAULT_ADDR: https://vault.service.consul:8200 - jobs: release: runs-on: iuclabs-release + env: + KO_DOCKER_REPO: ghcr.io/iuclabs/encapi + VERSION: ${{ github.ref_name }} steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - fetch-depth: 0 - uses: actions/setup-go@d8cbb8045d7f43706b9177cceb36c1f91a6644d5 # v7.1.0 with: go-version-file: go.mod - - uses: hashicorp/vault-action@892a26828f195e65540a40b4768ae4571f51ebfc # v4.0.0 - with: - url: ${{ env.VAULT_ADDR }} - method: jwt - path: jwt/github/iuclabs - role: release - jwtGithubAudience: ${{ env.VAULT_ADDR }} - exportToken: true - - uses: goreleaser/goreleaser-action@a4f02ab5355a589de60d917a659ce617ed19b3de # v7.3.0 - with: - distribution: goreleaser - version: v2.20.2 - args: release --clean + - run: | + go install github.com/google/ko@v0.19.1 + go install github.com/google/go-containerregistry/cmd/crane@v0.22.1 + - run: echo "${GITHUB_TOKEN}" | crane auth login ghcr.io -u "${GITHUB_ACTOR}" --password-stdin env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - run: >- + ko build --bare --sbom=none --platform linux/amd64 --tags "${VERSION}" + --image-label org.opencontainers.image.source=https://github.com/IUCLabs/encapi + ./cmd/encapi + - run: crane tag "${KO_DOCKER_REPO}:${VERSION}" latest diff --git a/.goreleaser.yml b/.goreleaser.yml deleted file mode 100644 index 8682b22..0000000 --- a/.goreleaser.yml +++ /dev/null @@ -1,75 +0,0 @@ -version: 2 -project_name: encapi - -builds: - - &build - id: encapi-cli - main: ./cmd/encapi-cli - binary: encapi-cli - env: - - CGO_ENABLED=0 - mod_timestamp: "{{ .CommitTimestamp }}" - flags: - - -trimpath - ldflags: - - -s -w -X main.version={{ .Tag }} - goos: [linux] - goarch: [amd64] - - <<: *build - id: encapi - main: ./cmd/encapi - binary: encapi - -archives: - - formats: [none] - -nfpms: - - package_name: encapi-cli - ids: [encapi-cli] - bindir: /usr/local/bin - formats: [rpm] - file_name_template: "{{ .ConventionalFileName }}" - release: "1" - section: default - priority: extra - description: CLI + Puppet ENC entrypoint for encapi (External Node Classifier) - maintainer: Ben Vincent - homepage: https://git.unkin.net/unkin/encapi - license: MIT - replaces: [encapi-cli] - provides: [encapi-cli] - contents: - - src: packaging/encapi-enc - dst: /usr/local/bin/encapi-enc - file_info: - mode: 0755 - - src: packaging/enc.conf - dst: /etc/encapi/enc.conf - type: config|noreplace - file_info: - mode: 0644 - scripts: - preinstall: packaging/scripts/preinstall.sh - -kos: - - build: encapi - base_image: gcr.io/distroless/static-debian12:nonroot - repositories: [ghcr.io/iuclabs/encapi] - tags: ["{{ .Tag }}", latest] - bare: true - platforms: [linux/amd64] - sbom: none - labels: - org.opencontainers.image.source: https://github.com/IUCLabs/encapi - -checksum: - name_template: "{{ .ProjectName }}_{{ .Version }}_SHA256SUMS" - algorithm: sha256 - -signs: - - artifacts: checksum - cmd: scripts/sign.sh - args: ["${artifact}", "${signature}"] - -changelog: - disable: true diff --git a/.ko.yaml b/.ko.yaml new file mode 100644 index 0000000..3a16d69 --- /dev/null +++ b/.ko.yaml @@ -0,0 +1,6 @@ +defaultBaseImage: gcr.io/distroless/static-debian12:nonroot +builds: + - id: encapi + main: ./cmd/encapi + ldflags: + - -s -w -X main.version={{.Env.VERSION}} diff --git a/Makefile b/Makefile index ac67ac6..4efa26a 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: build build-server build-cli test test-short lint fmt e2e docker compose clean tidy rpm check-go patch minor major +.PHONY: build build-server build-cli test test-short lint fmt e2e docker compose clean tidy check-go patch minor major MODULE := git.unkin.net/unkin/encapi VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo "0.0.0-dev") @@ -42,10 +42,6 @@ docker: compose: docker compose up -d -# Local snapshot of the release: encapi-cli RPM + encapi image (needs Docker). -rpm: - GOTOOLCHAIN=auto go run github.com/goreleaser/goreleaser/v2@v2.20.2 release --snapshot --clean --skip=sign - clean: rm -rf bin/ $(DIST)/ diff --git a/README.md b/README.md index dd89208..db1e608 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ keeping Puppet's node-classification contract byte-compatible. |-----------------|-----------------------------------------------------------------------| | `encapi` | HTTP server: serves ENC documents + a read/write API. Postgres-backed. | | `encapi-cli` | CLI over the API. `encapi-cli classify ` is the Puppet ENC. | -| `encapi-enc` | Thin wrapper (shipped in the RPM) for Puppet's `external_nodes`. | +| `encapi-enc` | Thin wrapper for Puppet's `external_nodes`. | The Terraform provider lives in a sibling repo: [`terraform-provider-encapi`](https://git.unkin.net/unkin/terraform-provider-encapi). @@ -130,9 +130,6 @@ make test-short # skip container-backed DB tests ## Releases -Tagging `vX.Y.Z` (`make patch|minor|major`) runs GoReleaser on GitHub Actions: - -- **`encapi` server image** — `ghcr.io/iuclabs/encapi:{tag,latest}` (distroless, built with ko). -- **`encapi-cli` RPM** — attached to the GitHub release with a signed - `SHA256SUMS`. Installs `encapi-cli`, the `encapi-enc` Puppet wrapper, and - `/etc/encapi/enc.conf`. +Tagging `vX.Y.Z` (`make patch|minor|major`) builds the `encapi` server image +with ko on GitHub Actions and pushes `ghcr.io/iuclabs/encapi:{tag,latest}` +(distroless). diff --git a/scripts/sign.sh b/scripts/sign.sh deleted file mode 100755 index e95575d..0000000 --- a/scripts/sign.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash -# Detached binary signature of $1 into $2 via the Vault gpg engine. -set -euo pipefail -b=$(base64 -w0 "$1") -jq -n --arg input "$b" '{input: $input, format: "base64"}' \ - | curl -sSf --cacert "${VAULT_CACERT:-/etc/vault-ca/ca.crt}" \ - -H "X-Vault-Token: ${VAULT_TOKEN}" -d @- \ - "${VAULT_ADDR}/v1/gpg/sign/iuclabs-release" \ - | jq -er .data.signature | base64 -d > "$2" From ba4126054cd27456c4c9df6309041693894f0731 Mon Sep 17 00:00:00 2001 From: unkin-agent Date: Fri, 20 Nov 2026 23:08:31 +1100 Subject: [PATCH 3/4] Set VERSION for ko image build; drop stale CLI RPM step from cutover doc --- .github/workflows/ci.yml | 1 + docs/cutover.md | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 25a436f..7a13ba7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -62,3 +62,4 @@ jobs: env: GOTOOLCHAIN: auto KO_DOCKER_REPO: ghcr.io/iuclabs/encapi + VERSION: ci-${{ github.sha }} diff --git a/docs/cutover.md b/docs/cutover.md index 48c03f1..5346de1 100644 --- a/docs/cutover.md +++ b/docs/cutover.md @@ -37,9 +37,8 @@ creates the derived status, role, and node. ## 2. Repoint the exec ENC (`profiles::puppet::cobbler_enc`) -Install the CLI RPM on the puppet masters (it ships `encapi-cli`, -`/usr/local/bin/encapi-enc`, and `/etc/encapi/enc.conf`), set -`ENCAPI_URL` in `/etc/encapi/enc.conf`, and point Puppet at the wrapper: +No `encapi-cli` RPM is published any more; `encapic` is the ENC client used +on every puppet master. The original exec wrapper setup was: ``` node_terminus = exec From 83ab71b3dfbdbfeb3902bf0e4b348547469afe34 Mon Sep 17 00:00:00 2001 From: unkin-agent Date: Fri, 20 Nov 2026 23:39:09 +1100 Subject: [PATCH 4/4] Let ko install pick its Go toolchain --- .github/workflows/release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1267228..dfd7e3c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,6 +22,8 @@ jobs: - run: | go install github.com/google/ko@v0.19.1 go install github.com/google/go-containerregistry/cmd/crane@v0.22.1 + env: + GOTOOLCHAIN: auto - run: echo "${GITHUB_TOKEN}" | crane auth login ghcr.io -u "${GITHUB_ACTOR}" --password-stdin env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}