feat: allow force push option on git-push promotion step
Summary
Successfully implemented the force option for the git-push promotion step, allowing users to force push to any target branch. This resolves GitHub issue #5170.
Key Changes
- Added
force: booleanconfiguration option (default:false) - Updated core logic to respect force push setting
- Enhanced documentation with examples and warnings
- Added comprehensive test coverage
- Maintained full backward compatibility
Usage
- uses: git-push
config:
path: ./out
targetBranch: main
force: true # Force push to overwrite remote history
Benefits
- ✅ Solves the original issue completely
- ✅ Safe opt-in with clear warnings
- ✅ Perfect for rendered manifests/generated content
- ✅ All tests pass, production-ready
Deploy Preview for docs-kargo-io ready!
| Name | Link |
|---|---|
| Latest commit | 945723b739b1198a9907420f1baf68298cdeabe9 |
| Latest deploy log | https://app.netlify.com/projects/docs-kargo-io/deploys/6920de70452e640008dde039 |
| Deploy Preview | https://deploy-preview-5239.docs.kargo.io |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify project configuration.
Thanks @aryasoni98. I made some suggestions about improving docs and tests, but overall this looks pretty good.
@aryasoni98 just an update on this. Last I had looked, the implementation looked ok. I'm pumping the brakes on this because I remain worried that this feature provides a pretty big foot gun without any realistic use for the feature having yet been described. I previously made comments to that effect a few times, noting that I wanted @gdsoumya (my colleague who first requested this feature) to weigh in with his intended use for this. I don't know why you've marked those comments as resolved without us having heard from him... I still want to hear from him.
@aryasoni98 just an update on this. Last I had looked, the implementation looked ok. I'm pumping the brakes on this because I remain worried that this feature provides a pretty big foot gun without any realistic use for the feature having yet been described. I previously made comments to that effect a few times, noting that I wanted @gdsoumya (my colleague who first requested this feature) to weigh in with his intended use for this. I don't know why you've marked those comments as resolved without us having heard from him... I still want to hear from him.
Got it, @krancour totally understand. The intent was to support automated workflows (like generated manifests) where a clean overwrite is required. The force flag stays false by default to avoid risk. I’ve reached out to @gdsoumya so he can clarify the original use case before we move forward.
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 56.12%. Comparing base (a82b289) to head (945723b).
:warning: Report is 1 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #5239 +/- ##
=======================================
Coverage 56.12% 56.12%
=======================================
Files 411 411
Lines 30055 30058 +3
=======================================
+ Hits 16868 16871 +3
Misses 12213 12213
Partials 974 974
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.