Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ wildfly:
message: Wrong content of the PR title
description: # 3
regexes:
- pattern: JIRA:\s+https://issues.redhat.com/browse/WFLY-\d+|https://issues.redhat.com/browse/WFLY-\d+
- pattern: JIRA:\s+https://redhat.atlassian.net/browse/WFLY-\d+|https://redhat.atlassian.net/browse/WFLY-\d+
message: The PR description must contain a link to the JIRA issue # 4
emails: # 5
- foo@bar.baz
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/wildfly/bot/model/RuntimeConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class RuntimeConstants {

public static final String BOT_JIRA_LINKS_HEADER = "Additional WildFly Issue Links Found:\n";

public static final String BOT_JIRA_LINK_TEMPLATE = "https://issues.redhat.com/browse/%1$s";
public static final String BOT_JIRA_LINK_TEMPLATE = "https://redhat.atlassian.net/browse/%1$s";

public static final String BOT_JIRA_LINK_COMMENT_TEMPLATE = String.format("* [%%1$s](%s)\n", BOT_JIRA_LINK_TEMPLATE);

Expand Down
38 changes: 19 additions & 19 deletions src/test/java/org/wildfly/bot/PRAppendingMessageTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ void testBodyContainingSomeJirasAppendMessageMultipleDifferentLinks() throws Thr
should not be

cleared.
Here is one jira for you https://issues.redhat.com/browse/WFLY-00002
and here is another one https://issues.redhat.com/browse/WFLY-00003
Here is one jira for you https://redhat.atlassian.net/browse/WFLY-00002
and here is another one https://redhat.atlassian.net/browse/WFLY-00003
""";

final String expectedDescriptionToBeChangedByBot = constructFullDescription(userBodySection,
Expand Down Expand Up @@ -164,9 +164,9 @@ void testBodyContainingAllJirasAppendMessageMultipleDifferentLinks() throws Thro
cleared.

Listing all jiras:
https://issues.redhat.com/browse/WFLY-00001
https://issues.redhat.com/browse/WFLY-00002
https://issues.redhat.com/browse/WFLY-00003
https://redhat.atlassian.net/browse/WFLY-00001
https://redhat.atlassian.net/browse/WFLY-00002
https://redhat.atlassian.net/browse/WFLY-00003
""";

pullRequestJson = TestModel.setPullRequestJsonBuilder(pullRequestJsonBuilder -> pullRequestJsonBuilder
Expand All @@ -189,7 +189,7 @@ void testBodyContainingAllJirasAppendMessageMultipleDifferentLinks() throws Thro
void testBotChangingBotSectionUponUserCorrectedSomeIssueLinks() throws Throwable {
final String userBodySection = """
This user body section has been corrected and here is the issue link:
https://issues.redhat.com/browse/WFLY-00002
https://redhat.atlassian.net/browse/WFLY-00002
""";
final String descriptionToBeChangedByBot = constructFullDescription(userBodySection,
List.of("WFLY-00000", "WFLY-00001", "WFLY-00002",
Expand Down Expand Up @@ -220,14 +220,14 @@ void testBotChangingBotSectionUponUserCorrectedSomeIssueLinks() throws Throwable
void testBotDeletingBotSectionUponUserCorrectedIssueLinks() throws Throwable {
final String userBodySection = """
This user body section has been corrected and here are the issue links:
https://issues.redhat.com/browse/WFLY-00000
https://issues.redhat.com/browse/WFLY-00001
https://redhat.atlassian.net/browse/WFLY-00000
https://redhat.atlassian.net/browse/WFLY-00001

____

https://issues.redhat.com/browse/WFLY-00002
https://issues.redhat.com/browse/WFLY-00003
https://issues.redhat.com/browse/WFLY-00004
https://redhat.atlassian.net/browse/WFLY-00002
https://redhat.atlassian.net/browse/WFLY-00003
https://redhat.atlassian.net/browse/WFLY-00004
""";
final String descriptionToBeChangedByBot = constructFullDescription(userBodySection,
List.of("WFLY-00000", "WFLY-00001", "WFLY-00002",
Expand Down Expand Up @@ -258,8 +258,8 @@ void testBotDeletingBotSectionUponUserCorrectedIssueLinks() throws Throwable {
void testEditingTitleToContainMissingIssueLink() throws Throwable {
final String userBodySection = """
This is my user section body with WFLY-00000 and WFLY-00001 issue links.
https://issues.redhat.com/browse/WFLY-00001
https://issues.redhat.com/browse/WFLY-00002
https://redhat.atlassian.net/browse/WFLY-00001
https://redhat.atlassian.net/browse/WFLY-00002
""";

final String originalBodyBeforeTheEdit = constructFullDescription(userBodySection, List.of("WFLY-00003"));
Expand Down Expand Up @@ -333,21 +333,21 @@ void testDescriptionIsModifiedByBotIfBotSectionIsIncorrect() throws Throwable {
@Test
void testNonBreakingChangesWithThePreviousAppendMessageFormat() throws Throwable {
final String oldBody = """
https://issues.redhat.com/browse/WFLY-20743
https://redhat.atlassian.net/browse/WFLY-20743

____

<--- THIS SECTION IS AUTOMATICALLY GENERATED BY WILDFLY GITHUB BOT. ANY MANUAL CHANGES WILL BE LOST. --->

> WildFly issue links:

> * [WFLY-20730] (https://issues.redhat.com/browse/WFLY-20730)
> * [WFLY-20730] (https://redhat.atlassian.net/browse/WFLY-20730)

<--- END OF WILDFLY GITHUB BOT REPORT --->

More information about the [wildfly-bot](https://github.com/wildfly/wildfly-bot)""";

final String expectedNewBody = constructFullDescription("https://issues.redhat.com/browse/WFLY-20743",
final String expectedNewBody = constructFullDescription("https://redhat.atlassian.net/browse/WFLY-20743",
List.of("WFLY-20730"));

pullRequestJson = TestModel.setPullRequestJsonBuilder(pullRequestJsonBuilder -> pullRequestJsonBuilder
Expand Down Expand Up @@ -405,7 +405,7 @@ void testSequencedCommitsWithoutUserManualyEditingDescription() throws Throwable
void testBotChangingBotSectionUponUserFixupsCommitWithMissingIssueLink() throws Throwable {
final String userBodySection = """
This is my user section body with one WFLY issue link:
https://issues.redhat.com/browse/WFLY-00001
https://redhat.atlassian.net/browse/WFLY-00001
""";

final String fullDescriptionBeforeTheFixup = constructFullDescription(userBodySection, List.of("WFLY-00002"));
Expand Down Expand Up @@ -444,8 +444,8 @@ void testBotChangingBotSectionUponUserFixupsCommitWithMissingIssueLink() throws
void testBotChangingBotSectionUponUserRewordingCommit() throws Throwable {
final String userBodySection = """
This is my user section body with two WFLY issue links:
https://issues.redhat.com/browse/WFLY-00001
https://issues.redhat.com/browse/WFLY-00003
https://redhat.atlassian.net/browse/WFLY-00001
https://redhat.atlassian.net/browse/WFLY-00003
""";
final String fullDescriptionBeforeTheReword = constructFullDescription(userBodySection, List.of("WFLY-00002"));

Expand Down
6 changes: 3 additions & 3 deletions src/test/java/org/wildfly/bot/PRChecksTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ void testAllChecksPass() throws Throwable {
title: "Title"
notify: [Tadpole]
- id: "Description"
body: "issues.redhat.com"
body: "redhat.atlassian.net"
notify: [Butterfly]
format:
description:
regexes:
- pattern: "JIRA:\\\\s+https://issues.redhat.com/browse/WFLY-\\\\d+|https://issues.redhat.com/browse/WFLY-\\\\d+"
- pattern: "JIRA:\\\\s+https://redhat.atlassian.net/browse/WFLY-\\\\d+|https://redhat.atlassian.net/browse/WFLY-\\\\d+"
message: "The PR description must contain a link to the JIRA issue"
""";
pullRequestJson = TestModel.getPullRequestJson();
Expand Down Expand Up @@ -99,7 +99,7 @@ void testAllChecksFail() throws Throwable {
format:
description:
regexes:
- pattern: "JIRA:\\\\s+https://issues.redhat.com/browse/WFLY-\\\\d+|https://issues.redhat.com/browse/WFLY-\\\\d+"
- pattern: "JIRA:\\\\s+https://redhat.atlassian.net/browse/WFLY-\\\\d+|https://redhat.atlassian.net/browse/WFLY-\\\\d+"
message: "The PR description must contain a link to the JIRA issue"
""";
pullRequestJson = TestModel.setPullRequestJsonBuilder(
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/org/wildfly/bot/PRDependabotTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void testDependabotOnPREdited() throws Throwable {
format:
description:
regexes:
- pattern: "https://issues.redhat.com/browse/WFLY-\\\\d+"
- pattern: "https://redhat.atlassian.net/browse/WFLY-\\\\d+"
message: "The PR description must contain a link to the JIRA issue"
""";

Expand Down Expand Up @@ -81,7 +81,7 @@ void testDependabotFormatCheckSkipOnPROpened() throws Throwable {
format:
description:
regexes:
- pattern: "https://issues.redhat.com/browse/WFLY-\\\\d+"
- pattern: "https://redhat.atlassian.net/browse/WFLY-\\\\d+"
""";

pullRequestJson = TestModel.setPullRequestJsonBuilder(pullRequestJsonBuilder -> pullRequestJsonBuilder
Expand Down
24 changes: 12 additions & 12 deletions src/test/java/org/wildfly/bot/PRDescriptionCheckTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void testDescriptionCheckFail() throws Throwable {
description:
message: Default fail message
regexes:
- pattern: "https://issues.redhat.com/browse/WFLY-\\\\d+"
- pattern: "https://redhat.atlassian.net/browse/WFLY-\\\\d+"
message: "The PR description must contain a link to the JIRA issue"
""";

Expand All @@ -75,7 +75,7 @@ void testNoMessageInConfigFile() throws Throwable {
format:
description:
regexes:
- pattern: "https://issues.redhat.com/browse/WFLY-\\\\d+"
- pattern: "https://redhat.atlassian.net/browse/WFLY-\\\\d+"
""";

pullRequestJson = TestModel.setPullRequestJsonBuilder(
Expand All @@ -99,7 +99,7 @@ void testDescriptionCheckSuccess() throws Throwable {
description:
message: Default fail message
regexes:
- pattern: "https://issues.redhat.com/browse/WFLY-\\\\d+"
- pattern: "https://redhat.atlassian.net/browse/WFLY-\\\\d+"
message: "The PR description must contain a link to the JIRA issue"
""";

Expand Down Expand Up @@ -139,14 +139,14 @@ void testMultipleLineDescription() throws Throwable {
description:
message: Default fail message
regexes:
- pattern: "https://issues.redhat.com/browse/WFLY-\\\\d+"
- pattern: "https://redhat.atlassian.net/browse/WFLY-\\\\d+"
message: "The PR description must contain a link to the JIRA issue"
""";

pullRequestJson = TestModel.setPullRequestJsonBuilder(pullRequestJsonBuilder -> pullRequestJsonBuilder
.description("""
First line of description
Additional line of description - JIRA: https://issues.redhat.com/browse/WFLY-666
Additional line of description - JIRA: https://redhat.atlassian.net/browse/WFLY-666
Another line with no JIRA link
"""));

Expand All @@ -166,7 +166,7 @@ void testMultipleRegexesFirstPatternHit() throws Throwable {
description:
message: Default fail message
regexes:
- pattern: "https://issues.redhat.com/browse/WFLY-\\\\d+"
- pattern: "https://redhat.atlassian.net/browse/WFLY-\\\\d+"
message: "The PR description must contain a link to the JIRA issue"
- pattern: "JIRA"
""";
Expand All @@ -192,13 +192,13 @@ void testMultipleRegexesSecondPatternHit() throws Throwable {
description:
message: Lorem ipsum dolor sit amet
regexes:
- pattern: "https://issues.redhat.com/browse/WFLY-\\\\d+"
- pattern: "https://redhat.atlassian.net/browse/WFLY-\\\\d+"
message: "The PR description must contain a link to the JIRA issue"
- pattern: "JIRA"
""";

pullRequestJson = TestModel.setPullRequestJsonBuilder(
pullRequestJsonBuilder -> pullRequestJsonBuilder.description("https://issues.redhat.com/browse/WFLY-123"));
pullRequestJsonBuilder -> pullRequestJsonBuilder.description("https://redhat.atlassian.net/browse/WFLY-123"));

TestModel.given(mocks -> WildflyGitHubBotTesting.mockRepo(mocks, wildflyConfigFile, pullRequestJson))
.pullRequestEvent(pullRequestJson)
Expand All @@ -218,7 +218,7 @@ void testMultipleRegexesAllPatternsHit() throws Throwable {
description:
message: Default fail message
regexes:
- pattern: "https://issues.redhat.com/browse/WFLY-\\\\d+"
- pattern: "https://redhat.atlassian.net/browse/WFLY-\\\\d+"
message: "The PR description must contain a link to the JIRA issue"
- pattern: "JIRA"
""";
Expand All @@ -244,7 +244,7 @@ void testMultipleRegexesNoPatternsHit() throws Throwable {
description:
message: Default fail message
regexes:
- pattern: "https://issues.redhat.com/browse/WFLY-\\\\d+"
- pattern: "https://redhat.atlassian.net/browse/WFLY-\\\\d+"
message: "The PR description must contain a link to the JIRA issue"
- pattern: "JIRA"
""";
Expand All @@ -268,7 +268,7 @@ public void testDisableGlobalFormatCheck() throws Throwable {
description:
message: Default fail message
regexes:
- pattern: "https://issues.redhat.com/browse/WFLY-\\\\d+"
- pattern: "https://redhat.atlassian.net/browse/WFLY-\\\\d+"
message: "The PR description must contain a link to the JIRA issue"
- pattern: "JIRA"
""";
Expand All @@ -292,7 +292,7 @@ void testPREmptyBody() throws Throwable {
format:
description:
regexes:
- pattern: "https://issues.redhat.com/browse/WFLY-\\\\d+"
- pattern: "https://redhat.atlassian.net/browse/WFLY-\\\\d+"
""";

pullRequestJson = TestModel.setPullRequestJsonBuilder(pullRequestJsonBuilder -> pullRequestJsonBuilder
Expand Down
6 changes: 3 additions & 3 deletions src/test/java/org/wildfly/bot/PRRuleDescriptionCheckTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void testSuccessfulBodyCheck() throws Throwable {
wildfly:
rules:
- id: "Description"
body: "issues.redhat.com"
body: "redhat.atlassian.net"
notify: [Tadpole]
""";

Expand All @@ -56,7 +56,7 @@ void testFailedBodyCheck() throws Throwable {
wildfly:
rules:
- id: "Description"
body: "issues.redhat.com"
body: "redhat.atlassian.net"
notify: [Tadpole]
""";

Expand All @@ -77,7 +77,7 @@ void testTitleBodyCheckForBodyCaseInsensitive() throws Throwable {
wildfly:
rules:
- id: "Description"
body: "ISSUES.REDHAT.COM"
body: "REDHAT.ATLASSIAN.NET"
notify: [Tadpole]
""";

Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/wildfly/bot/PRRuleNotifyTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ void testMentionsCCCommentForDuplicateMentions() throws Throwable {
title: "Title"
notify: [Tadpole,Duke]
- id: "Description"
body: "issues.redhat.com"
body: "redhat.atlassian.net"
notify: [Tadpole,Doggo]
""";

Expand Down
4 changes: 2 additions & 2 deletions src/test/java/org/wildfly/bot/PRRuleTitleBodyCheckTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void testTitleBodyCheckForBody() throws Throwable {
- id: "TitleBody"
title: "NonTitle"
body: "NonBody"
titleBody: "issues.redhat.com"
titleBody: "redhat.atlassian.net"
notify: [Tadpole]
""";

Expand All @@ -83,7 +83,7 @@ void testTitleBodyCheckForTitleBodyCaseInsensitive() throws Throwable {
- id: "TitleBody"
title: "NonTitle"
body: "NonBody"
titleBody: "ISSUES.REDHAT.COM"
titleBody: "REDHAT.ATLASSIAN.NET"
notify: [Tadpole]
""";

Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/events/raw_pr_review_template.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"type": "User",
"site_admin": false
},
"body": "JIRA: https://issues.redhat.com/browse/WFLY-123",
"body": "JIRA: https://redhat.atlassian.net/browse/WFLY-123",
"created_at": "2024-04-09T12:27:12Z",
"updated_at": "2024-04-22T09:17:41Z",
"closed_at": null,
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/events/raw_pr_template.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"type": "User",
"site_admin": false
},
"body": "JIRA: https://issues.redhat.com/browse/WFLY-123",
"body": "JIRA: https://redhat.atlassian.net/browse/WFLY-123",
"created_at": "2024-04-25T07:00:40Z",
"updated_at": "2024-04-25T07:00:40Z",
"closed_at": null,
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/webhooks/valid-pr-review-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"type": "User",
"site_admin": false
},
"body": "JIRA: https://issues.redhat.com/browse/WFLY-123",
"body": "JIRA: https://redhat.atlassian.net/browse/WFLY-123",
"created_at": "2023-08-14T07:46:48Z",
"updated_at": "2023-09-05T11:59:00Z",
"closed_at": null,
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/webhooks/valid-pr-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"type": "User",
"site_admin": false
},
"body": "JIRA: https://issues.redhat.com/browse/WFLY-123",
"body": "JIRA: https://redhat.atlassian.net/browse/WFLY-123",
"created_at": "2023-05-31T07:51:01Z",
"updated_at": "2023-05-31T07:51:01Z",
"closed_at": null,
Expand Down
2 changes: 1 addition & 1 deletion wildfly-bot-config-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ wildfly:

description:
regexes: # List of objects, where the object is as follows:
- pattern: "JIRA:\\s+https://issues.redhat.com/browse/WFLY-\\d+|https://issues.redhat.com/browse/WFLY-\\d+" # Regex pattern must be matched by the title
- pattern: "JIRA:\\s+https://redhat.atlassian.net/browse/WFLY-\\d+|https://redhat.atlassian.net/browse/WFLY-\\d+" # Regex pattern must be matched by the title
message: "The PR description must contain a link to the JIRA issue" # Message to display if check does not succeed
message: "The PR description is not correct" # Default message to display if a object is missing message field

Expand Down