ci: ship the binaries the gate built, and stop rebuilding archied
The release gate stamps the version into `task build`, and the distribution step packages those binaries instead of compiling the tree a second time with different flags. `task build` is static to match. The image builds keep Go's compile cache between runs. canary and promote take archied from the published edge image. The Woodpecker gate and pull-request check keep Go's caches on the host. Also: one Node version, the distribution waits for the archied image, release notes wait for the signed release and carry the prerelease flag.
This commit is contained in:
1 parent
c3e64e5485
commit
b137942b35
11 files changed
+152
-103
No files matched your search
@@ -17,24 +17,20 @@ jobs:
|
||||
if: vars.CANARY_URL != ''
|
||||
runs-on: self-hosted
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: main
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: false
|
||||
|
||||
- name: Build archied
|
||||
run: go build -tags no_ui -o "$RUNNER_TEMP/archied" ./cmd/archied
|
||||
|
||||
- name: Log in to the Gitea registry
|
||||
run: echo "${{ secrets.DEPLOY_TOKEN }}" | docker login git.catlow.cloud -u "${{ github.actor }}" --password-stdin
|
||||
|
||||
# The judge is the archied that deploy published for main, not a build
|
||||
# of its own.
|
||||
- name: Fetch archied from the edge image
|
||||
run: |
|
||||
set -e
|
||||
image=git.catlow.cloud/sam/archied:edge
|
||||
docker pull -q "$image"
|
||||
container="$(docker create "$image")"
|
||||
trap 'docker rm "$container" >/dev/null' EXIT
|
||||
docker cp "$container:/usr/local/bin/archied" "$RUNNER_TEMP/archied"
|
||||
|
||||
- name: Judge the canary
|
||||
env:
|
||||
ARCHIE_CANARY_TOKEN: ${{ secrets.CANARY_TOKEN }}
|
||||
|
||||
@@ -70,7 +70,7 @@ jobs:
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "22"
|
||||
node-version: "24"
|
||||
|
||||
- name: Install quality tools
|
||||
run: |
|
||||
@@ -93,9 +93,17 @@ jobs:
|
||||
- name: Pull test container images
|
||||
run: docker pull alpine:3
|
||||
|
||||
# A release stamps its version here: dist-zip ships these binaries, so
|
||||
# the release is what the gate tested.
|
||||
- name: Quality gate
|
||||
env:
|
||||
RELEASE_VERSION: ${{ needs.plan.outputs.archied_version }}
|
||||
run: |
|
||||
task check TEST_FLAGS=-count=1
|
||||
if [ -n "$RELEASE_VERSION" ]; then
|
||||
task check TEST_FLAGS=-count=1 GATEWAY_VERSION="$RELEASE_VERSION" RUNTIME_VERSION="$RELEASE_VERSION"
|
||||
else
|
||||
task check TEST_FLAGS=-count=1
|
||||
fi
|
||||
git diff --exit-code
|
||||
|
||||
- name: Vulnerability scan
|
||||
@@ -129,6 +137,15 @@ jobs:
|
||||
echo "This commit isn't a release, so the images are published as :edge and sha-<sha>; :latest keeps naming the newest promoted release."
|
||||
fi
|
||||
|
||||
- name: Upload the release binaries
|
||||
if: needs.plan.outputs.archied_version != ''
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release-binaries
|
||||
path: bin/
|
||||
if-no-files-found: error
|
||||
retention-days: 1
|
||||
|
||||
archied-image:
|
||||
needs: gate
|
||||
runs-on: self-hosted
|
||||
@@ -147,6 +164,11 @@ jobs:
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
# A named builder that keeps its state, so the Dockerfile's compile
|
||||
# cache is still there on the next run.
|
||||
name: archie-archied
|
||||
keep-state: true
|
||||
|
||||
- name: Log in to the Gitea registry
|
||||
run: echo "${{ secrets.DEPLOY_TOKEN }}" | docker login git.catlow.cloud -u "${{ github.actor }}" --password-stdin
|
||||
@@ -188,7 +210,8 @@ jobs:
|
||||
agent-image:
|
||||
outputs:
|
||||
agent_digest: ${{ steps.agent.outputs.digest }}
|
||||
needs: gate
|
||||
needs: [plan, gate]
|
||||
if: needs.plan.outputs.archied_version != ''
|
||||
runs-on: self-hosted
|
||||
steps:
|
||||
- name: Checkout
|
||||
@@ -205,6 +228,9 @@ jobs:
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
name: archie-agent
|
||||
keep-state: true
|
||||
|
||||
- name: Log in to the Gitea registry
|
||||
run: echo "${{ secrets.DEPLOY_TOKEN }}" | docker login git.catlow.cloud -u "${{ github.actor }}" --password-stdin
|
||||
@@ -234,51 +260,23 @@ jobs:
|
||||
cache-to: type=gha,mode=max,scope=archie-agent
|
||||
|
||||
dist-zip:
|
||||
needs: [plan, gate, agent-image]
|
||||
needs: [plan, gate, archied-image, agent-image]
|
||||
if: needs.plan.outputs.archied_version != ''
|
||||
runs-on: self-hosted
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
- name: Download the binaries the gate built
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: false
|
||||
|
||||
- uses: pnpm/action-setup@v4
|
||||
with:
|
||||
package_json_file: ui/package.json
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "24"
|
||||
|
||||
- name: Build the dashboard
|
||||
working-directory: ui
|
||||
run: |
|
||||
pnpm install --frozen-lockfile
|
||||
pnpm run build
|
||||
name: release-binaries
|
||||
path: bin
|
||||
|
||||
- name: Resolve archied version
|
||||
id: version
|
||||
run: echo "version=${{ needs.plan.outputs.archied_version }}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Build linux/amd64 binaries
|
||||
env:
|
||||
GOOS: linux
|
||||
GOARCH: amd64
|
||||
CGO_ENABLED: "0"
|
||||
run: |
|
||||
set -e
|
||||
ldflags="-X github.com/samcharles93/archie-core/internal/installtype.buildType=binary -X github.com/samcharles93/archie-core/internal/buildinfo.Version=${{ steps.version.outputs.version }} -X github.com/samcharles93/archie-core/internal/buildinfo.Runtime=${{ steps.version.outputs.version }} -X github.com/samcharles93/archie-core/internal/app/agentworker.version=${{ steps.version.outputs.version }}"
|
||||
mkdir -p dist
|
||||
for cmd in $(jq -r '.required_topology.units[], .required_topology.binaries[]?' release.json); do
|
||||
go build -ldflags "$ldflags" -o "dist/$cmd" "./cmd/$cmd"
|
||||
done
|
||||
|
||||
- name: Assemble distribution zip
|
||||
id: zip
|
||||
run: |
|
||||
@@ -286,8 +284,10 @@ jobs:
|
||||
name="archie-core-archied-v${{ steps.version.outputs.version }}-linux-amd64"
|
||||
mkdir -p "$name"
|
||||
for cmd in $(jq -r '.required_topology.units[], .required_topology.binaries[]?' release.json); do
|
||||
cp "dist/$cmd" "$name/"
|
||||
# An artifact does not keep the executable bit.
|
||||
install -m 0755 "bin/$cmd" "$name/$cmd"
|
||||
done
|
||||
chmod +x bin/archied
|
||||
cp deployments/INSTRUCTIONS.md CHANGELOG.md "$name/"
|
||||
digest='${{ needs.agent-image.outputs.agent_digest }}'
|
||||
test -n "$digest"
|
||||
@@ -314,7 +314,7 @@ jobs:
|
||||
version="${{ steps.version.outputs.version }}"
|
||||
prerelease=false
|
||||
case "$version" in *-*) prerelease=true ;; esac
|
||||
./dist/archied release publish -source git.catlow.cloud/sam/archie \
|
||||
./bin/archied release publish -source git.catlow.cloud/sam/archie \
|
||||
-version "$version" -prerelease="$prerelease" \
|
||||
-zip "${{ steps.zip.outputs.name }}.zip" \
|
||||
-agent-image "git.catlow.cloud/sam/archie-agent@${{ needs.agent-image.outputs.agent_digest }}" \
|
||||
@@ -327,6 +327,8 @@ jobs:
|
||||
set -e
|
||||
tag="v${{ steps.version.outputs.version }}"
|
||||
version="${{ steps.version.outputs.version }}"
|
||||
prerelease=false
|
||||
case "$version" in *-*) prerelease=true ;; esac
|
||||
notes="$(mktemp)"
|
||||
awk -v hdr="## [$version]" '
|
||||
index($0, hdr) == 1 { printing = 1 }
|
||||
@@ -343,7 +345,8 @@ jobs:
|
||||
curl -sf -X DELETE -H "$auth" "$api/repos/$repo/releases/tags/$tag" >/dev/null || true
|
||||
curl -sf -X POST -H "$auth" -H "Content-Type: application/json" \
|
||||
-d "$(jq -n --arg tag "$tag" --arg name "Archie v$version" --arg body "$(cat "$notes")" \
|
||||
'{tag_name: $tag, name: $name, body: $body, draft: false, prerelease: false}')" \
|
||||
--argjson prerelease "$prerelease" \
|
||||
'{tag_name: $tag, name: $name, body: $body, draft: false, prerelease: $prerelease}')" \
|
||||
"$api/repos/$repo/releases" >/dev/null
|
||||
echo "published release notes for $tag"
|
||||
|
||||
@@ -351,7 +354,7 @@ jobs:
|
||||
if: vars.CANARY_URL != ''
|
||||
env:
|
||||
ARCHIE_CANARY_TOKEN: ${{ secrets.CANARY_TOKEN }}
|
||||
run: ./dist/archied release canary start -dashboard "${{ vars.CANARY_URL }}" -version "${{ steps.version.outputs.version }}"
|
||||
run: ./bin/archied release canary start -dashboard "${{ vars.CANARY_URL }}" -version "${{ steps.version.outputs.version }}"
|
||||
|
||||
- name: Link the packages to this repository
|
||||
env:
|
||||
|
||||
@@ -21,23 +21,19 @@ jobs:
|
||||
if: vars.CANARY_URL != ''
|
||||
runs-on: self-hosted
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: main
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: false
|
||||
|
||||
- name: Build archied
|
||||
run: go build -tags no_ui -o "$RUNNER_TEMP/archied" ./cmd/archied
|
||||
|
||||
- name: Log in to the Gitea registry
|
||||
run: echo "${{ secrets.DEPLOY_TOKEN }}" | docker login git.catlow.cloud -u "${{ github.actor }}" --password-stdin
|
||||
|
||||
# The archied that deploy published for main, not a build of its own.
|
||||
- name: Fetch archied from the edge image
|
||||
run: |
|
||||
set -e
|
||||
image=git.catlow.cloud/sam/archied:edge
|
||||
docker pull -q "$image"
|
||||
container="$(docker create "$image")"
|
||||
trap 'docker rm "$container" >/dev/null' EXIT
|
||||
docker cp "$container:/usr/local/bin/archied" "$RUNNER_TEMP/archied"
|
||||
|
||||
- name: Promote the canary's release
|
||||
env:
|
||||
ARCHIE_CANARY_TOKEN: ${{ secrets.CANARY_TOKEN }}
|
||||
|
||||
+22
-2
@@ -18,6 +18,27 @@ when:
|
||||
concurrency: 1
|
||||
|
||||
steps:
|
||||
# The judge is the archied that deploy published for main, not a build of
|
||||
# its own.
|
||||
- name: fetch
|
||||
image: docker:29-cli
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
environment:
|
||||
DOCKER_HOST: unix:///var/run/docker.sock
|
||||
DEPLOY_TOKEN:
|
||||
from_secret: deploy_token
|
||||
commands:
|
||||
- '[ -n "$$DEPLOY_TOKEN" ] || { echo "repo secret deploy_token is not set, so the registry cannot be read"; exit 1; }'
|
||||
- printf '%s' "$$DEPLOY_TOKEN" | docker login git.catlow.cloud -u "$$CI_REPO_OWNER" --password-stdin
|
||||
- |
|
||||
set -eu
|
||||
image=git.catlow.cloud/sam/archied:edge
|
||||
docker pull -q "$$image"
|
||||
container=$(docker create "$$image")
|
||||
trap 'docker rm "$$container" >/dev/null' EXIT
|
||||
docker cp "$$container:/usr/local/bin/archied" "$$CI_WORKSPACE/.git/archied"
|
||||
|
||||
- name: judge
|
||||
image: golang:1.27.3-bookworm
|
||||
environment:
|
||||
@@ -33,7 +54,6 @@ steps:
|
||||
- '[ -n "$$CANARY_URL" ] || { echo "repo secret canary_url is not set, so there is no canary to judge"; exit 1; }'
|
||||
- '[ -n "$$ARCHIE_CANARY_TOKEN" ] || { echo "repo secret canary_token is not set, so the canary cannot be reached"; exit 1; }'
|
||||
- '[ -n "$$DEPLOY_TOKEN" ] || { echo "repo secret deploy_token is not set, so the registry cannot be tagged"; exit 1; }'
|
||||
- go build -tags no_ui -o /tmp/archied ./cmd/archied
|
||||
# archied reads the registry credentials a docker login would have
|
||||
# written; this step has no docker CLI, so the file is written directly.
|
||||
- |
|
||||
@@ -47,5 +67,5 @@ steps:
|
||||
if [ -n "$$CANARY_WINDOW" ]; then
|
||||
set -- -window "$$CANARY_WINDOW"
|
||||
fi
|
||||
/tmp/archied release canary check -dashboard "$$CANARY_URL" "$$@" \
|
||||
"$$CI_WORKSPACE/.git/archied" release canary check -dashboard "$$CANARY_URL" "$$@" \
|
||||
-latest git.catlow.cloud/sam/archied,git.catlow.cloud/sam/archie-agent
|
||||
+24
-25
@@ -24,9 +24,7 @@ when:
|
||||
concurrency: 1
|
||||
|
||||
variables:
|
||||
# The gate and the distribution step both build the dashboard. Anchored here
|
||||
# rather than written twice, so the digest and the pnpm version can only
|
||||
# change in one place.
|
||||
# Node and pnpm for the gate, which builds the dashboard the binaries embed.
|
||||
- &node-setup |
|
||||
set -eu
|
||||
apt-get update -qq
|
||||
@@ -81,9 +79,14 @@ steps:
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
- /var/tmp/woodpecker-archie-gate:/var/tmp/woodpecker-archie-gate
|
||||
# Go's build and module caches outlive the step. Pull requests keep
|
||||
# their own (quality.yaml), so they cannot seed a release build.
|
||||
- /var/cache/woodpecker-archie/go:/var/cache/go
|
||||
environment:
|
||||
DOCKER_HOST: unix:///var/run/docker.sock
|
||||
TMPDIR: /var/tmp/woodpecker-archie-gate
|
||||
GOCACHE: /var/cache/go/build
|
||||
GOMODCACHE: /var/cache/go/mod
|
||||
commands:
|
||||
- '. "$$CI_WORKSPACE/.git/ci-plan.env"'
|
||||
- '[ "$$RUN" = true ] || { echo "a release tag owns this commit; the tag pipeline publishes it"; exit 0; }'
|
||||
@@ -104,7 +107,15 @@ steps:
|
||||
git branch main HEAD
|
||||
fi
|
||||
fi
|
||||
- task check TEST_FLAGS=-count=1
|
||||
# A release stamps its version here: the dist step ships these binaries,
|
||||
# so the release is what the gate tested.
|
||||
- |
|
||||
set -eu
|
||||
if [ -n "$$RELEASE_VERSION" ]; then
|
||||
task check TEST_FLAGS=-count=1 GATEWAY_VERSION="$$RELEASE_VERSION" RUNTIME_VERSION="$$RELEASE_VERSION"
|
||||
else
|
||||
task check TEST_FLAGS=-count=1
|
||||
fi
|
||||
- git diff --exit-code
|
||||
- go install golang.org/x/vuln/cmd/govulncheck@latest
|
||||
- govulncheck ./...
|
||||
@@ -210,29 +221,14 @@ steps:
|
||||
- '[ -n "$$RELEASE_VERSION" ] || { echo "not a release; no distribution to build"; exit 0; }'
|
||||
- apt-get update -qq
|
||||
- apt-get install -y -qq --no-install-recommends jq zip
|
||||
- *node-setup
|
||||
# A subshell: a bare `cd ui` here would leave every later command in this
|
||||
# step building from the dashboard directory.
|
||||
# The gate built and tested these binaries; this step only packages them.
|
||||
- |
|
||||
set -eu
|
||||
(
|
||||
cd ui
|
||||
pnpm install --frozen-lockfile
|
||||
pnpm run build
|
||||
)
|
||||
- |
|
||||
set -eu
|
||||
base=github.com/samcharles93/archie-core
|
||||
ldflags="-X $${base}/internal/installtype.buildType=binary -X $${base}/internal/buildinfo.Version=$$RELEASE_VERSION -X $${base}/internal/buildinfo.Runtime=$$RELEASE_VERSION -X $${base}/internal/app/agentworker.version=$$RELEASE_VERSION"
|
||||
cmds=$(jq -r '.required_topology.units[], .required_topology.binaries[]?' release.json)
|
||||
mkdir -p dist
|
||||
for cmd in $$cmds; do
|
||||
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags "$$ldflags" -o "dist/$$cmd" "./cmd/$$cmd"
|
||||
done
|
||||
name="archie-core-archied-v$$RELEASE_VERSION-linux-amd64"
|
||||
mkdir -p "$$name"
|
||||
for cmd in $$cmds; do
|
||||
cp "dist/$$cmd" "$$name/"
|
||||
cp "bin/$$cmd" "$$name/"
|
||||
done
|
||||
cp deployments/INSTRUCTIONS.md CHANGELOG.md "$$name/"
|
||||
if [ -f README.md ]; then cp README.md "$$name/"; fi
|
||||
@@ -269,7 +265,7 @@ steps:
|
||||
prerelease=false
|
||||
case "$$RELEASE_VERSION" in *-*) prerelease=true ;; esac
|
||||
digest=$(cat "$$CI_WORKSPACE/.git/agent-image.digest")
|
||||
./dist/archied release publish -source git.catlow.cloud/sam/archie \
|
||||
./bin/archied release publish -source git.catlow.cloud/sam/archie \
|
||||
-version "$$RELEASE_VERSION" -prerelease="$$prerelease" \
|
||||
-zip "$$RELEASE_ZIP" \
|
||||
-agent-image "git.catlow.cloud/sam/archie-agent@$$digest" \
|
||||
@@ -277,7 +273,7 @@ steps:
|
||||
|
||||
- name: notes
|
||||
image: golang:1.27.3-bookworm
|
||||
depends_on: [dist]
|
||||
depends_on: [publish]
|
||||
environment:
|
||||
DEPLOY_TOKEN:
|
||||
from_secret: deploy_token
|
||||
@@ -291,6 +287,8 @@ steps:
|
||||
- |
|
||||
set -eu
|
||||
tag="v$$RELEASE_VERSION"
|
||||
prerelease=false
|
||||
case "$$RELEASE_VERSION" in *-*) prerelease=true ;; esac
|
||||
notes=$(mktemp)
|
||||
awk -v hdr="## [$$RELEASE_VERSION]" '
|
||||
index($$0, hdr) == 1 { printing = 1 }
|
||||
@@ -307,7 +305,8 @@ steps:
|
||||
curl -sf -X DELETE -H "$$auth" "$$api/repos/$$repo/releases/tags/$$tag" >/dev/null || true
|
||||
curl -sf -X POST -H "$$auth" -H "Content-Type: application/json" \
|
||||
-d "$(jq -n --arg tag "$$tag" --arg name "Archie v$$RELEASE_VERSION" --arg body "$(cat "$$notes")" \
|
||||
'{tag_name: $$tag, name: $$name, body: $$body, draft: false, prerelease: false}')" \
|
||||
--argjson prerelease "$$prerelease" \
|
||||
'{tag_name: $$tag, name: $$name, body: $$body, draft: false, prerelease: $$prerelease}')" \
|
||||
"$$api/repos/$$repo/releases" >/dev/null
|
||||
echo "published release notes for $$tag"
|
||||
# The packages exist under this repository's namespace but are not
|
||||
@@ -330,4 +329,4 @@ steps:
|
||||
- '[ "$$RUN" = true ] || { echo "skipped: the tag pipeline publishes this commit"; exit 0; }'
|
||||
- '[ -n "$$RELEASE_VERSION" ] || { echo "not a release; nothing to install on the canary"; exit 0; }'
|
||||
- '[ -n "$$CANARY_URL" ] || { echo "canary_url is not set; skipping the canary install"; exit 0; }'
|
||||
- ./dist/archied release canary start -dashboard "$$CANARY_URL" -version "$$RELEASE_VERSION"
|
||||
- ./bin/archied release canary start -dashboard "$$CANARY_URL" -version "$$RELEASE_VERSION"
|
||||
@@ -13,6 +13,26 @@ when:
|
||||
concurrency: 1
|
||||
|
||||
steps:
|
||||
# The archied that deploy published for main, not a build of its own.
|
||||
- name: fetch
|
||||
image: docker:29-cli
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
environment:
|
||||
DOCKER_HOST: unix:///var/run/docker.sock
|
||||
DEPLOY_TOKEN:
|
||||
from_secret: deploy_token
|
||||
commands:
|
||||
- '[ -n "$$DEPLOY_TOKEN" ] || { echo "repo secret deploy_token is not set, so the registry cannot be read"; exit 1; }'
|
||||
- printf '%s' "$$DEPLOY_TOKEN" | docker login git.catlow.cloud -u "$$CI_REPO_OWNER" --password-stdin
|
||||
- |
|
||||
set -eu
|
||||
image=git.catlow.cloud/sam/archied:edge
|
||||
docker pull -q "$$image"
|
||||
container=$(docker create "$$image")
|
||||
trap 'docker rm "$$container" >/dev/null' EXIT
|
||||
docker cp "$$container:/usr/local/bin/archied" "$$CI_WORKSPACE/.git/archied"
|
||||
|
||||
- name: promote
|
||||
image: golang:1.27.3-bookworm
|
||||
environment:
|
||||
@@ -27,7 +47,6 @@ steps:
|
||||
- '[ -n "$$CANARY_URL" ] || { echo "repo secret canary_url is not set, so there is no canary to read"; exit 1; }'
|
||||
- '[ -n "$$ARCHIE_CANARY_TOKEN" ] || { echo "repo secret canary_token is not set, so the canary cannot be reached"; exit 1; }'
|
||||
- '[ -n "$$DEPLOY_TOKEN" ] || { echo "repo secret deploy_token is not set, so the registry cannot be tagged"; exit 1; }'
|
||||
- go build -tags no_ui -o /tmp/archied ./cmd/archied
|
||||
# archied reads the registry credentials a docker login would have
|
||||
# written; this step has no docker CLI, so the file is written directly.
|
||||
- |
|
||||
@@ -36,6 +55,6 @@ steps:
|
||||
auth=$(printf '%s:%s' "$$CI_REPO_OWNER" "$$DEPLOY_TOKEN" | base64 -w0)
|
||||
printf '{"auths":{"git.catlow.cloud":{"auth":"%s"}}}\n' "$$auth" > "$$HOME/.docker/config.json"
|
||||
- >-
|
||||
/tmp/archied release canary promote -dashboard "$$CANARY_URL"
|
||||
"$$CI_WORKSPACE/.git/archied" release canary promote -dashboard "$$CANARY_URL"
|
||||
-version "$$VERSION"
|
||||
-latest git.catlow.cloud/sam/archied,git.catlow.cloud/sam/archie-agent
|
||||
@@ -21,6 +21,13 @@ clone:
|
||||
steps:
|
||||
- name: check
|
||||
image: golang:1.27.3-bookworm
|
||||
# Go's build and module caches outlive the step. Kept apart from the
|
||||
# deploy gate's, so a pull request cannot seed a release build.
|
||||
volumes:
|
||||
- /var/cache/woodpecker-archie/go-pr:/var/cache/go
|
||||
environment:
|
||||
GOCACHE: /var/cache/go/build
|
||||
GOMODCACHE: /var/cache/go/mod
|
||||
commands:
|
||||
- go install github.com/go-task/task/v3/cmd/task@v3.48.0
|
||||
- go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(cat .golangci-version)
|
||||
|
||||
+3
-1
@@ -12,7 +12,9 @@ WORKDIR /src
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
COPY . .
|
||||
RUN CGO_ENABLED=0 go build \
|
||||
# COPY . . invalidates this layer on every commit; the compile cache outlives it.
|
||||
RUN --mount=type=cache,id=archie-go-build,target=/root/.cache/go-build \
|
||||
CGO_ENABLED=0 go build \
|
||||
-ldflags "-X github.com/samcharles93/archie-core/internal/app/agentworker.version=${RUNTIME_VERSION} -X github.com/samcharles93/archie-core/internal/installtype.buildType=container" \
|
||||
-o /usr/local/bin/archie-agent ./cmd/archie-agent/
|
||||
|
||||
|
||||
+3
-1
@@ -17,7 +17,9 @@ COPY . .
|
||||
COPY --from=dashboard /src/ui/dist ./ui/dist
|
||||
ARG GATEWAY_VERSION=dev
|
||||
ARG RUNTIME_VERSION=dev
|
||||
RUN CGO_ENABLED=0 go build \
|
||||
# COPY . . invalidates this layer on every commit; the compile cache outlives it.
|
||||
RUN --mount=type=cache,id=archie-go-build,target=/root/.cache/go-build \
|
||||
CGO_ENABLED=0 go build \
|
||||
-ldflags "-X github.com/samcharles93/archie-core/internal/buildinfo.Version=${GATEWAY_VERSION} -X github.com/samcharles93/archie-core/internal/buildinfo.Runtime=${RUNTIME_VERSION} -X github.com/samcharles93/archie-core/internal/installtype.buildType=container" \
|
||||
-o /usr/local/bin/archied ./cmd/archied/
|
||||
|
||||
|
||||
+4
-2
@@ -71,7 +71,8 @@ The tag push runs `deploy.yml`:
|
||||
|
||||
- **Gate.** `task check TEST_FLAGS=-count=1` (uncached, including the
|
||||
Docker-backed tests `-short` skips) and `govulncheck`, then a check that the
|
||||
tag has a `[version]` section in `CHANGELOG.md`.
|
||||
tag has a `[version]` section in `CHANGELOG.md`. The gate's `task build` is
|
||||
stamped with the version, and those binaries are the ones the zip ships.
|
||||
- **Images.** `archied:v<version>` and `archie-agent:v<version>` on a release
|
||||
tag; `archied:edge` and `archied:sha-<commit>` on any other push to `main`.
|
||||
`:latest` moves only on promotion, so it names the newest promoted release.
|
||||
@@ -92,7 +93,8 @@ release rather than committing the fix on top of a tagged one.
|
||||
## The canary
|
||||
|
||||
The canary is the production host, following `next`. Every quarter hour
|
||||
`canary.yml` runs `archied release canary check`, which reads the canary
|
||||
`canary.yml` takes `archied` from the published `archied:edge` image and runs
|
||||
`release canary check`, which reads the canary
|
||||
through its dashboard API and judges **the release the canary actually runs**,
|
||||
not the moving `next` tag:
|
||||
|
||||
|
||||
+4
-1
@@ -231,6 +231,9 @@ tasks:
|
||||
build:
|
||||
desc: Build archie services and agent binaries
|
||||
deps: [ui]
|
||||
# Static, like the images: a release ships the binaries its gate built.
|
||||
env:
|
||||
CGO_ENABLED: "0"
|
||||
vars:
|
||||
GATEWAY_VERSION: '{{.GATEWAY_VERSION | default .VERSION}}'
|
||||
RUNTIME_VERSION: '{{.RUNTIME_VERSION | default .VERSION}}'
|
||||
@@ -262,7 +265,7 @@ tasks:
|
||||
# binary reports the same version.
|
||||
- for: [archied, archie-gateway, archie-state-store, archie-ui, archie-messaging]
|
||||
cmd: go build -trimpath -ldflags "{{.SERVICE_LDFLAGS}}" -o {{.BIN_DIR}}/{{.ITEM}} ./cmd/{{.ITEM}}
|
||||
- go build -trimpath -ldflags "-X github.com/samcharles93/archie-core/internal/app/agentworker.version={{.RUNTIME_VERSION}} -X github.com/samcharles93/archie-core/internal/installtype.buildType=binary" -o {{.BIN_DIR}}/archie-agent ./cmd/archie-agent
|
||||
- go build -trimpath -ldflags "{{.SERVICE_LDFLAGS}} -X github.com/samcharles93/archie-core/internal/app/agentworker.version={{.RUNTIME_VERSION}}" -o {{.BIN_DIR}}/archie-agent ./cmd/archie-agent
|
||||
|
||||
test:
|
||||
desc: Run Go tests; the release gate passes TEST_FLAGS=-count=1
|
||||
|
||||
Reference in new issue
Block a user