Add possibility to update build version format for Azure Pipelines task#1591
Merged
arturcic merged 5 commits intoGitTools:vnextfrom Apr 30, 2025
Merged
Conversation
Replaced "update-build-number=false" with "semantic-version-format=Loose" across various configuration files, tests, and documentation.
Introduced a new method `getExpandedString` to replace placeholders in a string with corresponding environment variable values. This enhancement supports dynamic configuration and improves flexibility when handling patterns with environment variables. Included a debug log for tracing expansions.
Introduced a `buildNumberFormat` option to support customizable build numbers. Updated related logic in `GitVersionTool` and implemented environment variable expansion for the format. Added unit tests to ensure correct behavior when `buildNumberFormat` is provided or omitted.
Renamed workflow and Azure files for clarity and consistency, aligning with related documentation changes. Added "buildNumberFormat" input to Azure configurations and updated corresponding documentation with examples and details.
There was a problem hiding this comment.
Pull Request Overview
This pull request updates the configuration for GitVersion to support a new semantic versioning format by replacing the old update‑build‑number option with a semantic-version‑format and a new buildNumberFormat input. It also adds enhancements to testing and updates documentation and CI configuration to reflect these changes.
- Updated GitVersion tool to use buildNumberFormat for build number updates.
- Modified settings and test files to support and validate the new configuration.
- Updated documentation and CI workflow files to demonstrate the new configuration and output examples.
Reviewed Changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/tools/gitversion/tool.ts | Added updateBuildNumber method to use custom build number formatting. |
| src/tools/gitversion/settings.ts | Integrated buildNumberFormat input retrieval into settings. |
| src/tools/gitversion/runner.ts | Updated error messaging and invoked updateBuildNumber after parsing. |
| src/tools/gitversion/models.ts | Extended ExecuteSettings to include an optional buildNumberFormat. |
| src/agents/common/build-agent.ts | Added getExpandedString support for environment variable expansion. |
| Various test files | Updated tests to validate buildNumberFormat behavior and consistency. |
| Documentation and Workflow Files | Modified examples to clearly demonstrate new configuration usage. |
Sets the build number format to include the major, minor, and patch versions. This ensures consistent and informative build versioning.
8ac1044 to
81231ee
Compare
This was
linked to
issues
Apr 30, 2025
Contributor
|
Thank you @arturcic for your contribution! |
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new configuration option for Azure Pipeline task:
buildNumberFormatoption which allows to specify the build number format.Example:
Closes #1434
Closes #1493
Configuration Updates:
.azure/ci.yml,.github/workflows/ci.yml, and other YAML files: Replacedupdate-build-number=falsewithsemantic-version-format=Looseand added thebuildNumberFormatinput to support custom build number formatting. [1] [2]Documentation Updates:
docs/examples/azure/gitversion/execute.mdanddocs/examples/github/gitversion/execute.md: Updated examples to reflect the newsemantic-version-formatconfiguration and added documentation for thebuildNumberFormatoption. Examples were renamed for clarity (e.g., "Example 8" to "Output Example 1"). [1] [2] [3]Test Enhancements:
src/__tests__/tools/gitversion/runner.spec.ts: Added tests for the newbuildNumberFormatoption, including mocking and validation ofupdateBuildNumberbehavior. Improved assertions to check forstdoutandstderr. [1] [2]src/__tests__/tools/gitversion/settings.spec.ts: Updated tests to validate thesemantic-version-formatandbuildNumberFormatsettings. Refactored variable names for consistency. [1] [2]