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

Create more tests on branches and recipes #679

Merged
merged 2 commits into from
Sep 20, 2024

Conversation

addyess
Copy link
Contributor

@addyess addyess commented Sep 17, 2024

Overview

  • Confirm that branches are available both in launchpad and github for the stable_release, the previous_stable and the current_release
  • Raises awareness that stable releases needs a release branch

Details

  • Represents a clean-up/adjustment due to the track map policy changes
  • Verifies that upstream stable, upstream previous stable, and this current version all have a stable release branch in Github and Launchpad
  • Verify the tip recipes always exist (regardless of stable version)
  • GH action must checkout with depth:0 so it can "see" all the remote branches

@addyess addyess requested a review from a team as a code owner September 17, 2024 21:01
@addyess addyess force-pushed the KU-1554/ensure-all-branches-and-recipes branch 4 times, most recently from 7ac11a4 to 9a4262b Compare September 17, 2024 21:37
@addyess addyess force-pushed the KU-1554/ensure-all-branches-and-recipes branch from 9a4262b to f24f70e Compare September 17, 2024 21:45
Comment on lines -62 to +64
tox -c tests/branch_management -e integration
tox -c tests/branch_management -e test
Copy link
Contributor Author

Choose a reason for hiding this comment

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

ooof! We weren't running these tests!

deps =
-r {tox_root}/requirements-test.txt
commands =
pytest -v \
--maxfail 1 \
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cmon, let's see all the failures. Don't stop for just one

Comment on lines +54 to +55
with:
fetch-depth: 0
Copy link
Contributor Author

Choose a reason for hiding this comment

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

lets see all the branches (so we can check that certain branches exist)

Comment on lines +37 to +42
@functools.lru_cache
def _confirm_branch_exists(repo, branch):
log.info(f"Checking {branch} branch exists in {repo}")
cmd = f"git ls-remote --heads {repo} {branch}"
output = _sh(cmd.split())
return branch in output
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the branches shouldn't be changing while we're checking them. lets cache the results

Comment on lines +57 to 61
@functools.lru_cache
def _confirm_recipe_exist(track, flavour):
recipe = f"https://launchpad.net/~containers/k8s/+snap/k8s-snap-{track}-{flavour}"
r = requests.get(recipe)
return r.status_code == 200
Copy link
Contributor Author

Choose a reason for hiding this comment

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

same for the lp_recipes,

the recipes shouldn't be changing while we're checking them. lets cache the results

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.

Great work @addyess
A couple of comments but I like where this is going already.

tests/branch_management/tests/conftest.py Outdated Show resolved Hide resolved
tests/branch_management/tests/conftest.py Outdated Show resolved Hide resolved
by the respective LP builders for building the v1.11.y.
This is to ensure that the prior release branches exist in the k8s-snap repository
before we can proceed to build the next release. For example, if the current stable
k8s release is v1.31.0, there must be a release-1.30 branch before updating main.
Copy link
Contributor

Choose a reason for hiding this comment

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

What happens if we explicitly don't want a release for a specific flavor? Maybe moonray should not have a 1.32 release (for whatever reason). Will this break all releases/checks for this flavor going forward?

Copy link
Contributor Author

@addyess addyess Sep 19, 2024

Choose a reason for hiding this comment

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

_confirm_all_branches_exist tests that all the flavors have a branch for given release channel.

If 1.XX release doesn't have a build-scripts/patches/foo-bunny, then it wont look for a autoupdate/release-1.XX-foo-bunny

The intent of this test is to block the component upgrade PR from running on the main branch and updating kubernetes to 1.(XX+1) if there is not yet a branch for 1.XX and all the flavors of 1.XX

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.

LGTM!

@addyess addyess merged commit e4dadd1 into main Sep 20, 2024
20 checks passed
@addyess addyess deleted the KU-1554/ensure-all-branches-and-recipes branch September 20, 2024 02:03
evilnick pushed a commit to evilnick/k8s-snap that referenced this pull request Nov 14, 2024
* Create more tests on branches and recipes

* Apply review comments
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