This repository was archived by the owner on Oct 28, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -345,14 +345,15 @@ pipeline {
345345 dir(" opbot-latest" ){
346346 script {
347347 def creds = getVaultSecret(' secret/k8s/elastic-apps/apm/opbot-google-creds' )
348- writeFile(file : ' credentials.json' , text : creds. data. value)
348+ def writeClosure = {writeFile(file : ' credentials.json' , text : creds. data. value)}
349+ buildDockerImage(
350+ repo : ' https://github.com/elastic/opbot.git' ,
351+ tag : " opbot" ,
352+ version : " latest" ,
353+ prepareWith : writeClosure,
354+ push : true )
349355 }
350356 }
351- buildDockerImage(
352- repo : ' https://github.com/elastic/opbot.git' ,
353- tag : " opbot" ,
354- version : " latest" ,
355- push : true )
356357 }
357358 post {
358359 cleanup {
@@ -382,6 +383,7 @@ def buildDockerImage(args){
382383 def env = args. containsKey(' env' ) ? args. env : []
383384 String options = args. containsKey(' options' ) ? args. options : " "
384385 boolean push = args. containsKey(' push' ) ? args. push : false
386+ def prepareWith = args. containsKey(' prepareWith' ) ? args. prepareWith : {}
385387
386388 def image = " ${ params.registry} "
387389 if (params. tag_prefix != null && params. tag_prefix != " " ){
@@ -392,6 +394,7 @@ def buildDockerImage(args){
392394 git credentialsId : ' 2a9602aa-ab9f-4e52-baf3-b71ca88469c7-UserAndToken' , url : " ${ repo} "
393395 dir(" ${ folder} " ){
394396 withEnv(env){
397+ prepareWith()
395398 sh(label : " build docker image" , script : " docker build ${ options} -t ${ image} ." )
396399 if (push){
397400 retry(3 ){
You can’t perform that action at this time.
0 commit comments