Skip to content
This repository was archived by the owner on Feb 6, 2025. It is now read-only.

Commit

Permalink
Set CI label from PR
Browse files Browse the repository at this point in the history
Retrive ci-label's from PR and set them as worker
labels for the PR execution.

Signed-off-by: Pablo Chacin <pchacin@suse.com>
(cherry picked from commit 9b64002)
  • Loading branch information
Pablo Chacin committed Jul 8, 2020
1 parent 2c86172 commit b95138c
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion ci/jenkins/pipelines/prs/skuba-test.Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,34 @@
// Branch specific repo
def branch_repo = ""

// Set the agent platform label. Cannot be set using the environment variables
// because agent labels are evaluated before environment is set
labels=''
node('caasp-team-private-integration') {
stage('set-labels') {
try {
def response = httpRequest(
url: "https://api.github.com/repos/SUSE/skuba/pulls/${CHANGE_ID}",
authentication: 'github-token',
validResponseCodes: "200")

def pr = readJSON text: response.content
pr.labels.findAll {
it.name.startsWith("ci-label:")
}.each{
def label = it.name.split(":")[1]
labels = labels + " && " + label
}
} catch (Exception e) {
echo "Error retrieving labels for PR ${e.getMessage()}"
currentBuild.result = 'ABORTED'
error('Error retrieving labels for PR')
}
}
}

pipeline {
agent { node { label "caasp-team-private-${worker_type} ${labels}" } }
agent { node { label "caasp-team-private-integration ${labels}" } }

environment {
SKUBA_BINPATH = '/home/jenkins/go/bin/skuba'
Expand Down

0 comments on commit b95138c

Please sign in to comment.