Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7da4d453a1 | |||
| 69c0894184 | |||
| 9b3b9f0330 | |||
| c4990259c8 | |||
| 762bf6f9b8 | |||
| aa8b74dcf0 |
@@ -0,0 +1 @@
|
|||||||
|
* @IUCLabs/maintainers
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
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
|
||||||
|
- uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9.3.0
|
||||||
|
with:
|
||||||
|
version: v2.15.0
|
||||||
|
|
||||||
|
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
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- uses: actions/setup-go@d8cbb8045d7f43706b9177cceb36c1f91a6644d5 # v7.1.0
|
||||||
|
with:
|
||||||
|
go-version-file: go.mod
|
||||||
|
- run: go build -trimpath -ldflags="-s -w" ./...
|
||||||
|
- uses: goreleaser/goreleaser-action@a4f02ab5355a589de60d917a659ce617ed19b3de # v7.3.0
|
||||||
|
with:
|
||||||
|
distribution: goreleaser
|
||||||
|
version: v2.20.2
|
||||||
|
args: check
|
||||||
|
- uses: goreleaser/goreleaser-action@a4f02ab5355a589de60d917a659ce617ed19b3de # v7.3.0
|
||||||
|
with:
|
||||||
|
distribution: goreleaser
|
||||||
|
version: v2.20.2
|
||||||
|
args: release --snapshot --clean --skip=sign,publish
|
||||||
@@ -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 }}
|
||||||
+4
-15
@@ -47,13 +47,6 @@ nfpms:
|
|||||||
dst: /usr/bin/encapic-enc
|
dst: /usr/bin/encapic-enc
|
||||||
file_info:
|
file_info:
|
||||||
mode: 0755
|
mode: 0755
|
||||||
# noreplace: puppet manages this file's contents (hiera-driven URL), so an
|
|
||||||
# upgrade must not overwrite it.
|
|
||||||
- src: packaging/encapic.conf
|
|
||||||
dst: /etc/encapic/encapic.conf
|
|
||||||
type: "config|noreplace"
|
|
||||||
file_info:
|
|
||||||
mode: 0644
|
|
||||||
- src: completions/encapic.bash
|
- src: completions/encapic.bash
|
||||||
dst: /usr/share/bash-completion/completions/encapic
|
dst: /usr/share/bash-completion/completions/encapic
|
||||||
file_info:
|
file_info:
|
||||||
@@ -69,14 +62,10 @@ checksum:
|
|||||||
split: true
|
split: true
|
||||||
name_template: "{{ .ArtifactName }}.sha256"
|
name_template: "{{ .ArtifactName }}.sha256"
|
||||||
|
|
||||||
release:
|
signs:
|
||||||
gitea:
|
- artifacts: checksum
|
||||||
owner: unkin
|
cmd: scripts/sign.sh
|
||||||
name: encapic
|
args: ["${artifact}", "${signature}"]
|
||||||
|
|
||||||
gitea_urls:
|
|
||||||
api: https://git.unkin.net/api/v1
|
|
||||||
download: https://git.unkin.net
|
|
||||||
|
|
||||||
changelog:
|
changelog:
|
||||||
sort: asc
|
sort: asc
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ steps:
|
|||||||
- git fetch --tags --force
|
- git fetch --tags --force
|
||||||
- go install github.com/goreleaser/goreleaser/v2@v2.17.1
|
- go install github.com/goreleaser/goreleaser/v2@v2.17.1
|
||||||
- goreleaser check
|
- goreleaser check
|
||||||
- goreleaser release --snapshot --clean
|
- goreleaser release --snapshot --clean --skip=sign
|
||||||
- ls -l dist/*.rpm dist/*.sha256
|
- ls -l dist/*.rpm dist/*.sha256
|
||||||
depends_on: [build]
|
depends_on: [build]
|
||||||
backend_options:
|
backend_options:
|
||||||
|
|||||||
@@ -1,110 +0,0 @@
|
|||||||
when:
|
|
||||||
- event: tag
|
|
||||||
ref: refs/tags/v*
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: test
|
|
||||||
image: "artifactapi.k8s.syd1.au.unkin.net/docker-internal/gobuilder:0.1.3-alma9"
|
|
||||||
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-encapic
|
|
||||||
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
|
|
||||||
commands:
|
|
||||||
- go test -race ./...
|
|
||||||
backend_options:
|
|
||||||
kubernetes:
|
|
||||||
serviceAccountName: default
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
memory: 512Mi
|
|
||||||
cpu: 1
|
|
||||||
limits:
|
|
||||||
memory: 2Gi
|
|
||||||
cpu: 2
|
|
||||||
|
|
||||||
# goreleaser is the single driver for the release: it builds the static
|
|
||||||
# binary, builds the RPM (nfpm is built in) and creates the Gitea release
|
|
||||||
# with the binary, RPM and per-artifact sha256 files attached. The binary
|
|
||||||
# asset name is unchanged — the puppet compilers pull it at pod start.
|
|
||||||
- name: goreleaser
|
|
||||||
image: "artifactapi.k8s.syd1.au.unkin.net/docker-internal/gobuilder:0.1.3-alma9"
|
|
||||||
environment:
|
|
||||||
GITEA_TOKEN:
|
|
||||||
from_secret: RELEASER_TOKEN
|
|
||||||
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-encapic
|
|
||||||
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
|
|
||||||
commands:
|
|
||||||
# goreleaser reads the tag history for the changelog; Woodpecker's clone
|
|
||||||
# can be shallow.
|
|
||||||
- git fetch --tags --force
|
|
||||||
- go install github.com/goreleaser/goreleaser/v2@v2.17.1
|
|
||||||
- goreleaser release --clean
|
|
||||||
depends_on: [test]
|
|
||||||
backend_options:
|
|
||||||
kubernetes:
|
|
||||||
serviceAccountName: default
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
memory: 512Mi
|
|
||||||
cpu: 1
|
|
||||||
limits:
|
|
||||||
memory: 2Gi
|
|
||||||
cpu: 2
|
|
||||||
|
|
||||||
# goreleaser cannot PUT to artifactapi, so the RPM it built into dist/ is
|
|
||||||
# published to the local rpm repo here (a real yum repo; repodata
|
|
||||||
# regenerates automatically).
|
|
||||||
- name: upload-rpm
|
|
||||||
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")
|
|
||||||
# artifactapi has no HEAD route (returns 405); probe with GET against
|
|
||||||
# the served path (RPMs are stored under Packages/) to avoid re-upload.
|
|
||||||
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: [goreleaser]
|
|
||||||
backend_options:
|
|
||||||
kubernetes:
|
|
||||||
serviceAccountName: default
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
memory: 512Mi
|
|
||||||
cpu: 1
|
|
||||||
limits:
|
|
||||||
memory: 2Gi
|
|
||||||
cpu: 2
|
|
||||||
@@ -38,7 +38,7 @@ rpm: rpm-package
|
|||||||
# goreleaser drives the build and the nfpm packaging in one pass, so packaging
|
# goreleaser drives the build and the nfpm packaging in one pass, so packaging
|
||||||
# an already-built binary is not a separate step.
|
# an already-built binary is not a separate step.
|
||||||
rpm-package:
|
rpm-package:
|
||||||
goreleaser release --snapshot --clean
|
GOTOOLCHAIN=auto go run github.com/goreleaser/goreleaser/v2@v2.20.2 release --snapshot --clean --skip=sign
|
||||||
|
|
||||||
# Bump helpers — read the latest semver tag and create the next one.
|
# Bump helpers — read the latest semver tag and create the next one.
|
||||||
# If no tag exists yet, start from v0.0.0.
|
# If no tag exists yet, start from v0.0.0.
|
||||||
|
|||||||
@@ -36,8 +36,7 @@ The encapi base URL comes from the first of:
|
|||||||
1. the `ENCAPI_URL` environment variable;
|
1. the `ENCAPI_URL` environment variable;
|
||||||
2. `${XDG_CONFIG_HOME:-~/.config}/encapi/encapic.conf`;
|
2. `${XDG_CONFIG_HOME:-~/.config}/encapi/encapic.conf`;
|
||||||
3. `/etc/encapi/encapic.conf`;
|
3. `/etc/encapi/encapic.conf`;
|
||||||
4. `/etc/encapic/encapic.conf` (legacy, shipped by the RPM);
|
4. the compiled-in default `http://encapi.encapi.svc.cluster.local`.
|
||||||
5. the compiled-in default `http://encapi.encapi.svc.cluster.local`.
|
|
||||||
|
|
||||||
Conf files are shell-sourceable `KEY=VALUE` (`ENCAPI_URL=https://...`).
|
Conf files are shell-sourceable `KEY=VALUE` (`ENCAPI_URL=https://...`).
|
||||||
`encapic init` prompts for the URL (default
|
`encapic init` prompts for the URL (default
|
||||||
@@ -127,10 +126,10 @@ make fmt # gofmt -w .
|
|||||||
make rpm # binary + RPM into dist/ via goreleaser, publishing nothing
|
make rpm # binary + RPM into dist/ via goreleaser, publishing nothing
|
||||||
```
|
```
|
||||||
|
|
||||||
Release: `make minor` (etc.) tags `vX.Y.Z` and pushes it; the `release`
|
Release: `make minor` (etc.) tags `vX.Y.Z` and pushes it; the tag mirrors to
|
||||||
Woodpecker pipeline runs goreleaser, which attaches `encapic_linux_amd64`
|
GitHub, where the `release` workflow runs goreleaser, which attaches
|
||||||
(+ `.sha256`) and the RPM to a Gitea release, and then publishes the RPM to the
|
`encapic_linux_amd64` and the RPM (each with a signed `.sha256`) to the GitHub
|
||||||
artifactapi `rpm-internal` yum repo.
|
release.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
@@ -148,11 +147,6 @@ It ships:
|
|||||||
- `/usr/bin/encapic` — the binary;
|
- `/usr/bin/encapic` — the binary;
|
||||||
- `/usr/bin/encapic-enc` — the ENC entrypoint. Puppet's exec `node_terminus`
|
- `/usr/bin/encapic-enc` — the ENC entrypoint. Puppet's exec `node_terminus`
|
||||||
invokes `external_nodes` with a certname and no environment, so the shim
|
invokes `external_nodes` with a certname and no environment, so the shim
|
||||||
sources the URL before exec'ing the binary. Point `external_nodes` at this,
|
sources the puppet-managed `/etc/encapi/encapic.conf` before exec'ing the
|
||||||
not at `/usr/bin/encapic`;
|
binary. Point `external_nodes` at this, not at `/usr/bin/encapic`;
|
||||||
- `/etc/encapic/encapic.conf` — `ENCAPI_URL=...`, defaulting to the external
|
|
||||||
address `https://encapi.k8s.syd1.au.unkin.net` because a VM cannot resolve
|
|
||||||
the in-cluster default. Shipped `%config(noreplace)` so puppet may own its
|
|
||||||
contents without an upgrade reverting them. A `/etc/encapi/encapic.conf`, when
|
|
||||||
present, takes precedence in both the shim and the binary;
|
|
||||||
- bash and zsh completion scripts.
|
- bash and zsh completion scripts.
|
||||||
|
|||||||
@@ -13,9 +13,7 @@ import (
|
|||||||
|
|
||||||
const initDefaultURL = "https://encapi.k8s.syd1.au.unkin.net"
|
const initDefaultURL = "https://encapi.k8s.syd1.au.unkin.net"
|
||||||
|
|
||||||
// systemConfPaths follow the user conf in precedence; the legacy path is a
|
var systemConfPath = "/etc/encapi/encapic.conf"
|
||||||
// read-only fallback for hosts whose puppet still manages it.
|
|
||||||
var systemConfPaths = []string{"/etc/encapi/encapic.conf", "/etc/encapic/encapic.conf"}
|
|
||||||
|
|
||||||
func xdgDir(env, fallback string) string {
|
func xdgDir(env, fallback string) string {
|
||||||
if d := os.Getenv(env); d != "" {
|
if d := os.Getenv(env); d != "" {
|
||||||
@@ -42,7 +40,7 @@ func resolveBaseURL() (string, bool) {
|
|||||||
if u := os.Getenv("ENCAPI_URL"); u != "" {
|
if u := os.Getenv("ENCAPI_URL"); u != "" {
|
||||||
return u, true
|
return u, true
|
||||||
}
|
}
|
||||||
for _, p := range append([]string{userConfPath()}, systemConfPaths...) {
|
for _, p := range []string{userConfPath(), systemConfPath} {
|
||||||
if u := readConfURL(p); u != "" {
|
if u := readConfURL(p); u != "" {
|
||||||
return u, true
|
return u, true
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-7
@@ -13,7 +13,7 @@ func TestMain(m *testing.M) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
systemConfPaths = nil
|
systemConfPath = ""
|
||||||
_ = os.Unsetenv("ENCAPI_URL")
|
_ = os.Unsetenv("ENCAPI_URL")
|
||||||
_ = os.Setenv("XDG_CONFIG_HOME", filepath.Join(dir, "config"))
|
_ = os.Setenv("XDG_CONFIG_HOME", filepath.Join(dir, "config"))
|
||||||
_ = os.Setenv("XDG_DATA_HOME", filepath.Join(dir, "data"))
|
_ = os.Setenv("XDG_DATA_HOME", filepath.Join(dir, "data"))
|
||||||
@@ -37,10 +37,9 @@ func TestResolveBaseURLPrecedence(t *testing.T) {
|
|||||||
t.Setenv("XDG_CONFIG_HOME", filepath.Join(dir, "user"))
|
t.Setenv("XDG_CONFIG_HOME", filepath.Join(dir, "user"))
|
||||||
user := filepath.Join(dir, "user", "encapi", "encapic.conf")
|
user := filepath.Join(dir, "user", "encapi", "encapic.conf")
|
||||||
system := filepath.Join(dir, "etc", "encapi", "encapic.conf")
|
system := filepath.Join(dir, "etc", "encapi", "encapic.conf")
|
||||||
legacy := filepath.Join(dir, "etc", "encapic", "encapic.conf")
|
old := systemConfPath
|
||||||
old := systemConfPaths
|
systemConfPath = system
|
||||||
systemConfPaths = []string{system, legacy}
|
t.Cleanup(func() { systemConfPath = old })
|
||||||
t.Cleanup(func() { systemConfPaths = old })
|
|
||||||
|
|
||||||
check := func(want string, wantFound bool) {
|
check := func(want string, wantFound bool) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
@@ -52,8 +51,6 @@ func TestResolveBaseURLPrecedence(t *testing.T) {
|
|||||||
|
|
||||||
t.Setenv("ENCAPI_URL", "")
|
t.Setenv("ENCAPI_URL", "")
|
||||||
check(defaultBaseURL, false)
|
check(defaultBaseURL, false)
|
||||||
writeConf(t, legacy, "ENCAPI_URL=https://legacy\n")
|
|
||||||
check("https://legacy", true)
|
|
||||||
writeConf(t, system, "# comment\nENCAPI_URL=\"https://system\"\n")
|
writeConf(t, system, "# comment\nENCAPI_URL=\"https://system\"\n")
|
||||||
check("https://system", true)
|
check("https://system", true)
|
||||||
writeConf(t, user, "OTHER=x\nexport ENCAPI_URL='https://user'\n")
|
writeConf(t, user, "OTHER=x\nexport ENCAPI_URL='https://user'\n")
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ const usage = `usage:
|
|||||||
encapic -v | --version show the version
|
encapic -v | --version show the version
|
||||||
|
|
||||||
ENCAPI_URL is read from the environment, then ~/.config/encapi/encapic.conf,
|
ENCAPI_URL is read from the environment, then ~/.config/encapi/encapic.conf,
|
||||||
/etc/encapi/encapic.conf, /etc/encapic/encapic.conf, else the in-cluster default.
|
/etc/encapi/encapic.conf, else the in-cluster default.
|
||||||
`
|
`
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|||||||
@@ -3,11 +3,9 @@
|
|||||||
# environment, so the encapi URL cannot be inherited; source it here instead.
|
# environment, so the encapi URL cannot be inherited; source it here instead.
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
for conf in /etc/encapic/encapic.conf /etc/encapi/encapic.conf; do
|
if [ -r /etc/encapi/encapic.conf ]; then
|
||||||
if [ -r "$conf" ]; then
|
. /etc/encapi/encapic.conf
|
||||||
. "$conf"
|
fi
|
||||||
fi
|
|
||||||
done
|
|
||||||
if [ -n "${ENCAPI_URL:-}" ]; then
|
if [ -n "${ENCAPI_URL:-}" ]; then
|
||||||
export ENCAPI_URL
|
export ENCAPI_URL
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
# Base URL of the encapi service, read by encapic and /usr/bin/encapic-enc.
|
|
||||||
# The binary's compiled-in default is the in-cluster address, which VM puppet
|
|
||||||
# masters cannot resolve.
|
|
||||||
ENCAPI_URL=https://encapi.k8s.syd1.au.unkin.net
|
|
||||||
Executable
+9
@@ -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"
|
||||||
Reference in New Issue
Block a user