Sampler
Sampler copied to clipboard
`Create_Release_Git_Tag`: CI-aware, idempotent tagging, and dry-run support
This PR enhances the Create_Release_Git_Tag build task with three key improvements:
1. CI-aware commit resolution
- Adds a new
BuildCommitparameter that automatically resolves the commit SHA from CI environment variables - Supports GitHub Actions (
GITHUB_SHA) and Azure Pipelines (BUILD_SOURCEVERSION) - Falls back to
git rev-parse HEADif no CI variables are available - Ensures release tags point to the exact commit that was built/tested, avoiding issues where the tag points to a different commit than what was actually deployed
2. Idempotent tagging behavior
- Checks for existing remote tags before attempting to create new ones
- Skips tag creation if the tag already exists remotely, preventing conflicts in overlapping CI runs
- Validates that target commits exist locally and fetches them if necessary
3. Dry-run support
- Adds a new
DryRunparameter (defaults tofalse) for testing tag operations without making changes - When enabled, skips the actual push and verification commands
- Outputs clear messages showing what would have been done
- Returns the commit SHA that would have been tagged
Enhanced logging
- Provides detailed debug output showing the resolved commit SHA and its source
- Logs all key operations including fetching, tag creation, and verification
- Makes troubleshooting easier in CI environments
These changes maintain backward compatibility while providing more reliable and observable tag creation in CI/CD pipelines.