Skip to content

Commit

Permalink
Merge pull request #411 from atlassian-labs/dev
Browse files Browse the repository at this point in the history
Forward merge to master
  • Loading branch information
yevhenhr authored Sep 9, 2024
2 parents 8dba978 + 7d24faf commit 1f54e53
Show file tree
Hide file tree
Showing 25 changed files with 96 additions and 80 deletions.
13 changes: 6 additions & 7 deletions .github/workflows/all-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
if: "(github.event.inputs.jobs == '' || contains(github.event.inputs.jobs, 'unit-tests')) && !contains(github.event.head_commit.message, '[skip ci]')"
strategy:
matrix:
java-version: [17]
java-version: [17, 21]
fail-fast: false
steps:
- uses: actions/checkout@v4
Expand All @@ -58,12 +58,11 @@ jobs:
name: Jira
runs-on: ubuntu-20.04
timeout-minutes: 30
# Disabled until Jira version is available
if: (github.event.inputs.jobs == '' || contains(github.event.inputs.jobs, 'integration-tests-jira')) && false
if: github.event.inputs.jobs == '' || contains(github.event.inputs.jobs, 'integration-tests-jira')
needs: unit-tests
strategy:
matrix:
java-version: [17]
java-version: [17, 21]
jira-version: [10.0.0]
fail-fast: false
steps:
Expand Down Expand Up @@ -102,8 +101,8 @@ jobs:
strategy:
matrix:
# every version part should be 0 <= <version> <= 255; otherwise Confluence fails to start
java-version: [17]
confluence-version: [9.0.0-rc2]
java-version: [17, 21]
confluence-version: [9.0.1]
fail-fast: false
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -141,7 +140,7 @@ jobs:
strategy:
matrix:
java-version: [17]
bitbucket-version: [9.0.0-eap09]
bitbucket-version: [9.0.0]
fail-fast: false
steps:
- uses: actions/checkout@v4
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ Links to the official documentation are specified on Marketplace pages.
Supported products. See [EOL policy](https://confluence.atlassian.com/support/atlassian-support-end-of-life-policy-201851003.html).
* `master`/`dev` branch
* Jira: 10+ (not released yet) on JDK 17.
* Confluence: 9+ (not released yet) on JDK 17.
* Bitbucket: 9+ (not released yet) on JDK 17.
* Confluence: 9+ on JDK 17.
* Bitbucket: 9+ on JDK 17.

* `release-1.x` branch
* Jira: 8.15.0 (EOL date: 2 Feb 2023) JDK 8, 11 - 9.5.0 (EOL date: 6 Dec 2024) on JDK 8, 11, 17.
Expand Down Expand Up @@ -138,12 +138,12 @@ See [all-tests.yml](.github/workflows/all-tests.yml) for more details. A specifi
Note: all integration test jobs in default workflow (`all-tests.yml`) are dependent on unit tests, so to run integration tests
for specific product pass the respective job's name along with `unit-test` to `jobs` parameter. For example: `unit-tests,integration-tests-jira-8`.

Integration tests for arbitrary verions of the the product and JVM may be run manually using
Integration tests for arbitrary versions of the product and JVM may be run manually using
[jira-int-tests.yml](.github/workflows/jira-int-tests.yml), [confluence-int-tests.yml](.github/workflows/confluence-int-tests.yml)
and [bitbucket-int-tests.yml](.github/workflows/bitbucket-int-tests.yml).

## Releasing
Release workflow allows to publish new releases to [Atlassian Artifactory](https://packages.atlassian.com/).
Release workflow allows to publish new releases to [GitHub Packages](https://github.com/orgs/atlassian-labs/packages?repo_name=atlassian-slack-integration-server).
This action should be usually be run by repo maintainer only. See workflow configuration in [release.yml](.github/workflows/release.yml).

# Contributions
Expand Down
19 changes: 0 additions & 19 deletions bin/build/prepare-matrices.sh

This file was deleted.

3 changes: 0 additions & 3 deletions bin/build/run-confluence-its.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ if [[ ${XVFB_ENABLE} != false ]] ; then
export DISPLAY=:20
fi

# TODO: Remove -Denforcer.skip=true after moving from milestone versions

atlas-mvn --batch-mode verify \
${VERSION_ARG} \
-Dut.test.skip=true \
Expand All @@ -20,6 +18,5 @@ atlas-mvn --batch-mode verify \
-Dfailsafe.rerunFailingTestsCount=${RETRY_COUNT:-2} \
-Dfailsafe.forkedProcessExitTimeoutInSeconds=360 \
-Dfailsafe.exitTimeout=360 \
-Denforcer.skip=true \
-pl confluence-slack-integration/confluence-slack-server-integration-plugin \
"$@"
4 changes: 1 addition & 3 deletions bin/build/run-unit-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,5 @@
set -ex
trap 'set +ex' EXIT

# TODO: Remove -Denforcer.skip=true after moving from milestone versions

atlas-version
atlas-mvn --batch-mode verify -P jacoco -Denforcer.skip=true
atlas-mvn --batch-mode verify -P jacoco
24 changes: 21 additions & 3 deletions bin/release-check/check-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,30 @@ esac
echo "Determined workflow name: $workflow_name"

# RUN TESTS AGAINST SPECIFIC VERSIONS
workflow_links=()
# Bitbucket 9+ does not support Java 21
if [ $product_type != "bitbucket" ]; then
echo "Running workflow with params: workflow-name=$workflow_name java-version=21 product-version=$product_version"
first_workflow_link=$(start_workflow $workflow_name 21 $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=17 product-version=$product_version"
workflow_link=$(start_workflow $workflow_name 17 $product_version)
echo "Pipeline URL: $workflow_link"
second_workflow_link=$(start_workflow $workflow_name 17 $product_version)
echo "Pipeline URL: $second_workflow_link"
workflow_links+=("$second_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_link" . ./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"
2 changes: 1 addition & 1 deletion bin/release-check/find-latest-releases.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pac_search_query="https://packages.atlassian.com/maven/${GROUP}/${ARTIFACT}/mave
search_response=$(curl -s "${pac_search_query}")

# PARSE RESPONSE AND GET AN ARRAY OF VERSIONS THAT CONTAIN ONLY NUMBERS (EXCLUDES SNAPSHOTS AND MILESTONE RELEASES)
latest_releases=$(echo "$search_response" | grep -oE '<version>[0-9][0-9]?\.[0-9]+\.[0-9]+</version>' | grep -oE '[0-9]\.[0-9]+\.[0-9]+')
latest_releases=$(echo "$search_response" | grep -oE '<version>[0-9][0-9]?\.[0-9]+\.[0-9]+</version>' | grep -oE '[0-9][0-9]?\.[0-9]+\.[0-9]+')

echo "$latest_releases"

Expand Down
3 changes: 0 additions & 3 deletions bin/run-bitbucket.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,12 @@ trap 'set +ex' EXIT
BB_NGROK="$(curl -s "http://127.0.0.1:4040/api/tunnels" | \
jq -r '.tunnels[] | select(.proto == "https") | select (.config.addr|endswith("'"7990"'")) | .public_url[8:]')"

# TODO: Remove -Denforcer.skip=true after moving from milestone versions

(
cd "$( dirname "${BASH_SOURCE[0]}")/.." ;

# set env var BB_NGROK to enable HTTPS

atlas-mvn bitbucket:debug \
-Denforcer.skip=true \
-Datlassian.dev.mode=true \
-Dmaven.test.skip=true \
-Dlogging.level.com.atlassian.bitbucket.plugins.slack=TRACE \
Expand Down
3 changes: 0 additions & 3 deletions bin/run-confluence.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
#!/usr/bin/env bash

# TODO: Remove -Denforcer.skip=true after moving from milestone versions

(
cd "$( dirname "${BASH_SOURCE[0]}")/.." ;
atlas-mvn confluence:debug \
-Denforcer.skip=true \
-Datlassian.dev.mode=true \
-Dmaven.test.skip=true \
"$@" \
Expand Down
21 changes: 14 additions & 7 deletions bitbucket-slack-server-integration-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,11 @@
<!-- product properties -->
<plugin.key>${project.groupId}.${project.artifactId}</plugin.key>
<!-- TODO: 9.0.0 bitbucket-rest-api and bitbucket-rest-model are not available yet-->
<bitbucket.api.version>9.0.0-eap09</bitbucket.api.version>
<bitbucket.version>9.0.0-eap09</bitbucket.version>
<bitbucket.rest.api.version>9.0.0-eap09</bitbucket.rest.api.version>
<bitbucket.api.version>9.0.0</bitbucket.api.version>
<bitbucket.version>9.0.0</bitbucket.version>
<bitbucket.data.version>${bitbucket.version}</bitbucket.data.version>
<bitbucket.amps.version>8.16.1</bitbucket.amps.version>
<bitbucket.amps.version>9.0.4</bitbucket.amps.version>
<platform.version>7.0.5</platform.version>
</properties>

Expand Down Expand Up @@ -127,13 +128,13 @@
<dependency>
<groupId>com.atlassian.bitbucket.server</groupId>
<artifactId>bitbucket-rest-api</artifactId>
<version>${bitbucket.api.version}</version>
<version>${bitbucket.rest.api.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.atlassian.bitbucket.server</groupId>
<artifactId>bitbucket-rest-model</artifactId>
<version>${bitbucket.api.version}</version>
<version>${bitbucket.rest.api.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -293,7 +294,7 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.24</version>
<version>1.18.30</version>
<scope>provided</scope>
</dependency>

Expand Down Expand Up @@ -338,6 +339,12 @@
<version>${mockito-core.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
<version>1.14.18</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
Expand Down Expand Up @@ -600,7 +607,7 @@
<profile>
<id>jvm17</id>
<activation>
<jdk>17</jdk>
<jdk>[17,)</jdk>
</activation>
<properties>
<!-- Needed to start Bitbucket on JDK 17 -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
<project.root.directory>${project.basedir}/..</project.root.directory>

<!-- version of Confluence libraries used to compile plugin code -->
<confluence.api.version>9.0.0-rc2</confluence.api.version>
<confluence.api.version>9.0.1</confluence.api.version>

<!-- version of Confluence used in integration tests -->
<confluence.version>9.0.0-rc2</confluence.version>
<confluence.version>9.0.1</confluence.version>
<confluence.data.version>${confluence.version}</confluence.data.version>

<confluence.amps.version>8.9.2</confluence.amps.version>
<confluence.amps.version>9.0.4</confluence.amps.version>
<jvm17.opens />
</properties>

Expand Down Expand Up @@ -326,6 +326,11 @@
<forceUpdateCheck>false</forceUpdateCheck>
<skipAllPrompts>true</skipAllPrompts>

<banningExcludes>
<exclude>com.atlassian.security:atlassian-secure-random</exclude>
<exclude>com.google.code.gson:gson</exclude>
</banningExcludes>

<!-- Custom logging config to show logs from plugin classes by default -->
<log4jProperties>src/main/resources/log4j.properties</log4jProperties>
<forceUpdateCheck>false</forceUpdateCheck>
Expand Down Expand Up @@ -559,7 +564,7 @@
<profile>
<id>jvm17</id>
<activation>
<jdk>17</jdk>
<jdk>[17,)</jdk>
</activation>
<properties>
<!-- Needed to start Confluence 8 on JDK 17 -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,10 @@ public void getSlackPrettyTime_shouldReturnExpectedValue() {
when(localeManager.getSiteDefaultLocale()).thenReturn(Locale.ENGLISH);
when(timeZoneManager.getDefaultTimeZone()).thenReturn(TimeZone.getTimeZone("America/Chicago"));

String result = target.getSlackPrettyTime(1551985533000L);
// `DateTimeFormatter` whitespace separator may change among JDKs
// Since `equals` method compares each character by its ascii value for equality,
// horizontal whitespace character (\\h) is replaced with a space for consistency
String result = target.getSlackPrettyTime(1551985533000L).replaceAll("\\h", " ");

assertThat(result, is("<!date^" + (1551985533L) + "^{time}|1:05 PM>"));
}
Expand Down
2 changes: 1 addition & 1 deletion jira-slack-server-integration/jira-8-compat/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
<version>1.11.22</version>
<version>1.14.18</version>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,12 @@
<!-- Give Java more heap to make Jira faster -->
<jvmArgs>${jvm17.opens} -Xmx2g</jvmArgs>

<banningExcludes>
<exclude>com.atlassian.security:atlassian-secure-random</exclude>
<exclude>commons-codec:commons-codec</exclude>
<exclude>com.google.code.gson:gson</exclude>
</banningExcludes>

<pluginArtifacts>
<pluginArtifact>
<groupId>com.atlassian.jira</groupId>
Expand Down Expand Up @@ -640,7 +646,7 @@
</build>

<properties>
<jira.amps.version>8.10.4</jira.amps.version>
<jira.amps.version>9.0.3</jira.amps.version>
<project.root.directory>${project.basedir}/../..</project.root.directory>
<maven.build.timestamp.format>yyyy-MM-dd'T'HH:mm:ss.SSSZ</maven.build.timestamp.format>
<build.timestamp>${maven.build.timestamp}</build.timestamp>
Expand All @@ -651,7 +657,7 @@
<profile>
<id>jvm17</id>
<activation>
<jdk>17</jdk>
<jdk>[17,)</jdk>
</activation>
<properties>
<!-- Needed to start Jira on JDK 17 -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ private String getProjectsFieldHtml() {
.build();

// We pass new JiraWebActionSupport() so the template has access to i18n
final JiraWebActionSupport fakeAction = new JiraWebActionSupport();
final JiraWebActionSupport fakeAction = new JiraWebActionSupport() {};
ActionContext.getValueStack().pushValue(fakeAction);
return projectField.getCreateHtml(null, operationContext, fakeAction, null, displayParameters);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.atlassian.jira.plugins.slack.web.panels;

import com.atlassian.plugin.web.model.WebPanel;
import com.atlassian.plugin.web.api.model.WebPanel;
import com.atlassian.webresource.api.assembler.PageBuilderService;

import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -790,4 +790,9 @@
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
</servlet-filter>

<velocity-allowlist key="velocity-allowlist-slack-plugin">
<method>com.atlassian.jira.plugins.slack.spi.impl.JiraSlackPluginResourceProvider#getPluginKey()</method>
</velocity-allowlist>

</atlassian-plugin>
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
import static org.mockito.Mockito.when;

@PrepareForTest({JqlIssueFilter.class, JqlQueryBuilder.class})
@PowerMockIgnore("javax.*")
@PowerMockIgnore({"javax.*", "org.xml.*", "org.w3c.*"})
@RunWith(PowerMockRunner.class)
public class JqlIssueFilterTest {
@Mock
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.mockito.junit.MockitoJUnit;
import org.mockito.junit.MockitoRule;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;

Expand All @@ -35,6 +36,7 @@
import static org.junit.Assert.assertThat;

@PrepareForTest({DefaultTaskBuilder.class, SendNotificationTask.class})
@PowerMockIgnore({"javax.*", "org.xml.*", "org.w3c.*"})
@RunWith(PowerMockRunner.class)
public class DefaultTaskBuilderTest {
@Mock
Expand Down
Loading

0 comments on commit 1f54e53

Please sign in to comment.