From 23261e4e914d00ab3e7c59e345d6cb19f27b1d9f Mon Sep 17 00:00:00 2001 From: Yevhen Hrytsai Date: Sun, 30 Jun 2024 00:42:57 +0300 Subject: [PATCH] Revert workflows and build scripts adoption --- .github/workflows/all-tests.yml | 58 ++++++++++--------- bin/build/get-plugin-major-version.sh | 30 ---------- bin/build/java-product-matrix.json | 58 ------------------- bin/build/prepare-matrices.sh | 20 ------- bin/release-check/check-release.sh | 24 ++++---- .../plugin-product-compat-matrix.json | 14 ----- .../run-product-release-check.sh | 18 +----- 7 files changed, 43 insertions(+), 179 deletions(-) delete mode 100755 bin/build/get-plugin-major-version.sh delete mode 100644 bin/build/java-product-matrix.json delete mode 100755 bin/build/prepare-matrices.sh delete mode 100644 bin/release-check/plugin-product-compat-matrix.json diff --git a/.github/workflows/all-tests.yml b/.github/workflows/all-tests.yml index 8241db95..7cb57b84 100644 --- a/.github/workflows/all-tests.yml +++ b/.github/workflows/all-tests.yml @@ -24,33 +24,15 @@ jobs: # check path to bundled Maven executable; it should be then used in ATLAS_MVN - run: mvn -version - prepare: - name: Prepare Matrix - runs-on: ubuntu-latest - outputs: - unit-tests-matrix: ${{ steps.set-matrix.outputs.unit-tests-matrix }} - jira-it-matrix: ${{ steps.set-matrix.outputs.jira-it-matrix }} - confluence-it-matrix: ${{ steps.set-matrix.outputs.confluence-it-matrix }} - bitbucket-it-matrix: ${{ steps.set-matrix.outputs.bitbucket-it-matrix }} - # TODO: Remove these flags when new major jira (10.x) and bitbucket (9.x) are released - skip-jira-its: ${{ steps.set-matrix.outputs.skip-jira-its }} - skip-bitbucket-its: ${{ steps.set-matrix.outputs.skip-bitbucket-its }} - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.event.inputs.ref }} - - id: set-matrix - run: bin/build/prepare-matrices.sh - unit-tests: name: Unit Tests - needs: prepare runs-on: ubuntu-20.04 # around 800 Mb of dependencies need to be loaded; it may take long first time until it's cached timeout-minutes: 30 if: "(github.event.inputs.jobs == '' || contains(github.event.inputs.jobs, 'unit-tests')) && !contains(github.event.head_commit.message, '[skip ci]')" strategy: - matrix: ${{ fromJSON(needs.prepare.outputs.unit-tests-matrix) }} + matrix: + java-version: [8, 11] fail-fast: false steps: - uses: actions/checkout@v4 @@ -76,10 +58,16 @@ jobs: name: Jira runs-on: ubuntu-20.04 timeout-minutes: 30 - if: (github.event.inputs.jobs == '' || contains(github.event.inputs.jobs, 'integration-tests-jira')) && !needs.prepare.outputs.skip-jira-its - needs: [prepare, unit-tests] + if: github.event.inputs.jobs == '' || contains(github.event.inputs.jobs, 'integration-tests-jira') + needs: unit-tests strategy: - matrix: ${{ fromJSON(needs.prepare.outputs.jira-it-matrix) }} + matrix: + java-version: [8, 11, 17] + jira-version: [8.15.0, 9.5.0] + # Java 17 support is added only since Jira 9.5: https://confluence.atlassian.com/jiracore/preparing-for-jira-9-5-1167834011.html + exclude: + - java-version: 17 + jira-version: 8.15.0 fail-fast: false steps: - uses: actions/checkout@v4 @@ -113,9 +101,17 @@ jobs: runs-on: ubuntu-20.04 timeout-minutes: 30 if: github.event.inputs.jobs == '' || contains(github.event.inputs.jobs, 'integration-tests-confluence') - needs: [prepare, unit-tests] + needs: unit-tests strategy: - matrix: ${{ fromJSON(needs.prepare.outputs.confluence-it-matrix) }} + matrix: + # every version part should be 0 <= <= 255; otherwise Confluence fails to start + java-version: [8, 11, 17] + confluence-version: [7.10.0, 8.0.0] + exclude: + - java-version: 8 + confluence-version: 8.0.0 # Confluence 8 doesn't support Java 8 anymore + - java-version: 17 + confluence-version: 7.10.0 fail-fast: false steps: - uses: actions/checkout@v4 @@ -148,10 +144,16 @@ jobs: name: Bitbucket runs-on: ubuntu-20.04 timeout-minutes: 30 - if: (github.event.inputs.jobs == '' || contains(github.event.inputs.jobs, 'integration-tests-bitbucket')) && !needs.prepare.outputs.skip-bitbucket-its - needs: [prepare, unit-tests] + if: github.event.inputs.jobs == '' || contains(github.event.inputs.jobs, 'integration-tests-bitbucket') + needs: unit-tests strategy: - matrix: ${{ fromJSON(needs.prepare.outputs.bitbucket-it-matrix) }} + matrix: + java-version: [8, 11, 17] + bitbucket-version: [7.6.0, 8.8.0] + # Bitbucket 8.8.0 is the first one that supports Java 17 + exclude: + - java-version: 17 + bitbucket-version: 7.6.0 fail-fast: false steps: - uses: actions/checkout@v4 diff --git a/bin/build/get-plugin-major-version.sh b/bin/build/get-plugin-major-version.sh deleted file mode 100755 index 67664922..00000000 --- a/bin/build/get-plugin-major-version.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env bash - -# INPUT ENV VARS -version_type="${1:?Please set pass a version type. Examples: 'jira', 'confluence', 'bitbucket' or 'common'}" -# [-SNAPSHOT] part prevents matching version in a [parent] section -version_pattern='[0-9]+\.[0-9]+\.[0-9]+-SNAPSHOT' - -case $version_type in - jira) - pl_path='jira-slack-server-integration/jira-slack-server-integration-plugin/pom.xml' - ;; - confluence) - pl_path='confluence-slack-integration/confluence-slack-server-integration-plugin/pom.xml' - ;; - bitbucket) - pl_path='bitbucket-slack-server-integration-plugin/pom.xml' - ;; - common) - pl_path='pom.xml' - version_pattern='[0-9]+\.[0-9]+\.[0-9]+' - ;; - *) - echo "Invalid version type" - exit 1 - ;; -esac - -SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) -pl_version=$(cat "$SCRIPT_DIR/../../$pl_path" | grep -oE -m 1 $version_pattern | grep -oE '[0-9]+\.[0-9]+\.[0-9]+') -echo "${pl_version%.*.*}" \ No newline at end of file diff --git a/bin/build/java-product-matrix.json b/bin/build/java-product-matrix.json deleted file mode 100644 index 781228e1..00000000 --- a/bin/build/java-product-matrix.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "current": { - "unit-tests": { - "java-version": ["17"] - }, - "jira-it": { - "java-version": ["17"], - "jira-version": ["10.0.0"] - }, - "confluence-it": { - "java-version": ["17"], - "confluence-version": ["9.0.0-m81"] - }, - "bitbucket-it": { - "java-version": ["17"], - "bitbucket-version": ["9.0.0"] - } - }, - "old": { - "unit-tests": { - "java-version": ["8", "11"] - }, - "jira-it": { - "java-version": ["8", "11", "17"], - "jira-version": ["8.15.0", "9.5.0"], - "exclude": [ - { - "java-version": "17", - "jira-version": "8.15.0" - } - ] - }, - "confluence-it": { - "java-version": ["8", "11", "17"], - "confluence-version": ["7.10.0", "8.0.0"], - "exclude": [ - { - "java-version": "8", - "confluence-version": "8.0.0" - }, - { - "java-version": "17", - "confluence-version": "7.10.0" - } - ] - }, - "bitbucket-it": { - "java-version": ["8", "11", "17"], - "bitbucket-version": ["7.6.0", "8.8.0"], - "exclude": [ - { - "java-version": "17", - "bitbucket-version": "7.6.0" - } - ] - } - } -} \ No newline at end of file diff --git a/bin/build/prepare-matrices.sh b/bin/build/prepare-matrices.sh deleted file mode 100755 index 200a3f17..00000000 --- a/bin/build/prepare-matrices.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash - -matrix_file='bin/build/java-product-matrix.json' - -# Get slack plugin major common version -pl_common_version=$(. bin/build/get-plugin-major-version.sh common) -if [ $pl_common_version -gt 1 ]; then - matrix_key='current' -# TODO: Remove these flags when new major jira (10.x) and bitbucket (9.x) are released - echo "skip-jira-its=true" >> $GITHUB_OUTPUT - echo "skip-bitbucket-its=true" >> $GITHUB_OUTPUT -else - matrix_key='old' -fi -echo "Matrix key - $matrix_key" - -echo "unit-tests-matrix=$(jq --compact-output --arg v "$matrix_key" '.[$v]."unit-tests"' $matrix_file)" >> $GITHUB_OUTPUT -echo "jira-it-matrix=$(jq --compact-output --arg v "$matrix_key" '.[$v]."jira-it"' $matrix_file)" >> $GITHUB_OUTPUT -echo "confluence-it-matrix=$(jq --compact-output --arg v "$matrix_key" '.[$v]."confluence-it"' $matrix_file)" >> $GITHUB_OUTPUT -echo "bitbucket-it-matrix=$(jq --compact-output --arg v "$matrix_key" '.[$v]."bitbucket-it"' $matrix_file)" >> $GITHUB_OUTPUT \ No newline at end of file diff --git a/bin/release-check/check-release.sh b/bin/release-check/check-release.sh index 5d870d75..b36ae1e4 100755 --- a/bin/release-check/check-release.sh +++ b/bin/release-check/check-release.sh @@ -48,21 +48,19 @@ echo "Determined workflow name: $workflow_name" # RUN TESTS AGAINST SPECIFIC VERSIONS workflow_links=() -pl_common_version=$(. ../build/get-plugin-major-version.sh common) -if [ $pl_common_version -eq 1 ]; then - if [ $product_type != "confluence" ]; then - echo "Running workflow with params: workflow-name=$workflow_name java-version=8.0.252 product-version=$product_version" - first_workflow_link=$(start_workflow $workflow_name 8.0.252 $product_version) - echo "Pipeline URL: $first_workflow_link" - workflow_links+=("$first_workflow_link") - fi - - echo "Running workflow with params: workflow-name=$workflow_name java-version=11 product-version=$product_version" - second_workflow_link=$(start_workflow $workflow_name 11 $product_version) - echo "Pipeline URL: $second_workflow_link" - workflow_links+=("$second_workflow_link") +# Confluence 8+ does not support Java 8 +if [ $product_type != "confluence" ]; then + echo "Running workflow with params: workflow-name=$workflow_name java-version=8.0.252 product-version=$product_version" + first_workflow_link=$(start_workflow $workflow_name 8.0.252 $product_version) + echo "Pipeline URL: $first_workflow_link" + workflow_links+=("$first_workflow_link") fi +echo "Running workflow with params: workflow-name=$workflow_name java-version=11 product-version=$product_version" +second_workflow_link=$(start_workflow $workflow_name 11 $product_version) +echo "Pipeline URL: $second_workflow_link" +workflow_links+=("$second_workflow_link") + echo "Running workflow with params: workflow-name=$workflow_name java-version=17 product-version=$product_version" third_workflow_link=$(start_workflow $workflow_name 17 $product_version) echo "Pipeline URL: $third_workflow_link" diff --git a/bin/release-check/plugin-product-compat-matrix.json b/bin/release-check/plugin-product-compat-matrix.json deleted file mode 100644 index 931dc794..00000000 --- a/bin/release-check/plugin-product-compat-matrix.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "jira": { - "3": "[0-9]\\.[0-9]+\\.[0-9]+", - "4": "10\\.[0-9]+\\.[0-9]+" - }, - "confluence": { - "3": "[0-8]\\.[0-9]+\\.[0-9]+", - "4": "9\\.[0-9]+\\.[0-9]+" - }, - "bitbucket": { - "4": "[0-8]\\.[0-9]+\\.[0-9]+", - "5": "9\\.[0-9]+\\.[0-9]+" - } -} \ No newline at end of file diff --git a/bin/release-check/run-product-release-check.sh b/bin/release-check/run-product-release-check.sh index 4ffb0c5a..53302dc3 100755 --- a/bin/release-check/run-product-release-check.sh +++ b/bin/release-check/run-product-release-check.sh @@ -12,22 +12,8 @@ if [ "$latest_releases" = "" ]; then exit fi -# TAKE AND CHECKS LATEST COMPATIBLE VERSION ONLY, MEANING THE GREATEST REVISION VERSION -pl_product_version=$(. ../get-plugin-major-version.sh "$PRODUCT") -product_compat_version_regex=$(jq -r --arg pl "$pl_product_version" --arg p "$PRODUCT" '.[$p].[$pl]' ./plugin-product-compat-matrix.json) -latest_version=$(echo "$latest_releases" | grep -oE "$product_compat_version_regex" | tail -1) - -if [ "$latest_version" = "" ]; then - echo "Could not find latest versions" - echo "Product [$PRODUCT]" - echo "Compatible version pattern [$product_compat_version_regex]" - exit -fi - -echo "========================" -echo "LATEST VERSION" -echo "$latest_version" -echo "========================" +# TAKE AND CHECKS LATEST VERSION ONLY, MEANING THE GREATEST REVISION VERSION +latest_version=$(echo "$latest_releases" | tail -1) # RUN CHECK FOR LATEST VERSION PRODUCT_VERSION="$latest_version" . ./check-release.sh