diff --git a/pom.xml b/pom.xml
index 200311c2a..3f92fc964 100644
--- a/pom.xml
+++ b/pom.xml
@@ -482,7 +482,7 @@
integrations-sdk
com.hpe.adm.octane.ciplugins
- 2.24.3.1
+ 2.24.3.2
diff --git a/src/main/java/com/microfocus/application/automation/tools/octane/GitFetchUtils.java b/src/main/java/com/microfocus/application/automation/tools/octane/GitFetchUtils.java
index 25f705e7e..1f6816e8a 100644
--- a/src/main/java/com/microfocus/application/automation/tools/octane/GitFetchUtils.java
+++ b/src/main/java/com/microfocus/application/automation/tools/octane/GitFetchUtils.java
@@ -133,6 +133,18 @@ public static AuthenticationStrategy getAuthenticationStrategy(StandardCredentia
return authenticationStrategy;
}
+ public static String getCredentialsPassword(StandardCredentials credentials) {
+ if (credentials == null) {
+ return "";
+ } else if (credentials instanceof StringCredentials) {
+ return ((StringCredentials) credentials).getSecret().getPlainText();
+ } else if (credentials instanceof StandardUsernamePasswordCredentials) {
+ return ((StandardUsernamePasswordCredentials) credentials).getPassword().getPlainText();
+ } else {
+ return "";
+ }
+ }
+
public static void updateRepoTemplates(PullRequestAndBranchService pullRequestAndBranchService, FetchHandler fetcherHandler, String repoHttpUrlForTemplates, String repoUrlForOctane, Long workspaceId, Consumer logConsumer) {
//update repo templates
try {
diff --git a/src/main/java/com/microfocus/application/automation/tools/octane/branches/BranchesPublisher.java b/src/main/java/com/microfocus/application/automation/tools/octane/branches/BranchesPublisher.java
index 1b9f959a3..6eabb9d9b 100644
--- a/src/main/java/com/microfocus/application/automation/tools/octane/branches/BranchesPublisher.java
+++ b/src/main/java/com/microfocus/application/automation/tools/octane/branches/BranchesPublisher.java
@@ -145,7 +145,8 @@ public void performInternal(@Nonnull Run, ?> run, @Nonnull TaskListener taskLi
try {
//GET BRANCHES FROM CI SERVER
- FetchHandler fetchHandler = FetchFactory.getHandler(ScmTool.fromValue(myScmTool), authenticationStrategy);
+ String secret = GitFetchUtils.getCredentialsPassword(credentials);
+ FetchHandler fetchHandler = FetchFactory.getHandler(ScmTool.fromValue(myScmTool), authenticationStrategy, secret);
OctaneClient octaneClient = OctaneSDK.getClientByInstanceId(myConfigurationId);
logConsumer.printLog("ALM Octane " + octaneClient.getConfigurationService().getConfiguration().getLocationForLog() + ", workspace - " + myWorkspaceId);
@@ -211,6 +212,7 @@ private BranchFetchParameters createFetchParameters(@Nonnull Run, ?> run, @Non
fp.setPageSize(getIntegerValueParameter(parameterAction, "branches_page_size"));
fp.setActiveBranchDays(getIntegerValueParameter(parameterAction, "branches_active_branch_days"));
fp.setMaxBranchesToFill(getIntegerValueParameter(parameterAction, "branches_max_branches_to_fill"));
+ fp.setSearchBranchOctaneRootRepositoryId(getIntegerValueParameter(parameterAction, "search_branch_octane_root_repository_id"));
}
logConsumer.accept("Repository URL : " + fp.getRepoUrl());
diff --git a/src/main/java/com/microfocus/application/automation/tools/octane/pullrequests/PullRequestPublisher.java b/src/main/java/com/microfocus/application/automation/tools/octane/pullrequests/PullRequestPublisher.java
index 4aeba8c70..27b94d25e 100644
--- a/src/main/java/com/microfocus/application/automation/tools/octane/pullrequests/PullRequestPublisher.java
+++ b/src/main/java/com/microfocus/application/automation/tools/octane/pullrequests/PullRequestPublisher.java
@@ -145,7 +145,8 @@ public void performInternal(@Nonnull Run, ?> run, @Nonnull TaskListener taskLi
StandardCredentials credentials = GitFetchUtils.getCredentialsById(myCredentialsId, run, taskListener.getLogger());
AuthenticationStrategy authenticationStrategy = GitFetchUtils.getAuthenticationStrategy(credentials);
- FetchHandler fetchHandler = FetchFactory.getHandler(ScmTool.fromValue(myScmTool), authenticationStrategy);
+ String secret = GitFetchUtils.getCredentialsPassword(credentials);
+ FetchHandler fetchHandler = FetchFactory.getHandler(ScmTool.fromValue(myScmTool), authenticationStrategy, secret);
try {
OctaneClient octaneClient = OctaneSDK.getClientByInstanceId(myConfigurationId);
logConsumer.printLog("ALM Octane " + octaneClient.getConfigurationService().getConfiguration().getLocationForLog() + ", workspace - " + myWorkspaceId);
@@ -205,6 +206,7 @@ private PullRequestFetchParameters createFetchParameters(@Nonnull Run, ?> run,
fp.setMaxPRsToFetch(getIntegerValueParameter(parameterAction, "pullrequests_max_pr_to_collect"));
fp.setMaxCommitsToFetch(getIntegerValueParameter(parameterAction, "pullrequests_max_commits_to_collect"));
fp.setMinUpdateTime(getLongValueParameter(parameterAction, "pullrequests_min_update_time"));
+ fp.setSearchBranchOctaneRootRepositoryId(getIntegerValueParameter(parameterAction, "search_branch_octane_root_repository_id"));
}
if (fp.getMinUpdateTime() == PullRequestFetchParameters.DEFAULT_MIN_UPDATE_DATE) {
long lastUpdateTime = OctaneSDK.getClientByInstanceId(myConfigurationId).getPullRequestAndBranchService().getPullRequestLastUpdateTime(myWorkspaceId, fp.getRepoUrl());
diff --git a/src/main/resources/com/microfocus/application/automation/tools/octane/branches/BranchesPublisher/help.html b/src/main/resources/com/microfocus/application/automation/tools/octane/branches/BranchesPublisher/help.html
index 3ae11434f..78929442d 100644
--- a/src/main/resources/com/microfocus/application/automation/tools/octane/branches/BranchesPublisher/help.html
+++ b/src/main/resources/com/microfocus/application/automation/tools/octane/branches/BranchesPublisher/help.html
@@ -46,7 +46,8 @@
You can change the behaviour of this step by adding the following parameters to the job:
- branches_active_branch_days: Only active branches can be added/updated to ALM Octane. Default is 60 days.
- - branches_max_branches_to_fill: Relevant for GitHub repository only. Max branches to collect data. If data is not collected from a branch, it cannot be added to ALM Octane. Default is 1000.
+ - branches_max_branches_to_fill: Relevant for GitHub and GitLab repository only. Max branches to collect data. If data is not collected from a branch, it cannot be added to ALM Octane. Default is 1000.
+ - search_branch_octane_root_repository_id: The plugin will look through the branches that are linked to the SCM Repository with the configured Id. If a branch has the same name and Last commit revision as one of those branches, they will be considered as duplicates and new branches won't be created in ALM Octane.
diff --git a/src/main/resources/com/microfocus/application/automation/tools/octane/pullrequests/PullRequestPublisher/help.html b/src/main/resources/com/microfocus/application/automation/tools/octane/pullrequests/PullRequestPublisher/help.html
index 2a08d8f0a..be5f178e4 100644
--- a/src/main/resources/com/microfocus/application/automation/tools/octane/pullrequests/PullRequestPublisher/help.html
+++ b/src/main/resources/com/microfocus/application/automation/tools/octane/pullrequests/PullRequestPublisher/help.html
@@ -52,6 +52,7 @@
pullrequests_min_update_time: Use this parameter to override the last update time that is updated after each successful injection to ALM Octane.
pullrequests_max_pr_to_collect: Max number of pull requests to collect. Default is 100.
pullrequests_max_commits_to_collect: Max number of commits to collect for each pull request. Default is 100.
+ search_branch_octane_root_repository_id: The plugin will look through the branches that are linked to the SCM Repository with the configured Id. If a pull request has the source branch or target branch wit hte same name as one of those branches, they will be considered as duplicates and new branches won't be created in ALM Octane.