From 3eff6ba1fde9ba438531e672fec54aba28b5dd8a Mon Sep 17 00:00:00 2001 From: Sayali Gaikawad Date: Fri, 8 Jul 2022 17:12:52 -0700 Subject: [PATCH] Add env to dockercopy Signed-off-by: Sayali Gaikawad --- jenkins/docker/docker-copy.jenkinsfile | 15 +++++++++------ ...pyContainerDockerProdtoEcrProd.jenkinsfile.txt | 1 + ...ainerDockerStagingToDockerProd.jenkinsfile.txt | 1 + ...ontainerDockerStagingToEcrProd.jenkinsfile.txt | 1 + ...ainerDockerStagingtoEcrStaging.jenkinsfile.txt | 1 + ...ontainerECRStagingtoDockerProd.jenkinsfile.txt | 1 + ...pyContainerEcrStagingtoEcrProd.jenkinsfile.txt | 1 + 7 files changed, 15 insertions(+), 6 deletions(-) diff --git a/jenkins/docker/docker-copy.jenkinsfile b/jenkins/docker/docker-copy.jenkinsfile index 5df1b64059..b3798344ad 100644 --- a/jenkins/docker/docker-copy.jenkinsfile +++ b/jenkins/docker/docker-copy.jenkinsfile @@ -4,10 +4,13 @@ pipeline { options { timeout(time: 30) } - agent none + agent none + environment { + DATA_PREPPER_STAGING_CONTAINER_REPOSITORY = credentials('jenkins-data-prepper-staging-container-repository') + } parameters { choice( - name: 'SOURCE_IMAGE_REGISTRY', + name: 'SOURCE_IMAGE_REGISTRY', choices: ['opensearchstaging', 'public.ecr.aws/opensearchstaging', 'opensearchproject', 'public.ecr.aws/opensearchproject', "${DATA_PREPPER_STAGING_CONTAINER_REPOSITORY}"], description: 'Choose the source image registry' ) @@ -17,7 +20,7 @@ pipeline { trim: true ) choice( - name: 'DESTINATION_IMAGE_REGISTRY', + name: 'DESTINATION_IMAGE_REGISTRY', choices: ['opensearchstaging', 'public.ecr.aws/opensearchstaging', 'opensearchproject', 'public.ecr.aws/opensearchproject'], description: 'Choose the destination image registry' ) @@ -28,7 +31,7 @@ pipeline { ) } stages { - stage("Image Copy") { + stage('Image Copy') { agent { docker { label 'Jenkins-Agent-al2-x64-c54xlarge-Docker-Host' @@ -60,7 +63,7 @@ pipeline { } } } - } + } post() { always { script { @@ -68,7 +71,7 @@ pipeline { sh "docker logout ${DESTINATION_IMAGE_REGISTRY} && docker image prune -f --all" } } - } + } } } } diff --git a/tests/jenkins/jenkinsjob-regression-files/docker/docker-copy-testCopyContainerDockerProdtoEcrProd.jenkinsfile.txt b/tests/jenkins/jenkinsjob-regression-files/docker/docker-copy-testCopyContainerDockerProdtoEcrProd.jenkinsfile.txt index e690f1c2b9..29b7b043de 100644 --- a/tests/jenkins/jenkinsjob-regression-files/docker/docker-copy-testCopyContainerDockerProdtoEcrProd.jenkinsfile.txt +++ b/tests/jenkins/jenkinsjob-regression-files/docker/docker-copy-testCopyContainerDockerProdtoEcrProd.jenkinsfile.txt @@ -2,6 +2,7 @@ docker-copy.legacySCM(groovy.lang.Closure) docker-copy.library({identifier=jenkins@20211123, retriever=null}) docker-copy.pipeline(groovy.lang.Closure) + docker-copy.credentials(jenkins-data-prepper-staging-container-repository) docker-copy.timeout({time=30}) docker-copy.echo(Executing on agent [label:none]) docker-copy.stage(Parameters Check, groovy.lang.Closure) diff --git a/tests/jenkins/jenkinsjob-regression-files/docker/docker-copy-testCopyContainerDockerStagingToDockerProd.jenkinsfile.txt b/tests/jenkins/jenkinsjob-regression-files/docker/docker-copy-testCopyContainerDockerStagingToDockerProd.jenkinsfile.txt index 1630929a18..280755dcfe 100644 --- a/tests/jenkins/jenkinsjob-regression-files/docker/docker-copy-testCopyContainerDockerStagingToDockerProd.jenkinsfile.txt +++ b/tests/jenkins/jenkinsjob-regression-files/docker/docker-copy-testCopyContainerDockerStagingToDockerProd.jenkinsfile.txt @@ -2,6 +2,7 @@ docker-copy.legacySCM(groovy.lang.Closure) docker-copy.library({identifier=jenkins@20211123, retriever=null}) docker-copy.pipeline(groovy.lang.Closure) + docker-copy.credentials(jenkins-data-prepper-staging-container-repository) docker-copy.timeout({time=30}) docker-copy.echo(Executing on agent [label:none]) docker-copy.stage(Parameters Check, groovy.lang.Closure) diff --git a/tests/jenkins/jenkinsjob-regression-files/docker/docker-copy-testCopyContainerDockerStagingToEcrProd.jenkinsfile.txt b/tests/jenkins/jenkinsjob-regression-files/docker/docker-copy-testCopyContainerDockerStagingToEcrProd.jenkinsfile.txt index 3308ade765..6669b3ed9b 100644 --- a/tests/jenkins/jenkinsjob-regression-files/docker/docker-copy-testCopyContainerDockerStagingToEcrProd.jenkinsfile.txt +++ b/tests/jenkins/jenkinsjob-regression-files/docker/docker-copy-testCopyContainerDockerStagingToEcrProd.jenkinsfile.txt @@ -2,6 +2,7 @@ docker-copy.legacySCM(groovy.lang.Closure) docker-copy.library({identifier=jenkins@20211123, retriever=null}) docker-copy.pipeline(groovy.lang.Closure) + docker-copy.credentials(jenkins-data-prepper-staging-container-repository) docker-copy.timeout({time=30}) docker-copy.echo(Executing on agent [label:none]) docker-copy.stage(Parameters Check, groovy.lang.Closure) diff --git a/tests/jenkins/jenkinsjob-regression-files/docker/docker-copy-testCopyContainerDockerStagingtoEcrStaging.jenkinsfile.txt b/tests/jenkins/jenkinsjob-regression-files/docker/docker-copy-testCopyContainerDockerStagingtoEcrStaging.jenkinsfile.txt index c8c86adcec..dd71df9a96 100644 --- a/tests/jenkins/jenkinsjob-regression-files/docker/docker-copy-testCopyContainerDockerStagingtoEcrStaging.jenkinsfile.txt +++ b/tests/jenkins/jenkinsjob-regression-files/docker/docker-copy-testCopyContainerDockerStagingtoEcrStaging.jenkinsfile.txt @@ -2,6 +2,7 @@ docker-copy.legacySCM(groovy.lang.Closure) docker-copy.library({identifier=jenkins@20211123, retriever=null}) docker-copy.pipeline(groovy.lang.Closure) + docker-copy.credentials(jenkins-data-prepper-staging-container-repository) docker-copy.timeout({time=30}) docker-copy.echo(Executing on agent [label:none]) docker-copy.stage(Parameters Check, groovy.lang.Closure) diff --git a/tests/jenkins/jenkinsjob-regression-files/docker/docker-copy-testCopyContainerECRStagingtoDockerProd.jenkinsfile.txt b/tests/jenkins/jenkinsjob-regression-files/docker/docker-copy-testCopyContainerECRStagingtoDockerProd.jenkinsfile.txt index 1df7f674e2..9092c767a4 100644 --- a/tests/jenkins/jenkinsjob-regression-files/docker/docker-copy-testCopyContainerECRStagingtoDockerProd.jenkinsfile.txt +++ b/tests/jenkins/jenkinsjob-regression-files/docker/docker-copy-testCopyContainerECRStagingtoDockerProd.jenkinsfile.txt @@ -2,6 +2,7 @@ docker-copy.legacySCM(groovy.lang.Closure) docker-copy.library({identifier=jenkins@20211123, retriever=null}) docker-copy.pipeline(groovy.lang.Closure) + docker-copy.credentials(jenkins-data-prepper-staging-container-repository) docker-copy.timeout({time=30}) docker-copy.echo(Executing on agent [label:none]) docker-copy.stage(Parameters Check, groovy.lang.Closure) diff --git a/tests/jenkins/jenkinsjob-regression-files/docker/docker-copy-testCopyContainerEcrStagingtoEcrProd.jenkinsfile.txt b/tests/jenkins/jenkinsjob-regression-files/docker/docker-copy-testCopyContainerEcrStagingtoEcrProd.jenkinsfile.txt index 8144926f15..1004479268 100644 --- a/tests/jenkins/jenkinsjob-regression-files/docker/docker-copy-testCopyContainerEcrStagingtoEcrProd.jenkinsfile.txt +++ b/tests/jenkins/jenkinsjob-regression-files/docker/docker-copy-testCopyContainerEcrStagingtoEcrProd.jenkinsfile.txt @@ -2,6 +2,7 @@ docker-copy.legacySCM(groovy.lang.Closure) docker-copy.library({identifier=jenkins@20211123, retriever=null}) docker-copy.pipeline(groovy.lang.Closure) + docker-copy.credentials(jenkins-data-prepper-staging-container-repository) docker-copy.timeout({time=30}) docker-copy.echo(Executing on agent [label:none]) docker-copy.stage(Parameters Check, groovy.lang.Closure)