Skip to content

chore(azldev): move azldev to a proper go module tool#18052

Draft
dmcilvaney wants to merge 4 commits into
microsoft:4.0from
dmcilvaney:damcilva/4.0/pipelines/go_tool_azldev
Draft

chore(azldev): move azldev to a proper go module tool#18052
dmcilvaney wants to merge 4 commits into
microsoft:4.0from
dmcilvaney:damcilva/4.0/pipelines/go_tool_azldev

Conversation

@dmcilvaney

Copy link
Copy Markdown
Contributor

Golang supports go tool <toolname> which allows you to version control go tools via a go.mod file.
Move away from the .azldev-version so we can rely on dependabot to manage the azldev version.

  • Refactor the version determination code to use the go modules rather than file
  • Reorder ADO pipeline to fully validate commit state before installing any externally controlled tools

The rendered-specs check built azldev from the PR head's .azldev-version and gated the full re-render on a two-dot `base..head` diff of .azldev-version. Both are wrong for a branch merely behind base on the pin: the head value is stale (not what runs on 4.0 after merge), and the two-dot diff fires a spurious full re-render that can only ever find no drift.

Resolve the version that will actually be in effect on 4.0 after the PR merges: read .azldev-version from GitHub's test-merge commit via the Contents API -- no merge tree is checked out, only a single regex-validated string crosses to the host. GitHub computes mergeability asynchronously and the event's merge_commit_sha can be empty or stale, so poll the PR endpoint for the authoritative value and fail closed on a genuinely non-mergeable PR.

Resolve once in update_locks (which polls mergeability, hence pull-requests:read) and expose azldev-version + render-all as job outputs that the render job consumes, so both jobs check drift against the same binary. A full re-render runs only when that post-merge version differs from the base pin -- i.e. the PR changes the azldev binary on 4.0 -- otherwise the normal PR-scoped render runs.
Copilot AI review requested due to automatic review settings July 17, 2026 22:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Moves azldev version management into Go modules and updates CI to resolve and validate immutable tool hashes.

Changes:

  • Adds the azldev Go tool dependency and supporting documentation.
  • Refactors GitHub and ADO workflows to resolve the post-merge azldev hash.
  • Adds resolver tests and dependency-smoke coverage.

Reviewed changes

Copilot reviewed 14 out of 15 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
go.mod Declares the azldev tool and dependencies.
go.sum Locks Go dependency checksums.
DEVELOPING.md Documents Go-based installation and usage.
.github/workflows/lint.yaml Runs azldev through go tool.
.github/workflows/dependency-smoke.yml Adds resolver test execution.
.github/workflows/azldev-smoke.yml Builds the runner from a resolved hash.
.github/workflows/check-rendered-specs.yml Resolves the post-merge tool and render scope.
.github/workflows/containers/azldev-runner.Dockerfile Installs azldev using an immutable hash.
.github/workflows/ado/templates/steps/install-deps.yml Resolves azldev from go.mod.
.github/workflows/ado/templates/steps/get-changes-info.yml Validates PR commit state before installation.
.github/instructions/pr-check-workflows.instructions.md Updates runner-build guidance.
scripts/ci/render-specs-check/resolve_azldev_version.py Implements secure version/hash resolution.
scripts/ci/render-specs-check/tests/conftest.py Configures resolver test imports.
scripts/ci/render-specs-check/tests/requirements.txt Pins pytest.
scripts/ci/render-specs-check/tests/test_resolve_azldev_version.py Tests resolver behavior and validation.

Comment on lines +97 to +105
version = _run_go(
"list",
"-mod=readonly",
f"-modfile={path.resolve()}",
"-m",
"-f",
"{{.Version}}",
AZLDEV_MODULE,
)
Comment thread scripts/ci/render-specs-check/resolve_azldev_version.py
Comment thread go.mod
Copilot AI review requested due to automatic review settings July 17, 2026 23:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 14 out of 15 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

go.mod:5

  • The stated Dependabot migration is incomplete: .github/dependabot.yml currently configures only pip and github-actions, so Dependabot will not scan this root Go module or propose azldev updates. Add a root gomod update entry (preferably scoped to github.com/microsoft/azure-linux-dev-tools) so this tool declaration is actually managed as intended.
tool github.com/microsoft/azure-linux-dev-tools/cmd/azldev

Copilot AI review requested due to automatic review settings July 18, 2026 01:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 15 out of 16 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

scripts/ci/render-specs-check/resolve_azldev_version.py:125

  • Resolving only the azldev module to a commit hash does not reproduce the tool selected by this repository's module graph. go tool azldev and the documented unversioned go install honor root go.mod transitive versions/replacements, while every Docker/ADO install uses go install ...@<hash>, which ignores root go.mod. Consequently, a Dependabot transitive update (explicitly enabled here) can change the developer/lint binary without changing this hash or setting render-all, so the render gates test a different binary. Build CI from a validated post-merge module graph, or restrict and validate the graph so only the top-level azldev pin can vary.
        module = json.loads(_run_go("mod", "download", "-json", f"{AZLDEV_MODULE}@{version}"))

Comment thread go.mod

go 1.25.6

tool github.com/microsoft/azure-linux-dev-tools/cmd/azldev
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.

2 participants