Skip to content

Commit

Permalink
Merge pull request #369 from atlassian-labs/dev
Browse files Browse the repository at this point in the history
Forward merge to master
  • Loading branch information
yevhenhr authored May 19, 2024
2 parents e0d6ec9 + feecd0a commit fe375d7
Show file tree
Hide file tree
Showing 8 changed files with 214 additions and 60 deletions.
96 changes: 47 additions & 49 deletions .github/workflows/all-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,32 +24,50 @@ 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:
java-version: [8, 11]
matrix: ${{ fromJSON(needs.prepare.outputs.unit-tests-matrix) }}
fail-fast: false
steps:
- 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: ${{ matrix.java-version }}
distribution: adopt
- run: bin/build/install-plugin-sdk.sh
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: ~/.m2/repository
key: maven-unit
- run: bin/build/override-plugin-sdk-maven.sh
- run: bin/build/run-unit-tests.sh
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: unit-tests-coverage-java-${{ matrix.java-version }}
path: '**/target/site/jacoco/**'
Expand All @@ -58,39 +76,33 @@ 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: unit-tests
if: (github.event.inputs.jobs == '' || contains(github.event.inputs.jobs, 'integration-tests-jira')) && !needs.prepare.outputs.skip-jira-its
needs: [prepare, unit-tests]
strategy:
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
matrix: ${{ fromJSON(needs.prepare.outputs.jira-it-matrix) }}
fail-fast: false
steps:
- 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: ${{ matrix.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-${{ matrix.jira-version }}
- run: bin/build/install-common-modules.sh
- run: VERSION=${{ matrix.jira-version }} bin/build/run-jira-its.sh
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: failure()
with:
name: webdriver-screenshots-jira-${{ matrix.jira-version }}
Expand All @@ -101,40 +113,32 @@ jobs:
runs-on: ubuntu-20.04
timeout-minutes: 30
if: github.event.inputs.jobs == '' || contains(github.event.inputs.jobs, 'integration-tests-confluence')
needs: unit-tests
needs: [prepare, unit-tests]
strategy:
matrix:
# every version part should be 0 <= <version> <= 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
matrix: ${{ fromJSON(needs.prepare.outputs.confluence-it-matrix) }}
fail-fast: false
steps:
- 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: ${{ matrix.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-${{ matrix.confluence-version }}
- run: bin/build/install-common-modules.sh
- run: VERSION=${{ matrix.confluence-version }} bin/build/run-confluence-its.sh
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: failure()
with:
name: webdriver-screenshots-confluence-${{ matrix.confluence-version }}-java-${{ matrix.java-version }}
Expand All @@ -144,44 +148,38 @@ 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: unit-tests
if: (github.event.inputs.jobs == '' || contains(github.event.inputs.jobs, 'integration-tests-bitbucket')) && !needs.prepare.outputs.skip-bitbucket-its
needs: [prepare, unit-tests]
strategy:
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
matrix: ${{ fromJSON(needs.prepare.outputs.bitbucket-it-matrix) }}
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.ref }}
# Dec 13, 2022
# latest Bitbucket 8.6.1 doesn't support latest git 2.38.1 installed on the Ubuntu 20 image Github provides
# 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: ${{ matrix.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-${{ matrix.bitbucket-version }}
- run: bin/build/install-common-modules.sh
- run: VERSION=${{ matrix.bitbucket-version }} bin/build/run-bitbucket-its.sh
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: failure()
with:
name: webdriver-screenshots-bitbucket-${{ matrix.bitbucket-version }}-java-${{ matrix.java-version }}
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/release-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@ jobs:
name: Release Check
runs-on: ubuntu-20.04
timeout-minutes: 15
strategy:
matrix:
branch: [master, release-1.x]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: ${{ matrix.branch }}
- working-directory: bin/release-check
run: |
PRODUCT="jira" \
Expand Down
30 changes: 30 additions & 0 deletions bin/build/get-plugin-major-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/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='<version>[0-9]+\.[0-9]+\.[0-9]+-SNAPSHOT</version>'

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='<version>[0-9]+\.[0-9]+\.[0-9]+</version>'
;;
*)
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%.*.*}"
58 changes: 58 additions & 0 deletions bin/build/java-product-matrix.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"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"
}
]
}
}
}
20 changes: 20 additions & 0 deletions bin/build/prepare-matrices.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/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
31 changes: 23 additions & 8 deletions bin/release-check/check-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,37 @@ esac
echo "Determined workflow name: $workflow_name"

# RUN TESTS AGAINST SPECIFIC VERSIONS
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=()
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"
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")

workflow_links="$first_workflow_link, $second_workflow_link, $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
}

# CREATE NEW ISSUE FOR RELEASE
echo "Creating a new issue"
new_issue_url=$(RELEASE_LABEL="$release_label" WORKFLOW_LINKS=$workflow_links. ./create-issue.sh)
new_issue_url=$(RELEASE_LABEL="$release_label" WORKFLOW_LINKS="$(join_by ', ' ${workflow_links[@]})" . ./create-issue.sh)

echo "New ticket created: $new_issue_url"
14 changes: 14 additions & 0 deletions bin/release-check/plugin-product-compat-matrix.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"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]+"
}
}
Loading

0 comments on commit fe375d7

Please sign in to comment.