Skip to content
This repository was archived by the owner on Oct 28, 2024. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions .ci/buildDockerImages.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -345,14 +345,15 @@ pipeline {
dir("opbot-latest"){
script {
def creds = getVaultSecret('secret/k8s/elastic-apps/apm/opbot-google-creds')
writeFile(file: 'credentials.json', text: creds.data.value)
def writeClosure = {writeFile(file: 'credentials.json', text: creds.data.value)}
buildDockerImage(
repo: 'https://github.com/elastic/opbot.git',
tag: "opbot",
version: "latest",
prepareWith: writeClosure,
push: true)
}
}
buildDockerImage(
repo: 'https://github.com/elastic/opbot.git',
tag: "opbot",
version: "latest",
push: true)
}
post {
cleanup {
Expand Down Expand Up @@ -382,6 +383,7 @@ def buildDockerImage(args){
def env = args.containsKey('env') ? args.env : []
String options = args.containsKey('options') ? args.options : ""
boolean push = args.containsKey('push') ? args.push : false
def prepareWith = args.containsKey('prepareWith') ? args.prepareWith : {}

def image = "${params.registry}"
if(params.tag_prefix != null && params.tag_prefix != ""){
Expand All @@ -392,6 +394,7 @@ def buildDockerImage(args){
git credentialsId: '2a9602aa-ab9f-4e52-baf3-b71ca88469c7-UserAndToken', url: "${repo}"
dir("${folder}"){
withEnv(env){
prepareWith()
sh(label: "build docker image", script: "docker build ${options} -t ${image} .")
if(push){
retry(3){
Expand Down