From a1d58b9d9c550b72f9bd5f74b9fb87ef632aff1d Mon Sep 17 00:00:00 2001 From: Jose Javier Merchante Date: Wed, 18 Jan 2023 16:57:15 +0200 Subject: [PATCH 1/5] [release] Update the way GrimoireLab upgrades its version This commit updates the way the release workflow checks the new version number for GrimoireLab. In the previous version, each package indicated the version changed, but that method isn't idempotent when the workflow is restarted. Now is in the last step when the version is calculated based on the packages installed in GrimoireLab and the new version for each package. Signed-off-by: Jose Javier Merchante --- .github/workflows/grimoirelab-release.yml | 95 ++++++++++++++----- .../release-grimoirelab-component.yml | 34 ------- 2 files changed, 73 insertions(+), 56 deletions(-) diff --git a/.github/workflows/grimoirelab-release.yml b/.github/workflows/grimoirelab-release.yml index 0f510d67..64318bb5 100644 --- a/.github/workflows/grimoirelab-release.yml +++ b/.github/workflows/grimoirelab-release.yml @@ -362,31 +362,82 @@ jobs: - id: semverup name: Update version number + env: + grimoirelab_toolkit_version: "${{ needs.grimoirelab-toolkit.outputs.version}}" + kidash_version: "${{ needs.grimoirelab-kidash.outputs.version}}" + sortinghat_version: "${{ needs.grimoirelab-sortinghat.outputs.version}}" + cereslib_version: "${{ needs.grimoirelab-cereslib.outputs.version}}" + grimoirelab_panels_version: "${{ needs.grimoirelab-sigils.outputs.version}}" + perceval_version: "${{ needs.grimoirelab-perceval.outputs.version}}" + perceval_mozilla_version: "${{ needs.grimoirelab-perceval-mozilla.outputs.version}}" + perceval_opnfv_version: "${{ needs.grimoirelab-perceval-opnfv.outputs.version}}" + perceval_puppet_version: "${{ needs.grimoirelab-perceval-puppet.outputs.version}}" + perceval_weblate_version: "${{ needs.grimoirelab-perceval-weblate.outputs.version}}" + graal_version: "${{ needs.grimoirelab-graal.outputs.version}}" + grimoire_elk_version: "${{ needs.grimoirelab-elk.outputs.version}}" + sirmordred_version: "${{ needs.grimoirelab-sirmordred.outputs.version}}" run: | - # Check what version to update: patch, minor or major BUMP_MAJOR=4 BUMP_MINOR=2 - if [ ${{ inputs.release_candidate }} == 'true' ] - then - rcArg='--pre-release' - else - rcArg='' - fi - versionUpdated=$(( - ${{ needs.grimoirelab-toolkit.outputs.changed_version }} | - ${{ needs.grimoirelab-perceval.outputs.changed_version }} | - ${{ needs.grimoirelab-perceval-mozilla.outputs.changed_version }} | - ${{ needs.grimoirelab-perceval-opnfv.outputs.changed_version }} | - ${{ needs.grimoirelab-perceval-puppet.outputs.changed_version }} | - ${{ needs.grimoirelab-perceval-weblate.outputs.changed_version }} | - ${{ needs.grimoirelab-elk.outputs.changed_version }} | - ${{ needs.grimoirelab-sortinghat.outputs.changed_version }} | - ${{ needs.grimoirelab-kidash.outputs.changed_version }} | - ${{ needs.grimoirelab-sigils.outputs.changed_version }} | - ${{ needs.grimoirelab-sirmordred.outputs.changed_version }} | - ${{ needs.grimoirelab-cereslib.outputs.changed_version }} | - ${{ needs.grimoirelab-graal.outputs.changed_version }})) - + BUMP_PATCH=1 + NO_BUMP=0 + + function cmp_version () { + old=$1 + old=${old%-*} + old=${old%rc*} + current=$2 + current=${current%-*} + current=${current%rc*} + + currentArr=(${current//./ }) + oldArr=(${old//./ }) + + if [ ${currentArr[0]} -gt ${oldArr[0]} ] + then + echo $BUMP_MAJOR + elif [ ${currentArr[1]} -gt ${oldArr[1]} ] + then + echo $BUMP_MINOR + elif [ ${currentArr[2]} -gt ${oldArr[2]} ] + then + echo $BUMP_PATCH + else + echo $NO_BUMP + fi + } + + function old_pkg_version () { + pkg=$1 + poetry show -l $pkg | grep version | head -1 | awk '{print $3}' + } + + pkgs=("grimoirelab-toolkit" + "kidash" + "sortinghat" + "cereslib" + "perceval" + "perceval-mozilla" + "perceval-opnfv" + "perceval-puppet" + "perceval-weblate" + "graal" + "grimoire-elk" + "sirmordred") + + versionUpdated=0 + for pkg in "${pkgs[@]}" + do + pkg_ver="${pkg/-/_}_version" + current=${!pkg_ver} + old=$(old_pkg_version "$pkg") + output=$(cmp_version "$old" "$current") + echo "$pkg updated from $old to $current, changed: $output" + versionUpdated=$(( versionUpdated | output )) + done + + echo $versionUpdated + if [ $((versionUpdated & $BUMP_MAJOR )) -ne 0 ] then version=$(semverup --bump-version=major $rcArg) diff --git a/.github/workflows/release-grimoirelab-component.yml b/.github/workflows/release-grimoirelab-component.yml index 993d44b6..c50df318 100644 --- a/.github/workflows/release-grimoirelab-component.yml +++ b/.github/workflows/release-grimoirelab-component.yml @@ -51,9 +51,6 @@ on: notes: description: "Notes content for the package" value: ${{ jobs.release.outputs.notes }} - changed_version: - description: "The version changed was major (4), minor (2), patch (1) or not changed (0)" - value: ${{ jobs.release.outputs.changed_version }} jobs: release: @@ -63,7 +60,6 @@ jobs: version: ${{ steps.version.outputs.version }} package_version: ${{ steps.version.outputs.package_version }} notes: ${{ steps.notes.outputs.notes }} - changed_version: ${{ steps.changed-version.outputs.changed }} steps: - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # 3.1.0 @@ -185,36 +181,6 @@ jobs: echo $package_version working-directory: ${{ inputs.module_directory }} - - id: changed-version - name: Get the version changed - run: | - BUMP_MAJOR=4 - BUMP_MINOR=2 - BUMP_PATCH=1 - current=${{ steps.version.outputs.version }} - old=${{ steps.old-version.outputs.version }} - # Remove rc part - current=${current%-*} - old=${old%-*} - currentArr=(${current//./ }) - oldArr=(${old//./ }) - if [ ${currentArr[0]} -gt ${oldArr[0]} ] - then - echo "changed=$BUMP_MAJOR" >> $GITHUB_OUTPUT - echo "Major" - elif [ ${currentArr[1]} -gt ${oldArr[1]} ] - then - echo "changed=$BUMP_MINOR" >> $GITHUB_OUTPUT - echo "Minor" - elif [ ${currentArr[2]} -gt ${oldArr[2]} ] - then - echo "changed=$BUMP_PATCH" >> $GITHUB_OUTPUT - echo "Patch" - else - echo "changed=0" >> $GITHUB_OUTPUT - echo "Not changed" - fi - - id: notes name: Generate release notes. if: steps.semverup.outcome == 'success' From adbe56d20e5db41af8e4a3a1fd007427f8173277 Mon Sep 17 00:00:00 2001 From: Jose Javier Merchante Date: Fri, 20 Jan 2023 09:09:09 +0100 Subject: [PATCH 2/5] [release:notes] Include release candidate argument to notes This commit includes the --pre-release argument to notes when it is a release candidate version to execute that command according to the new changes to release-tools. Signed-off-by: Jose Javier Merchante --- .github/workflows/release-grimoirelab-component.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release-grimoirelab-component.yml b/.github/workflows/release-grimoirelab-component.yml index c50df318..63a50b45 100644 --- a/.github/workflows/release-grimoirelab-component.yml +++ b/.github/workflows/release-grimoirelab-component.yml @@ -191,13 +191,15 @@ jobs: if [ ${{ inputs.release_candidate }} == 'true' ] then newsArg='' + rcArg='--pre-release' else newsArg='--news' + rcArg='' fi if [ ${{ steps.semverup.outputs.forced_version }} != 'true' ] then - notes "${{ inputs.module_name }}" $version $newsArg --authors + notes "${{ inputs.module_name }}" $version $newsArg --authors $rcArg else module_name=${{ inputs.module_name }} today=$(date -u "+%Y-%m-%d") From 6def514672d77a4c252ea42a2bfbeab9cf1dbb4e Mon Sep 17 00:00:00 2001 From: Jose Javier Merchante Date: Fri, 20 Jan 2023 10:38:50 +0100 Subject: [PATCH 3/5] [release] Include SortingHat new dependencies This commit includes grimoirelab-toolkit as a new dependency for SortingHat in the release workflow. Signed-off-by: Jose Javier Merchante --- .github/workflows/grimoirelab-release.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/grimoirelab-release.yml b/.github/workflows/grimoirelab-release.yml index 64318bb5..25dd5fd5 100644 --- a/.github/workflows/grimoirelab-release.yml +++ b/.github/workflows/grimoirelab-release.yml @@ -71,6 +71,7 @@ jobs: name: Sortinghat needs: - variables-job + - grimoirelab-toolkit uses: ./.github/workflows/release-grimoirelab-component.yml with: git_email: ${{ needs.variables-job.outputs.git_email }} @@ -79,8 +80,8 @@ jobs: module_name: 'sortinghat' module_repository: 'chaoss/grimoirelab-sortinghat' module_directory: 'src/grimoirelab-sortinghat' - dependencies: '' - wait_dependencies: false + dependencies: '${{ needs.grimoirelab-toolkit.outputs.package_version }}' + wait_dependencies: true secrets: access_token: ${{ secrets.GRIMOIRELAB_BUILD_TOKEN }} From ed83f2d57495d527d8cde63b69d658ad284ce721 Mon Sep 17 00:00:00 2001 From: Jose Javier Merchante Date: Mon, 23 Jan 2023 10:25:16 +0100 Subject: [PATCH 4/5] [release] Increase time waiting for dependencies available This commit increases the time to wait in elk and sirmordred from 60 to 180 seconds. This allows to wait for packages to be available in PyPI. Signed-off-by: Jose Javier Merchante --- .github/workflows/grimoirelab-release.yml | 2 +- .github/workflows/release-grimoirelab-component.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/grimoirelab-release.yml b/.github/workflows/grimoirelab-release.yml index 25dd5fd5..2c9e672c 100644 --- a/.github/workflows/grimoirelab-release.yml +++ b/.github/workflows/grimoirelab-release.yml @@ -359,7 +359,7 @@ jobs: - id: check-dependencies name: Check if package dependencies exist run: | - sleep 60 + sleep 180 - id: semverup name: Update version number diff --git a/.github/workflows/release-grimoirelab-component.yml b/.github/workflows/release-grimoirelab-component.yml index 63a50b45..9b18e359 100644 --- a/.github/workflows/release-grimoirelab-component.yml +++ b/.github/workflows/release-grimoirelab-component.yml @@ -123,7 +123,7 @@ jobs: name: Wait for dependencies to be ready in PyPI if: inputs.wait_dependencies == false run: | - sleep 60 + sleep 180 - id: update-dependencies name: Update package dependencies From 757e93b548f6bfb3ef1956fdab5693e580617619 Mon Sep 17 00:00:00 2001 From: Jose Javier Merchante Date: Mon, 23 Jan 2023 10:27:38 +0100 Subject: [PATCH 5/5] [docker] Include libmariadbclient for SortingHat installation The library 'libmariadbclient-dev-compat' is needed to install the new version of SortingHat. Include it in the Dockerfile. Signed-off-by: Jose Javier Merchante --- docker/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/Dockerfile b/docker/Dockerfile index f2c039b1..b233e895 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -26,6 +26,7 @@ RUN apt-get update && \ python3-dev \ python3-gdbm \ mariadb-client \ + libmariadbclient-dev-compat \ unzip curl wget sudo ssh \ && \ apt-get clean && \