Skip to content
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

Improve DOCKER_IMAGE detection #617

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ Note that some of these currently tied only to a single option, but we still lea
* **NOT_TEST_BUILD** (default: not set): If true, tests in ``build`` space won't be run.
* **NOT_TEST_DOWNSTREAM** (default: not set): If true, tests in the downstream workspace won't be run.
* **OS_CODE_NAME** (default: derived from ROS_DISTRO): See `this section for the detail <https://github.com/ros-industrial/industrial_ci/blob/master/doc/index.rst#optional-type-of-os-and-distribution>`__.
* **OS_NAME** (default: ubuntu): Possible options: {``ubuntu``, ``debian``}. See `this section for the detail <https://github.com/ros-industrial/industrial_ci/blob/master/doc/index.rst#optional-type-of-os-and-distribution>`__.
* **OS_NAME** (default: derived from OS_CODE_NAME): Possible options: {``ubuntu``, ``debian``}. See `this section for the detail <https://github.com/ros-industrial/industrial_ci/blob/master/doc/index.rst#optional-type-of-os-and-distribution>`__.
* **PARALLEL_BUILDS** (default: 0): Sets the number of parallel build jobs among all packages. ``0`` or ``true`` unsets the limit.
* **PARALLEL_TESTS** (default: 1): Sets the number of parallel test jobs. ``0`` or ``true`` unsets the limit.
* **PRERELEASE** (default: ``false``): If ``true``, run `Prerelease Test on docker that emulates ROS buildfarm <http://wiki.ros.org/bloom/Tutorials/PrereleaseTest/>`__. The usage of Prerelease Test feature is `explained more in this section <https://github.com/ros-industrial/industrial_ci/blob/master/doc/index.rst#run-ros-prerelease-test>`__.
Expand Down Expand Up @@ -625,8 +625,8 @@ Use Debian

E.g.:

* ``OS_NAME=debian OS_CODE_NAME=jessie``
* ``OS_NAME=debian OS_CODE_NAME=stretch``
* ``OS_CODE_NAME=jessie``
* ``OS_CODE_NAME=stretch``

All combinations available of OS and distros
++++++++++++++++++++++++++++++++++++++++++++++
Expand Down
11 changes: 10 additions & 1 deletion industrial_ci/src/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,16 @@ export PARALLEL_BUILDS=${PARALLEL_BUILDS:-0}
export PARALLEL_TESTS=${PARALLEL_TESTS:-1}

export PRERELEASE=${PRERELEASE:-false}
export OS_NAME=${OS_NAME:-ubuntu}

case "${OS_CODE_NAME-}" in
# https://wiki.debian.org/DebianReleases#Production_Releases
"jessie"|"stretch"|"buster"|"bullseye"|"bookwork"|"trixie")
export OS_NAME=debian
;;
*)
export OS_NAME=${OS_NAME:-ubuntu}
;;
esac

export ROSDEP_SKIP_KEYS=${ROSDEP_SKIP_KEYS:-}

Expand Down
11 changes: 10 additions & 1 deletion industrial_ci/src/isolation/docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,16 @@ function ici_forward_variable() {
#######################################
function ici_isolate() {
local file=${1}; shift
DOCKER_IMAGE=${DOCKER_IMAGE:-${OS_NAME:-ubuntu}:$OS_CODE_NAME} # scheme works for all supported OS images

if [ "${DOCKER_IMAGE-x}" = "" ]; then
ici_error "Empty string passed to DOCKER_IMAGE. Specify a valid docker image or unset the environment variable to use the default image."
fi

if [ -n "${OS_CODE_NAME-}" ]; then
DOCKER_IMAGE=${DOCKER_IMAGE:-${OS_NAME}:$OS_CODE_NAME} # scheme works for all supported OS images
elif [ -z "${DOCKER_IMAGE-}" ]; then
ici_error "Please set ROS_DISTRO, OS_CODE_NAME or DOCKER_IMAGE."
fi

if [ "$DOCKER_PULL" != false ]; then
ici_run "pull_docker_image" docker pull "$DOCKER_IMAGE"
Expand Down
4 changes: 2 additions & 2 deletions industrial_ci/src/tests/black_check.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/bash

function prepare_black_check() {
DOCKER_IMAGE=${DOCKER_IMAGE:-python:3-buster}
ROS_DISTRO=${ROS_DISTRO:-false}
export DOCKER_IMAGE=${DOCKER_IMAGE:-python:3}
export ROS_DISTRO=${ROS_DISTRO:-false}
}

function install_black() {
Expand Down