From c598abd6646059f4de5af31069379ceaa22f5ef7 Mon Sep 17 00:00:00 2001 From: Jeff Date: Mon, 5 Oct 2020 13:57:11 -0700 Subject: [PATCH 1/3] make update-version workflow branch aware --- .github/workflows/update-version.yaml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/update-version.yaml b/.github/workflows/update-version.yaml index 3f4109bd72..b8e9fec229 100644 --- a/.github/workflows/update-version.yaml +++ b/.github/workflows/update-version.yaml @@ -3,6 +3,8 @@ on: repository_dispatch: types: - update-on-release +env: + CURRENT_STABLE: 2.3 jobs: update-version: if: github.event.client_payload.prerelease == 'false' @@ -30,6 +32,22 @@ jobs: fi echo "Extracted the version number '${version_number}'." echo "::set-output name=yb_version::${version_number}" + - name: "Switch to correct branch" + run: | + rel=${{steps.extract-version.outputs.yb_version}} + a=( ${rel//./ } ) + branch_name="${a[0]}.${a[1]}" + if [[ "${branch_name}" == "${CURRENT_STABLE}" ]]; then # 2.3 is the latest "master" release + branch_name='master' + fi + if git branch | grep -qE "^${branch_name}$"; then + # branch laready exists so check it out + git checkout ${branch_name} + else + # First time creating charts for this release + # This won't start working 'correctly' till 2.4 + git checkout -b ${branch_name} origin/master + fi - name: "Check python version and install dependencies" run: | python3 --version From 26782b1e8d49111c384ba1a041be1a3acd34bd85 Mon Sep 17 00:00:00 2001 From: Jeff Date: Mon, 5 Oct 2020 14:27:49 -0700 Subject: [PATCH 2/3] Fix typo, grab all git history, make calcualted branch name available to the entire workflow --- .github/workflows/update-version.yaml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update-version.yaml b/.github/workflows/update-version.yaml index b8e9fec229..bf495971e3 100644 --- a/.github/workflows/update-version.yaml +++ b/.github/workflows/update-version.yaml @@ -11,6 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + fetch-depth: 1 - name: "Configure git" run: | git config user.name 'YugaByte CI' @@ -33,6 +34,7 @@ jobs: echo "Extracted the version number '${version_number}'." echo "::set-output name=yb_version::${version_number}" - name: "Switch to correct branch" + id: extract-branch run: | rel=${{steps.extract-version.outputs.yb_version}} a=( ${rel//./ } ) @@ -41,13 +43,17 @@ jobs: branch_name='master' fi if git branch | grep -qE "^${branch_name}$"; then - # branch laready exists so check it out + # branch already exists so check it out git checkout ${branch_name} else # First time creating charts for this release # This won't start working 'correctly' till 2.4 + # till then, we will need to manually create the new branches and seed them with + # sufficiently old version numbers (the update script won't go down versions) git checkout -b ${branch_name} origin/master fi + echo "Extracted the branch: '${branch_name}'" + echo "::set-output name=yb_branch::${branch_name}" - name: "Check python version and install dependencies" run: | python3 --version @@ -65,7 +71,7 @@ jobs: git add ./stable/yugabyte/Chart.yaml ./stable/yugaware/Chart.yaml \ ./stable/yugabyte/values.yaml ./stable/yugaware/values.yaml ./stable/yugabyte/app-readme.md git commit -m "Update the version to ${{steps.extract-version.outputs.yb_version}}" - git push origin ${{ github.ref }} + git push - name: "Show git status in case of failure" if: steps.update-version.outcome == 'failure' run: | From e10a81bd2b019a48ec5ea0b27ebdfb705d44854b Mon Sep 17 00:00:00 2001 From: Jeff Date: Mon, 19 Oct 2020 15:47:08 -0700 Subject: [PATCH 3/3] Update action to use yb_release_train variable. --- .github/workflows/update-version.yaml | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/.github/workflows/update-version.yaml b/.github/workflows/update-version.yaml index bf495971e3..b996b4a7dd 100644 --- a/.github/workflows/update-version.yaml +++ b/.github/workflows/update-version.yaml @@ -3,8 +3,6 @@ on: repository_dispatch: types: - update-on-release -env: - CURRENT_STABLE: 2.3 jobs: update-version: if: github.event.client_payload.prerelease == 'false' @@ -34,14 +32,11 @@ jobs: echo "Extracted the version number '${version_number}'." echo "::set-output name=yb_version::${version_number}" - name: "Switch to correct branch" - id: extract-branch + id: switch-branch run: | - rel=${{steps.extract-version.outputs.yb_version}} - a=( ${rel//./ } ) - branch_name="${a[0]}.${a[1]}" - if [[ "${branch_name}" == "${CURRENT_STABLE}" ]]; then # 2.3 is the latest "master" release - branch_name='master' - fi + # We use the yb_release_train as the branch in this repo + # This allows us to map multiple '2.2' release branches to a single set of helm charts + branch_name="${{github.events.client_payload.yb_release_train}}" if git branch | grep -qE "^${branch_name}$"; then # branch already exists so check it out git checkout ${branch_name}