Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update docker related copy lib to new version #3800

Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions jenkins/docker/docker-copy.jenkinsfile
Original file line number Diff line number Diff line change
@@ -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',
]))
Expand Down Expand Up @@ -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"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/jenkins/TestDockerCopy.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
Original file line number Diff line number Diff line change
@@ -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])
Expand All @@ -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)