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

Commit

Permalink
Set platform from PR labels
Browse files Browse the repository at this point in the history
If PR specifies a ci-platform label, override the default
test platform.

Signed-off-by: Pablo Chacin <pchacin@suse.com>
  • Loading branch information
Pablo Chacin committed May 21, 2020
1 parent 97d3114 commit 95799ab
Showing 1 changed file with 23 additions and 9 deletions.
32 changes: 23 additions & 9 deletions ci/jenkins/pipelines/prs/skuba-test.Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@
* - Basic skuba deployment, bootstrapping, and adding nodes to a cluster
*/


// Platform for pr tests.
def platform = 'vmware'

// 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=''
def labels=''
node('caasp-team-private-integration') {
stage('set-labels') {
sh 'env'
Expand All @@ -19,13 +23,23 @@ node('caasp-team-private-integration') {
validResponseCodes: "200")

if (response.status == 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
}
def pr = readJSON text: response.content

// set al pr specific labels
pr.labels.findAll {
it.name.startsWith("ci-label:")
}.each{
def label = it.name.split(":")[1]
labels = labels + " && " + label
}

// check if the PR request an specific test platform
def pr_platform_label = pr.labels.find {
it.name.startsWith("ci-platform")
}
if (pr_platform_label != null) {
platform = pr_platform_label.name.split(":")[1]
}
}
}
}
Expand All @@ -37,7 +51,7 @@ pipeline {
SKUBA_BINPATH = '/home/jenkins/go/bin/skuba'
VMWARE_ENV_FILE = credentials('vmware-env')
GITHUB_TOKEN = credentials('github-token')
PLATFORM = 'vmware'
PLATFORM = "${platform}"
TERRAFORM_STACK_NAME = "${BUILD_NUMBER}-${JOB_NAME.replaceAll("/","-")}".take(70)
PR_CONTEXT = 'jenkins/skuba-test'
PR_MANAGER = 'ci/jenkins/pipelines/prs/helpers/pr-manager'
Expand Down

0 comments on commit 95799ab

Please sign in to comment.