| * Update Salt environment pipeline |
| * SALT_MASTER_URL Salt API server location |
| * SALT_MASTER_CREDENTIALS Credentials to the Salt API |
| * UPDATE_FORMULAS Boolean switch for enforcing updating formulas |
| def salt = new com.mirantis.mk.Salt() |
| def common = new com.mirantis.mk.Common() |
| def python = new com.mirantis.mk.Python() |
| def venvPepper = "venvPepper" |
| timeout(time: 12, unit: 'HOURS') { |
| python.setupPepperVirtualenv(venvPepper, SALT_MASTER_URL, SALT_MASTER_CREDENTIALS) |
| stage("Update formulas"){ |
| if(UPDATE_FORMULAS.toBoolean()){ |
| common.infoMsg("Updating salt formulas") |
| 'apt-get update && apt-get install -y salt-formula-*' |
| common.infoMsg("Running salt sync-all") |
| salt.runSaltProcessStep(venvPepper, '*', 'saltutil.sync_all', [], null, true) |
| stage("Update Reclass") { |
| common.infoMsg("Updating reclass model") |
| 'cd /srv/salt/reclass && git pull -r && git submodule update', |
| // If there was an error or exception thrown, the build failed |
| currentBuild.result = "FAILURE" |