Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Zhu <[email protected]>
  • Loading branch information
peterzhuamazon committed Jul 19, 2023
1 parent 0415079 commit cdb6c12
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ jacocoTestReport {
}
}

String version = '5.1.0'
String version = '5.2.0'

task updateVersion {
doLast {
Expand Down
4 changes: 2 additions & 2 deletions tests/jenkins/TestCopyContainer.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class TestCopyContainer extends BuildPipelineTest {
String craneStr = 'set -x && crane cp opensearchstaging/ci-runner:centos7-123 public.ecr.aws/opensearchstaging/ci-runner:centos7-123'
assertThat(getShellCommands('sh', 'crane'), hasItem(craneStr))

String dockerStr = 'set +x && docker logout && docker logout public.ecr.aws/opensearchstaging'
String dockerStr = 'set +x && docker logout && docker logout public.ecr.aws'
assertThat(getShellCommands('sh', 'docker logout'), hasItem(dockerStr))
}

Expand All @@ -54,7 +54,7 @@ class TestCopyContainer extends BuildPipelineTest {
String craneAllTagsStr = 'set -x && crane cp opensearchstaging/ci-runner opensearchstaging/ci-runner --all-tags'
assertThat(getShellCommands('sh', 'crane'), hasItem(craneAllTagsStr))

String dockerAllTagsStr = 'set +x && docker logout && docker logout opensearchstaging'
String dockerAllTagsStr = 'set +x && docker logout && docker logout public.ecr.aws'
assertThat(getShellCommands('sh', 'docker logout'), hasItem(dockerAllTagsStr))
}

Expand Down
6 changes: 3 additions & 3 deletions tests/jenkins/jobs/DockerCopyAllTags_Jenkinsfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
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.echo(Copying all the tags of image opensearchstaging/ci-runner to opensearchstaging/ci-runner)
copyContainer.sh(set -x && crane cp opensearchstaging/ci-runner opensearchstaging/ci-runner --all-tags)
copyContainer.sh(set +x && docker logout && docker logout opensearchstaging)
copyContainer.echo(Copying all the tags of image opensearchstaging/ci-runner to opensearchstaging/ci-runner)
copyContainer.sh(set -x && crane cp opensearchstaging/ci-runner opensearchstaging/ci-runner --all-tags)
copyContainer.sh(set +x && docker logout && docker logout public.ecr.aws)
5 changes: 4 additions & 1 deletion tests/jenkins/jobs/DockerCopy_Jenkinsfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
DockerCopy_Jenkinsfile.stage(Copy Image to ECR/DockerHub, groovy.lang.Closure)
DockerCopy_Jenkinsfile.script(groovy.lang.Closure)
DockerCopy_Jenkinsfile.copyContainer({sourceImage=ci-runner:centos7-123, sourceRegistry=opensearchstaging, destinationImage=ci-runner:centos7-123, 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:centos7-123 to public.ecr.aws/opensearchstaging/ci-runner:centos7-123)
copyContainer.sh(set -x && crane cp opensearchstaging/ci-runner:centos7-123 public.ecr.aws/opensearchstaging/ci-runner:centos7-123)
copyContainer.sh(set +x && docker logout && docker logout public.ecr.aws/opensearchstaging)
copyContainer.sh(set +x && docker logout && docker logout public.ecr.aws)

0 comments on commit cdb6c12

Please sign in to comment.