Skip to content

Commit

Permalink
Use sh syntax to clean up RUN commands
Browse files Browse the repository at this point in the history
Signed-off-by: Steve Peters <[email protected]>
  • Loading branch information
scpeters committed Dec 1, 2021
1 parent e1122c7 commit 2c6faf1
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions jenkins-scripts/docker/lib/docker_generate_dockerfile.bash
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export APT_PARAMS=

GZDEV_DIR=${WORKSPACE}/gzdev
GZDEV_BRANCH=${GZDEV_BRANCH:-master}
if [[ "$ghprbSourceBranch" =~ matching_branch\/ ]]; then
if [[ "$ghprbSourceBranch" =~ ci_matching_branch\/ ]]; then
GZDEV_TRY_BRANCH=$ghprbSourceBranch
fi

Expand All @@ -42,23 +42,25 @@ dockerfile_install_gzdev_repos()
cat >> Dockerfile << DELIM_OSRF_REPO_GIT
RUN rm -fr ${GZDEV_DIR}
RUN git clone https://github.com/ignition-tooling/gzdev -b ${GZDEV_BRANCH} ${GZDEV_DIR}
RUN bash -c "if [[ -n \"$GZDEV_TRY_BRANCH\" ]]; then git -C ${GZDEV_DIR} fetch origin \"$GZDEV_TRY_BRANCH\"; fi || true"
RUN bash -c "if [[ -n \"$GZDEV_TRY_BRANCH\" ]]; then git -C ${GZDEV_DIR} checkout \"$GZDEV_TRY_BRANCH\"; fi || true"
RUN if [ -n $GZDEV_TRY_BRANCH ]; then \
git -C ${GZDEV_DIR} fetch origin $GZDEV_TRY_BRANCH || true; \
git -C ${GZDEV_DIR} checkout $GZDEV_TRY_BRANCH || true; \
fi || true"
RUN git -C ${GZDEV_DIR} branch
DELIM_OSRF_REPO_GIT
if [[ -n ${GZDEV_PROJECT_NAME} ]]; then
# debian sid docker images does not return correct name so we need to use
# force-linux-distro
cat >> Dockerfile << DELIM_OSRF_REPO_GZDEV
RUN ${GZDEV_DIR}/gzdev.py repository enable --project=${GZDEV_PROJECT_NAME} --force-linux-distro=${DISTRO} || ( git -C ${GZDEV_DIR} pull origin ${GZDEV_BRANCH} && \
(bash -c "if [[ -n \"$GZDEV_TRY_BRANCH\" ]]; then git -C ${GZDEV_DIR} checkout \"$GZDEV_TRY_BRANCH\"; fi || true") && \
if [ -n $GZDEV_TRY_BRANCH ]; then git -C ${GZDEV_DIR} checkout $GZDEV_TRY_BRANCH; fi || true && \
${GZDEV_DIR}/gzdev.py repository enable --project=${GZDEV_PROJECT_NAME} --force-linux-distro=${DISTRO} )
DELIM_OSRF_REPO_GZDEV
else
for repo in ${OSRF_REPOS_TO_USE}; do
cat >> Dockerfile << DELIM_OSRF_REPO
RUN ${GZDEV_DIR}/gzdev.py repository enable osrf ${repo} --force-linux-distro=${DISTRO} || ( git -C ${GZDEV_DIR} pull origin ${GZDEV_BRANCH} && \
(bash -c "if [[ -n \"$GZDEV_TRY_BRANCH\" ]]; then git -C ${GZDEV_DIR} checkout \"$GZDEV_TRY_BRANCH\"; fi || true") && \
if [ -n $GZDEV_TRY_BRANCH ]; then git -C ${GZDEV_DIR} checkout $GZDEV_TRY_BRANCH; fi || true && \
${GZDEV_DIR}/gzdev.py repository enable osrf ${repo} --force-linux-distro=${DISTRO} )
DELIM_OSRF_REPO
done
Expand Down

0 comments on commit 2c6faf1

Please sign in to comment.