ci: Add pipeline for Koji

Dustin 2018-08-12 10:23:52 -05:00
parent f0e21440ae
commit 6f1c9b2bf2
1 changed files with 105 additions and 0 deletions

105
ci/koji.jenkinsfile Normal file
View File

@ -0,0 +1,105 @@
// vim: set ft=groovy sw=4 ts=4 sts=4 et :
pipeline {
agent {
label 'ansible'
}
triggers {
cron 'H H * * *'
}
stages {
stage('kinit') {
steps {
withCredentials([file(
credentialsId: 'keytab-jenkins@pyrocufflink.blue',
variable: 'KEYTAB')]) {
sh 'kinit -kt "${KEYTAB}" jenkins@PYROCUFFLINK.BLUE'
}
withCredentials([file(
credentialsId: 'vault-jenkins@pyrocufflink.blue',
variable: 'SUDO_PASS_FILE'
)]) {
sh 'cp "${SUDO_PASS_FILE}" group_vars/pyrocufflink/sudo-pass'
}
}
}
stage('Remount R/W') {
steps {
withCredentials([file(
credentialsId: 'vault-jenkins@pyrocufflink.blue',
variable: 'SUDO_PASS_FILE')]) {
ansiblePlaybook \
playbook: 'remount.yml',
limit: 'koji',
become: true,
vaultCredentialsId: 'ansible-vault',
extraVars: [
remount_state: 'rw',
],
}
}
}
stage('Koji Hub') {
steps {
ansiblePlaybook \
playbook: 'koji-web.yml',
become: true,
vaultCredentialsId: 'ansible-vault',
extras: '--diff'
}
}
}
stage('Koji Web') {
steps {
ansiblePlaybook \
playbook: 'koji-web.yml',
become: true,
vaultCredentialsId: 'ansible-vault',
extras: '--diff'
}
}
}
stage('Koji Builder') {
steps {
ansiblePlaybook \
playbook: 'koji-builder.yml',
become: true,
vaultCredentialsId: 'ansible-vault',
extras: '--diff'
}
}
}
stage('Remount R/O') {
steps {
ansiblePlaybook \
playbook: 'remount.yml',
limit: 'koji',
become: true,
vaultCredentialsId: 'ansible-vault',
extras: '--diff'
}
}
}
}
post {
always {
sh 'kdestroy'
sh 'find . -name sudo-pass -delete'
}
failure {
emailext \
to: 'gyrfalcon@ebonfire.com',
subject: '$DEFAULT_SUBJECT',
body: '$DEFAULT_CONTENT'
}
}
}