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

Git pushes to different branch are behind the base branch. #450

Closed
jamesloosli opened this issue Oct 25, 2022 · 6 comments · Fixed by #453
Closed

Git pushes to different branch are behind the base branch. #450

jamesloosli opened this issue Oct 25, 2022 · 6 comments · Fixed by #453
Assignees
Labels
area/git Git related issues and pull requests
Milestone

Comments

@jamesloosli
Copy link

Hi Y'all,

I'm implementing a workflow where my image update automation flows are updating a different target branch vs the source branch. This seems to be working, but the target branch becomes stale very quickly (we have our flux manifests in a monorepo with ~30 services). Because the branch becomes out of date, automated PR's require manual rebase.

My preferred behavior would be for the image-automation-controller to do a fresh clone of the base branch, then apply updates to the current HEAD of that branch and push --force to the target branch.

If this could at least be a setting available in the CRD, that would be fine. Any other smarter workarounds would be appreciated.

@pjbgf pjbgf added the area/git Git related issues and pull requests label Oct 25, 2022
@pjbgf
Copy link
Member

pjbgf commented Oct 25, 2022

Hey @jamesloosli thanks for opening this issue. I noticed we have an old issue that proposed this but was closed a while ago: #205.

But it seems that the way IAC works has changed since then. I added this to the backlog and we will take a look once the Git refactoring piece is done.

@cep21
Copy link

cep21 commented Oct 25, 2022

I am in the same situation with a large kub cluster as well. I wonder if there should be an info message in the controller logs when it cannot push upstream?

We push to branches so we can run some basic CI/CD on the PR at the github level, before auto merging the PR.

One workaround I am thinking about is force deleting the remote branch if it is stale.

@pjbgf pjbgf added this to the GA milestone Oct 28, 2022
@pjbgf pjbgf self-assigned this Oct 28, 2022
@pjbgf pjbgf moved this to In Progress in Maintainers' Focus Oct 28, 2022
@pjbgf
Copy link
Member

pjbgf commented Oct 28, 2022

This becomes even more relevant when using go-git (WIP) with ShallowClones enabled. I will propose a PR to this effect and share an RC image with it.

@pjbgf
Copy link
Member

pjbgf commented Nov 3, 2022

@jamesloosli @cep21 can you please try the RC image below to confirm that it resolves the problem you are experiencing?

ghcr.io/fluxcd/image-automation-controller:rc-842c6d78

@pjbgf pjbgf closed this as completed in #453 Nov 4, 2022
Repository owner moved this from In Progress to Since Last Dev Meeting in Maintainers' Focus Nov 4, 2022
@pjbgf pjbgf moved this from Since Last Dev Meeting to Done in Maintainers' Focus Nov 9, 2022
@EmilMunksoe
Copy link

EmilMunksoe commented Sep 21, 2023

@pjbgf I think this is still a bug in the controller. I see this behavior right now using version 0.30.0. My checkout branch is main and push branch is production. I have not overwritten the feature flags as this per. documentation seem to not fix the issue;

If .push.branch is present, the specified branch is pushed to at the origin. The branch will be created locally if it does not already exist, starting from the checkout branch. If it does already exist, it will be overwritten with the cloned version plus the changes made by the controller. Alternatively, force push can be disabled by starting the controller with --feature-gates=GitForcePushBranch=false, in which case the updates will be calculated on top of any commits already on the push branch. Note that without force push in push branches, if the target branch is stale, the controller may not be able to conclude the operation and will consistently fail until the branch is either deleted or refreshed. https://fluxcd.io/flux/components/image/imageupdateautomations/#push

FYI @stefanprodan

@kingdonb
Copy link
Member

kingdonb commented Oct 2, 2023

@EmilMunksoe It's not clear from your reply what issue you're seeing under what circumstances, please open a new issue.

You can refer to this issue if you think it is the same issue, but please provide complete details about the situation. Is your push branch stale and is force enabled? There's not enough information in your post to help you here, and this issue report is resolved/stale so not likely to get attention again, unless we have all that information and can easily confirm your report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/git Git related issues and pull requests
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

5 participants