From 2f3d414fc4aea20eea37915ae3bcb346614753cd Mon Sep 17 00:00:00 2001 From: Toni Oliver Date: Wed, 29 Nov 2023 11:13:04 +0100 Subject: [PATCH 01/19] Change tag name for humble image, so that it doesn't specify the the base ubuntu image. The reason to do it is that the upstream image is silently moved from one ubuntu version to the next eventually. --- docker/ros2/humble/buildspec.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/ros2/humble/buildspec.yml b/docker/ros2/humble/buildspec.yml index b070e31a..ede76bf2 100644 --- a/docker/ros2/humble/buildspec.yml +++ b/docker/ros2/humble/buildspec.yml @@ -5,7 +5,7 @@ env: variables: branch: default image: build-tools - tag: focal-humble + tag: humble dockerfile_folder: docker/ros2/humble/ exported-variables: - branch From 752c8d5f93fb58c8c796a3ce0d9500ec27a10313 Mon Sep 17 00:00:00 2001 From: Toni Oliver Date: Wed, 29 Nov 2023 11:14:15 +0100 Subject: [PATCH 02/19] changes to make te build work on the latest AWS ubuntu image --- docker/ros2/humble/buildspec.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/docker/ros2/humble/buildspec.yml b/docker/ros2/humble/buildspec.yml index ede76bf2..5b53dce7 100644 --- a/docker/ros2/humble/buildspec.yml +++ b/docker/ros2/humble/buildspec.yml @@ -13,9 +13,6 @@ env: - tag - dockerfile_folder phases: - install: - runtime-versions: - docker: 19 build: commands: - | @@ -29,11 +26,6 @@ phases: else branch=$CODEBUILD_SOURCE_VERSION fi - - awscli_v1_executable=$(which aws) - - rm $awscli_v1_executable - - curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" - - unzip awscliv2.zip - - ./aws/install - git checkout $branch - cd $dockerfile_folder - aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/shadowrobot From ddacc08d4257311129ffc043046c22e8aadf3132 Mon Sep 17 00:00:00 2001 From: Toni Oliver Date: Wed, 29 Nov 2023 12:38:03 +0100 Subject: [PATCH 03/19] Fix missing space --- docker/ros2/humble/buildspec.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/ros2/humble/buildspec.yml b/docker/ros2/humble/buildspec.yml index 5b53dce7..d6e57200 100644 --- a/docker/ros2/humble/buildspec.yml +++ b/docker/ros2/humble/buildspec.yml @@ -29,7 +29,7 @@ phases: - git checkout $branch - cd $dockerfile_folder - aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/shadowrobot - - docker build --build-arg toolset_branch=$branch-t $image . + - docker build --build-arg toolset_branch=$branch -t $image . - docker tag $image:latest public.ecr.aws/shadowrobot/$image:$tag - docker push public.ecr.aws/shadowrobot/$image:$tag - comm -13 <(aws ecr-public describe-image-tags --repository-name $image --region us-east-1 --output text | awk '{print $3}' | tr " " "\n" | sort -u) <(aws ecr-public describe-images --repository-name $image --region us-east-1 --output text | awk '{print $2}' | tr " " "\n" | sort -u) >> ids_to_delete.txt From bf85b6a4da9b1991e26ba17b35a19ab04db0309f Mon Sep 17 00:00:00 2001 From: Toni Oliver Date: Thu, 30 Nov 2023 15:56:43 +0100 Subject: [PATCH 04/19] Try to fix build by allowing higher version of PyYAML --- bin/sr-run-ci-build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/sr-run-ci-build.sh b/bin/sr-run-ci-build.sh index 08ae157c..dbe53132 100755 --- a/bin/sr-run-ci-build.sh +++ b/bin/sr-run-ci-build.sh @@ -24,7 +24,7 @@ if [ "semaphore_docker" != $server_type ] && [ "local" != $server_type ] && [ " sudo apt-get install -y python3-dev libxml2-dev libxslt-dev python3-pip lcov wget git libssl-dev libffi-dev libyaml-dev sudo pip3 install --upgrade pip setuptools==51.1.1 gcovr - sudo pip3 install PyYAML==5.4.1 --ignore-installed + sudo pip3 install PyYAML>=5.4.1 --ignore-installed git config --global user.email "build.tools@example.com" git config --global user.name "Build Tools" From 086fedb9de0f91e0e817f7a4e86c1d04acb865d9 Mon Sep 17 00:00:00 2001 From: Toni Oliver Date: Thu, 30 Nov 2023 16:28:11 +0100 Subject: [PATCH 05/19] Add needed double quotes to pip install --- bin/sr-run-ci-build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/sr-run-ci-build.sh b/bin/sr-run-ci-build.sh index dbe53132..52132449 100755 --- a/bin/sr-run-ci-build.sh +++ b/bin/sr-run-ci-build.sh @@ -24,7 +24,7 @@ if [ "semaphore_docker" != $server_type ] && [ "local" != $server_type ] && [ " sudo apt-get install -y python3-dev libxml2-dev libxslt-dev python3-pip lcov wget git libssl-dev libffi-dev libyaml-dev sudo pip3 install --upgrade pip setuptools==51.1.1 gcovr - sudo pip3 install PyYAML>=5.4.1 --ignore-installed + sudo pip3 install "PyYAML>=5.4.1" --ignore-installed git config --global user.email "build.tools@example.com" git config --global user.name "Build Tools" From 582d55f0c993ee60fae9d36145232669d7a1db24 Mon Sep 17 00:00:00 2001 From: Toni Oliver Date: Thu, 30 Nov 2023 17:08:00 +0100 Subject: [PATCH 06/19] Add progress=plain option, as it seems to be necessary to see the output of docker build when using buildkit (new docker build engine). --- docker/ros2/humble/buildspec.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/ros2/humble/buildspec.yml b/docker/ros2/humble/buildspec.yml index d6e57200..16f4d553 100644 --- a/docker/ros2/humble/buildspec.yml +++ b/docker/ros2/humble/buildspec.yml @@ -29,7 +29,7 @@ phases: - git checkout $branch - cd $dockerfile_folder - aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/shadowrobot - - docker build --build-arg toolset_branch=$branch -t $image . + - docker build --progress=plain --build-arg toolset_branch=$branch -t $image . - docker tag $image:latest public.ecr.aws/shadowrobot/$image:$tag - docker push public.ecr.aws/shadowrobot/$image:$tag - comm -13 <(aws ecr-public describe-image-tags --repository-name $image --region us-east-1 --output text | awk '{print $3}' | tr " " "\n" | sort -u) <(aws ecr-public describe-images --repository-name $image --region us-east-1 --output text | awk '{print $2}' | tr " " "\n" | sort -u) >> ids_to_delete.txt From a6099ae51c3f5f46a3df98791b40d3a82fb21585 Mon Sep 17 00:00:00 2001 From: Toni Oliver Date: Fri, 1 Dec 2023 11:10:53 +0100 Subject: [PATCH 07/19] Check what happens if we remove PYTHONUNBUFFERED. (Ansible output is looking odd right now). --- bin/sr-run-ci-build.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/sr-run-ci-build.sh b/bin/sr-run-ci-build.sh index 52132449..2d1762a9 100755 --- a/bin/sr-run-ci-build.sh +++ b/bin/sr-run-ci-build.sh @@ -83,7 +83,8 @@ case $server_type in ;; "docker_hub") echo "Docker Hub" - PYTHONUNBUFFERED=1 ansible-playbook -v -i "localhost," -c local docker_site.yml --tags "docker_hub,$tags_list" -e "ros_release=$ros_release ubuntu_version_name=$ubuntu_version" + # PYTHONUNBUFFERED=1 ansible-playbook -v -i "localhost," -c local docker_site.yml --tags "docker_hub,$tags_list" -e "ros_release=$ros_release ubuntu_version_name=$ubuntu_version" + PYTHONUNBUFFERED=0 ansible-playbook -v -i "localhost," -c local docker_site.yml --tags "docker_hub,$tags_list" -e "ros_release=$ros_release ubuntu_version_name=$ubuntu_version" ;; "local") echo "Local run" From f0cbbd29f9ba115fe3db1bbd60f43ac417014336 Mon Sep 17 00:00:00 2001 From: Toni Oliver Date: Fri, 1 Dec 2023 11:43:41 +0100 Subject: [PATCH 08/19] Add verbosity --- bin/sr-run-ci-build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/sr-run-ci-build.sh b/bin/sr-run-ci-build.sh index 2d1762a9..f501fe9b 100755 --- a/bin/sr-run-ci-build.sh +++ b/bin/sr-run-ci-build.sh @@ -84,7 +84,7 @@ case $server_type in "docker_hub") echo "Docker Hub" # PYTHONUNBUFFERED=1 ansible-playbook -v -i "localhost," -c local docker_site.yml --tags "docker_hub,$tags_list" -e "ros_release=$ros_release ubuntu_version_name=$ubuntu_version" - PYTHONUNBUFFERED=0 ansible-playbook -v -i "localhost," -c local docker_site.yml --tags "docker_hub,$tags_list" -e "ros_release=$ros_release ubuntu_version_name=$ubuntu_version" + PYTHONUNBUFFERED=0 ansible-playbook -vvv -i "localhost," -c local docker_site.yml --tags "docker_hub,$tags_list" -e "ros_release=$ros_release ubuntu_version_name=$ubuntu_version" ;; "local") echo "Local run" From b0565630e6cfd658f715873fc2c4e2e40a9fcc15 Mon Sep 17 00:00:00 2001 From: Toni Oliver Date: Fri, 1 Dec 2023 14:51:42 +0100 Subject: [PATCH 09/19] Remove fixed versions from requirements.txt --- ansible/data/requirements.txt | 40 +++++++++++++++++------------------ 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/ansible/data/requirements.txt b/ansible/data/requirements.txt index c79b0bd5..9ef6e08e 100644 --- a/ansible/data/requirements.txt +++ b/ansible/data/requirements.txt @@ -1,20 +1,20 @@ -ansible==4.2.0 -ansible-core==2.11.11 -asn1crypto==1.5.1 -bcrypt==3.2.0 -cffi==1.15.0 -cryptography==3.3.2 -ipaddress==1.0.23 -Jinja2==3.1.1 -MarkupSafe==2.1.1 -packaging==21.3 -paramiko==2.7.2 -pbr==5.8.1 -pyasn1==0.4.8 -pycparser==2.21 -pycrypto==2.6.1 -PyNaCl==1.4.0 -pyopenssl==20.0.1 -resolvelib==0.5.4 -six==1.15.0 -testresources==2.0.1 +ansible +ansible-core +asn1crypto +bcrypt +cffi +cryptography +ipaddress +Jinja2 +MarkupSafe +packaging +paramiko +pbr +pyasn1 +pycparser +pycrypto +PyNaCl +pyopenssl +resolvelib +six +testresources From 3095bf9a42b8c303db6e853e13741e6fc7790e2b Mon Sep 17 00:00:00 2001 From: Toni Oliver Date: Fri, 1 Dec 2023 15:25:17 +0100 Subject: [PATCH 10/19] Remove deprecated json argument --- ansible/callback_plugins/log_beautifier.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/callback_plugins/log_beautifier.py b/ansible/callback_plugins/log_beautifier.py index e8a88c77..d76bfdf2 100644 --- a/ansible/callback_plugins/log_beautifier.py +++ b/ansible/callback_plugins/log_beautifier.py @@ -15,7 +15,7 @@ def obfuscate_credentials(input_value): def fixed_dump_results(self, result, indent=None, sort_keys=True, keep_invocation=False): json_message = self._original_dump_results(result, indent, sort_keys, keep_invocation) - message_dictionary = json.loads(json_message, encoding="utf-8") + message_dictionary = json.loads(json_message) result = "" for key, value in message_dictionary.items(): if key not in ["stderr", "stdout_lines"]: From 1ac21c178676348a4d6743b18560238cfad4d521 Mon Sep 17 00:00:00 2001 From: Toni Oliver Date: Fri, 1 Dec 2023 17:39:45 +0100 Subject: [PATCH 11/19] Update ubuntu version name for humble --- docker/ros2/humble/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/ros2/humble/Dockerfile b/docker/ros2/humble/Dockerfile index 7164cdad..e8e8a421 100644 --- a/docker/ros2/humble/Dockerfile +++ b/docker/ros2/humble/Dockerfile @@ -18,6 +18,7 @@ ENV toolset_branch ${toolset_branch:-"master"} ENV server_type="docker_hub" ENV used_modules="check_cache,create_workspace" ENV ros_release_name=humble +ENV ubuntu_version_name=jammy ENV remote_shell_script="https://raw.githubusercontent.com/shadow-robot/sr-build-tools/$toolset_branch/bin/sr-run-ci-build.sh" ENV remote_additional_bashrc_cmds="https://raw.githubusercontent.com/shadow-robot/sr-build-tools/$toolset_branch/docker/utils/additional_bashrc_cmds_rolling" From 301db0f9dbbcaf8c98d2931e411b2c0eab44658c Mon Sep 17 00:00:00 2001 From: Toni Oliver Date: Mon, 4 Dec 2023 11:03:24 +0100 Subject: [PATCH 12/19] Fix conditions that checked for ROS2 versions. Add rosdep bash command for humble. --- .../ci/init/create_workspace/tasks/main.yml | 4 +- ansible/roles/ci/init/install/tasks/main.yml | 4 +- docker/ros2/humble/Dockerfile | 4 +- docker/utils/additional_bashrc_cmds_humble | 49 +++++++++++++++++++ 4 files changed, 53 insertions(+), 8 deletions(-) create mode 100644 docker/utils/additional_bashrc_cmds_humble diff --git a/ansible/roles/ci/init/create_workspace/tasks/main.yml b/ansible/roles/ci/init/create_workspace/tasks/main.yml index a6beb117..c0b34264 100644 --- a/ansible/roles/ci/init/create_workspace/tasks/main.yml +++ b/ansible/roles/ci/init/create_workspace/tasks/main.yml @@ -61,6 +61,4 @@ # chdir: "/home/user/workspace/" # become: yes # become_method: sudo - when: - - ros_release == 'rolling' - - ros_release == 'humble' + when: (ros_release == 'rolling') or (ros_release == 'humble') diff --git a/ansible/roles/ci/init/install/tasks/main.yml b/ansible/roles/ci/init/install/tasks/main.yml index 65cc26b3..b9ab3c0d 100644 --- a/ansible/roles/ci/init/install/tasks/main.yml +++ b/ansible/roles/ci/init/install/tasks/main.yml @@ -26,9 +26,7 @@ become: yes become_method: sudo become_user: root - when: - - ros_release == 'rolling' - - ros_release == 'humble' + when: (ros_release == 'rolling') or (ros_release == 'humble') - name: Install PIP modules pip: diff --git a/docker/ros2/humble/Dockerfile b/docker/ros2/humble/Dockerfile index e8e8a421..d5bb3604 100644 --- a/docker/ros2/humble/Dockerfile +++ b/docker/ros2/humble/Dockerfile @@ -1,5 +1,5 @@ # -# ROS2 rolling with build tools Dockerfile +# ROS2 humble with build tools Dockerfile # # https://github.com/shadow-robot/sr-build-tools/ # @@ -21,7 +21,7 @@ ENV ros_release_name=humble ENV ubuntu_version_name=jammy ENV remote_shell_script="https://raw.githubusercontent.com/shadow-robot/sr-build-tools/$toolset_branch/bin/sr-run-ci-build.sh" -ENV remote_additional_bashrc_cmds="https://raw.githubusercontent.com/shadow-robot/sr-build-tools/$toolset_branch/docker/utils/additional_bashrc_cmds_rolling" +ENV remote_additional_bashrc_cmds="https://raw.githubusercontent.com/shadow-robot/sr-build-tools/$toolset_branch/docker/utils/additional_bashrc_cmds_humble" COPY entrypoint.sh /usr/local/bin/entrypoint.sh COPY terminator_config /tmp/terminator_config diff --git a/docker/utils/additional_bashrc_cmds_humble b/docker/utils/additional_bashrc_cmds_humble new file mode 100644 index 00000000..1fabf1c1 --- /dev/null +++ b/docker/utils/additional_bashrc_cmds_humble @@ -0,0 +1,49 @@ +# Print nickname for git/hg/bzr/svn version control in CWD +# Optional $1 of format string for printf, default "(%s) " +if [ -f /etc/bash_completion.d/git ]; then + . /etc/bash_completion.d/git +fi +if [ -f /etc/bash_completion.d/git-prompt ]; then + . /etc/bash_completion.d/git-prompt +fi +if [ -f /usr/share/bash-completion/completions/git ]; then + . /usr/share/bash-completion/completions/git +fi +function be_get_branch { + local dir="$PWD" + local vcs + local nick + while [[ "$dir" != "/" ]]; do + for vcs in git hg svn bzr; do + if [[ -d "$dir/.$vcs" ]] && hash "$vcs" &>/dev/null; then + case "$vcs" in + git) __git_ps1 "${1:-(%s) }"; return;; + hg) nick=$(hg branch 2>/dev/null);; + svn) nick=$(svn info 2>/dev/null\ + | grep -e '^Repository Root:'\ + | sed -e 's#.*/##');; + bzr) + local conf="${dir}/.bzr/branch/branch.conf" # normal branch + [[ -f "$conf" ]] && nick=$(grep -E '^nickname =' "$conf" | cut -d' ' -f 3) + conf="${dir}/.bzr/branch/location" # colo/lightweight branch + [[ -z "$nick" ]] && [[ -f "$conf" ]] && nick="$(basename "$(< $conf)")" + [[ -z "$nick" ]] && nick="$(basename "$(readlink -f "$dir")")";; + esac + [[ -n "$nick" ]] && printf "${1:-(%s) }" "$nick" + return 0 + fi + done + dir="$(dirname "$dir")" + done +} +# Add branch to PS1 (based on $PS1 or $1), formatted as $2 +export GIT_PS1_SHOWDIRTYSTATE=yes + +#pretty PS1: +export PS1="\$([[ \$? != 0 ]] && echo \"[\[\033[0;31m\]\342\234\227\[\033[0;37m\]]\342\224\200\")[$(if [[ ${EUID} == 0 ]]; then echo '\[\033[0;31m\]\h'; else echo '\[\033[0;33m\]\u\[\033[0;37m\]@\[\033[0;95m\]\h'; fi)\[\033[0;37m\]]\342\224\200[\[\033[0;32m\]\w\[\033[0;37m\]]\n\[\033[0;37m\]\342\224\224\342\224\200\342\224\200\342\225\274 \[\033[0m\]" +export PS1="\[\033[0;37m\]\342\224\214\342\224\200\$(be_get_branch "$2")${PS1}"; + +alias dephumble='rosdep install --from-paths . --ignore-src --rosdistro humble -y' + +export ROSCONSOLE_FORMAT='[${severity}](${node}): [${time}] ${message}' +alias python=python3 From c2f431e135a6b64b780ffea478e35af7db615be0 Mon Sep 17 00:00:00 2001 From: Toni Oliver Date: Mon, 4 Dec 2023 13:40:43 +0100 Subject: [PATCH 13/19] Add condition to ur-client-library role. It only makes sense in noetic. --- ansible/docker_site.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ansible/docker_site.yml b/ansible/docker_site.yml index ffa9753e..f8dea237 100644 --- a/ansible/docker_site.yml +++ b/ansible/docker_site.yml @@ -35,13 +35,13 @@ "xml_code_style_check", "catkin_code_style_check", "code_style_check", "create_workspace", "benchmarking", "check_install"]} - - {role: build_deps/ur-client-library, tags: ["build", "unit_tests", "software_tests", "all_tests", - "code_coverage", "codecov_tool", "python_code_coverage", - "cpp_code_coverage", "check_deb_make", "complete_deb_check", - "check_build", "python_code_style_check", - "cpp_code_style_check", "xml_code_style_check", - "catkin_code_style_check", "code_style_check", - "create_workspace", "benchmarking", "check_install"]} + - {role: build_deps/ur-client-library, when: (ros_release == "noetic"), tags: ["build", "unit_tests", "software_tests", "all_tests", + "code_coverage", "codecov_tool", "python_code_coverage", + "cpp_code_coverage", "check_deb_make", "complete_deb_check", + "check_build", "python_code_style_check", + "cpp_code_style_check", "xml_code_style_check", + "catkin_code_style_check", "code_style_check", + "create_workspace", "benchmarking", "check_install"]} - {role: ci/update_dependencies, when: run_build, tags: ["build", "unit_tests", "software_tests", "all_tests", "code_coverage", "codecov_tool", "python_code_coverage", "cpp_code_coverage", "check_deb_make", From 5ceb7618ea1d5e9e001b350a32788ec61b8c87df Mon Sep 17 00:00:00 2001 From: Toni Oliver Date: Mon, 4 Dec 2023 14:36:20 +0100 Subject: [PATCH 14/19] Fix empy version to avoid error caused by the presence of the debian installed version --- ansible/roles/ci/init/install/tasks/main.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ansible/roles/ci/init/install/tasks/main.yml b/ansible/roles/ci/init/install/tasks/main.yml index b9ab3c0d..e50c46fb 100644 --- a/ansible/roles/ci/init/install/tasks/main.yml +++ b/ansible/roles/ci/init/install/tasks/main.yml @@ -18,9 +18,12 @@ - ros_release != 'rolling' - ros_release != 'humble' +# Using aspecificversion for empy as that's the one that is installed by default in Ubuntu Jammy form debian repos +# so pip will skip it. Otherwise pip throws an error when failing to uninstall the deb version to install the latest pip version. +# I don't really know what this package is needed for. - name: Install PIP modules pip: - name: ['catkin_pkg','empy','coverage','catkin-lint','pylint'] + name: ['catkin_pkg','empy==3.3.4','coverage','catkin-lint','pylint'] extra_args: '--upgrade' executable: pip3 become: yes From b33d030b7e2c661bd850be05334f46b1dbfda6c0 Mon Sep 17 00:00:00 2001 From: Toni Oliver Date: Mon, 4 Dec 2023 15:49:15 +0100 Subject: [PATCH 15/19] Changing rolling base image to be the correct one for development (to deveop packages on ROS2, not to develop ROS2 itself. Changes to allow for a newer codebuild image. --- docker/ros2/rolling/Dockerfile | 3 ++- docker/ros2/rolling/buildspec.yml | 11 +---------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/docker/ros2/rolling/Dockerfile b/docker/ros2/rolling/Dockerfile index 0ad9f6f8..8ad7e43d 100644 --- a/docker/ros2/rolling/Dockerfile +++ b/docker/ros2/rolling/Dockerfile @@ -4,7 +4,7 @@ # https://github.com/shadow-robot/sr-build-tools/ # -FROM osrf/ros2:nightly +FROM ros:rolling-ros-base LABEL Description="This image is used to make ROS2 rolling based projects build faster using build tools" Vendor="Shadow Robot" Version="1.0" @@ -18,6 +18,7 @@ ENV toolset_branch ${toolset_branch:-"master"} ENV server_type="docker_hub" ENV used_modules="check_cache,create_workspace" ENV ros_release_name=rolling +ENV ubuntu_version_name=jammy ENV remote_shell_script="https://raw.githubusercontent.com/shadow-robot/sr-build-tools/$toolset_branch/bin/sr-run-ci-build.sh" ENV remote_additional_bashrc_cmds="https://raw.githubusercontent.com/shadow-robot/sr-build-tools/$toolset_branch/docker/utils/additional_bashrc_cmds_rolling" diff --git a/docker/ros2/rolling/buildspec.yml b/docker/ros2/rolling/buildspec.yml index f032fe31..18fb8d24 100644 --- a/docker/ros2/rolling/buildspec.yml +++ b/docker/ros2/rolling/buildspec.yml @@ -5,7 +5,7 @@ env: variables: branch: default image: build-tools - tag: focal-rolling + tag: rolling dockerfile_folder: docker/ros2/rolling/ exported-variables: - branch @@ -13,16 +13,12 @@ env: - tag - dockerfile_folder phases: - install: - runtime-versions: - docker: 19 build: commands: - | if [[ $branch != "default" ]]; then toolset_branch=$branch elif [[ $CODEBUILD_SOURCE_VERSION == "pr/"* ]]; then - pr_number=${CODEBUILD_SOURCE_VERSION#pr/} pr_number=${CODEBUILD_SOURCE_VERSION#pr/} branch=$(curl -s "https://api.github.com/repos/shadow-robot/sr-build-tools/pulls/$pr_number" | jq -r '.head.ref') elif [[ $CODEBUILD_SOURCE_VERSION =~ ^[0-9a-f]{40}$ ]]; then @@ -30,11 +26,6 @@ phases: else branch=$CODEBUILD_SOURCE_VERSION fi - - awscli_v1_executable=$(which aws) - - rm $awscli_v1_executable - - curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" - - unzip awscliv2.zip - - ./aws/install - git checkout $branch - cd $dockerfile_folder - aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/shadowrobot From fe14157fb84268b58874d0ece2a1d6d211490302 Mon Sep 17 00:00:00 2001 From: Toni Oliver Date: Mon, 4 Dec 2023 17:24:53 +0100 Subject: [PATCH 16/19] Undo some unnecessary changes --- bin/sr-run-ci-build.sh | 3 +-- docker/ros2/humble/buildspec.yml | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/bin/sr-run-ci-build.sh b/bin/sr-run-ci-build.sh index f501fe9b..cb27275c 100755 --- a/bin/sr-run-ci-build.sh +++ b/bin/sr-run-ci-build.sh @@ -83,8 +83,7 @@ case $server_type in ;; "docker_hub") echo "Docker Hub" - # PYTHONUNBUFFERED=1 ansible-playbook -v -i "localhost," -c local docker_site.yml --tags "docker_hub,$tags_list" -e "ros_release=$ros_release ubuntu_version_name=$ubuntu_version" - PYTHONUNBUFFERED=0 ansible-playbook -vvv -i "localhost," -c local docker_site.yml --tags "docker_hub,$tags_list" -e "ros_release=$ros_release ubuntu_version_name=$ubuntu_version" + PYTHONUNBUFFERED=1 ansible-playbook -vvv -i "localhost," -c local docker_site.yml --tags "docker_hub,$tags_list" -e "ros_release=$ros_release ubuntu_version_name=$ubuntu_version" ;; "local") echo "Local run" diff --git a/docker/ros2/humble/buildspec.yml b/docker/ros2/humble/buildspec.yml index 16f4d553..d6e57200 100644 --- a/docker/ros2/humble/buildspec.yml +++ b/docker/ros2/humble/buildspec.yml @@ -29,7 +29,7 @@ phases: - git checkout $branch - cd $dockerfile_folder - aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/shadowrobot - - docker build --progress=plain --build-arg toolset_branch=$branch -t $image . + - docker build --build-arg toolset_branch=$branch -t $image . - docker tag $image:latest public.ecr.aws/shadowrobot/$image:$tag - docker push public.ecr.aws/shadowrobot/$image:$tag - comm -13 <(aws ecr-public describe-image-tags --repository-name $image --region us-east-1 --output text | awk '{print $3}' | tr " " "\n" | sort -u) <(aws ecr-public describe-images --repository-name $image --region us-east-1 --output text | awk '{print $2}' | tr " " "\n" | sort -u) >> ids_to_delete.txt From b0843bfe3a7320492abd87ff5786c5e5802bbb02 Mon Sep 17 00:00:00 2001 From: Toni Oliver Date: Tue, 5 Dec 2023 13:31:35 +0100 Subject: [PATCH 17/19] Fix typos in comment --- ansible/roles/ci/init/install/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/roles/ci/init/install/tasks/main.yml b/ansible/roles/ci/init/install/tasks/main.yml index e50c46fb..463c2196 100644 --- a/ansible/roles/ci/init/install/tasks/main.yml +++ b/ansible/roles/ci/init/install/tasks/main.yml @@ -18,7 +18,7 @@ - ros_release != 'rolling' - ros_release != 'humble' -# Using aspecificversion for empy as that's the one that is installed by default in Ubuntu Jammy form debian repos +# Using a specific version for empy as that's the one that is installed by default in Ubuntu Jammy from debian repos # so pip will skip it. Otherwise pip throws an error when failing to uninstall the deb version to install the latest pip version. # I don't really know what this package is needed for. - name: Install PIP modules From 188c7d8cffcfef465613877ce0191ac93a2c76f0 Mon Sep 17 00:00:00 2001 From: Toni Oliver Date: Tue, 5 Dec 2023 15:47:44 +0100 Subject: [PATCH 18/19] Make requirements.txt compatible with jammy as well as focal --- ansible/data/focal/requirements.txt | 20 ++++++++++++++++++++ ansible/data/{ => jammy}/requirements.txt | 0 ansible/deploy.sh | 3 ++- bin/sr-run-ci-build.sh | 10 ++++++++-- 4 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 ansible/data/focal/requirements.txt rename ansible/data/{ => jammy}/requirements.txt (100%) diff --git a/ansible/data/focal/requirements.txt b/ansible/data/focal/requirements.txt new file mode 100644 index 00000000..c79b0bd5 --- /dev/null +++ b/ansible/data/focal/requirements.txt @@ -0,0 +1,20 @@ +ansible==4.2.0 +ansible-core==2.11.11 +asn1crypto==1.5.1 +bcrypt==3.2.0 +cffi==1.15.0 +cryptography==3.3.2 +ipaddress==1.0.23 +Jinja2==3.1.1 +MarkupSafe==2.1.1 +packaging==21.3 +paramiko==2.7.2 +pbr==5.8.1 +pyasn1==0.4.8 +pycparser==2.21 +pycrypto==2.6.1 +PyNaCl==1.4.0 +pyopenssl==20.0.1 +resolvelib==0.5.4 +six==1.15.0 +testresources==2.0.1 diff --git a/ansible/data/requirements.txt b/ansible/data/jammy/requirements.txt similarity index 100% rename from ansible/data/requirements.txt rename to ansible/data/jammy/requirements.txt diff --git a/ansible/deploy.sh b/ansible/deploy.sh index f867577b..6f092e81 100755 --- a/ansible/deploy.sh +++ b/ansible/deploy.sh @@ -203,7 +203,8 @@ echo " | Setting up requirements |" echo " ----------------------------------" echo "" -sudo pip3 install -r "${SR_BUILD_TOOLS_HOME}/ansible/data/requirements.txt" +export ubuntu_version="$(lsb_release -cs)" +sudo pip3 install -r "${SR_BUILD_TOOLS_HOME}/ansible/data/$ubuntu_version/requirements.txt" sudo pip3 install --upgrade setuptools==51.1.1 echo "" diff --git a/bin/sr-run-ci-build.sh b/bin/sr-run-ci-build.sh index cb27275c..2a94a6eb 100755 --- a/bin/sr-run-ci-build.sh +++ b/bin/sr-run-ci-build.sh @@ -24,7 +24,13 @@ if [ "semaphore_docker" != $server_type ] && [ "local" != $server_type ] && [ " sudo apt-get install -y python3-dev libxml2-dev libxslt-dev python3-pip lcov wget git libssl-dev libffi-dev libyaml-dev sudo pip3 install --upgrade pip setuptools==51.1.1 gcovr - sudo pip3 install "PyYAML>=5.4.1" --ignore-installed + if [ "$ubuntu_version" != "jammy" ] + then + sudo pip3 install PyYAML==5.4.1 --ignore-installed + else + sudo pip3 install "PyYAML>=5.4.1" --ignore-installed + fi + git config --global user.email "build.tools@example.com" git config --global user.name "Build Tools" @@ -34,7 +40,7 @@ if [ "semaphore_docker" != $server_type ] && [ "local" != $server_type ] && [ " git clone --depth 1 https://github.com/shadow-robot/sr-build-tools.git -b "$toolset_branch" $build_tools_folder cd $build_tools_folder/ansible - sudo pip3 install -r data/requirements.txt + sudo pip3 install -r data/$ubuntu_version/requirements.txt fi export extra_variables="codecov_secure=$CODECOV_TOKEN github_login=$GITHUB_LOGIN github_password=$GITHUB_PASSWORD ros_release=$ros_release ubuntu_version_name=$ubuntu_version " From 0399e436a9e1a9bcfa1b1cef9f8aaa273681716a Mon Sep 17 00:00:00 2001 From: Toni Oliver Date: Tue, 5 Dec 2023 16:18:31 +0100 Subject: [PATCH 19/19] Make json loading compatible with newer versions of python --- ansible/callback_plugins/log_beautifier.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ansible/callback_plugins/log_beautifier.py b/ansible/callback_plugins/log_beautifier.py index d76bfdf2..214c54c5 100644 --- a/ansible/callback_plugins/log_beautifier.py +++ b/ansible/callback_plugins/log_beautifier.py @@ -5,6 +5,7 @@ from __future__ import absolute_import import json import re +import sys from threading import Timer from ansible.plugins.callback import CallbackBase @@ -15,7 +16,10 @@ def obfuscate_credentials(input_value): def fixed_dump_results(self, result, indent=None, sort_keys=True, keep_invocation=False): json_message = self._original_dump_results(result, indent, sort_keys, keep_invocation) - message_dictionary = json.loads(json_message) + if sys.version_info.major>=3 and sys.version_info.minor>=9: + message_dictionary = json.loads(json_message) + else: + message_dictionary = json.loads(json_message, encoding="utf-8") result = "" for key, value in message_dictionary.items(): if key not in ["stderr", "stdout_lines"]: