Add GitHub Actions CI and GoReleaser release (#6)
ci / pre-commit (push) Has been cancelled
ci / lint (push) Has been cancelled
ci / test (push) Has been cancelled
ci / build (push) Has been cancelled

Releases move to the GitHub IUCLabs mirror so a `v*` tag publishes signed x86_64 RPMs as GitHub release assets; Woodpecker keeps PR CI only.

- `ci.yml` runs pre-commit, vet, test and build on PRs and main
- `release.yml` runs goreleaser on `v*` tags and signs SHA256SUMS via the Vault GPG engine (`scripts/sign.sh`)
- `.goreleaser.yml` builds linux/amd64 and packages the vault and openbao RPMs via nfpms; no binary archives
- `make rpm` builds a local goreleaser snapshot; `build-rpm.sh`, the nfpm template and `.woodpecker/release.yml` are removed
- `.github/CODEOWNERS` assigns `@IUCLabs/maintainers`

Reviewed-on: #6
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
This commit was merged in pull request #6.
This commit is contained in:
2026-11-19 22:26:22 +11:00
committed by BenVincent
parent 53227f9126
commit 681bd8264f
13 changed files with 166 additions and 155 deletions
+1
View File
@@ -0,0 +1 @@
* @IUCLabs/maintainers
+52
View File
@@ -0,0 +1,52 @@
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" ./...
+38
View File
@@ -0,0 +1,38 @@
name: release
on:
push:
tags: ["v*"]
permissions:
contents: write
id-token: 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 }}
+56
View File
@@ -0,0 +1,56 @@
version: 2
project_name: vault-plugin-secrets-gpg
builds:
- main: ./cmd/vault-plugin-secrets-gpg
env:
- CGO_ENABLED=0
mod_timestamp: "{{ .CommitTimestamp }}"
flags:
- -trimpath
ldflags:
- -s -w
goos: [linux]
goarch: [amd64]
archives:
- formats: [none]
nfpms:
- &rpm
id: vault
package_name: vault-plugin-secrets-gpg
bindir: /opt/vault-plugins
scripts:
preinstall: packaging/scripts/preinstall-vault.sh
replaces: [vault-plugin-secrets-gpg]
provides: [vault-plugin-secrets-gpg]
formats: [rpm]
file_name_template: "{{ .ConventionalFileName }}"
release: "1"
section: default
priority: extra
description: Vault/OpenBao secrets engine for GPG/OpenPGP keys (sign/verify/encrypt/decrypt)
maintainer: IUCLabs
homepage: https://github.com/IUCLabs/vault-plugin-secrets-gpg
license: MIT
- <<: *rpm
id: openbao
package_name: openbao-plugin-secrets-gpg
bindir: /opt/openbao-plugins
scripts:
preinstall: packaging/scripts/preinstall-openbao.sh
replaces: [openbao-plugin-secrets-gpg]
provides: [openbao-plugin-secrets-gpg]
checksum:
name_template: "{{ .ProjectName }}_{{ .Version }}_SHA256SUMS"
algorithm: sha256
signs:
- artifacts: checksum
cmd: scripts/sign.sh
args: ["${artifact}", "${signature}"]
changelog:
disable: true
-66
View File
@@ -1,66 +0,0 @@
when:
- event: tag
steps:
- name: build
image: artifactapi.k8s.syd1.au.unkin.net/docker-internal/gobuilder:0.1.2-alma9
commands:
- make build 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-vault-plugin-secrets-gpg
GOCACHE_METRICS: "true"
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 exists; skipping"; continue; fi
echo "Uploading $$FILE (probe $$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}
+3 -5
View File
@@ -1,4 +1,4 @@
.PHONY: build install test lint fmt clean tidy rpm rpm-package patch minor major check-go e2e e2e-vault e2e-openbao e2e-up e2e-down
.PHONY: build install test lint fmt clean tidy rpm patch minor major check-go e2e e2e-vault e2e-openbao e2e-up e2e-down
BINARY := vault-plugin-secrets-gpg
PKG := ./cmd/vault-plugin-secrets-gpg
@@ -36,10 +36,8 @@ tidy:
clean:
rm -rf $(PLUGIN_DIR)
rpm: build rpm-package
rpm-package:
./scripts/build-rpm.sh $(VERSION)
rpm:
GOTOOLCHAIN=auto go run github.com/goreleaser/goreleaser/v2@v2.20.2 release --snapshot --clean --skip=sign
# End-to-end tests bring up Vault and OpenBao in Docker and drive the full key
# lifecycle (generate/sign/verify/encrypt/decrypt/rotate) against each with the
+1 -1
View File
@@ -24,7 +24,7 @@ To manage the engine's mounts and keys from Terraform or OpenTofu, use
## Installation
Download a binary from the
Install the x86_64 RPM (vault or openbao flavour) from the
[releases page](https://github.com/IUCLabs/vault-plugin-secrets-gpg/releases),
or build one:
-35
View File
@@ -1,35 +0,0 @@
---
# nfpm config for the vault-plugin-secrets-gpg RPM. Rendered through
# envsubst (see scripts/build-rpm.sh) then fed to `nfpm pkg`. Built once per
# target server (Vault, OpenBao); PACKAGE_NAME and PACKAGE_PLUGIN_DIR vary.
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:
- ${PACKAGE_NAME}
provides:
- ${PACKAGE_NAME}
contents:
- src: dist/vault-plugin-secrets-gpg
dst: ${PACKAGE_PLUGIN_DIR}/vault-plugin-secrets-gpg
file_info:
mode: 0755
owner: root
group: root
scripts:
preinstall: ${PACKAGE_PREINSTALL}
+3
View File
@@ -0,0 +1,3 @@
#!/usr/bin/env bash
# Ensure the plugin directory exists before the binary is laid down.
mkdir -p /opt/openbao-plugins
+3
View File
@@ -0,0 +1,3 @@
#!/usr/bin/env bash
# Ensure the plugin directory exists before the binary is laid down.
mkdir -p /opt/vault-plugins
-4
View File
@@ -1,4 +0,0 @@
#!/usr/bin/env bash
# Ensure the plugin directory exists before the binary is laid down.
# Rendered per flavour via envsubst (see scripts/build-rpm.sh).
mkdir -p ${PACKAGE_PLUGIN_DIR}
-44
View File
@@ -1,44 +0,0 @@
#!/usr/bin/env bash
#
# Package the (already built) plugin binary into RPMs with nfpm. Builds one RPM
# per target server: Vault (/opt/vault-plugins) and OpenBao (/opt/openbao-plugins).
# 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}"
BINARY="vault-plugin-secrets-gpg"
DIST="dist"
if [ ! -f "${DIST}/${BINARY}" ]; then
echo "ERROR: ${DIST}/${BINARY} not found; run 'make build' first" >&2
exit 1
fi
export PACKAGE_VERSION="${VERSION}"
export PACKAGE_RELEASE="1"
export PACKAGE_ARCH="amd64"
export PACKAGE_PLATFORM="linux"
export PACKAGE_DESCRIPTION="Vault/OpenBao secrets engine for GPG/OpenPGP keys (sign/verify/encrypt/decrypt)"
export PACKAGE_MAINTAINER="IUCLabs"
export PACKAGE_HOMEPAGE="https://github.com/IUCLabs/vault-plugin-secrets-gpg"
export PACKAGE_LICENSE="MIT"
build_flavor() {
export PACKAGE_NAME="$1"
export PACKAGE_PLUGIN_DIR="$2"
export PACKAGE_PREINSTALL="${DIST}/preinstall-${PACKAGE_NAME}.sh"
envsubst '${PACKAGE_PLUGIN_DIR}' < packaging/scripts/preinstall.sh.tmpl > "${PACKAGE_PREINSTALL}"
envsubst < packaging/nfpm.yaml > "${DIST}/nfpm-${PACKAGE_NAME}.yaml"
nfpm pkg --config "${DIST}/nfpm-${PACKAGE_NAME}.yaml" --target "${DIST}" --packager rpm
}
build_flavor "vault-plugin-secrets-gpg" "/opt/vault-plugins"
build_flavor "openbao-plugin-secrets-gpg" "/opt/openbao-plugins"
echo "Built:"
ls -1 "${DIST}"/*.rpm
+9
View File
@@ -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"