-
Notifications
You must be signed in to change notification settings - Fork 27
RAC-5945:[refactor]Docker-Publish: implement a shell script docker/publish.sh and a groovy script docker/Publish.groovy to publish docker #337
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
base: master
Are you sure you want to change the base?
Conversation
| withCredentials([ | ||
| usernamePassword(credentialsId: 'rackhd-ci-docker-hub', | ||
| passwordVariable: 'DOCKERHUB_PASS', | ||
| usernameVariable: 'DOCKERHUB_USER')]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are not used.
The user and password are passed by arguments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it. Thanks.
| exit 1 | ||
| fi | ||
| done | ||
| done < $DOCKER_RECORD_STASH_PATH |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tag info is the output of docker load
Could you please remove the parameter "DOCKER_RECORD_STASH_PATH"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. That means docker push command will push all repos in the docker tar file to the hub.docker.com
8015124 to
8b69e32
Compare
| :dockerhub_user: the rackhd user of dockerhub | ||
| :dockerhub_pass: the rackhd user password of dockerhub | ||
| */ | ||
| def publish(String library_dir, String docker_tar_path, String dockerhub_user, String dockerhub_pass) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it better to pass jenkins creds id and get creds info inside this function instead of passing user/password?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
waiting to discuss.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with @HQebupt's implementation :-)
usability and flexibility , either way .
| # | ||
| ######################################################## | ||
|
|
||
| main(){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recommand to cut this main function into serval small functions, for example:
loadImages
push
clean
one method one function is easy to maintain, especially for next maintainers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea.
8b69e32 to
cca1750
Compare
| timeout(120){ | ||
| sh """#!/bin/bash -ex | ||
| pushd $library_dir/src/pipeline/rackhd/docker | ||
| ./publish.sh --DOCKER_STASH_PATH $docker_tar_path \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure, do you need to run publish.sh with sudo ?
can you run docker operation without sudo in sandbox ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it works fine without sudo. :)
| #!/bin/bash -e | ||
| # Environmental requirement: | ||
| # docker service running and docker have already logged with Rackhd Dockerhub ID, | ||
| # cmd 'docker login', if not logged then can't push images to dockerhub |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this comment still valid ? you have docker login in your code already
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Careful observation, I fixed it.
…nd a groovy script docker/Publish.groovy to publish docker.
cca1750 to
8a98932
Compare
|
👍 |
implement a shell script to publish docker .The input of the script: a tar package with all docker images. And implement a groovy script to call the shell script to publish docker to docker hub.