Modern Docker Management, Designed for Everyone
Go composecontainer-managementcontainersdockerdocker-composedocker-managementgoself-hostedsveltekittypescriptweb-ui
chore: refactor next tags to be less buly and more readable
Kyle Mendella18841ec0317
diff --git a/.depot/workflows/build-next-images.yml b/.depot/workflows/build-next-images.ymlindex 452a41946..8f00bc0aa 100644--- a/.depot/workflows/build-next-images.yml+++ b/.depot/workflows/build-next-images.yml@@ -18,12 +18,6 @@ jobs:build-next-images:runs-on: depot-ubuntu-24.04-32- env:- MANAGER_IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/arcane- MANAGER_IMAGE_ALIAS: ghcr.io/${{ github.repository_owner }}/manager- AGENT_IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/arcane-headless- AGENT_IMAGE_ALIAS: ghcr.io/${{ github.repository_owner }}/agent-steps:- name: Checkout codeuses: actions/checkout@v6@@ -38,6 +32,9 @@ jobs:- name: Setup Justuses: taiki-e/install-action@just+ - name: Setup git-cliff+ uses: taiki-e/install-action@git-cliff+- name: Setup Node.jsuses: actions/setup-node@v6with:@@ -76,10 +73,9 @@ jobs:username: ${{ vars.GHCR_USERNAME }}password: ${{ secrets.ARCANE_BOT_TOKEN }}- - name: Set Short Git Commit SHA- id: vars- run: |- echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT+ - name: Compute next image version+ id: next-version+ run: just next-image-version github-output- name: Run GoReleaseruses: goreleaser/goreleaser-action@ec59f474b9834571250b370d4735c50f8e2d1e29 #v7.0.0@@ -94,7 +90,9 @@ jobs:BUILD_NEXT: 'true'SKIP_RELEASE: 'true'SKIP_CHANGELOG: 'true'- GORELEASER_CURRENT_TAG: next-static-${{ steps.vars.outputs.sha_short }}+ NEXT_IMAGE_VERSION: ${{ steps.next-version.outputs.version }}+ GORELEASER_CURRENT_TAG: ${{ steps.next-version.outputs.image_tag }}+ GORELEASER_PREVIOUS_TAG: ${{ steps.next-version.outputs.previous_tag }}GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}MACOS_SIGN_P12: ${{ secrets.MACOS_SIGN_P12 }}MACOS_SIGN_PASSWORD: ${{ secrets.MACOS_SIGN_PASSWORD }}@@ -109,94 +107,3 @@ jobs:R2_BUCKET: ${{ secrets.R2_BUCKET }}NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}-- - name: Manager image metadata- id: manager-meta- uses: docker/metadata-action@v6- with:- images: |- ${{ env.MANAGER_IMAGE_NAME }}- ${{ env.MANAGER_IMAGE_ALIAS }}- tags: |- type=raw,value=next- type=raw,value=next-${{ steps.vars.outputs.sha_short }}- labels: |- org.opencontainers.image.authors=OFKM Technologies- org.opencontainers.image.url=https://github.com/getarcaneapp/arcane- org.opencontainers.image.documentation=https://github.com/getarcaneapp/arcane/blob/main/README.md- org.opencontainers.image.source=https://github.com/getarcaneapp/arcane- org.opencontainers.image.version=next-${{ steps.vars.outputs.sha_short }}- org.opencontainers.image.revision=${{ github.sha }}- org.opencontainers.image.licenses=BSD-3-Clause- org.opencontainers.image.ref.name=arcane- org.opencontainers.image.title=Arcane- org.opencontainers.image.description=Modern Docker Management, Made for Everyone- com.getarcaneapp.arcane=true-- - name: Build and push manager image- id: manager-build- uses: depot/build-push-action@v1- with:- context: .- file: docker/Dockerfile- platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/riscv64- push: true- tags: ${{ steps.manager-meta.outputs.tags }}- labels: ${{ steps.manager-meta.outputs.labels }}- build-args: |- VERSION=next-${{ steps.vars.outputs.sha_short }}- REVISION=${{ github.sha }}- sbom: true- provenance: true-- - name: Sign manager image- run: cosign sign --yes --key env://COSIGN_PRIVATE_KEY "${MANAGER_IMAGE_NAME}@${{ steps.manager-build.outputs.digest }}" "${MANAGER_IMAGE_ALIAS}@${{ steps.manager-build.outputs.digest }}"- env:- COSIGN_PRIVATE_KEY: ${{ secrets.COSIGN_PRIVATE_KEY }}- COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }}-- - name: Agent image metadata- id: agent-meta- uses: docker/metadata-action@v6- with:- images: |- ${{ env.AGENT_IMAGE_NAME }}- ${{ env.AGENT_IMAGE_ALIAS }}- tags: |- type=raw,value=next- type=raw,value=next-${{ steps.vars.outputs.sha_short }}- labels: |- org.opencontainers.image.authors=OFKM Technologies- org.opencontainers.image.url=https://github.com/getarcaneapp/arcane- org.opencontainers.image.documentation=https://github.com/getarcaneapp/arcane/blob/main/README.md- org.opencontainers.image.source=https://github.com/getarcaneapp/arcane- org.opencontainers.image.version=next-${{ steps.vars.outputs.sha_short }}- org.opencontainers.image.revision=${{ github.sha }}- org.opencontainers.image.licenses=BSD-3-Clause- org.opencontainers.image.ref.name=arcane-agent- org.opencontainers.image.title=Arcane Agent- org.opencontainers.image.description=Arcane Agent- com.getarcaneapp.arcane=true- com.getarcaneapp.arcane.agent=true-- - name: Build and push agent image- id: agent-build- uses: depot/build-push-action@v1- with:- context: .- file: docker/Dockerfile-agent- platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/riscv64- push: true- tags: ${{ steps.agent-meta.outputs.tags }}- labels: ${{ steps.agent-meta.outputs.labels }}- build-args: |- VERSION=next-${{ steps.vars.outputs.sha_short }}- REVISION=${{ github.sha }}- sbom: true- provenance: true-- - name: Sign agent image- run: cosign sign --yes --key env://COSIGN_PRIVATE_KEY "${AGENT_IMAGE_NAME}@${{ steps.agent-build.outputs.digest }}" "${AGENT_IMAGE_ALIAS}@${{ steps.agent-build.outputs.digest }}"- env:- COSIGN_PRIVATE_KEY: ${{ secrets.COSIGN_PRIVATE_KEY }}- COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }}diff --git a/.goreleaser.yaml b/.goreleaser.yamlindex 71f5cd912..10e33553a 100644--- a/.goreleaser.yaml+++ b/.goreleaser.yaml@@ -219,7 +219,7 @@ checksum:name_template: arcane-cli_darwin_arm64nightly:- version_template: '0.0.0-next.{{ .ShortCommit }}'+ version_template: '{{ .Env.NEXT_IMAGE_VERSION }}'nfpms:- id: arcane-cli@@ -310,8 +310,9 @@ dockers_v2:- 'ghcr.io/getarcaneapp/arcane'- 'ghcr.io/getarcaneapp/manager'tags:+ - 'next'- 'next-static'- - '{{ .Version }}'+ - 'v{{ .Version }}'platforms:- linux/amd64- linux/arm64@@ -322,7 +323,7 @@ dockers_v2:'org.opencontainers.image.url': 'https://github.com/getarcaneapp/arcane''org.opencontainers.image.documentation': 'https://github.com/getarcaneapp/arcane/blob/main/README.md''org.opencontainers.image.source': 'https://github.com/getarcaneapp/arcane'- 'org.opencontainers.image.version': '{{.Version}}'+ 'org.opencontainers.image.version': 'v{{.Version}}''org.opencontainers.image.revision': '{{.FullCommit}}''org.opencontainers.image.licenses': 'BSD-3-Clause''org.opencontainers.image.title': 'Arcane'@@ -339,8 +340,9 @@ dockers_v2:- 'ghcr.io/getarcaneapp/arcane-headless'- 'ghcr.io/getarcaneapp/agent'tags:+ - 'next'- 'next-static'- - '{{ .Version }}'+ - 'v{{ .Version }}'platforms:- linux/amd64- linux/arm64@@ -351,7 +353,7 @@ dockers_v2:'org.opencontainers.image.url': 'https://github.com/getarcaneapp/arcane''org.opencontainers.image.documentation': 'https://github.com/getarcaneapp/arcane/blob/main/README.md''org.opencontainers.image.source': 'https://github.com/getarcaneapp/arcane'- 'org.opencontainers.image.version': '{{.Version}}'+ 'org.opencontainers.image.version': 'v{{.Version}}''org.opencontainers.image.revision': '{{.FullCommit}}''org.opencontainers.image.licenses': 'BSD-3-Clause''org.opencontainers.image.title': 'Arcane Agent'diff --git a/Justfile b/Justfileindex b409a0155..7dac9b951 100644--- a/Justfile+++ b/Justfile@@ -1092,6 +1092,91 @@ release *args:echo "Test mode complete. No changes were written."fi+# Compute the next semver next-image version (e.g. 2.4.0-next.1) from unreleased commits.+# Bump rules: breaking -> major, feat -> minor, other included commits -> patch.+# The -next.N counter continues from tags already published to GHCR; set+# GHCR_TAGS (newline separated) to bypass the registry query for testing.+#+# Usage: just next-image-version [github-output]+[group('release')]+next-image-version mode="":+ #!/usr/bin/env bash+ set -euo pipefail++ CLIFF_CMD=""+ if command -v git-cliff &>/dev/null; then+ CLIFF_CMD="git-cliff"+ elif git cliff --version &>/dev/null; then+ CLIFF_CMD="git cliff"+ else+ echo "Error: git cliff is not installed. Please install it from https://git-cliff.org/docs/installation." >&2+ exit 1+ fi++ if ! command -v jq &>/dev/null; then+ echo "Error: jq is required." >&2+ exit 1+ fi++ PREVIOUS_TAG=$(git tag -l 'v[0-9]*' --sort=-v:refname | head -n1)+ BASE_VERSION="${PREVIOUS_TAG#v}"+ if [ -z "$PREVIOUS_TAG" ]; then+ BASE_VERSION="0.0.0"+ fi++ CONTEXT=$($CLIFF_CMD --unreleased --context --offline --config cliff.toml)++ BREAKING=$(jq '[.[].commits[]? | select(.breaking == true)] | length' <<<"$CONTEXT")+ FEATURES=$(jq '[.[].commits[]? | select((.group // "") | test("New features"))] | length' <<<"$CONTEXT")++ IFS='.' read -r MAJOR MINOR PATCH <<<"$BASE_VERSION"+ if [ "$BREAKING" -gt 0 ]; then+ NEXT_BASE="$((MAJOR + 1)).0.0"+ elif [ "$FEATURES" -gt 0 ]; then+ NEXT_BASE="${MAJOR}.$((MINOR + 1)).0"+ else+ NEXT_BASE="${MAJOR}.${MINOR}.$((PATCH + 1))"+ fi++ GHCR_IMAGE="${GHCR_IMAGE:-getarcaneapp/arcane}"+ if [ -n "${GHCR_TAGS+x}" ]; then+ TAGS="$GHCR_TAGS"+ else+ TOKEN=$(curl -fsSL "https://ghcr.io/token?scope=repository:${GHCR_IMAGE}:pull" | jq -r '.token')+ TAGS=""+ URL="https://ghcr.io/v2/${GHCR_IMAGE}/tags/list?n=1000"+ HEADERS_FILE=$(mktemp)+ while [ -n "$URL" ]; do+ PAGE=$(curl -fsSL -D "$HEADERS_FILE" -H "Authorization: Bearer ${TOKEN}" "$URL")+ TAGS+=$'\n'"$(jq -r '.tags[]?' <<<"$PAGE")"+ NEXT_LINK=$(awk -F'[<>]' 'tolower($0) ~ /^link:/ { print $2 }' "$HEADERS_FILE" | tr -d '\r')+ if [ -n "$NEXT_LINK" ]; then+ URL="https://ghcr.io${NEXT_LINK}"+ else+ URL=""+ fi+ done+ rm -f "$HEADERS_FILE"+ fi++ ESCAPED_BASE="${NEXT_BASE//./\\.}"+ MAX_N=$(grep -E "^v${ESCAPED_BASE}-next\.[0-9]+$" <<<"$TAGS" | sed -E 's/.*-next\.//' | sort -n | tail -n1 || true)+ COUNTER=$(( ${MAX_N:-0} + 1 ))++ VERSION="${NEXT_BASE}-next.${COUNTER}"+ IMAGE_TAG="v${VERSION}"++ echo "previous_tag=${PREVIOUS_TAG}"+ echo "version=${VERSION}"+ echo "image_tag=${IMAGE_TAG}"++ if [ "{{ mode }}" = "github-output" ]; then+ printf '%s\n' \+ "previous_tag=${PREVIOUS_TAG}" \+ "version=${VERSION}" \+ "image_tag=${IMAGE_TAG}" >> "${GITHUB_OUTPUT:?GITHUB_OUTPUT is not set}"+ fi+[group('release')]_utils-list-fixes:#!/usr/bin/env bash