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

Push to branch #121

Merged
merged 2 commits into from
Mar 12, 2021
Merged

Push to branch #121

merged 2 commits into from
Mar 12, 2021

Conversation

squaremo
Copy link
Member

@squaremo squaremo commented Mar 5, 2021

This implements the simplest workable design for pushing to a branch other than the branch checked out. If .spec.push.branch is present in the ImageUpdateAutomation object, the controller will check out that branch, creating it if necessary, and commit to it before pushing to the origin repo.

This is conceptually and mechanically simple, and does enough to build further automation on -- e.g., a GitHub Action that creates a pull request when it sees the branch created.

Addresses #120.

Signed-off-by: Michael Bridgen <michael@weave.works>
This adapts the controller so that it will honour the
`.spec.push.branch` field.

The behaviour _without_ that field is to check out the branch given in
`.spec.checkout.branch`, commit, and push to the origin.

With `.spec.push.branch` present, it will try to check out that
branch; if it doesn't exist, it'll create it, starting from
`.spec.checkout.branch`. Either way it'll commit to that branch and
push to the origin.

The effect is that all automation will happen on the "push" branch,
and (most likely) not be applied into the cluster until merged into
whichever branch is synced. When the push branch is deleted, it'll be
created anew; otherwise, commits will pile up there as more changes
are made.

Signed-off-by: Michael Bridgen <michael@weave.works>
Copy link
Member

@stefanprodan stefanprodan left a comment

Choose a reason for hiding this comment

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

LGTM

Thanks @squaremo will you add this to the API spec docs in a different PR?

@squaremo
Copy link
Member Author

will you add this to the API spec docs in a different PR?

I can add it in this one or another -- I paused to see if there were any objections or expressions of urgency. Since you've helpfully approved this PR I'll merge it and write the reference in another :-)

@squaremo squaremo merged commit e0d66b2 into main Mar 12, 2021
@squaremo squaremo deleted the push-to-branch branch March 12, 2021 10:06
@squaremo
Copy link
Member Author

@stefanprodan Do you think we should mark this as experimental in some way? I feel like I need to try building some e.g., GitHub Actions automation on top to make sure it works nicely in the way we anticipate (but don't have time right now)

@stefanprodan
Copy link
Member

I'll work on the GH Actions example, if you can update the spec doc to describe the feature it would be great. The whole API is experimental being alpha so I don't think we need to do anything special for this field.

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