Skip to content

Commit

Permalink
Merge pull request #3 from ika-rwth-aachen/fix/gitlab-ci-run-image
Browse files Browse the repository at this point in the history
Fix bug in gitlab run images
  • Loading branch information
jpbusch authored Jun 14, 2023
2 parents de2328b + b9e3854 commit 0c9987d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
28 changes: 14 additions & 14 deletions .gitlab-ci/docker-ros.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ default:
- privileged
- amd64
before_script:
- if [[ -n ${_PLATFORM} ]] && ! [[ "${PLATFORM}" =~ ${_PLATFORM} ]]; then echo "Platform '${_PLATFORM}' is skipped; can be enabled by adding '${_PLATFORM}' to the 'PLATFORM' variable" && exit 0; fi
- echo -e "section_start:`date +%s`:setup_section[collapsed=true]\r\e[0K[docker-ros] Setup docker-ros"
- apk add bash
- cd ${BUILD_CONTEXT}
Expand All @@ -100,16 +101,16 @@ default:
if [[ ${CI_RUNNER_EXECUTABLE_ARCH} != ${_PLATFORM} && ${CI_RUNNER_EXECUTABLE_ARCH} != linux/${_PLATFORM} ]]; then
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
fi
- TARGET=${_TARGET} PLATFORM=${_PLATFORM} ./docker/docker-ros/scripts/ci.sh
- echo -e "section_start:`date +%s`:push_section[collapsed=true]\r\e[0K[docker-ros] Push ${IMAGE}"
- docker push ${IMAGE}
- echo -e "section_end:`date +%s`:push_section\r\e[0K"
TARGET=${_TARGET} PLATFORM=${_PLATFORM} ./docker/docker-ros/scripts/ci.sh
echo -e "section_start:`date +%s`:push_section[collapsed=true]\r\e[0K[docker-ros] Push ${IMAGE}"
docker push ${IMAGE}
echo -e "section_end:`date +%s`:push_section\r\e[0K"
dev-amd64:
stage: Build dev Images
extends: .build
rules:
- if: $PLATFORM =~ /.*amd64.*/ && $TARGET =~ /.*dev.*/
- if: $TARGET =~ /.*dev.*/
variables:
_PLATFORM: amd64
_TARGET: dev
Expand All @@ -122,7 +123,7 @@ dev-arm64:
extends: .build
tags: [privileged, arm64]
rules:
- if: $PLATFORM =~ /.*arm64.*/ && $TARGET =~ /.*dev.*/
- if: $TARGET =~ /.*dev.*/
variables:
_PLATFORM: arm64
_TARGET: dev
Expand All @@ -137,11 +138,10 @@ run-amd64:
- job: dev-amd64
optional: true
rules:
- if: $PLATFORM =~ /.*amd64.*/ && $TARGET =~ /.*run.*/
- if: $TARGET =~ /.*run.*/
variables:
_PLATFORM: amd64
_TARGET: run
COMMAND: ${COMMAND}
IMAGE: ${_IMAGE_RUN_CI_AMD64}
ENABLE_SINGLEARCH_PUSH: 'true'
_IMAGE_POSTFIX: _${CI_COMMIT_REF_SLUG}_ci
Expand All @@ -154,11 +154,10 @@ run-arm64:
- job: dev-arm64
optional: true
rules:
- if: $PLATFORM =~ /.*arm64.*/ && $TARGET =~ /.*run.*/
- if: $TARGET =~ /.*run.*/
variables:
_PLATFORM: arm64
_TARGET: run
COMMAND: ${COMMAND}
IMAGE: ${_IMAGE_RUN_CI_ARM64}
ENABLE_SINGLEARCH_PUSH: 'true'
_IMAGE_POSTFIX: _${CI_COMMIT_REF_SLUG}_ci
Expand All @@ -172,6 +171,7 @@ run-arm64:
AFTER_INIT_EMBED: git config --global url.https://${GIT_HTTPS_USER}:${GIT_HTTPS_PASSWORD}@${GIT_HTTPS_SERVER}.insteadOf https://${GIT_HTTPS_SERVER}
DOCKER_RUN_OPTS: -u root:root
before_script:
- if [[ -n ${_PLATFORM} ]] && ! [[ "${PLATFORM}" =~ ${_PLATFORM} ]]; then echo "Platform '${_PLATFORM}' is skipped; can be enabled by adding '${_PLATFORM}' to the 'PLATFORM' variable" && exit 0; fi
- docker login -u ${REGISTRY_USER} -p ${REGISTRY_PASSWORD} ${REGISTRY}
- apk add --update bash coreutils grep tar
- |-
Expand All @@ -189,7 +189,7 @@ Test dev-amd64:
- job: dev-amd64
optional: true
rules:
- if: $ENABLE_INDUSTRIAL_CI == 'true' && $PLATFORM =~ /.*amd64.*/
- if: $ENABLE_INDUSTRIAL_CI == 'true'
variables:
DOCKER_IMAGE: ${_IMAGE_DEV_CI_AMD64}
_PLATFORM: amd64
Expand All @@ -202,7 +202,7 @@ Test dev-arm64:
- job: dev-arm64
optional: true
rules:
- if: $ENABLE_INDUSTRIAL_CI == 'true' && $PLATFORM =~ /.*arm64.*/
- if: $ENABLE_INDUSTRIAL_CI == 'true'
variables:
DOCKER_IMAGE: ${_IMAGE_DEV_CI_ARM64}
_PLATFORM: arm64
Expand Down Expand Up @@ -230,10 +230,10 @@ Test dev-arm64:
if [[ "${PLATFORM}" =~ amd64 && "${PLATFORM}" =~ arm64 ]]; then
[[ "${TARGET}" =~ dev ]] && docker manifest create ${IMG_DEV} --amend ${_IMAGE_DEV_CI_AMD64} --amend ${_IMAGE_DEV_CI_ARM64}
[[ "${TARGET}" =~ run ]] && docker manifest create ${IMG_RUN} --amend ${_IMAGE_RUN_CI_AMD64} --amend ${_IMAGE_RUN_CI_ARM64}
elif [[ "${PLATFORM}" == amd64 ]]; then
elif [[ "${PLATFORM}" =~ amd64 ]]; then
[[ "${TARGET}" =~ dev ]] && docker manifest create ${IMG_DEV} --amend ${_IMAGE_DEV_CI_AMD64}
[[ "${TARGET}" =~ run ]] && docker manifest create ${IMG_RUN} --amend ${_IMAGE_RUN_CI_AMD64}
elif [[ "${PLATFORM}" == arm64 ]]; then
elif [[ "${PLATFORM}" =~ arm64 ]]; then
[[ "${TARGET}" =~ dev ]] && docker manifest create ${IMG_DEV} --amend ${_IMAGE_DEV_CI_ARM64}
[[ "${TARGET}" =~ run ]] && docker manifest create ${IMG_RUN} --amend ${_IMAGE_RUN_CI_ARM64}
fi
Expand Down
8 changes: 4 additions & 4 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ if [[ $DOCKER_UID && $DOCKER_GID ]]; then
--password "$(openssl passwd -1 $DOCKER_USER)" \
$DOCKER_USER && \
touch /home/$DOCKER_USER/.sudo_as_admin_successful
chown -R $DOCKER_USER:$DOCKER_USER $WORKSPACE
ln -s $WORKSPACE /home/$DOCKER_USER/ws
cd /home/$DOCKER_USER/ws
cp /root/.bashrc /home/$DOCKER_USER
chown $DOCKER_USER:$DOCKER_USER /home/$DOCKER_USER/.bashrc
ln -s $WORKSPACE /home/$DOCKER_USER/ws
chown -R $DOCKER_USER:$DOCKER_USER $WORKSPACE
chown -R $DOCKER_USER:$DOCKER_USER /home/$DOCKER_USER
[[ $(pwd) == "$WORKSPACE" ]] && cd /home/$DOCKER_USER/ws
exec gosu $DOCKER_USER "$@"
else
exec "$@"
Expand Down

0 comments on commit 0c9987d

Please sign in to comment.