From c1afa844de92eb29ff82a4e4180871bf0795522f Mon Sep 17 00:00:00 2001 From: "Addisu Z. Taddese" Date: Fri, 17 Jan 2025 20:15:08 +0100 Subject: [PATCH] Only use matching branch in gzdev if the branch actually exists (#1240) Signed-off-by: Addisu Z. Taddese --- jenkins-scripts/docker/lib/docker_generate_dockerfile.bash | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/jenkins-scripts/docker/lib/docker_generate_dockerfile.bash b/jenkins-scripts/docker/lib/docker_generate_dockerfile.bash index a333639eb..ac5942b86 100644 --- a/jenkins-scripts/docker/lib/docker_generate_dockerfile.bash +++ b/jenkins-scripts/docker/lib/docker_generate_dockerfile.bash @@ -58,9 +58,10 @@ ADD https://api.github.com/repos/gazebo-tooling/gzdev/git/refs/heads/$GZDEV_BRAN RUN rm -fr ${GZDEV_DIR} \ && git clone https://github.com/gazebo-tooling/gzdev -b ${GZDEV_BRANCH} ${GZDEV_DIR} DELIM_OSRF_REPO_GIT_1 -if [ -n $GZDEV_TRY_BRANCH ]; then +GZDEV_TRY_BRANCH_URL="https://api.github.com/repos/gazebo-tooling/gzdev/git/refs/heads/$GZDEV_TRY_BRANCH" +if [ -n $GZDEV_TRY_BRANCH ] && curl --output /dev/null --silent --head --fail $GZDEV_TRY_BRANCH_URL; then cat >> Dockerfile << DELIM_OSRF_REPO_GIT_2 -ADD https://api.github.com/repos/gazebo-tooling/gzdev/git/refs/heads/$GZDEV_TRY_BRANCH version.json +ADD $GZDEV_TRY_BRANCH_URL version.json RUN git -C ${GZDEV_DIR} fetch origin $GZDEV_TRY_BRANCH || true; RUN git -C ${GZDEV_DIR} checkout $GZDEV_TRY_BRANCH || true; DELIM_OSRF_REPO_GIT_2