Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: #895 Image Updater continuously force-pushes new commits when checkout branch is specified #911

Merged
merged 1 commit into from
Nov 1, 2024

Conversation

chengfang
Copy link
Collaborator

Fixes #895

This PR changes how a custom git write-back branch is created. Please review and look for any side effects. See issue comments #895 (comment)

Tested with the following scenarios with the following app config:

annotations:
    argocd-image-updater.argoproj.io/image-list: nginx=nginx:1.16.x
    argocd-image-updater.argoproj.io/update-strategy: semver
    argocd-image-updater.argoproj.io/force-update: "false"
    argocd-image-updater.argoproj.io/write-back-method: git:secret:argocd/git-creds
    argocd-image-updater.argoproj.io/git-branch: :push-branch
  • initially the write-back branch push-branch does not exist. image-updater creates the new branch from the checkout branch main, and writes the update to the file push-branch-kustomize/source/.argocd-source-argocd_push-branch-kustomize.yaml
  • in the next few iterations, the write branch already exists, and there are no updates to the image. So image updater uses the existing write branch push-branch, and no changes are committed or pushed.
  • update the application version constraint so that new tags will be available. image updater uses the existing write branch push-branch to commit and push the updates.

…mmits when checkout branch is specified

Signed-off-by: Cheng Fang <[email protected]>
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 42.85714% with 8 lines in your changes missing coverage. Please review.

Project coverage is 74.70%. Comparing base (78e925b) to head (a325229).

Files with missing lines Patch % Lines
pkg/argocd/git.go 42.85% 6 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #911      +/-   ##
==========================================
- Coverage   74.84%   74.70%   -0.14%     
==========================================
  Files          31       31              
  Lines        3915     3922       +7     
==========================================
  Hits         2930     2930              
- Misses        850      856       +6     
- Partials      135      136       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@jannfis jannfis left a comment

Choose a reason for hiding this comment

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

LGTM

@jannfis jannfis merged commit 17a57da into argoproj-labs:master Nov 1, 2024
10 checks passed
@chengfang chengfang deleted the push.branch branch November 1, 2024 19:06
chengfang added a commit to chengfang/argocd-image-updater that referenced this pull request Nov 8, 2024
…mmits when checkout branch is specified (argoproj-labs#911)

Signed-off-by: Cheng Fang <[email protected]>
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.

Image Updater continuously force-pushes new commits when checkout branch is specified.
3 participants