Skip to content

ci: enable best-effort delta builds using ADO pipelines#17684

Open
dmcilvaney wants to merge 1 commit into
microsoft:4.0from
dmcilvaney:damcilva/4.0/pipelines/enable_v1_delta_build
Open

ci: enable best-effort delta builds using ADO pipelines#17684
dmcilvaney wants to merge 1 commit into
microsoft:4.0from
dmcilvaney:damcilva/4.0/pipelines/enable_v1_delta_build

Conversation

@dmcilvaney

@dmcilvaney dmcilvaney commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Automatic source upload is being reworked, but we don't need to wait on that to enable the initial version of delta builds. Disable the source upload component in the delta build pipeline, and configure it to calculate the commit range using the ADO REST API instead of git commands (since this will be post-merge).

To make future pipeline work easier, split the common components into their own template.

Also fix a bug where the environment variable names were shadowed by ADO predefined variables.

@dmcilvaney

dmcilvaney commented Jun 10, 2026

Copy link
Copy Markdown
Contributor Author

Note: Planning on renaming the file to something more accurate, but will need to combine that with ADO changes, leaving as-is to allow testing in the meantime.

Comment thread .github/workflows/ado/templates/sources-upload-stages.yml Outdated
@dmcilvaney dmcilvaney force-pushed the damcilva/4.0/pipelines/enable_v1_delta_build branch 2 times, most recently from ed24ecf to 11afe71 Compare June 11, 2026 01:49
@dmcilvaney dmcilvaney marked this pull request as ready for review June 11, 2026 01:52
@dmcilvaney dmcilvaney requested a review from a team as a code owner June 11, 2026 01:52
Copilot AI review requested due to automatic review settings June 11, 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

Enables best-effort post-merge “delta” package builds in Azure DevOps by introducing a shared step template and a new helper that determines (target, source) commit ranges via the Azure DevOps control-plane API (rather than git heuristics), while also removing the package-build submission from the legacy source-upload pipeline and avoiding env-var name shadowing.

Changes:

  • Add determine_commit_range.py (Azure DevOps SDK-based) plus docs/deps to compute a stable, non-overlapping commit range for delta builds.
  • Introduce a shared ADO step sub-template (common-steps.yml) and refactor stages templates to consume it.
  • Add a new package-build ADO wrapper + stages template for post-merge delta builds; adjust lock verification expectations accordingly.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
scripts/ci/control-tower/verify_locks.sh Stops self-unshallowing; relies on the pipeline’s shared “Ensure full git history” step.
scripts/ci/ado/requirements.txt Pins Azure DevOps Python SDK dependency for ADO control-plane queries.
scripts/ci/ado/README.md Documents conventions and caller contract for ADO helper scripts.
scripts/ci/ado/determine_commit_range.py New helper to compute commit range using ADO build history (best-effort fallback included).
ruff.toml Adds per-file ignore to allow namespace-style execution of scripts/ci/** helpers without __init__.py.
.github/workflows/ado/templates/steps/common-steps.yml New shared step template: unshallow, install deps, determine range, verify locks, compute change set, verify rendered specs.
.github/workflows/ado/templates/sources-upload-stages.yml Refactors to use common-steps.yml, removes package-build submission, and fixes reserved env var shadowing.
.github/workflows/ado/templates/package-build-stages.yml New raw stages template for post-merge delta package builds via Control Tower.
.github/workflows/ado/sources-upload.yml Updates wrapper metadata and parameters (e.g., artifact base name).
.github/workflows/ado/package-build.yml New wrapper pipeline wiring for the delta package-build flow.
.github/instructions/ado-pipeline.instructions.md Extends applyTo glob and documents shared step sub-templates + ADO control-plane auth via System.AccessToken.

Comment thread .github/workflows/ado/templates/steps/common-steps.yml Outdated
Comment thread .github/workflows/ado/templates/steps/common-steps.yml
Comment thread .github/workflows/ado/templates/sources-upload-stages.yml Outdated
Comment thread .github/workflows/ado/templates/package-build-stages.yml
Automatic source upload is being reworked, but we don't need to wait on that
to enable the initial version of delta builds. Disable the source upload
component in the delta build pipeline, and configure it to calculate the
commit range using the ADO REST API instead of git commands (since this will
be post-merge).

Also fix a bug where the environment variable names were shadowed by
ADO predefined variables.
@dmcilvaney dmcilvaney force-pushed the damcilva/4.0/pipelines/enable_v1_delta_build branch from 11afe71 to 9ca3207 Compare June 11, 2026 17:38
@dmcilvaney dmcilvaney requested a review from Copilot June 11, 2026 20:25

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 11 out of 11 changed files in this pull request and generated 2 comments.

Comment on lines +197 to +220
# The job is fail-loud, so reaching this step means "Prepare change
# set" succeeded and renderSetFile points at a real (possibly empty)
# file. An empty render set just means no PR-scoped components
# changed -- nothing to verify.
if [[ ! -s "$(renderSetFile)" ]]; then
echo "No changed components -- skipping render."
exit 0
fi
echo "##[group]Render set"
sed 's/^/ - /' "$(renderSetFile)"
echo "##[endgroup]"
echo "##[group]Specs rendering + verification"
# `-x` fails loudly if the arg list would split into multiple
# xargs invocations -- a multi-batch render-check would
# silently mask drift in the later batches. `-n 50000` is
# required for `-x` to have any effect (without `-n`/`-L`,
# GNU xargs never splits). `--` ends azldev option parsing so
# component names beginning with `-` (none today) are
# unambiguous. `env AZLDEV_ALLOW_ROOT=1` is inline per
# .github/instructions/ado-pipeline.instructions.md.
xargs -x -n 50000 -d '\n' env AZLDEV_ALLOW_ROOT=1 azldev component render --check-only -- \
< "$(renderSetFile)"
echo "##[endgroup]"
displayName: "Verify rendered specs are up to date"
Comment on lines +169 to +187
echo "##[group]Preparing change set"
scripts/ci/components/compute_change_set.sh \
--output-dir "$change_set_dir" \
--source-commit "$(sourceCommit)" \
--target-commit "$(targetCommit)"
echo "##[endgroup]"

echo "##[group]Upload set (sourcesChange == true, changeType in {added, changed})"
upload_count=$(jq -r '[.[] | select(.sourcesChange == true and (.changeType | IN("added", "changed")))] | length' "$json_file")
jq -r '.[] | select(.sourcesChange == true and (.changeType | IN("added", "changed"))) | .component' "$json_file" | sort
echo "Total: $upload_count component(s) to upload."
echo "##[endgroup]"

# Publish the downstream pipeline variables now that the change set is
# ready (consumed by the render-verify step and the trailing Control
# Tower call).
echo "##vso[task.setvariable variable=changedComponentsFile;isreadonly=true]$json_file"
echo "##vso[task.setvariable variable=renderSetFile;isreadonly=true]$render_set_file"
displayName: "Prepare change set"
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