-
Notifications
You must be signed in to change notification settings - Fork 597
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
created a new build_docker_remote.sh script for building the docker image remotely with google cloud build #7951
Conversation
…mage remotely with google cloud build
Codecov Report
@@ Coverage Diff @@
## master #7951 +/- ##
===============================================
- Coverage 87.089% 87.064% -0.025%
- Complexity 36993 37014 +21
===============================================
Files 2217 2218 +1
Lines 173847 173760 -87
Branches 18791 18769 -22
===============================================
- Hits 151402 151282 -120
- Misses 15816 15892 +76
+ Partials 6629 6586 -43
|
|
||
## generate the tag if it wasn't explicitly specified | ||
if [ -z "$DOCKER_IMAGE_TAG" ]; then | ||
DOCKER_IMAGE_TAG=${GCR_REPO}:$(whoami)-${GITHUB_TAG}-${GIT_HASH_FOR_TAG} |
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.
If a Github tag is used this ends up with a name ending in tag-tag. For example: us.gcr.io/broad-dsde-methods/broad-gatk-snapshots/gatk-remote-builds:mshand-4.2.6.1-4.2.6.1
. I don't think that's a problem, but just fyi
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.
Yeah. I decided against going down the rabbit hole of trying too hard to make a reasonable image name.... If you pull a specific commit then there isn't necessarily a branch associated and I don't think this is super high priority to fix given that most ofthe time people should give their own -T tags
scripts/docker/README.md
Outdated
``build_docker.sh`` is a script to create the full gatk4 docker image. | ||
``build_docker_remote.sh`` is a script to create the full gatk4 docker image using google cloud build remotely. NOTE: this requires the user first specify their project with the command `gcloud config set project <PROJECT>` to a project that has access to google cloud build. |
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 worth mentioning somewhere that one potential motivation for using the remote version is if you have M1 hardware?
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.
@jamesemery Back to you with my comments
build_docker_remote.sh
Outdated
|
||
REPO=broadinstitute | ||
PROJECT=gatk | ||
REPO_PRJ=${REPO}/${PROJECT} |
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.
Delete REPO_PRJ
-- it is a reference to the dockerhub repo, which we can't push to in this script.
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.
False, its used farther down git clone https://github.com/${REPO}/${PROJECT}.git
when we do the git clone.
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's not -- that's $REPO and $PROJECT. $REPO_PRJ is unused, and in the original script it's used for the dockerhub repo.
|
||
SUBMIT_COMMAND="gcloud builds submit --tag ${DOCKER_IMAGE_TAG} --timeout=24h --machine-type n1_highcpu_8" | ||
echo "running the following gcloud command: ${SUBMIT_COMMAND}" | ||
echo -n "" >> .gcloudignore |
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.
What does this line do? Can you add a comment?
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.
Its from the Carrot version of this code. Without an explicit gcloudignore set it blacklists the .git directory which causes our script to crash since we need to download the lfs files from the intermediate docker image. I've added a comment
|
||
cd ${ORIGINAL_WORKING_DIRECTORY} | ||
if [ -n "$STAGING_DIR" ] ; then | ||
rm -Rf ${STAGING_DIR}/${STAGING_CLONE_DIR} |
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 think the clone actually may get put into ${STAGING_DIR}/${STAGING_DIR}/${STAGING_CLONE_DIR}
rather than ${STAGING_DIR}/${STAGING_CLONE_DIR}
. Can you double-check this and make sure the script is cleaning up properly?
export GITHUB_TAG=4.2.6.1 | ||
|
||
# REPLACE with the directory where you'd like to clone the repo | ||
export STAGING_DIR=~/tmp/tmp_build_docker_image/ |
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.
These don't actually have to be exported, since you're passing them into the script directly below.
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 simply copying the syntax of the other dozen of these things in this folder
@droazen i responded to your comments can this be merged? |
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.
@jamesemery Still a few issues here...
build_docker_remote.sh
Outdated
mkdir -p ${STAGING_DIR} | ||
cd ${STAGING_DIR} | ||
set +e | ||
rm -Rf ${STAGING_DIR}/${STAGING_CLONE_DIR} |
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.
We cd
into ${STAGING_DIR}
, and then rm -Rf
${STAGING_DIR}/${STAGING_CLONE_DIR}
. This still seems wrong...
build_docker.sh
Outdated
@@ -93,7 +93,7 @@ if [ -n "$STAGING_DIR" ]; then | |||
set +e | |||
rm -Rf ${STAGING_DIR}/${STAGING_CLONE_DIR} |
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.
Same issue here -- we've just cd'd into ${STAGING_DIR}
, so why are we deleting ${STAGING_DIR}/${STAGING_CLONE_DIR}
?
build_docker_remote.sh
Outdated
rm -Rf ${STAGING_DIR}/${STAGING_CLONE_DIR} | ||
set -e | ||
GIT_LFS_SKIP_SMUDGE=1 git clone https://github.com/${REPO}/${PROJECT}.git ${STAGING_CLONE_DIR} | ||
cd ${STAGING_DIR}/${STAGING_CLONE_DIR} |
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.
How does this cd
command even succeed? We already cd'd into ${STAGING_DIR}
, and now we are cd'ing into ${STAGING_DIR}/${STAGING_CLONE_DIR}
?
|
||
echo "Building image with the tag ${DOCKER_IMAGE_TAG}..." | ||
|
||
SUBMIT_COMMAND="gcloud builds submit --tag ${DOCKER_IMAGE_TAG} --timeout=24h --machine-type n1_highcpu_8" |
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.
Will an existing image with the same tag get overwritten by this command?
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.
yes. but thats effectively impossible unless the user specifies the image themselves (in which case its their fault and problem) since we include the github tag/hash in the image name
@droazen one more round |
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.
👍 Merge after doing a test run of the latest version with both relative and absolute paths for the staging dir.
@droazen just checked and it works with both relative and absolute paths. I'm going to hit merge. |
Fixes #7949