diff --git a/jenkins/docker/docker-copy.jenkinsfile b/jenkins/docker/docker-copy.jenkinsfile index 4db1d9218a..cdeb99288e 100644 --- a/jenkins/docker/docker-copy.jenkinsfile +++ b/jenkins/docker/docker-copy.jenkinsfile @@ -1,4 +1,4 @@ -lib = library(identifier: 'jenkins@4.2.0', retriever: modernSCM([ +lib = library(identifier: 'jenkins@5.2.0', retriever: modernSCM([ $class: 'GitSCMSource', remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git', ])) @@ -76,7 +76,7 @@ pipeline { always { script { postCleanup() - sh "docker logout ${DESTINATION_IMAGE_REGISTRY} && docker image prune -f --all" + sh "docker logout && docker logout public.ecr.aws && docker image prune -f --all" } } } diff --git a/tests/jenkins/TestDockerCopy.groovy b/tests/jenkins/TestDockerCopy.groovy index b80d917ecf..f6fa090d9e 100644 --- a/tests/jenkins/TestDockerCopy.groovy +++ b/tests/jenkins/TestDockerCopy.groovy @@ -29,7 +29,7 @@ class TestDockerCopy extends BuildPipelineTest { helper.registerSharedLibrary( library().name('jenkins') - .defaultVersion('4.2.0') + .defaultVersion('5.2.0') .allowOverride(true) .implicit(true) .targetPath('vars') diff --git a/tests/jenkins/jenkinsjob-regression-files/docker/docker-copy.jenkinsfile.txt b/tests/jenkins/jenkinsjob-regression-files/docker/docker-copy.jenkinsfile.txt index f32749f78a..639ad7fe71 100644 --- a/tests/jenkins/jenkinsjob-regression-files/docker/docker-copy.jenkinsfile.txt +++ b/tests/jenkins/jenkinsjob-regression-files/docker/docker-copy.jenkinsfile.txt @@ -1,6 +1,6 @@ docker-copy.run() docker-copy.modernSCM({$class=GitSCMSource, remote=https://github.com/opensearch-project/opensearch-build-libraries.git}) - docker-copy.library({identifier=jenkins@4.2.0, retriever=null}) + docker-copy.library({identifier=jenkins@5.2.0, retriever=null}) docker-copy.pipeline(groovy.lang.Closure) docker-copy.timeout({time=30}) docker-copy.echo(Executing on agent [label:none]) @@ -9,11 +9,14 @@ docker-copy.stage(Copy Image to ECR/DockerHub, groovy.lang.Closure) docker-copy.script(groovy.lang.Closure) docker-copy.copyContainer({allTags=false, sourceImage=ci-runner:testtag, sourceRegistry=opensearchstaging, destinationImage=ci-runner:testtag2, destinationRegistry=public.ecr.aws/opensearchstaging}) + copyContainer.usernamePassword({credentialsId=jenkins-staging-dockerhub-credential, usernameVariable=DOCKER_USERNAME, passwordVariable=DOCKER_PASSWORD}) + copyContainer.withCredentials([[DOCKER_USERNAME, DOCKER_PASSWORD]], groovy.lang.Closure) + copyContainer.sh(set +x && echo DOCKER_PASSWORD | docker login --username DOCKER_USERNAME --password-stdin) copyContainer.sh(set +x && aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/opensearchstaging) copyContainer.echo(Copying single image tag from opensearchstaging/ci-runner:testtag to public.ecr.aws/opensearchstaging/ci-runner:testtag2) copyContainer.sh(set -x && crane cp opensearchstaging/ci-runner:testtag public.ecr.aws/opensearchstaging/ci-runner:testtag2) - copyContainer.sh(set +x && docker logout && docker logout public.ecr.aws/opensearchstaging) + copyContainer.sh(set +x && docker logout && docker logout public.ecr.aws) docker-copy.script(groovy.lang.Closure) docker-copy.postCleanup() postCleanup.cleanWs({disableDeferredWipeout=true, deleteDirs=true}) - docker-copy.sh(docker logout public.ecr.aws/opensearchstaging && docker image prune -f --all) + docker-copy.sh(docker logout && docker logout public.ecr.aws && docker image prune -f --all)