Browse Source
Merge pull request #12050 from VannTen/cleanup/next_version_auto
Auto compute previous tag in CI
pull/11988/head
Kubernetes Prow Robot
6 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with
67 additions and
39 deletions
.gitlab-ci.yml
.gitlab-ci/lint.yml
.pre-commit-config.yaml
RELEASE.md
scripts/galaxy_version.py
tests/scripts/check_galaxy_version.sh
tests/scripts/rebase.sh
tests/scripts/testcases_run.sh
@ -6,9 +6,13 @@ stages:
- deploy-extended
variables:
KUBESPRAY_VERSION : v2.27.0
FAILFASTCI_NAMESPACE : 'kargo-ci'
GITLAB_REPOSITORY : 'kargo-ci/kubernetes-sigs-kubespray'
GIT_CONFIG_COUNT : 1
GIT_CONFIG_KEY_0 : user.key
GIT_CONFIG_VALUE_0 : "ci@kubespray.io"
GIT_CONFIG_KEY_1 : user.name
GIT_CONFIG_VALUE_1 : "CI"
ANSIBLE_FORCE_COLOR : "true"
MAGIC : "ci check this"
GS_ACCESS_KEY_ID : $GS_KEY
@ -52,7 +56,6 @@ before_script:
needs:
- pipeline-image
- ci-not-authorized
- check-galaxy-version # lint
- pre-commit # lint
- vagrant-validate # lint
@ -24,13 +24,3 @@ vagrant-validate:
script:
- ./tests/scripts/vagrant-validate.sh
except : [ 'triggers' , 'master' ]
# TODO: convert to pre-commit hook
check-galaxy-version:
needs : [ ]
stage : test
tags : [ ffci]
image : python:3
script:
- tests/scripts/check_galaxy_version.sh
@ -70,6 +70,14 @@ repos:
- pathlib
- pyaml
- id : check-galaxy-version
name : Verify correct version for galaxy.yml
entry : scripts/galaxy_version.py
language : python
pass_filenames : false
additional_dependencies:
- ruamel.yaml
- id : jinja-syntax-check
name : jinja-syntax-check
entry : tests/scripts/check-templates.py
@ -12,7 +12,6 @@ The Kubespray Project is released on an as-needed basis. The process is as follo
1. (For major releases) On the `master` branch: bump the version in `galaxy.yml` to the next expected major release (X.y.0 with y = Y + 1), make a Pull Request.
1. (For minor releases) On the `release-X.Y` branch: bump the version in `galaxy.yml` to the next expected minor release (X.Y.z with z = Z + 1), make a Pull Request.
1. The corresponding version of [quay.io/kubespray/kubespray:vX.Y.Z ](https://quay.io/repository/kubespray/kubespray ) and [quay.io/kubespray/vagrant:vX.Y.Z ](https://quay.io/repository/kubespray/vagrant ) container images are built and tagged. See the following `Container image creation` section for the details.
1. (Only for major releases) The `KUBESPRAY_VERSION` in `.gitlab-ci.yml` is upgraded to the version we just released # TODO clarify this, this variable is for testing upgrades.
1. The release issue is closed
1. An announcement email is sent to `dev@kubernetes.io` with the subject `[ANNOUNCE] Kubespray $VERSION is released`
1. The topic of the #kubespray channel is updated with `vX.Y.Z is released! | ...`
@ -0,0 +1,49 @@
#!/usr/bin/env python
import subprocess
import ruamel.yaml
import os
last_tag = (
subprocess . Popen (
[ " git " , " describe " , " --tags " , " --abbrev=0 " ] , stdout = subprocess . PIPE
)
. communicate ( ) [ 0 ]
. rstrip ( )
. decode ( " utf-8 " )
. removeprefix ( " v " )
. split ( " . " )
)
# Use CI provided base ref if available, else use HEAD to guess
git_branch = os . getenv (
" GITHUB_BASE_REF " ,
(
subprocess . Popen (
[ " git " , " rev-parse " , " --abbrev-ref " , " HEAD " ] , stdout = subprocess . PIPE
)
. communicate ( ) [ 0 ]
. rstrip ( )
. decode ( " utf-8 " )
) ,
)
if git_branch . startswith ( " release " ) :
version_comp_index = 2
else :
version_comp_index = 1
last_tag [ version_comp_index ] = str ( int ( last_tag [ version_comp_index ] ) + 1 )
new_tag = " . " . join ( last_tag )
yaml = ruamel . yaml . YAML ( )
yaml . indent ( mapping = 2 , sequence = 4 , offset = 2 )
yaml . explicit_start = True
with open (
" galaxy.yml " ,
) as galaxy_yml :
config = yaml . load ( galaxy_yml )
config [ " version " ] = new_tag
with open ( " galaxy.yml " , " w " ) as galaxy_yml :
yaml . dump ( config , galaxy_yml )
@ -1,12 +0,0 @@
#!/bin/bash
set -e
version_from_galaxy = $( grep "^version:" galaxy.yml | awk '{print $2}' )
# TODO: compute the next expected version somehow
if [ [ $KUBESPRAY_VERSION = = " v ${ version_from_galaxy } " ] ]
then
echo "Please update galaxy.yml version to match the next KUBESPRAY_VERSION."
echo "Be sure to remove the \"v\" to adhere to semantic versioning"
exit 1
fi
@ -1,15 +1,6 @@
#!/bin/ba sh
set -eu xo pipefail
#!/bin/sh
set -ex
KUBESPRAY_NEXT_VERSION = 2.$(( ${ KUBESPRAY_VERSION : 3 : 2 } + 1 ))
# Rebase PRs on master (or release branch) to get latest changes
if [ [ $CI_COMMIT_REF_NAME = = pr-* ] ] ; then
git config user.email "ci@kubespray.io"
git config user.name "CI"
if [ [ -z " `git branch -a --list origin/release- $KUBESPRAY_NEXT_VERSION ` " ] ] ; then
git pull --rebase origin master
else
git pull --rebase origin release-$KUBESPRAY_NEXT_VERSION
fi
if [ " ${ GITHUB_BASE_REF } " ] ; then
git pull --rebase origin $GITHUB_BASE_REF
fi
@ -17,7 +17,7 @@ fi
# Check out latest tag if testing upgrade
if [ " ${ UPGRADE_TEST } " != "false" ] ; then
git fetch --all && git checkout " $KUBESPRAY_VERSION "
git fetch --all && git checkout $( git describe --tags --abbrev= 0)
# Checkout the current tests/ directory ; even when testing old version,
# we want the up-to-date test setup/provisionning
git checkout " ${ CI_COMMIT_SHA } " -- tests/