Skip to content

Conversation

Copy link

Copilot AI commented Aug 30, 2025

This PR enhances the Create_Release_Git_Tag build task with three key improvements:

1. CI-aware commit resolution

  • Adds a new BuildCommit parameter 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 HEAD if 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 DryRun parameter (defaults to false) 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.


This change is Reviewable

Co-authored-by: johlju <7189721+johlju@users.noreply.github.com>
Copilot AI changed the title [WIP] Create_Release_Git_Tag: tag the built commit, add CI-aware default, and improve debug logging Enhance Create_Release_Git_Tag task with CI-aware commit resolution and idempotent tagging Aug 30, 2025
Copilot AI requested a review from johlju August 30, 2025 08:42
Copy link
Collaborator

@johlju johlju left a comment

Choose a reason for hiding this comment

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

@copilot update changelog with a short entry

Co-authored-by: johlju <7189721+johlju@users.noreply.github.com>
Copy link
Author

Copilot AI commented Aug 31, 2025

@copilot update changelog with a short entry

Added changelog entry under "Unreleased > Added" section describing the Create_Release_Git_Tag task enhancement. Commit: d9ca6d4

Copilot AI requested a review from johlju August 31, 2025 18:55
Co-authored-by: johlju <7189721+johlju@users.noreply.github.com>
Copilot AI changed the title Enhance Create_Release_Git_Tag task with CI-aware commit resolution and idempotent tagging Enhance Create_Release_Git_Tag task with CI-aware commit resolution, idempotent tagging, and dry-run support Sep 1, 2025
Copilot AI requested a review from johlju September 1, 2025 19:36
@johlju johlju marked this pull request as ready for review September 2, 2025 10:29
@johlju
Copy link
Collaborator

johlju commented Sep 3, 2025

I just realized that it is not this task that sets the preview tag for GitHub, it is the task Publish_release_to_GitHub and this line in particular: https://github.com/gaelcolas/Sampler.GitHubTasks/blob/1f288c3bc35ab124ff9f8a8f405111c10761744e/.build/tasks/New-Release.GitHub.build.ps1#L125

@johlju johlju changed the title Enhance Create_Release_Git_Tag task with CI-aware commit resolution, idempotent tagging, and dry-run support Create_Release_Git_Tag: CI-aware, idempotent tagging, and dry-run support Sep 3, 2025
@johlju
Copy link
Collaborator

johlju commented Sep 3, 2025

I keep this open for a while if there is any demand we can merge, but need someone to verify functionality in an actual use-case.

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