Skip to content

Conversation

@olblak
Copy link
Member

@olblak olblak commented Oct 28, 2025

Fix #2801
Fix #6199

This pull request add a new flag on the apply command to delete working git branches with no changes

--clean-git-branches    Remove updatecli working git branches like '--clean-git-branches=true'

This pull request changes the moment the git push are done.
Instead of pushing commits after each target execution, we now collect them to push them only once once all target have been processed and just before actions.

This brings multiple benefits

  • Move all git push operation at the end just before actions
  • Only push commits once to trigger CI only one time.
  • It allows us to differentiate left over commits vs those created during previous execution.
  • Allow to clean up git working branches with no changes.

Test

To test this pull request, you can run the following commands:

cd <to_package_directory>
go test

Additional Information

Checklist

  • I have updated the documentation via pull request in website repository.

Tradeoff

Even though, I would prefer cleaning working branches by default, I am concerned about edge cases where someone could accidently delete an unexpected branch so I prefer to go extra safe on this

Potential improvement

@olblak olblak added the scm-git SCM of kind "Git" label Oct 28, 2025
@olblak olblak requested a review from Copilot October 28, 2025 20:46
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the SCM push logic by centralizing it in a new finalizeSCMUpdates function. The push operation is moved from individual target execution to a dedicated finalization step that runs after all pipelines complete.

  • Removed target-level push execution and migrated to centralized SCM finalization
  • Introduced PushCommits() method on Target to handle individual target push operations
  • Removed unused Commit and Clean fields from the Target struct

Reviewed Changes

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

File Description
pkg/core/pipeline/target/main.go Removed Commit and Clean fields, simplified Run() to defer push operations, added PushCommits() method
pkg/core/engine/scm.go Added finalizeSCMUpdates() function to centralize push operations across all pipelines and SCMs
pkg/core/engine/run.go Integrated finalizeSCMUpdates() call into engine execution flow

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@olblak olblak added the enhancement New feature or request label Oct 30, 2025
@olblak olblak changed the title chore: move all git push operation at the end just before actions feat: Add flag to clean git working branches with no changes Oct 30, 2025
@olblak olblak requested a review from Copilot October 31, 2025 08:48
Copy link
Contributor

Copilot AI left a comment

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


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@olblak olblak requested a review from Copilot November 1, 2025 07:48
Copy link
Contributor

Copilot AI left a comment

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


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@olblak olblak enabled auto-merge (squash) November 1, 2025 08:02
@olblak olblak merged commit f814b55 into updatecli:main Nov 1, 2025
5 checks passed
@olblak olblak deleted the issue/2801 branch November 1, 2025 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request scm-git SCM of kind "Git"

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Updatecli left over working branches without changes toward the head branch Unwanted updates due to diverged branch

1 participant