Skip to content

Pin the plain agent version in the version file - #12

Merged
fivetran-paulharper merged 5 commits into
mainfrom
paulh/plain-version-file
Nov 4, 2026
Merged

fivetran-paulharper merged 5 commits into
mainfrom
paulh/plain-version-file

Conversation

@fivetran-paulharper

@fivetran-paulharper fivetran-paulharper commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The version file used to hold a full image tag, such as 1.2.9-ubuntu-26.04 or 1.2.9-windows-ltsc2022. That made rollbacks awkward: a user had to know the tag suffix for their container mode, and on Linux a bare 1.2.9 silently selected the legacy numeric tag instead of the Ubuntu one. This came up while reviewing the Docker rollback steps in the public docs (fivetran/engineering#286828).

The version file now holds the plain agent version (for example 1.2.9). The management scripts append the image tag suffix for the detected container mode when they start the container:

  • Linux containers: <version>-ubuntu-26.04
  • Windows containers: <version>-windows-<ltsc>

Changes

  • install.sh and install.ps1 write the plain version to the version file, and the registry lookups return plain versions.
  • proxy-agent-manager.sh and proxy-agent-manager.ps1 build the image tag from the pinned version at start and upgrade time. Legacy full tags in the version file are still accepted and rewritten to the plain version on the next start, restart, or upgrade. Invalid content fails with Invalid proxy agent version '<x>' in <file>. Expected <major>.<minor>.<patch>.
  • The -WindowsVersion override is persisted as $WINDOWS_VERSION in settings.ps1 instead of in the pinned tag. A variant pinned by a legacy Windows tag is migrated there on first run. A legacy Windows tag under Linux containers still errors, as before.
  • Get-ImageTagType, Get-ImageTagVariant, and Resolve-ImageTag are removed from proxy-agent-manager.ps1, along with the "switch to explicit Ubuntu tag" branch in upgrade, since a plain version now covers both cases.
  • README updated to describe the version file as the pinned agent version and to note where the Windows override is stored.

Compatibility

Installs running the previous management scripts handle a plain version already: the bare numeric tag is the same Linux image as the Ubuntu tag, and proxy-agent-manager.ps1 already appended the LTSC suffix for Windows containers. So the docs can tell users to roll back with echo "1.2.7" > version regardless of which manager version they have.

Testing

  • shellcheck and bash -n pass on both shell scripts.
  • Smoke-tested proxy-agent-manager.sh with stubbed docker and curl: a legacy 1.2.9-ubuntu-26.04 pin starts 1.2.9-ubuntu-26.04 and rewrites the file to 1.2.9; upgrade picks 1.2.10 and ignores bare and Windows tags in the registry listing; a second upgrade is a no-op; echo 1.2.7 > version followed by start runs 1.2.7-ubuntu-26.04; 2.0 fails with the validation error.
  • proxy-agent-manager.ps1 and install.ps1 are not tested yet. There is no PowerShell on the machine this was written on, so start and upgrade need a run on a Windows host before merge.

🤖 Generated with Claude Code


Stack

@GiovanniMoya

Copy link
Copy Markdown

proxy-agent-manager.sh:204 and proxy-agent-manager.ps1:399 parse the version file before command dispatch, so a malformed non-empty version prevents stop, status, and logs from running. Defer parsing to commands that need the version.

fivetran-paulharper and others added 3 commits November 4, 2026 11:20
The version file used to hold a full image tag (1.2.9-ubuntu-26.04 or
1.2.9-windows-ltsc2022), so a user rolling back had to know the tag
suffix for their container mode, and a bare version on Linux silently
selected the legacy numeric tag. The installers now write the plain
version and the management scripts append the suffix for the detected
container mode when starting the container. Legacy full tags in the
version file are still accepted and rewritten to the plain version on
the next start or upgrade.

The -WindowsVersion override is now persisted as $WINDOWS_VERSION in
settings.ps1 instead of in the pinned tag; a variant pinned by a legacy
Windows tag is migrated there.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Cover each accepted version file entry in the manager unit tests: a plain
version, a legacy Ubuntu tag rewritten to the plain version on start, restart
and upgrade, and a legacy Windows tag migrated to the plain version plus the
$WINDOWS_VERSION setting. Also cover the $WINDOWS_VERSION setting overriding
host detection, and that the bash manager rejects Windows tags.

The integration tests now check that the version file holds exactly the plain
version, start from a legacy tag, and check that install.ps1 persists
-WindowsVersion.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A legacy -ubuntu-26.04 tag in the version file is still accepted with Windows
containers, but the switch to the Windows image is now logged as a warning.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fivetran-paulharper
fivetran-paulharper changed the base branch from paulh/ci-tests to main November 4, 2026 19:20
Copilot AI balanced review requested due to automatic review settings November 4, 2026 19:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The migration can corrupt settings without a trailing newline or lose the pinned variant, and accepted uppercase WindowsVersion values produce Docker tags that fail installation.

2 open issues
What changed in this PR

This PR simplifies agent rollbacks by pinning a plain version in the version file and letting the management scripts select the image suffix for the container mode.

Changes:

  • Return and store plain versions while migrating legacy image tags.
  • Persist Windows LTSC overrides in settings.ps1.
  • Update documentation and tests for exact version pins, migration, and rollback behavior.
File Description
tests/​pwsh/​Manager.Tests.ps1 Covers plain pins, legacy migration, and Windows overrides.
tests/​pwsh/​Install.Tests.ps1 Checks plain versions and persisted Windows overrides.
tests/​integration/​windows.ps1 Verifies exact pins, legacy migration, and override persistence.
tests/​integration/​linux.sh Verifies suffixed images and plain version migration.
tests/​bash/​manager.bats Adds migration checks and exact version assertions.
README.md Documents plain pins and Windows override storage.
proxy-agent-manager.sh Normalizes pins and appends the Ubuntu image suffix.
proxy-agent-manager.ps1 Resolves image suffixes and migrates legacy Windows variants.
install.sh Extracts plain versions from Ubuntu registry tags.
install.ps1 Stores plain versions and Windows overrides separately.

Review effort: Balanced

Comment thread install.ps1 Resolved
Comment thread proxy-agent-manager.ps1 Resolved
@fivetran-paulharper

Copy link
Copy Markdown
Contributor Author

@GiovanniMoya Thanks for catching this. Fixed in ce69b35: both managers now parse and validate the pinned version only for start, restart, and upgrade. I added regression tests showing stop, status, and logs still work with a malformed non-empty version file. The Bash and PowerShell unit tests are passing in CI.

@fivetran-paulharper
fivetran-paulharper merged commit f7bcc34 into main Nov 4, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants