From 383d7366eda8811fc92a792e027ea56bd8ea9488 Mon Sep 17 00:00:00 2001 From: Alex Kavanagh Date: Fri, 15 Apr 2022 20:17:31 +0100 Subject: [PATCH 1/5] More 22.04 release process changes This patch contains the changes that were made to help with the 22.04 release process. In particular, these were: - modifications to scripts to work with the charms that were present in the charms/ sub-directory, rather than looking in charms.txt - Modifications to the add-build-lock-file (and helpers) to work with chamcraft driven builds (being able to extract the build.lock file). - removal of the get-charms script that uses charms.txt. - Updates to the release-stable-charms, stable-branch-updates, update-stable-charms and commit-review-stable-charms scripts to work with charms that have a different release (in terms of stable libs) and branch name. (e.g. mysql charms use 'stable/yoga' libraries but have a 'stable/jammy' branch) --- _charms-git-diff | 8 +--- _charms-git-status | 9 +---- add-build-lock-file | 9 ++++- add-gerrit-remote | 23 ++++++++++++ commit-message-update-branches-example.txt | 14 +++---- commit-review-stable-charms | 2 +- get-charms | 31 ---------------- .../charmcraft-build-lock-file.yaml | 37 +++++++++++++++++++ lp-builder-config/misc.yaml | 19 ++++++++-- release-stable-charms | 10 +---- stable-branch-updates | 13 +++++-- update-stable-charms | 15 +++----- 12 files changed, 109 insertions(+), 81 deletions(-) create mode 100755 add-gerrit-remote delete mode 100755 get-charms create mode 100644 global/source-zaza/charmcraft-build-lock-file.yaml diff --git a/_charms-git-diff b/_charms-git-diff index 8765a87..aca7db0 100755 --- a/_charms-git-diff +++ b/_charms-git-diff @@ -1,14 +1,8 @@ #!/bin/bash -e # Get the git status of the charms -- i.e. what has changed -charms="$(cat charms.txt)" +charms=$(cd charms && ls -d1 *) -for charm in $charms; do - if [ ! -d "charms/$charm" ]; then - echo "Use ./get-charms master to clone the charm dirs first ($charm not found)" - #exit 1 - fi -done for charm in $charms; do echo "===== $charm git status =====" diff --git a/_charms-git-status b/_charms-git-status index 5bc9c6a..d9ca4d7 100755 --- a/_charms-git-status +++ b/_charms-git-status @@ -1,14 +1,7 @@ #!/bin/bash -e # Get the git status of the charms -- i.e. what has changed -charms="$(cat charms.txt)" - -for charm in $charms; do - if [ ! -d "charms/$charm" ]; then - echo "Use ./get-charms master to clone the charm dirs first ($charm not found)" - #exit 1 - fi -done +charms=$(cd charms && ls -d1 *) for charm in $charms; do echo "===== $charm git status =====" diff --git a/add-build-lock-file b/add-build-lock-file index 8ca11d7..b438dfd 100755 --- a/add-build-lock-file +++ b/add-build-lock-file @@ -13,9 +13,14 @@ case $charm_type in source-zaza) # Build the charm. if [ ! -f src/build.lock ]; then - tox -e add-build-lock-file + # copy the add-build-lock file charmcraft in place + cp ${_dir}/global/source-zaza/charmcraft-build-lock-file.yaml charmcraft.yaml + tox -e build rm -rf .tox - rm -rf build + # unpack the build charm + charm=$(grep "charm_build_name" osci.yaml | awk '{print $2}') + unzip -p "${charm}.charm" build.lock >src/build.lock + git checkout charmcraft.yaml # temporarily workaround the stable branch detection - charm-tools Bug: #606 sed -i "s#refs/heads/master\\\\nrefs/heads/stable/#refs/heads/stable/#g" src/build.lock fi diff --git a/add-gerrit-remote b/add-gerrit-remote new file mode 100755 index 0000000..069774f --- /dev/null +++ b/add-gerrit-remote @@ -0,0 +1,23 @@ +#!/bin/bash -e +# +# Add a gerrit remote if one doesn't exist +# Note that the charms need to have been fetched using fetch-charms.py + +basedir="$(pwd)" +username="$1" +usage="usage: add-gerrit-remote gerrit-username" + +if [ -z "$username" ]; then + echo $usage + exit 1 +fi + +# get the url for the charm. +TLP=$(grep "^project=.*" .gitreview | perl -n -e'/=(.*)\// && print $1') +CHARM=$(grep "^project=.*" .gitreview | perl -n -e'/=.*\/(.*.git)/ && print $1') + +git remote | grep gerrit || { + echo "Adding gerrit remote" + git remote add gerrit ssh://${username}@review.openstack.org:29418/${TLP}/${CHARM} +} + diff --git a/commit-message-update-branches-example.txt b/commit-message-update-branches-example.txt index 34a888e..0f2cc21 100644 --- a/commit-message-update-branches-example.txt +++ b/commit-message-update-branches-example.txt @@ -1,9 +1,9 @@ Updates for stable branch creation -Set default branch for git review/gerrit. - -Switch tests to stable. - -Switch to using stable charm-helpers branch. - -Switch to using stable charm.openstack branch. +- Set default branch for git review/gerrit. +- Switch tests to stable. +- Switch to using stable charm-helpers branch. +- Switch to using stable charm.openstack branch. +- Switch to using stable zaza, zaza-openstack-tests + branch +- (reactive charms) Add build.lock file diff --git a/commit-review-stable-charms b/commit-review-stable-charms index 7fe0118..4b24bfc 100755 --- a/commit-review-stable-charms +++ b/commit-review-stable-charms @@ -16,7 +16,7 @@ if [ ! -f "$msg_file" ]; then exit 1 fi -charms="$(cat charms.txt)" +charms=$(cd charms && ls -d1 *) basedir="$(pwd)" for charm in $charms; do diff --git a/get-charms b/get-charms deleted file mode 100755 index b193d07..0000000 --- a/get-charms +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -e -# Clones charm branches and checks out the provided branch. -# Note it clones into the charms/ subdirectory - -branch="$1" -all_charms="$(cat charms.txt)" -usage="usage: get-charms " - -# Optionally useful for local and/or offline iterations: -# base_url="$HOME/git/release-tools.alt/" - -if [ -z "$branch" ]; then - echo $usage && exit 1 -fi - -[ ! -d "./charms" ] && mkdir charms - -for charm in $all_charms; do - [ -d "charms/$charm" ] && rm -Rf "charms/$charm" - - # Handle repo url overrides if present - if grep "^$charm|" repo-link-overrides.txt > /dev/null; then - REPO_URL=$(grep "^$charm|" repo-link-overrides.txt | cut -f 2 -d "|") - else - REPO_URL="https://opendev.org/openstack/charm-${charm}" - fi - - git clone $REPO_URL charms/$charm - (cd charms/$charm; git checkout $branch) -done - diff --git a/global/source-zaza/charmcraft-build-lock-file.yaml b/global/source-zaza/charmcraft-build-lock-file.yaml new file mode 100644 index 0000000..69f4f48 --- /dev/null +++ b/global/source-zaza/charmcraft-build-lock-file.yaml @@ -0,0 +1,37 @@ +type: charm + +parts: + charm: + build-packages: + - tox + - git + - python3-dev + - libffi-dev + - libssl-dev + - libxml2-dev + - libxslt1-dev + - libmysqlclient-dev # for executable mysql_shell + override-build: | + apt-get install ca-certificates -y + tox -e add-build-lock-file + override-stage: | + echo "Copying charm to staging area: $CHARMCRAFT_STAGE" + NAME=$(ls $CHARMCRAFT_PART_BUILD/build/builds) + cp -r $CHARMCRAFT_PART_BUILD/build/builds/$NAME/* $CHARMCRAFT_STAGE/ + cp $CHARMCRAFT_PART_BUILD/src/build.lock $CHARMCRAFT_STAGE/build.lock + override-prime: | + # For some reason, the normal priming chokes on the fact that there's a + # hooks directory. + cp -r $CHARMCRAFT_STAGE/* . + +bases: + - build-on: + - name: ubuntu + channel: "20.04" + architectures: + - amd64 + run-on: + - name: ubuntu + channel: "20.04" + architectures: + - amd64 diff --git a/lp-builder-config/misc.yaml b/lp-builder-config/misc.yaml index 2096af4..f6869be 100644 --- a/lp-builder-config/misc.yaml +++ b/lp-builder-config/misc.yaml @@ -13,6 +13,9 @@ projects: charmcraft: "1.5/stable" channels: - latest/edge + stable/jammy: + channels: + - 2.4/edge stable/focal: build-channels: charmcraft: "1.5/stable" @@ -45,11 +48,14 @@ projects: charmcraft: "1.5/stable" channels: - latest/edge + stable/jammy: + channels: + - jammy/edge stable/focal: build-channels: charmcraft: "1.5/stable" channels: - - 8.0.19/edge + - focal/edge - name: MySQL Router charmhub: mysql-router @@ -61,11 +67,14 @@ projects: charmcraft: "1.5/stable" channels: - latest/edge + stable/jammy: + channels: + - jammy/edge stable/focal: build-channels: charmcraft: "1.5/stable" channels: - - 8.0.19/edge + - focal/edge - name: Percona Cluster Charm charmhub: percona-cluster @@ -93,7 +102,9 @@ projects: charmcraft: "1.5/stable" channels: - latest/edge - #- 3.9/edge + stable/jammy: + channels: + - 3.9/edge stable/focal: build-channels: charmcraft: "1.5/stable" @@ -154,6 +165,8 @@ projects: charmcraft: "1.5/stable" channels: - latest/edge + stable/jammy: + channels: - jammy/edge stable/focal: build-channels: diff --git a/release-stable-charms b/release-stable-charms index 0c24e33..8b354a1 100755 --- a/release-stable-charms +++ b/release-stable-charms @@ -18,14 +18,8 @@ for charm in $charms; do ( cd charms/$charm echo "Looking at charm $charm" - # get the url for the charm. - TLP=$(grep "^project=.*" .gitreview | perl -n -e'/=(.*)\// && print $1') - REPO_URL="https://opendev.org/$TLP/charm-${charm}" - - git remote | grep gerrit || { - echo "Adding gerrit remote" - git remote add gerrit ssh://${username}@review.openstack.org:29418/${TLP}/charm-${charm}.git - } + # Add the remote gerrit if needed + $basedir/add-gerrit-remote $username echo "Creating stable branch for release $release" $basedir/create-stable-branch $release ) diff --git a/stable-branch-updates b/stable-branch-updates index 62769fb..ae61911 100755 --- a/stable-branch-updates +++ b/stable-branch-updates @@ -5,16 +5,21 @@ # - Update .gitreview with new stable branch name. release="$1" +branch="$2" -if [ -z "$release" ]; then - echo "Please provide release as only parameter" +if [ -z "$branch" ]; then + echo "Please provide release and branch parameters" + echo "usage: stable-branch-updates release branch" + echo "e.g. stable-branch-updates yoga jammy" + echo " means 'stable/yoga' for libs, and 'stable/jammy' for this charm" exit 1 fi -git checkout -b ${release}-updates origin/stable/${release} +git fetch --all +git checkout -b ${release}-updates origin/stable/${branch} grep -q defaultbranch .gitreview || { - echo -e "\ndefaultbranch=stable/$release" >> .gitreview + echo -e "\ndefaultbranch=stable/$branch" >> .gitreview git add .gitreview } diff --git a/update-stable-charms b/update-stable-charms index 918a1b0..3245361 100755 --- a/update-stable-charms +++ b/update-stable-charms @@ -7,9 +7,10 @@ charms=$(cd charms && ls -d1 *) basedir="$(pwd)" username="$2" release="$1" -usage="usage: update-stable-charms release-name" +branch="$3" +usage="usage: update-stable-charms release-name username branch" -if [ -z "$release" ]; then +if [ -z "$branch" ]; then echo $usage exit 1 fi @@ -19,13 +20,7 @@ for charm in $charms; do cd charms/$charm echo "Looking at charm $charm" # get the url for the charm. - TLP=$(grep "^project=.*" .gitreview | perl -n -e'/=(.*)\// && print $1') - REPO_URL="https://opendev.org/$TLP/charm-${charm}" - - git remote | grep gerrit || { - echo "Adding gerrit remote" - git remote add gerrit ssh://${username}@review.openstack.org:29418/${TLP}/charm-${charm}.git - } - $basedir/stable-branch-updates $release + $basedir/add-gerrit-remote $username + $basedir/stable-branch-updates $release $branch ) done From 5ab0b45981487cbd8d502b8abf43df054a0351f9 Mon Sep 17 00:00:00 2001 From: Alex Kavanagh Date: Fri, 15 Apr 2022 21:28:13 +0100 Subject: [PATCH 2/5] Visit most files and adjust for 22.04 release This visits most of the batch files and ensures that they work with what is available in the charms/ directory rather than relying on charms.txt. This is to enable release tools to be used with releases on sections. (Eventually, all the tools will work with lp-builder-config directly). --- _do-batch-add-build-lock-file | 35 ---------- _do-batch-cp-stable-candidate | 29 -------- _do-batch-flip-master-libs-to-stable | 32 --------- _do-clean-reactive | 34 --------- _do-reset-hard-branch | 7 +- _do-single-charm-amend-review | 8 ++- _ensure_master_libraries_all_charms | 87 ------------------------ _ensure_reactive_charms_master_libraries | 51 -------------- _update-metadata.py | 25 ++++--- _update-rebuild | 9 +-- _update-requirements | 9 +-- add-channel-batch | 22 ------ check-bug-links | 3 +- check-promulgation | 14 ---- check-repo-links | 11 ++- flip-master-libs-to-stable | 60 ---------------- list-revisions-in-charmstore.py | 57 ---------------- remove-channel-batch | 9 +-- update-charms-metadata | 9 +-- update-reactive-stable-charms | 60 ---------------- zaza-required.yaml | 10 --- 21 files changed, 37 insertions(+), 544 deletions(-) delete mode 100755 _do-batch-add-build-lock-file delete mode 100755 _do-batch-cp-stable-candidate delete mode 100755 _do-batch-flip-master-libs-to-stable delete mode 100755 _do-clean-reactive delete mode 100755 _ensure_master_libraries_all_charms delete mode 100755 _ensure_reactive_charms_master_libraries mode change 100644 => 100755 _update-metadata.py delete mode 100755 add-channel-batch delete mode 100755 check-promulgation delete mode 100755 flip-master-libs-to-stable delete mode 100755 list-revisions-in-charmstore.py delete mode 100755 update-reactive-stable-charms delete mode 100644 zaza-required.yaml diff --git a/_do-batch-add-build-lock-file b/_do-batch-add-build-lock-file deleted file mode 100755 index 1412996..0000000 --- a/_do-batch-add-build-lock-file +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -e -# Build only reactive charms with build.lock files; requires the charms to have been synced using -# ./get-charms - -charms="$(cat charms.txt)" -_dir="$( cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd)" - -for charm in $charms; do - if [ ! -d "charms/$charm" ]; then - echo "Use ./get-charms master to clone the charm dirs first ($charm not found)" - exit 1 - fi -done - -for charm in $charms; do - charm_type="$(./what-is charms/$charm)" - echo "===== $charm ($charm_type) =====" - ( - cd "charms/$charm" - case $charm_type in - source-zaza) - # Build the charm with a lock file and clean-up afterwards - ${_dir}/add-build-lock-file - ;; - classic-zaza) - echo "NOOP on $charm as it is a classic charm." - ;; - *) - echo "UNKNOWN TYPE" && exit 1 - ;; - esac - - ) -done - diff --git a/_do-batch-cp-stable-candidate b/_do-batch-cp-stable-candidate deleted file mode 100755 index a571039..0000000 --- a/_do-batch-cp-stable-candidate +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -e -# Build only reactive charms with build.lock files; requires the charms to have been synced using -# ./get-charms - -charms="$(cat charms.txt)" -_dir="$( cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd)" - - -for charm in $charms; do - echo "===== $charm =====" - full_charm="cs:~openstack-charmers/$charm" - id_revision=$(charm show "$full_charm" --channel stable id | grep -e "Id: $full_charm" | xargs | cut -d " " -f 2) - if [ -z "$id_revision" ]; then - echo "Nothing to do." - else - echo "Charm revision is $id_revision" - - # now get the resources: - resources_line=$(charm show "$full_charm" resources | yq eval '.resources[] | "--resource " + .Name + "-" + .Revision' - | tr '\n' ' ') - echo "resource line is: $resources_line" - - # now try to release it. - echo "Running >> charm release $id_revision $resources_line --channel=candidate" - charm release $id_revision $resources_line --channel=candidate - echo "Running >> charm grant $full_charm --channel candidate --acl read everyone" - charm grant $full_charm --channel candidate --acl read everyone - fi -done - diff --git a/_do-batch-flip-master-libs-to-stable b/_do-batch-flip-master-libs-to-stable deleted file mode 100755 index 5a1f315..0000000 --- a/_do-batch-flip-master-libs-to-stable +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -e -# For all the charms, flip the master libs to stable ON THE MASTER branch -# This is for the freeze period and ensures that during freeze the charms only -# take updates from the stable libraries. -# ./get-charms - -release="$1" - -if [ -z "$release" ]; then - echo "Please provide release as only parameter" - exit 1 -fi - -charms="$(cat charms.txt)" -_dir="$( cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd)" - -for charm in $charms; do - if [ ! -d "charms/$charm" ]; then - echo "Use ./get-charms master to clone the charm dirs first ($charm not found)" - exit 1 - fi -done - -for charm in $charms; do - charm_type="$(./what-is charms/$charm)" - echo "===== $charm ($charm_type) =====" - ( - cd "charms/$charm" - ${_dir}/flip-master-libs-to-stable $release - ) -done - diff --git a/_do-clean-reactive b/_do-clean-reactive deleted file mode 100755 index b844e4e..0000000 --- a/_do-clean-reactive +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -e -# Clean-up the build and .tox directories after a build for reactive charms. -# This is used after a build step when making reproducible reactive charms. - -charms="$(cat charms.txt)" - -for charm in $charms; do - if [ ! -d "charms/$charm" ]; then - echo "Use ./get-charms master to clone the charm dirs first ($charm not found)" - exit 1 - fi -done - -for charm in $charms; do - charm_type="$(./what-is charms/$charm)" - echo "===== $charm ($charm_type) =====" - ( - cd "charms/$charm" - case $charm_type in - source-zaza) - rm -rf build - rm -rf .tox - ;; - classic-zaza) - echo "NOOP on $charm as it is a classic charm." - ;; - *) - echo "UNKNOWN TYPE" && exit 1 - ;; - esac - - ) -done - diff --git a/_do-reset-hard-branch b/_do-reset-hard-branch index bfbd49c..4685bc7 100755 --- a/_do-reset-hard-branch +++ b/_do-reset-hard-branch @@ -1,9 +1,14 @@ #!/bin/bash -e # Do a reset in all the charms; great for undoing damage and starting again. -charms="$(cat charms.txt)" +charms=$(cd charms && ls -d1 *) branch=$1 +if [ -z "$branch" ]; then + echo "Please provide the branch name as the param." + exit 1 +fi + for charm in $charms; do if [ ! -d "charms/$charm" ]; then echo "Use ./get-charms master to clone the charm dirs first ($charm not found)" diff --git a/_do-single-charm-amend-review b/_do-single-charm-amend-review index 2fbcbcc..74a053f 100755 --- a/_do-single-charm-amend-review +++ b/_do-single-charm-amend-review @@ -5,6 +5,12 @@ topic=$1 script_dir="$( cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd)" +if [ -z "$topic" ]; then + echo "Please provide the topic as the only param." + echo "Usage $0 " + exit 1 +fi + _dir=$(pwd) # verify that the branch isn't master branch=$(git branch --show-current | tr -d '\n') @@ -20,7 +26,7 @@ if [[ -n "$git_status" ]]; then echo "Updating, no-edit-amend and git review with topic for ${_dir}" git add . git commit --amend --no-edit - git review -t charmhub-migration-yoga + git review -t $topic else echo "Nothing to do as git repo is not dirty." fi diff --git a/_ensure_master_libraries_all_charms b/_ensure_master_libraries_all_charms deleted file mode 100755 index 714c1a9..0000000 --- a/_ensure_master_libraries_all_charms +++ /dev/null @@ -1,87 +0,0 @@ -#!/bin/bash -# -# Ensure that charm-helpers, charms.openstack, charms.ceph, zaza and -# zaza-openstack-tests are from the master branch. - -charms="$(cat charms.txt)" -basedir="$(pwd)" - - -function ensure_line { - search="$1" - add_line="$2" - file="$3" - if grep "$search" "$file" >/dev/null; then - # line exists so replace it. - cmd="/$search/c\\$add_line" - sed -i "$cmd" $file - else - # line doesn't exist so add it - echo -e "\n$add_line" >> $file - fi -} - - -function ensure_line_if_exists { - search="$1" - add_line="$2" - file="$3" - if grep "$search" "$file" >/dev/null; then - # line exists so replace it. - cmd="/$search/c\\$add_line" - sed -i "$cmd" $file - fi -} - - -# the directory needs to be in the root for the charm repo for this function -function ensure_lines { - charm_type="$($basedir/what-is .)" - case $charm_type in - classic-zaza) - echo "$charm is a classic charm - possibly making changes." - - # charm-helpers-hooks.yaml - ensure_line "charm-helpers" "repo: https://github.com/juju/charm-helpers" "charm-helpers-hooks.yaml" - - # test-requirements.txt - ensure_line "zaza.git" "git+https://github.com/openstack-charmers/zaza.git#egg=zaza;python_version>='3.0'" "test-requirements.txt" - ensure_line "zaza-openstack-tests" "git+https://github.com/openstack-charmers/zaza-openstack-tests.git#egg=zaza.openstack" "test-requirements.txt" - ;; - - source-zaza) - echo "$charm is a source charm (reactive) - possibly making changes" - - # src/wheelhouse.txt - ensure_line "charms.openstack" "git+https://github.com/openstack/charms.openstack.git#egg=charms.openstack" "src/wheelhouse.txt" - ensure_line "charm-helpers" "git+https://github.com/juju/charm-helpers.git#egg=charmhelpers" "src/wheelhouse.txt" - ensure_line_if_exists "charms.ceph" "git+https://github.com/openstack/charms.ceph.git#egg=charms.ceph" "src/wheelhouse.txt" - - # test-requirements.txt - ensure_line "charms.openstack" "git+https://github.com/openstack/charms.openstack.git#egg=charms.openstack" "test-requirements.txt" - - # src/test-requirements.txt - ensure_line "zaza.git" "git+https://github.com/openstack-charmers/zaza.git#egg=zaza" "src/test-requirements.txt" - ensure_line "zaza-openstack-tests" "git+https://github.com/openstack-charmers/zaza-openstack-tests.git#egg=zaza.openstack" "src/test-requirements.txt" - - # remote the build lock if present - remove_build_lock_if_present - ;; - esac -} - - -function remove_build_lock_if_present { - [ -e src/build.lock ] && rm src/build.lock -} - -for charm in $charms; do - if [ ! -d "charms/$charm" ]; then - echo "charm dir $charm is missing. exiting" - exit 1 - fi - ( - cd charms/$charm - ensure_lines - ) -done diff --git a/_ensure_reactive_charms_master_libraries b/_ensure_reactive_charms_master_libraries deleted file mode 100755 index 9e77f6e..0000000 --- a/_ensure_reactive_charms_master_libraries +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -e -# -# Ensure that charm-helpers and charms.openstack are from the master branch in -# git. - -charms="$(cat charms.txt)" -basedir="$(pwd)" - - -function ensure_line { - search="$1" - add_line="$2" - if grep "$search" src/wheelhouse.txt >/dev/null; then - # line exists so replace it. - cmd="/$search/c\\$add_line" - sed -i "$cmd" src/wheelhouse.txt - else - # line doesn't exist so add it - echo -e "\n$add_line" >> src/wheelhouse.txt - fi -} - - -# ensure that charm-helpers and charms.openstack master branches are in the -# wheelhouse.txt -# the directory needs to be in the root for the charm repo for this function -function ensure_lines { - charm_type="$($basedir/what-is .)" - case $charm_type in - classic-zaza) - echo "$charm is a classic charm - no changes." - ;; - - source-zaza) - echo "$charm is a source charm (reactive) - possibly making changes" - ensure_line "charms.openstack" "git+https://github.com/openstack/charms.openstack.git#egg=charms.openstack" - ensure_line "charm-helpers" "git+https://github.com/juju/charm-helpers.git#egg=charmhelpers" - ;; - esac -} - -for charm in $charms; do - if [ ! -d "charms/$charm" ]; then - echo "charm dir $charm is missing. exiting" - exit 1 - fi - ( - cd charms/$charm - ensure_lines - ) -done diff --git a/_update-metadata.py b/_update-metadata.py old mode 100644 new mode 100755 index abebf02..276dc70 --- a/_update-metadata.py +++ b/_update-metadata.py @@ -19,7 +19,7 @@ def usage(): - print("usage: {} [list | add | remove | ensure] [ [list | add | remove | ensure] [ /dev/null; then diff --git a/check-promulgation b/check-promulgation deleted file mode 100755 index 63bcd23..0000000 --- a/check-promulgation +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -ue -# Check promulgation - -DISPOSITION=0 -for charm in $(cat charms.txt); do - if charm show cs:$charm -o /dev/null &> /dev/null; then - FMT="\e[0mOK " - else - FMT="\e[31m**FAIL " - DISPOSITION=1 - fi - echo -e "${FMT} $charm" -done -exit $DISPOSITION diff --git a/check-repo-links b/check-repo-links index 6acc703..8f5aa02 100755 --- a/check-repo-links +++ b/check-repo-links @@ -2,14 +2,11 @@ # Check repo links DISPOSITION=0 -for charm in $(cat charms.txt); do +charms=$(cd charms && ls -d1 *) +for charm in $charms; do - # Handle repo url overrides if present - if grep "^$charm|" repo-link-overrides.txt > /dev/null; then - REPO_URL=$(grep "^$charm|" repo-link-overrides.txt | cut -f 2 -d "|") - else - REPO_URL="https://opendev.org/openstack/charm-${charm}" - fi + TLP=$(grep "^project=.*" charms/$charm/.gitreview | perl -n -e'/=(.*)\// && print $1') + REPO_URL="https://opendev.org/${TLP}/charm-${charm}" HTTP_CODE=$(curl --head -s -o /dev/null -w "%{http_code}" ${REPO_URL}) diff --git a/flip-master-libs-to-stable b/flip-master-libs-to-stable deleted file mode 100755 index 830b3d7..0000000 --- a/flip-master-libs-to-stable +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/bash -e -# -# Freeze tasks for 21.04+ (flipping branches to stable) -# - charm-helpers -# - charms.openstack -# - charms.ceph -# - zaza -# - zaza-openstack-tests -# -# DOES NOT flip the .gitreview nor update the tests bundles -# -# the release (21.xx) is in the 1st param. -# Run in the directory of the charm that is to be flipped. -# Does NOT stage commits. - -release="$1" - -if [ -z "$release" ]; then - echo "Please provide release as only parameter" - exit 1 -fi - -for ch in charm-helpers-hooks.yaml charm-helpers-tests.yaml; do - if [ -f $ch ]; then - sed -i "s/https\:\/\/github.com\/juju\/charm-helpers$/https\:\/\/github.com\/juju\/charm-helpers\@stable\/${release}/g" $ch - fi - if [ -f src/$ch ]; then - sed -i "s/https\:\/\/github.com\/juju\/charm-helpers$/https\:\/\/github.com\/juju\/charm-helpers\@stable\/${release}/g" src/$ch - fi -done - -if [ -f src/layer.yaml ]; then - set +e - grep -q charms.openstack.git@stable src/wheelhouse.txt 2>/dev/null || { - echo "Updating charm wheelhouse, with stable 'charms.openstack'" - sed -i "s#openstack/charms.openstack.git#openstack/charms.openstack.git@stable/$release#g" src/wheelhouse.txt - } - grep -q charm-helpers.git@stable src/wheelhouse.txt 2>/dev/null || { - echo "Updating charm wheelhouse, with stable 'charmhelpers'" - sed -i "s#juju/charm-helpers.git#juju/charm-helpers.git@stable/${release}#g" src/wheelhouse.txt - } - grep -q charms.openstack.git@stable tests-requirements.txt 2>/dev/null || { - echo "Updating test-requirements.txt in repository with stable charms.openstack" - sed -i "s#openstack/charms.openstack.git#openstack/charms.openstack.git@stable/$release#g" test-requirements.txt - } - grep -q zaza-openstack-tests.git@stable src/tests-requirements.txt 2>/dev/null || { - echo "Updating src/test-requirements.txt in repository with stable Zaza" - sed -i "s#openstack-charmers/zaza.git#openstack-charmers/zaza.git@stable/$release#g" src/test-requirements.txt - sed -i "s#openstack-charmers/zaza-openstack-tests.git#openstack-charmers/zaza-openstack-tests.git@stable/$release#g" src/test-requirements.txt - } - set -e -else - set +e - grep -q zaza-openstack-tests.git@stable tests-requirements.txt 2>/dev/null || { - echo "Updating test-requirements.txt in repository with stable Zaza" - sed -i "s#openstack-charmers/zaza.git#openstack-charmers/zaza.git@stable/$release#g" test-requirements.txt - sed -i "s#openstack-charmers/zaza-openstack-tests.git#openstack-charmers/zaza-openstack-tests.git@stable/$release#g" test-requirements.txt - } - set -e -fi diff --git a/list-revisions-in-charmstore.py b/list-revisions-in-charmstore.py deleted file mode 100755 index 733fcc5..0000000 --- a/list-revisions-in-charmstore.py +++ /dev/null @@ -1,57 +0,0 @@ -from typing import List, Tuple -import sys - -import theblues.charmstore -import charmstore - -name = "nova-compute" - - -def usage(): - print("usage: {} ".format(sys.argv[0])) - - -def parse_args() -> str: - if len(sys.argv) < 2: - usage() - sys.exit(1) - charm = sys.argv[1] - return charm - - -def get_revisions(name: str) -> List[Tuple[str, str]]: - charm = charmstore.CharmStore().search(name)[0] - latest = charm.revision - print("{} revisions for charm: {}".format(latest, name)) - - cs = theblues.charmstore.CharmStore() - - results = [] - for a in range(1, int(latest)): - print(".", end="", flush=True) - try: - results.append(("{}/{}".format(name, a), - (cs.entity("{}-{}" - .format(name, a)) - ['Meta']['extra-info']['vcs-revisions'][0]['date'] - ))) - except Exception as e: - print("Exception was: {}".format(str(e))) - pass - print() - return results - - -def print_revisions(revisions: List[Tuple[str, str]]): - for (name, date) in revisions: - print(f"{name} - {date}") - - -def run(): - charm = parse_args() - revisions = get_revisions(charm) - print_revisions(revisions) - - -if __name__ == "__main__": - run() diff --git a/remove-channel-batch b/remove-channel-batch index b696c03..2c27523 100755 --- a/remove-channel-batch +++ b/remove-channel-batch @@ -2,14 +2,7 @@ # Remove the channel from the bundles of all of the charms using the # ./update-channel-single.py helper. -charms="$(cat charms.txt)" - -for charm in $charms; do - if [ ! -d "charms/$charm" ]; then - echo "Use ./get-charms master to clone the charm dirs first ($charm not found)" - exit 1 - fi -done +charms=$(cd charms && ls -d1 *) for charm in $charms; do charm_type="$(./what-is charms/$charm)" diff --git a/update-charms-metadata b/update-charms-metadata index e32802c..b9c5bd1 100755 --- a/update-charms-metadata +++ b/update-charms-metadata @@ -1,7 +1,7 @@ #!/bin/bash -e # Update the charms metadata with a command line "add" "groovy" -charms="$(cat charms.txt)" +charms=$(cd charms && ls -d1 *) cmd=$1 shift params=$@ @@ -11,13 +11,6 @@ if [ ! -d ".tox/py3" ]; then fi -for charm in $charms; do - if [ ! -d "charms/$charm" ]; then - echo "Use ./get-charms master to clone the charm dirs first ($charm not found)" - exit 1 - fi -done - for charm in $charms; do echo "===== $charm =====" .tox/py3/bin/python _update-metadata.py $charm $cmd $params diff --git a/update-reactive-stable-charms b/update-reactive-stable-charms deleted file mode 100755 index a384ea0..0000000 --- a/update-reactive-stable-charms +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/bash -e -# -# Apply stable-branch-updates to just reactive charms (typically post-release charm-helper and zaza stable bit flips). - -charms="$(cat charms.txt)" -basedir="$(pwd)" -username="$2" -release="$1" -usage="usage: update-reactive-stable-charms release-name" - -if [ -z "$release" ]; then - echo $usage - exit 1 -fi - -# function to download a charm -function download_charm(){ - local charm=$1 - echo "doing $charm" - # Handle repo url overrides if present - if grep "^$charm|" repo-link-overrides.txt > /dev/null; then - REPO_URL=$(grep "^$charm|" repo-link-overrides.txt | cut -f 2 -d "|") - else - REPO_URL="https://opendev.org/openstack/charm-${charm}" - fi - - git clone $REPO_URL charms/$charm -} - - - -for charm in $charms; do - if [ -d charms/$charm ]; then - # charm exists, so check if it's actually a reactive charm - charm_type="$(./what-is charms/$charm)" - case $charm_type in - source-zaza) - echo "===== $charm ($charm_type) =====, but need to redownload" - rm -Rf charms/$charm - download_charm $charm - esac - else - # charm does not exist, so download it. - download_charm $charm - fi - - charm_type="$(./what-is charms/$charm)" - case $charm_type in - classic-zaza) - echo "NOOP on $charm." - ;; - - source-zaza) - # perform the action - ( - cd charms/$charm - $basedir/stable-branch-updates $release - ) - esac -done diff --git a/zaza-required.yaml b/zaza-required.yaml deleted file mode 100644 index c0ab721..0000000 --- a/zaza-required.yaml +++ /dev/null @@ -1,10 +0,0 @@ -# Impose the following on all managed zaza charms -gate_bundles: - - bionic-rocky-functional - - bionic-queens-functional - - xenial-pike-functional - - xenial-queens-functional -smoke_bundles: - - bionic-queens-functional -dev_bundles: - - cosmic-rocky-functional From 0d62379c30063455e827b533b98d55195287447b Mon Sep 17 00:00:00 2001 From: Alex Kavanagh Date: Tue, 19 Apr 2022 14:21:54 +0100 Subject: [PATCH 3/5] Put back mysql-* 8.0.19 track for focal It's probably too ambitious to try to remove the 8.0.19 track as all the stable charms on focal refer to it (despite 8.0.22 being the version in focal now). --- lp-builder-config/misc.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lp-builder-config/misc.yaml b/lp-builder-config/misc.yaml index f6869be..fa7a274 100644 --- a/lp-builder-config/misc.yaml +++ b/lp-builder-config/misc.yaml @@ -55,7 +55,8 @@ projects: build-channels: charmcraft: "1.5/stable" channels: - - focal/edge + # - focal/edge + - 8.0.19/edge - name: MySQL Router charmhub: mysql-router @@ -74,7 +75,8 @@ projects: build-channels: charmcraft: "1.5/stable" channels: - - focal/edge + # - focal/edge + - 8.0.19/edge - name: Percona Cluster Charm charmhub: percona-cluster From 6847ed138a564d9941e94dba26f27bc79eab9a63 Mon Sep 17 00:00:00 2001 From: Alex Kavanagh Date: Tue, 19 Apr 2022 14:23:39 +0100 Subject: [PATCH 4/5] Add more helpers for the 22.04 release process - do-batch - modified to work with charms in charms/ rather than charms.txt - add a helper that does a single review (use with do-batch-with) --- _do-single-charm-review | 24 ++++++++++++++++++++++++ do-batch | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100755 _do-single-charm-review diff --git a/_do-single-charm-review b/_do-single-charm-review new file mode 100755 index 0000000..f072047 --- /dev/null +++ b/_do-single-charm-review @@ -0,0 +1,24 @@ +#!/bin/bash -e +# git add . then amend no-edit and then review. Topic in param +# Does a single charm; use with do-batch-with to do the entire batch. + +topic=$1 +script_dir="$( cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd)" + +if [ -z "$topic" ]; then + echo "Please provide the topic as the only param." + echo "Usage $0 " + exit 1 +fi + +_dir=$(pwd) +# verify that the branch isn't master +branch=$(git branch --show-current | tr -d '\n') +if [[ "$branch" == "master" ]]; +then + echo "Branch is ${_dir}" + echo "Branch is master - not updating." + exit 0 +fi + +git review -t $topic diff --git a/do-batch b/do-batch index 7a10051..1e9fb05 100755 --- a/do-batch +++ b/do-batch @@ -36,7 +36,7 @@ Usage examples: Note, no clone ./batch-example master some_file.txt topic-name --do-commit --do-review --amend --sync-helpers --update-tox --update-reqs" -charms="$(cat charms.txt)" +charms=$(cd charms && ls -d1 *) branch="$1" commit_msg_file="$2" gerrit_topic="$3" From b697ea437fd56d72118ecf6d8f657dca7f060dbd Mon Sep 17 00:00:00 2001 From: Alex Kavanagh Date: Thu, 21 Apr 2022 11:57:40 +0100 Subject: [PATCH 5/5] Ensure that lp-builder-config is consistent with master branch This is to keep the commits for 22.04 to be consistent with just the process of doing the release for 22.04 rather than the changes to the lp-builder-config --- lp-builder-config/misc.yaml | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/lp-builder-config/misc.yaml b/lp-builder-config/misc.yaml index fa7a274..2096af4 100644 --- a/lp-builder-config/misc.yaml +++ b/lp-builder-config/misc.yaml @@ -13,9 +13,6 @@ projects: charmcraft: "1.5/stable" channels: - latest/edge - stable/jammy: - channels: - - 2.4/edge stable/focal: build-channels: charmcraft: "1.5/stable" @@ -48,14 +45,10 @@ projects: charmcraft: "1.5/stable" channels: - latest/edge - stable/jammy: - channels: - - jammy/edge stable/focal: build-channels: charmcraft: "1.5/stable" channels: - # - focal/edge - 8.0.19/edge - name: MySQL Router @@ -68,14 +61,10 @@ projects: charmcraft: "1.5/stable" channels: - latest/edge - stable/jammy: - channels: - - jammy/edge stable/focal: build-channels: charmcraft: "1.5/stable" channels: - # - focal/edge - 8.0.19/edge - name: Percona Cluster Charm @@ -104,9 +93,7 @@ projects: charmcraft: "1.5/stable" channels: - latest/edge - stable/jammy: - channels: - - 3.9/edge + #- 3.9/edge stable/focal: build-channels: charmcraft: "1.5/stable" @@ -167,8 +154,6 @@ projects: charmcraft: "1.5/stable" channels: - latest/edge - stable/jammy: - channels: - jammy/edge stable/focal: build-channels: