Conversation
Signed-off-by: Jose Luis Rivero <jrivero@honurobotics.com>
Owner
AndrejOrsula
left a comment
There was a problem hiding this comment.
Thank you @j-rivero for the PR and taking care of the updates!
This PR currently results in Docker images tagged as:
panda_gz_moveit2-jazzy_tag-6911abf:latest
I am wondering if the following tag wouldn't be preferable:
<DOCKER USER>/panda_gz_moveit2:jazzy_tag-6911abf- OR
panda_gz_moveit2:jazzy_tag-6911abfif the user is not logged into Docker
The following diff of build.bash would result in such behaviour (the same logic could be applied to run.bash):
diff --git a/.docker/build.bash b/.docker/build.bash
index 9b0a344..2a4a15c 100755
--- a/.docker/build.bash
+++ b/.docker/build.bash
@@ -3,9 +3,9 @@
SCRIPT_DIR="$(cd "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" &>/dev/null && pwd)"
PROJECT_DIR="$(dirname "${SCRIPT_DIR}")"
-TAG=$(git -C "${PROJECT_DIR}" remote get-url origin | sed 's/.*\///; s/\.git$//')
-TAG=${TAG}-$(git -C "${PROJECT_DIR}" branch --show-current)
-TAG=${TAG}-$(git -C "${PROJECT_DIR}" rev-parse --short HEAD)
+DOCKERHUB_USER="$(${WITH_SUDO} docker info 2>/dev/null | sed '/Username:/!d;s/.* //')"
+PROJECT_NAME="$(git -C "${PROJECT_DIR}" remote get-url origin | sed 's/.*\///; s/\.git$//')"
+TAG="${DOCKERHUB_USER:+${DOCKERHUB_USER}/}${PROJECT_NAME,,}"
if [ "${#}" -gt "0" ]; then
if [[ "${1}" != "-"* ]]; then
@@ -15,6 +15,9 @@ if [ "${#}" -gt "0" ]; then
BUILD_ARGS=${*:1}
fi
fi
+if [[ "${TAG}" != *":"* ]]; then
+ TAG="${TAG}:$(git -C "${PROJECT_DIR}" branch --show-current)-$(git -C "${PROJECT_DIR}" rev-parse --short HEAD)"
+fi
DOCKER_BUILD_CMD=(
docker build$PROJECT_NAME could also be PROJECT_NAME="$(basename "${REPOSITORY_DIR}")" to let the end-user rename the project if desired.
In either case, the tag can still be overriden via .docker/build.bash custom_tag, which results in panda_gz_moveit2:custom_tag
What do you think?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The docker image tags are not linked to a particular code version, that could end up in build one branch or code and using a different one. The PR builds tags using the branch and the HEAD sha.