Merge pull request #712 from samcharles93/fix/issue-710
fix(ci): skip runtime image on gateway-only releases
This commit is contained in:
commit
ea7564c928
2 files changed
+47
No files matched your search
@@ -134,6 +134,10 @@ jobs:
|
||||
RUNTIME_VERSION="${RUNTIME_TAG#archie/}"
|
||||
[ -n "$GATEWAY_VERSION" ] || GATEWAY_VERSION=dev
|
||||
[ -n "$RUNTIME_VERSION" ] || RUNTIME_VERSION=dev
|
||||
# Keep the raw tag presence separate from the version fallback:
|
||||
# gateway-only releases must not rebuild the runtime image as dev.
|
||||
echo "gateway_tag=$GATEWAY_TAG" >> "$GITHUB_OUTPUT"
|
||||
echo "runtime_tag=$RUNTIME_TAG" >> "$GITHUB_OUTPUT"
|
||||
echo "gateway=$GATEWAY_VERSION" >> "$GITHUB_OUTPUT"
|
||||
echo "runtime=$RUNTIME_VERSION" >> "$GITHUB_OUTPUT"
|
||||
|
||||
@@ -151,6 +155,7 @@ jobs:
|
||||
cache-to: type=gha,mode=max,scope=archied
|
||||
|
||||
- name: Build and push archie-agent
|
||||
if: steps.versions.outputs.runtime_tag != ''
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package configtemplate
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestDeployWorkflowOnlyPublishesRuntimeImageForRuntimeTag(t *testing.T) {
|
||||
source := readDeploymentFile(t, ".github/workflows/deploy.yml")
|
||||
|
||||
// The fallback remains necessary because Dockerfile.archied accepts a
|
||||
// runtime version, but it must not be used as the image-publish selector.
|
||||
for _, required := range []string{
|
||||
`RUNTIME_TAG="$(git tag --points-at HEAD --list 'archie/v*' | sort -V | tail -1)"`,
|
||||
`echo "runtime_tag=$RUNTIME_TAG" >> "$GITHUB_OUTPUT"`,
|
||||
"if: steps.versions.outputs.runtime_tag != ''",
|
||||
} {
|
||||
if !strings.Contains(source, required) {
|
||||
t.Errorf("deploy workflow is missing runtime-image guard %q", required)
|
||||
}
|
||||
}
|
||||
|
||||
// The gateway build remains unconditional, while the runtime build is
|
||||
// guarded. This verifies both sides of the gateway-only/dual-tag contract.
|
||||
agentMarker := " - name: Build and push archie-agent\n"
|
||||
agentStart := strings.Index(source, agentMarker)
|
||||
if agentStart < 0 {
|
||||
t.Fatal("deploy workflow has no archie-agent build step")
|
||||
}
|
||||
if !strings.Contains(source[agentStart:], agentMarker+" if: steps.versions.outputs.runtime_tag != ''\n") {
|
||||
t.Fatal("archie-agent build step is not conditionally enabled")
|
||||
}
|
||||
|
||||
gatewayMarker := " - name: Build and push archied\n"
|
||||
gatewayStart := strings.Index(source, gatewayMarker)
|
||||
if gatewayStart < 0 {
|
||||
t.Fatal("deploy workflow has no archied build step")
|
||||
}
|
||||
if strings.Contains(source[gatewayStart:agentStart], "\n if:") {
|
||||
t.Fatal("archied build step is unexpectedly conditional")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user