From b62f08ccd4ea63c191ea1d21a2c23c90627d7ef3 Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Sat, 13 Nov 2021 09:49:24 -0600 Subject: [PATCH] ci: gitea: Convert to cfgpol shared library --- ci/gitea.jenkinsfile | 99 ++++---------------------------------------- 1 file changed, 9 insertions(+), 90 deletions(-) diff --git a/ci/gitea.jenkinsfile b/ci/gitea.jenkinsfile index 5c34493..295b81f 100644 --- a/ci/gitea.jenkinsfile +++ b/ci/gitea.jenkinsfile @@ -1,92 +1,11 @@ // vim: set ft=groovy sw=4 ts=4 sts=4 et : +@Library('cfgpol')_ -pipeline { - agent { - dockerfile { - dir 'ci' - args '''\ - -v /etc/ssh/ssh_known_hosts:/etc/ssh/ssh_known_hosts:ro - ''' - } - } - - options { - lock 'cfgpol' - timeout(time: 1, unit: 'HOURS') - } - - triggers { - cron 'H H * * *' - } - - environment { - KRB5CCNAME = "${WORKSPACE}/.krb5cc" - } - - 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 { - ansiblePlaybook \ - playbook: 'remount.yml', - limit: 'gitea', - become: true, - vaultCredentialsId: 'ansible-vault', - extraVars: [ - remount_state: 'rw', - ] - } - } - - stage('Gitea') { - steps { - ansiblePlaybook \ - playbook: 'gitea.yml', - become: true, - vaultCredentialsId: 'ansible-vault', - extras: '--diff' - } - } - - stage('Remount R/O') { - steps { - ansiblePlaybook \ - playbook: 'remount.yml', - limit: 'gitea', - 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' - } - } -} - +applyConfigPolicy( + 'gitea', + [ + 'Gitea': [ + 'gitea.yml' + ] + ] +)