Skip to content

Commit

Permalink
fix: add PR validation to Jenkinsfile
Browse files Browse the repository at this point in the history
Semver: patch
Ref: LOG-7717
  • Loading branch information
ligerzero459 committed Oct 28, 2020
1 parent 6c535da commit 157194e
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
library 'magic-butler-catalogue'

def PROJECT_NAME = "tail-file-node"
def repo = "logdna/${PROJECT_NAME}"
def REPO = "logdna/${PROJECT_NAME}"
def TRIGGER_PATTERN = ".*@logdnabot.*"

pipeline {
agent none
Expand All @@ -11,7 +12,23 @@ pipeline {
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 @@ -108,7 +125,8 @@ pipeline {
versioner(
token: "${GITHUB_PACKAGES_TOKEN}"
, dry: true
, repo: repo
, repo: REPO
, branch: "master"
)
}
}
Expand Down Expand Up @@ -142,8 +160,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 157194e

Please sign in to comment.