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

Automatically manage pre-release branches #916

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

petrutlucian94
Copy link
Contributor

We need to automatically create k8s-snap branches for upstream pre-releases such as v1.33.0-alpha.1.

Whenever a new pre-release or stable release comes out, the old pre-release branches become obsolete and are automatically
removed.

Note that these branches are used by the Launchpad recipes to produce and publish k8s-snap builds.

The new workflow will be executed nightly and whenever a patch merges on main.

* get latest stable or pre-release
* get all tags
* get obsolete pre-releases
@petrutlucian94 petrutlucian94 requested a review from a team as a code owner December 18, 2024 16:35
petrutlucian94 added a commit to canonical/canonical-kubernetes-release-ci that referenced this pull request Dec 19, 2024
A k8s-snap PR automatically creates and cleans up git branches
for upstream k8s pre-releases:
canonical/k8s-snap#916

Here we're adding an almost identical job that picks up these
git branches and prepares launchpad recipes.

TODOs:
* clean up obsolete pre-releases that were superseeded by a new
  pre-release or stable release
* promote beta and rc pre-releases to the corresponding snap
  risk level
petrutlucian94 added a commit to canonical/canonical-kubernetes-release-ci that referenced this pull request Dec 19, 2024
A k8s-snap PR automatically creates and cleans up git branches
for upstream k8s pre-releases:
canonical/k8s-snap#916

Here we're adding an almost identical job that picks up these
git branches and prepares launchpad recipes.

TODOs:
* clean up obsolete pre-releases that were superseeded by a new
  pre-release or stable release
* promote beta and rc pre-releases to the corresponding snap
  risk level
petrutlucian94 added a commit to canonical/canonical-kubernetes-release-ci that referenced this pull request Dec 19, 2024
A k8s-snap PR automatically creates and cleans up git branches
for upstream k8s pre-releases:
canonical/k8s-snap#916

Here we're adding an almost identical job that picks up these
git branches and prepares launchpad recipes.

TODOs:
* clean up obsolete pre-releases that were superseeded by a new
  pre-release or stable release
* promote beta and rc pre-releases to the corresponding snap
  risk level
petrutlucian94 added a commit to canonical/canonical-kubernetes-release-ci that referenced this pull request Dec 19, 2024
A k8s-snap PR automatically creates and cleans up git branches
for upstream k8s pre-releases:
canonical/k8s-snap#916

Here we're adding an almost identical job that picks up these
git branches and prepares launchpad recipes.

TODOs:
* clean up obsolete pre-releases that were superseeded by a new
  pre-release or stable release
* promote beta and rc pre-releases to the corresponding snap
  risk level
@petrutlucian94 petrutlucian94 force-pushed the lpetrut/auto-pre-release branch from ea5541f to c5f5a1c Compare December 19, 2024 07:20
petrutlucian94 added a commit to canonical/canonical-kubernetes-release-ci that referenced this pull request Dec 19, 2024
A k8s-snap PR automatically creates and cleans up git branches
for upstream k8s pre-releases:
canonical/k8s-snap#916

Here we're adding an almost identical job that picks up these
git branches and prepares launchpad recipes.

TODOs:
* clean up obsolete pre-releases that were superseeded by a new
  pre-release or stable release
* promote beta and rc pre-releases to the corresponding snap
  risk level
petrutlucian94 added a commit to canonical/canonical-kubernetes-release-ci that referenced this pull request Dec 19, 2024
A k8s-snap PR automatically creates and cleans up git branches
for upstream k8s pre-releases:
canonical/k8s-snap#916

Here we're adding an almost identical job that picks up these
git branches and prepares launchpad recipes.

TODOs:
* clean up obsolete pre-releases that were superseeded by a new
  pre-release or stable release
* promote beta and rc pre-releases to the corresponding snap
  risk level
petrutlucian94 added a commit to canonical/canonical-kubernetes-release-ci that referenced this pull request Dec 19, 2024
A k8s-snap PR automatically creates and cleans up git branches
for upstream k8s pre-releases:
canonical/k8s-snap#916

Here we're adding an almost identical job that picks up these
git branches and prepares launchpad recipes.

TODOs:
* clean up obsolete pre-releases that were superseeded by a new
  pre-release or stable release
* promote beta and rc pre-releases to the corresponding snap
  risk level
petrutlucian94 added a commit to canonical/canonical-kubernetes-release-ci that referenced this pull request Dec 19, 2024
A k8s-snap PR automatically creates and cleans up git branches
for upstream k8s pre-releases:
canonical/k8s-snap#916

Here we're adding an almost identical job that picks up these
git branches and prepares launchpad recipes.

TODOs:
* clean up obsolete pre-releases that were superseeded by a new
  pre-release or stable release
* promote beta and rc pre-releases to the corresponding snap
  risk level
petrutlucian94 added a commit to canonical/canonical-kubernetes-release-ci that referenced this pull request Dec 19, 2024
A k8s-snap PR automatically creates and cleans up git branches
for upstream k8s pre-releases:
canonical/k8s-snap#916

Here we're adding an almost identical job that picks up these
git branches and prepares launchpad recipes.

TODOs:
* clean up obsolete pre-releases that were superseeded by a new
  pre-release or stable release
* promote beta and rc pre-releases to the corresponding snap
  risk level
petrutlucian94 added a commit to canonical/canonical-kubernetes-release-ci that referenced this pull request Dec 19, 2024
A k8s-snap PR automatically creates and cleans up git branches
for upstream k8s pre-releases:
canonical/k8s-snap#916

Here we're adding an almost identical job that picks up these
git branches and prepares launchpad recipes.

TODOs:
* clean up obsolete pre-releases that were superseeded by a new
  pre-release or stable release
* promote beta and rc pre-releases to the corresponding snap
  risk level
petrutlucian94 added a commit to canonical/canonical-kubernetes-release-ci that referenced this pull request Dec 19, 2024
A k8s-snap PR automatically creates and cleans up git branches
for upstream k8s pre-releases:
canonical/k8s-snap#916

Here we're adding an almost identical job that picks up these
git branches and prepares launchpad recipes.

TODOs:
* clean up obsolete pre-releases that were superseeded by a new
  pre-release or stable release
* promote beta and rc pre-releases to the corresponding snap
  risk level
petrutlucian94 added a commit to canonical/canonical-kubernetes-release-ci that referenced this pull request Dec 19, 2024
A k8s-snap PR automatically creates and cleans up git branches
for upstream k8s pre-releases:
canonical/k8s-snap#916

Here we're adding an almost identical job that picks up these
git branches and prepares launchpad recipes.

TODOs:
* clean up obsolete pre-releases that were superseeded by a new
  pre-release or stable release
* promote beta and rc pre-releases to the corresponding snap
  risk level
petrutlucian94 added a commit to canonical/canonical-kubernetes-release-ci that referenced this pull request Dec 19, 2024
A k8s-snap PR automatically creates and cleans up git branches
for upstream k8s pre-releases:
canonical/k8s-snap#916

Here we're adding an almost identical job that picks up these
git branches and prepares launchpad recipes.

TODOs:
* clean up obsolete pre-releases that were superseeded by a new
  pre-release or stable release
* promote beta and rc pre-releases to the corresponding snap
  risk level
petrutlucian94 added a commit to canonical/canonical-kubernetes-release-ci that referenced this pull request Dec 19, 2024
A k8s-snap PR automatically creates and cleans up git branches
for upstream k8s pre-releases:
canonical/k8s-snap#916

Here we're adding an almost identical job that picks up these
git branches and prepares launchpad recipes.

TODOs:
* clean up obsolete pre-releases that were superseeded by a new
  pre-release or stable release
* promote beta and rc pre-releases to the corresponding snap
  risk level
We need to automatically create k8s-snap branches for upstream
pre-releases such as v1.33.0-alpha.1.

Whenever a new pre-release or stable release comes out, the old
pre-release branches become obsolete and are automatically
removed.

Note that these branches are used by the Launchpad recipes to
produce and publish k8s-snap builds.
@petrutlucian94 petrutlucian94 force-pushed the lpetrut/auto-pre-release branch from c5f5a1c to f81a49d Compare December 19, 2024 13:00
@petrutlucian94
Copy link
Contributor Author

petrutlucian94 commented Dec 19, 2024

Instead of continuously adding/removing branches such as autoupdate/v1.33.0-alpha.0 -> autoupdate/v1.33.0-beta.0, we may also consider having a single branch called autoupdate/v1.33-prerelease.

Copy link
Contributor

@bschimke95 bschimke95 left a comment

Choose a reason for hiding this comment

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

I think we are doing two separate things here, branch management and version updates.

Let's reuse the existing update-components scripts and CI. I believe we don't need to create a separate workflow for this.

We only need to update the logic in the upgrade scripts to correctly determine the version if this is a pre-release version. The rest should be similar to the upgrade-components workflow, no?

for outstandingPreRelease in `python3 ./build-scripts/k8s_releases.py get_obsolete_prereleases`; do
branch="autoupdate/${outstandingPreRelease}"
if git branch -r | grep "origin/$branch"; then
echo "Cleaning up obsolete pre-release branch: $branch"
Copy link
Contributor

Choose a reason for hiding this comment

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

If you are doing the cleanup here, then what is this for: https://github.com/canonical/canonical-kubernetes-release-ci/pull/18/files#diff-ce5e51b2f5af159f9e18385b27ee73318dad2d035680225b48298aba83cd60e2R90

I'd leave the branch creation and deletion to the ci repo and only perform the version update here.

Copy link
Contributor Author

@petrutlucian94 petrutlucian94 Dec 30, 2024

Choose a reason for hiding this comment

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

This workflow currently handles git branches, the other one manages launchpad recipes.

run: |
echo ${{ steps.determine.outputs.preRelease }} > ./build-scripts/components/kubernetes/version
git add ./build-scripts/components/kubernetes/version
git commit -m "Update k8s version to ${{ steps.determine.outputs.preRelease }}"
Copy link
Contributor

Choose a reason for hiding this comment

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

please move all of those steps into a script, similar to

@@ -0,0 +1,87 @@
#!/usr/bin/env python3
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we need to add all of this here (see my comment above).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure I understand what you mean.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, I see. You mean moving the pre-release checks to the "update-components.yaml" script and the branch management to the other project.

Copy link
Contributor Author

@petrutlucian94 petrutlucian94 Dec 30, 2024

Choose a reason for hiding this comment

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

One problem is that update-components.yaml will simply create a PR that updates the component versions. However, we also need to sync the changes from the main branch of k8s-snap, which is why the new job currently does a force push.

@bschimke95
Copy link
Contributor

@petrutlucian94 regarding your comment


Instead of continuously adding/removing branches such as autoupdate/v1.33.0-alpha.0 -> autoupdate/v1.33.0-beta.0, we may also consider having a single branch called autoupdate/v1.33-prerelease.

We don't need autoupdate/v1.33.0-alpha.0 but autoupdate/v1.33.0-alpha.
utoupdate/v1.33.0-prerelease does not work as we need to populate alpha to edge, beta to beta and release candidate to candiate branches so we need to maintain all 3 branches.

@petrutlucian94
Copy link
Contributor Author

We don't need autoupdate/v1.33.0-alpha.0 but autoupdate/v1.33.0-alpha.
utoupdate/v1.33.0-prerelease does not work as we need to populate alpha to edge, beta to beta and release candidate to candiate branches so we need to maintain all 3 branches.

I see. Do we keep the alpha and beta branches once the rc comes out?

@petrutlucian94
Copy link
Contributor Author

petrutlucian94 commented Dec 30, 2024

Let's reuse the existing update-components scripts and CI. I believe we don't need to create a separate workflow for this.

We only need to update the logic in the upgrade scripts to correctly determine the version if this is a pre-release version. The rest should be similar to the upgrade-components workflow, no?

That script fetches the latest stable k8s version, we could add a parameter to get pre-releases instead and maybe have a separate step in update-components.yaml for pre-releases.

However, we also need to sync the k8s-snap changes from the main branch. Having a separate job might be easier after all.

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