fix(update): treat the runtime as the release version; stamp it in dist-zip
The update check still read the retired archie/v* tag stream, so a host on 1.41.1 was offered runtime 1.35.0, and the installer built the agent image from that stale tag. Both now use the release's archied/v* tag. The dist-zip build also stamps runtimeVersion, so /version stops reporting 'dev'.
This commit is contained in:
1 parent
3face41be0
commit
9ab28bb72d
5 files changed
+29
-25
No files matched your search
@@ -321,7 +321,7 @@ jobs:
|
||||
# ran on with a dead Telegram bot and no error anywhere
|
||||
# (archie-core-1c01). TestDistZipShipsEveryHostCommand fails if this
|
||||
# list and the copy list below stop matching the commands in cmd/.
|
||||
ldflags="-X github.com/samcharles93/archie-core/internal/app/archied.gatewayVersion=${{ steps.version.outputs.version }} -X github.com/samcharles93/archie-core/internal/installtype.buildType=binary -X github.com/samcharles93/archie-core/internal/buildinfo.Version=${{ steps.version.outputs.version }}"
|
||||
ldflags="-X github.com/samcharles93/archie-core/internal/app/archied.gatewayVersion=${{ steps.version.outputs.version }} -X github.com/samcharles93/archie-core/internal/app/archied.runtimeVersion=${{ steps.version.outputs.version }} -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 }}"
|
||||
mkdir -p dist
|
||||
for cmd in archied archie-gateway archie-state-store archie-ui archie-messaging archie-playbooks; do
|
||||
go build -ldflags "$ldflags" -o "dist/$cmd" "./cmd/$cmd"
|
||||
|
||||
@@ -110,7 +110,9 @@ esac
|
||||
if got, want := componentAvailable(snapshot, ComponentDaemon), "1.23.0"; got != want {
|
||||
t.Errorf("daemon available = %q, want %q", got, want)
|
||||
}
|
||||
if got, want := componentAvailable(snapshot, ComponentAgent), "1.21.0"; got != want {
|
||||
// One version covers every component; a stale archie/v* runtime tag must
|
||||
// never be offered as an update.
|
||||
if got, want := componentAvailable(snapshot, ComponentAgent), "1.23.0"; got != want {
|
||||
t.Errorf("agent available = %q, want %q", got, want)
|
||||
}
|
||||
}
|
||||
@@ -154,7 +156,7 @@ esac
|
||||
if got, want := componentAvailable(snapshot, ComponentDaemon), "1.24.0"; got != want {
|
||||
t.Errorf("daemon available = %q, want %q", got, want)
|
||||
}
|
||||
if got, want := componentAvailable(snapshot, ComponentAgent), "1.23.0"; got != want {
|
||||
if got, want := componentAvailable(snapshot, ComponentAgent), "1.24.0"; got != want {
|
||||
t.Errorf("agent available = %q, want %q", got, want)
|
||||
}
|
||||
if ref := componentReference(snapshot, ComponentDaemon); !strings.Contains(ref, "forge-api-tags") {
|
||||
|
||||
@@ -81,32 +81,33 @@ func TestUpdateInstallBothComponentsBuildsDaemonAndManagedWorkerImage(t *testing
|
||||
// releases are the norm. Each changed component must be built from its own
|
||||
// approved tag; forcing both tags onto one commit refuses every update once
|
||||
// the two components' newest releases diverge.
|
||||
func TestUpdateInstallBuildsEachComponentFromItsOwnTag(t *testing.T) {
|
||||
// One version covers every component, so the managed worker image is built
|
||||
// from the release's own archied/v* tag -- never from a stale archie/v* tag.
|
||||
func TestUpdateInstallBuildsTheAgentImageFromTheReleaseTag(t *testing.T) {
|
||||
result, calls := runUpdateInstallScript(t, map[string]string{
|
||||
"ARCHIE_UPDATE_DAEMON_PREVIOUS": "1.12.0",
|
||||
"ARCHIE_UPDATE_DAEMON_VERSION": "1.13.0",
|
||||
"ARCHIE_UPDATE_AGENT_PREVIOUS": "1.9.9",
|
||||
"ARCHIE_UPDATE_AGENT_VERSION": "1.10.0",
|
||||
"ARCHIE_UPDATE_AGENT_PREVIOUS": "1.12.0",
|
||||
"ARCHIE_UPDATE_AGENT_VERSION": "1.13.0",
|
||||
})
|
||||
|
||||
if result.Installed[ComponentDaemon] != "1.13.0" || result.Installed[ComponentAgent] != "1.10.0" {
|
||||
t.Fatalf("installed = %#v, want both release versions", result.Installed)
|
||||
if result.Installed[ComponentDaemon] != "1.13.0" || result.Installed[ComponentAgent] != "1.13.0" {
|
||||
t.Fatalf("installed = %#v, want the release version for both", result.Installed)
|
||||
}
|
||||
// The derived fake commits differ per tag, so these assertions fail if
|
||||
// either component is built from the other's release.
|
||||
daemonCheckout := indexOfCallContaining(t, calls, "checkout --quiet --detach archied-v1.13.0")
|
||||
agentCheckout := indexOfCallContaining(t, calls, "checkout --quiet --detach archie-v1.10.0")
|
||||
assertCallAbsent(t, calls, "archie-v1.13.0")
|
||||
daemonBuild := indexOfCallContaining(t, calls, "go build", "./cmd/archied")
|
||||
agentImageBuild := indexOfCallContaining(t, calls, "docker build")
|
||||
if daemonCheckout < 0 || agentCheckout < 0 || daemonBuild < 0 || agentImageBuild < 0 {
|
||||
t.Fatalf("missing expected step: daemon checkout %d, daemon build %d, agent checkout %d, agent image build %d",
|
||||
daemonCheckout, daemonBuild, agentCheckout, agentImageBuild)
|
||||
lastCheckout := -1
|
||||
for i, call := range calls {
|
||||
if strings.Contains(call, "checkout --quiet --detach") && i < agentImageBuild {
|
||||
lastCheckout = i
|
||||
}
|
||||
}
|
||||
if daemonCheckout > daemonBuild {
|
||||
t.Errorf("daemon binaries must be built from the daemon tag's commit; calls = %#v", calls)
|
||||
if daemonBuild < 0 || agentImageBuild < 0 || lastCheckout < 0 {
|
||||
t.Fatalf("missing expected step: daemon build %d, agent image build %d, checkout %d", daemonBuild, agentImageBuild, lastCheckout)
|
||||
}
|
||||
if agentCheckout > agentImageBuild {
|
||||
t.Errorf("the managed worker image must be built from the agent tag's commit; calls = %#v", calls)
|
||||
if !strings.Contains(calls[lastCheckout], "archied-v1.13.0") {
|
||||
t.Errorf("image built after checking out %q, want the archied/v1.13.0 release; calls = %#v", calls[lastCheckout], calls)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -136,15 +136,16 @@ else
|
||||
agent_installed="$(base "$(installed_for archie-agent || true)")"
|
||||
fi
|
||||
|
||||
# One version covers every component (RELEASING.md): the runtime image a
|
||||
# release publishes carries the release's own version, tagged archied/v*.
|
||||
daemon_available="$(newest_tag_git archied || true)"
|
||||
agent_available="$(newest_tag_git archie || true)"
|
||||
tag_source="git-tags"
|
||||
if [ -z "$daemon_available" ] && [ -z "$agent_available" ]; then
|
||||
if [ -z "$daemon_available" ]; then
|
||||
daemon_available="$(newest_tag_api archied || true)"
|
||||
agent_available="$(newest_tag_api archie || true)"
|
||||
tag_source="forge-api-tags"
|
||||
fi
|
||||
if [ -z "$daemon_available" ] && [ -z "$agent_available" ]; then
|
||||
agent_available="$daemon_available"
|
||||
if [ -z "$daemon_available" ]; then
|
||||
# Neither source answered. Report the failure; do not exit 0 with two empty
|
||||
# components, which the caller renders as "up to date".
|
||||
echo "archie-update-check: could not resolve any release tag from ${SOURCE_URL} or ${API_BASE}/repos/${REPO_SLUG}/tags" >&2
|
||||
@@ -154,7 +155,7 @@ fi
|
||||
daemon_artifacts=""
|
||||
[ -n "$daemon_available" ] && daemon_artifacts="$(artifact_state "archied/v${daemon_available}")"
|
||||
agent_artifacts=""
|
||||
[ -n "$agent_available" ] && agent_artifacts="$(artifact_state "archie/v${agent_available}")"
|
||||
agent_artifacts="$daemon_artifacts"
|
||||
|
||||
reference_for() {
|
||||
local component="$1" version="$2" artifacts="$3"
|
||||
|
||||
@@ -181,7 +181,7 @@ if [[ ",$components," == *,daemon,* ]]; then
|
||||
gw_commit="$(git -C "$source_dir" rev-parse --verify "refs/tags/archied/v$GW^{commit}")"
|
||||
fi
|
||||
if [[ ",$components," == *,agent,* ]]; then
|
||||
rt_commit="$(git -C "$source_dir" rev-parse --verify "refs/tags/archie/v$RT^{commit}")"
|
||||
rt_commit="$(git -C "$source_dir" rev-parse --verify "refs/tags/archied/v$RT^{commit}")"
|
||||
fi
|
||||
build_commit="$gw_commit"
|
||||
[ -n "$build_commit" ] || build_commit="$rt_commit"
|
||||
|
||||
Reference in new issue
Block a user