Skip to content

Commit

Permalink
Merge pull request #310 from azarouski/bitb
Browse files Browse the repository at this point in the history
Bitbucket onPush and onPR jobs fix
  • Loading branch information
vdelendik authored Jun 20, 2023
2 parents d0391cd + 623a74a commit 95d7a5c
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public class PullRequestJobFactory extends PipelineFactory {
printContributedVariables(isLogLevelActive(Logger.LogLevel.DEBUG))
printPostContent(isLogLevelActive(Logger.LogLevel.DEBUG))
silentResponse(false)
regexpFilterText(String.format(webHookArgs.prFilterText, resolveUrl(this.repoUrl)))
regexpFilterText(String.format(webHookArgs.prFilterText, this.repoUrl))
regexpFilterExpression(String.format(webHookArgs.prFilterExpression, this.repoUrl))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,19 +74,18 @@ public class PushJobFactory extends PipelineFactory {
regexpFilter("")
}
}

def webhookTokenCreds = "${this.webHookArgs.scmType}-webhook-token"
if (this.organization != null && !this.organization.isEmpty()) {
webhookTokenCreds = "${this.organization}-${this.webHookArgs.scmType}-webhook-token"
}

tokenCredentialId(webhookTokenCreds)
printContributedVariables(isLogLevelActive(Logger.LogLevel.DEBUG))
printPostContent(isLogLevelActive(Logger.LogLevel.DEBUG))
silentResponse(false)
regexpFilterText(String.format(webHookArgs.pushFilterText, resolveUrl(this.repoUrl)))
regexpFilterExpression("bitbucket".equals(webHookArgs.scmType) ? String.format(webHookArgs.pushFilterExpression, repoUrl.split("/")[3] + "/" + repoUrl.split("/")[4].replace(".git", "")) : String.format(webHookArgs.pushFilterExpression, this.branch, this.repoUrl))
}
regexpFilterExpression("bitbucket".equals(webHookArgs.scmType) ? String.format(webHookArgs.pushFilterExpression, this.branch, repoUrl.split("/")[3] + "/" + repoUrl.split("/")[4].replace(".git", "")) : String.format(webHookArgs.pushFilterExpression, this.branch, this.repoUrl)) }
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class BitBucket extends Scm {
enum HookArgs {
GIT_TYPE("scmType", "bitbucket"),
HEADER_EVENT_NAME("eventName", "x-event-key"),
SSH_RUL("sshUrl", ""),
SSH_URL("sshUrl", ""),
HTTP_URL("httpUrl", "\$.repository.full_name"),

PR_ACTION("prAction", ""),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class GitHub extends Scm {

enum HookArgs {
GIT_TYPE("scmType", "github"),
SSH_RUL("sshUrl", "\$.repository.ssh_url"),
SSH_URL("sshUrl", "\$.repository.ssh_url"),
HTTP_URL("httpUrl", "\$.repository.clone_url"),
HEADER_EVENT_NAME("eventName", "x-github-event"),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Gitlab extends Scm {

enum HookArgs {
GIT_TYPE("scmType", "gitlab"),
SSH_RUL("sshUrl", "\$.project.ssh_url"),
SSH_URL("sshUrl", "\$.project.ssh_url"),
HTTP_URL("httpUrl", "\$.project.http_url"),
HEADER_EVENT_NAME("eventName", "x-gitlab-event"),

Expand Down

0 comments on commit 95d7a5c

Please sign in to comment.