forked from IBM/community-automation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile-example
49 lines (42 loc) · 1.88 KB
/
Jenkinsfile-example
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
#! groovy
## jenkins file examples
## update paramsList
## update Stage () section
// Standard job properties
def jobProps = [
buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '', numToKeepStr: '50')),
disableResume(),
durabilityHint("PERFORMANCE_OPTIMIZED"),
[$class: 'RebuildSettings', autoRebuild: false, rebuildDisabled: false]
]
def paramsList = [
string(name: 'API_Server_URL', defaultValue: "api.", description: 'clustre api server url'),
string(name: 'API_Server_Port', defaultValue: "6443", description: 'clustrer api serfver port number'),
string(name: 'cluster_admin', defaultValue: "kubeadmin", description: 'clustrer admin user'),
password(name: 'cluster_admin_password', description: 'cluster admin password'),
string(name: 'ocp_client_version', defaultValue: "4.2.0"),
string(name: 'machine_config', description: 'machine config found from oc get mc, newest version')
]
jobProps.push(parameters(paramsList))
properties(jobProps)
timestamps {
ansiColor('xterm') {
node ( 'kube_pod_slave' ) {
checkout scm
stage('Recover Machine Config') {
sh """
cp ./ansible/recover-machine-config-play/examples/mc_vars.yml ./ansible/recover-machine-config-play/;\
cp ./ansible/recover-machine-config-play/examples/inventory ./ansible/recover-machine-config-play/;\
ansible-playbook -i ./ansible/recover-machine-config-play/inventory \
./ansible/recover-machine-config-play/recover-machine-config-play.yml \
-e kubeadmin_user=${params.cluster_admin} \
-e kubeadmin_password=${params.cluster_admin_password} \
-e ocp_api_url=${API_Server_URL}:${API_Server_Port} \
-e arch="linux" \
-e ocp_client_version=${ocp_client_version} \
-e machine_config=${machine_config} -vv
""".stripIndent()
}
}
}
}