Skip to content

Commit

Permalink
fix: add PR source validation to Jenkinsfile
Browse files Browse the repository at this point in the history
Semver: patch
Ref: LOG-7713
  • Loading branch information
mdeltito committed Oct 27, 2020
1 parent e903ed0 commit fe8b166
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,29 @@
library 'magic-butler-catalogue'

def projectName = "logdna-winston"
def repo = "logdna/${projectName}"
def PROJECT_NAME = "logdna-winston"
def REPO = "logdna/${PROJECT_NAME}"
def TRIGGER_PATTERN = ".*@logdnabot.*"

pipeline {
agent none

options {
timestamps()
ansiColor 'xterm'
triggers {
issueCommentTrigger(TRIGGER_PATTERN)
}

stages {
stage('Validate PR Source') {
when {
expression { env.CHANGE_FORK }
not {
triggeredBy 'issueCommentCause'
}
}
steps {
error("A maintainer needs to approve this PR for CI by commenting")
}
}

stage('Test Suite') {
matrix {
axes {
Expand Down Expand Up @@ -107,7 +119,8 @@ pipeline {
versioner(
token: "${GITHUB_PACKAGES_TOKEN}"
, dry: true
, repo: repo
, repo: REPO
, branch: "master"
)
}
}
Expand Down Expand Up @@ -140,8 +153,9 @@ pipeline {
versioner(
token: "${GITHUB_PACKAGES_TOKEN}"
, dry: false
, repo: repo
, repo: REPO
, NPM_PUBLISH_TOKEN: "${NPM_PUBLISH_TOKEN}"
, branch: "master"
)
}
}
Expand Down

0 comments on commit fe8b166

Please sign in to comment.