-
Notifications
You must be signed in to change notification settings - Fork 19
/
Jenkinsfile
64 lines (64 loc) · 2.3 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
podTemplate(
cloud: 'openshift',
containers: [
containerTemplate(name: 'jnlp',
image: 'image-registry.openshift-image-registry.svc:5000/oasis/jenkins-agent-oasis:latest',
args: '${computer.jnlpmac} ${computer.name}',
envVars: [
secretEnvVar(key: 'OASIS_RHSM_USERNAME', secretName: 'oasis-rhsm', secretKey: 'username'),
secretEnvVar(key: 'OASIS_RHSM_PASSWORD', secretName: 'oasis-rhsm', secretKey: 'password'),
secretEnvVar(key: 'OASIS_RHSM_POOL_IDS', secretName: 'oasis-rhsm', secretKey: 'pool_ids'),
secretEnvVar(key: 'OASIS_RHSM_SERVER_HOSTNAME', secretName: 'oasis-rhsm', secretKey: 'hostname'),
secretEnvVar(key: 'OCP_PULL_SECRETS_OFFLINE_TOKEN', secretName: 'oasis-ci-pull-secrets', secretKey: 'offline_token')
],
alwaysPullImage: true)
]
) {
node(POD_LABEL) {
def collectionDir = 'ansible_collections/oasis_roles/satellite'
def builders = [:]
def String[] openstackTestEnvs
checkout scm
openstackTestEnvs = sh(
script: 'tox --ansible-driver openstack -l',
returnStdout: true
).trim().split()
for (testEnv in openstackTestEnvs) {
// bind testEnv into the local scope to ensure the correct value ends up in the build closure
def boundTestEnv = testEnv
def ghContext = "tox-ansible/${boundTestEnv}"
githubNotify(
credentialsId: 'gh-status-update',
status: 'PENDING',
description: 'Build Scheduled',
context: ghContext
)
builders["${boundTestEnv}"] = {
node(POD_LABEL) {
stage("Checkout ${boundTestEnv}") {
sh "mkdir -p ${collectionDir}"
dir(collectionDir) {
checkout scm
}
}
stage("Test ${boundTestEnv}") {
dir(collectionDir) {
warnError(message: "tox env ${boundTestEnv} failed") {
gitStatusWrapper(
credentialsId: 'gh-status-update',
description: 'Building',
failureDescription: 'Build Failed',
successDescription: 'Build Succeeded',
gitHubContext: ghContext
) { sh "tox -e '${boundTestEnv}'" }
}
}
}
}
}
}
throttle(['throttled']) {
parallel builders
}
}
}