From 6bf4faf4b1f170a73dabf7847715564d18191d9b Mon Sep 17 00:00:00 2001 From: Yevhen Hrytsai Date: Sat, 27 Jul 2024 15:10:20 +0300 Subject: [PATCH] Fix workflows and CI scripts --- .github/workflows/all-tests.yml | 43 ++++++-------- .github/workflows/bitbucket-int-tests.yml | 10 ++-- .github/workflows/confluence-int-tests.yml | 10 ++-- .github/workflows/jira-int-tests.yml | 10 ++-- .github/workflows/release.yml | 4 +- bin/build/get-plugin-major-version.sh | 30 ---------- bin/build/java-product-matrix.json | 58 ------------------- bin/release-check/check-release.sh | 31 +--------- .../plugin-product-compat-matrix.json | 14 ----- .../run-product-release-check.sh | 20 +++++-- 10 files changed, 52 insertions(+), 178 deletions(-) delete mode 100755 bin/build/get-plugin-major-version.sh delete mode 100644 bin/build/java-product-matrix.json 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 7ffb4708..608869ae 100644 --- a/.github/workflows/all-tests.yml +++ b/.github/workflows/all-tests.yml @@ -24,32 +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) is released - skip-jira-its: ${{ steps.set-matrix.outputs.skip-jira-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: [17] fail-fast: false steps: - uses: actions/checkout@v4 @@ -75,10 +58,13 @@ 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] + # Disabled until Jira version is available + if: (github.event.inputs.jobs == '' || contains(github.event.inputs.jobs, 'integration-tests-jira')) && false + needs: unit-tests strategy: - matrix: ${{ fromJSON(needs.prepare.outputs.jira-it-matrix) }} + matrix: + java-version: [17] + jira-version: [10.0.0] fail-fast: false steps: - uses: actions/checkout@v4 @@ -112,9 +98,12 @@ 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: [17] + confluence-version: [9.0.0-m72] fail-fast: false steps: - uses: actions/checkout@v4 @@ -148,9 +137,11 @@ jobs: runs-on: ubuntu-20.04 timeout-minutes: 30 if: github.event.inputs.jobs == '' || contains(github.event.inputs.jobs, 'integration-tests-bitbucket') - needs: [prepare, unit-tests] + needs: unit-tests strategy: - matrix: ${{ fromJSON(needs.prepare.outputs.bitbucket-it-matrix) }} + matrix: + java-version: [17] + bitbucket-version: [9.0.0-eap03] fail-fast: false steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/bitbucket-int-tests.yml b/.github/workflows/bitbucket-int-tests.yml index dc986e63..0d035059 100644 --- a/.github/workflows/bitbucket-int-tests.yml +++ b/.github/workflows/bitbucket-int-tests.yml @@ -20,7 +20,7 @@ jobs: timeout-minutes: 30 steps: - run: echo 'Github event inputs [${{ toJson(github.event.inputs) }}].' - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: ref: ${{ github.event.inputs.ref }} # Dec 13, 2022 @@ -28,18 +28,18 @@ jobs: # install last supported git - 2.37.4; remove this trick once Bitbucket implements support for latest git # https://confluence.atlassian.com/bitbucketserver/supported-platforms-776640981.html#Supportedplatforms-dvcsDVCS - run: bin/build/install-supported-git.sh - - uses: actions/setup-java@v3 + - uses: actions/setup-java@v4 with: java-version: ${{ github.event.inputs.java-version }} distribution: adopt - run: bin/build/install-plugin-sdk.sh - run: bin/build/override-plugin-sdk-maven.sh - run: bin/build/install-int-test-libs.sh - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: ~/.m2/repository key: maven-unit - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: ~/.m2/repository/com/atlassian/bitbucket key: maven-integration-bitbucket-${{ github.event.inputs.product-version }} @@ -47,7 +47,7 @@ jobs: - run: | VERSION=${{ github.event.inputs.product-version }} \ bin/build/run-bitbucket-its.sh - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 if: failure() with: name: webdriver-screenshots-bitbucket-${{ github.event.inputs.product-version }}-java-${{ github.event.inputs.java-version }} diff --git a/.github/workflows/confluence-int-tests.yml b/.github/workflows/confluence-int-tests.yml index 248b3fa5..abf043c2 100644 --- a/.github/workflows/confluence-int-tests.yml +++ b/.github/workflows/confluence-int-tests.yml @@ -20,21 +20,21 @@ jobs: timeout-minutes: 30 steps: - run: echo 'Github event inputs [${{ toJson(github.event.inputs) }}].' - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: ref: ${{ github.event.inputs.ref }} - - uses: actions/setup-java@v3 + - uses: actions/setup-java@v4 with: java-version: ${{ github.event.inputs.java-version }} distribution: adopt - run: bin/build/install-plugin-sdk.sh - run: bin/build/override-plugin-sdk-maven.sh - run: bin/build/install-int-test-libs.sh - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: ~/.m2/repository key: maven-unit - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: ~/.m2/repository/com/atlassian/confluence key: maven-integration-confluence-${{ github.event.inputs.product-version }} @@ -42,7 +42,7 @@ jobs: - run: | VERSION=${{ github.event.inputs.product-version }} \ bin/build/run-confluence-its.sh - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 if: failure() with: name: webdriver-screenshots-confluence-${{ github.event.inputs.product-version }}-java-${{ github.event.inputs.java-version }} diff --git a/.github/workflows/jira-int-tests.yml b/.github/workflows/jira-int-tests.yml index 11ed242b..9377d39c 100644 --- a/.github/workflows/jira-int-tests.yml +++ b/.github/workflows/jira-int-tests.yml @@ -23,21 +23,21 @@ jobs: timeout-minutes: 30 steps: - run: echo 'Github event inputs [${{ toJson(github.event.inputs) }}].' - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: ref: ${{ github.event.inputs.ref }} - - uses: actions/setup-java@v3 + - uses: actions/setup-java@v4 with: java-version: ${{ github.event.inputs.java-version }} distribution: adopt - run: bin/build/install-plugin-sdk.sh - run: bin/build/override-plugin-sdk-maven.sh - run: bin/build/install-int-test-libs.sh - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: ~/.m2/repository key: maven-unit - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: ~/.m2/repository/com/atlassian/jira key: maven-integration-jira-${{ github.event.inputs.product-version }} @@ -46,7 +46,7 @@ jobs: VERSION=${{ github.event.inputs.product-version }} \ TESTKIT_VERSION=${{ github.event.inputs.testkit-version }} \ bin/build/run-jira-its.sh - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 if: failure() with: name: webdriver-screenshots-jira-${{ github.event.inputs.product-version }}-java-${{ github.event.inputs.java-version }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d19368a6..d9b54246 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -31,7 +31,7 @@ jobs: echo 'Release version [${{ github.event.inputs.release-version }}].' echo 'Next development version [${{ github.event.inputs.next-development-version }}].' - name: Check out the code from selected branch - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: ${{ github.event.inputs.ref }} - name: Configure git for operations performed during the release @@ -55,7 +55,7 @@ jobs: run: bin/build/install-plugin-sdk.sh - run: bin/build/override-plugin-sdk-maven.sh - name: Unpack cached Maven dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.m2/repository key: maven-release 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 c2a3a8e5..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-m72"] - }, - "bitbucket-it": { - "java-version": ["17"], - "bitbucket-version": ["9.0.0-eap03"] - } - }, - "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" - } - ] - } - } -} diff --git a/bin/release-check/check-release.sh b/bin/release-check/check-release.sh index 5d870d75..dd5c9b92 100755 --- a/bin/release-check/check-release.sh +++ b/bin/release-check/check-release.sh @@ -47,37 +47,12 @@ esac 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") -fi - 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" -workflow_links+=("$third_workflow_link") - -# Join elements with a multi-character delimiter -function join_by { - local d=${1-} f=${2-} - if shift 2; then - printf %s "$f" "${@/#/$d}" - fi -} +workflow_link=$(start_workflow $workflow_name 17 $product_version) +echo "Pipeline URL: $workflow_link" # CREATE NEW ISSUE FOR RELEASE echo "Creating a new issue" -new_issue_url=$(RELEASE_LABEL="$release_label" WORKFLOW_LINKS="$(join_by ', ' ${workflow_links[@]})" . ./create-issue.sh) +new_issue_url=$(RELEASE_LABEL="$release_label" WORKFLOW_LINKS="$workflow_link" . ./create-issue.sh) echo "New ticket created: $new_issue_url" 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..881db7d8 100755 --- a/bin/release-check/run-product-release-check.sh +++ b/bin/release-check/run-product-release-check.sh @@ -12,15 +12,25 @@ 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) +case $PRODUCT in + jira) + version_regex="10\\.[0-9]+\\.[0-9]+" + ;; + confluence|bitbucket) + version_regex="9\\.[0-9]+\\.[0-9]+" + ;; + *) + echo "Invalid product" + exit 1 + ;; +esac + +latest_version=$(echo "$latest_releases" | grep -oE "$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]" + echo "Compatible version pattern [$version_regex]" exit fi