From fa9878764f2620af61f7484435635cc9fc1da8bd Mon Sep 17 00:00:00 2001 From: Matthijs van der Burgh Date: Tue, 19 Sep 2023 09:53:20 +0200 Subject: [PATCH 01/19] (actions) also generate rolling --- .github/workflows/main.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4cb0b4b99..9e0cc4fe6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -44,6 +44,15 @@ jobs: ros-version: 2 platform: "amd64" base-image: "ubuntu:22.04" + - ros-distro: rolling + ros-version: 2 + platform: "amd64" + flavor: u20 + - ros-distro: rolling + ros-version: 2 + platform: "amd64" + base-image: "ubuntu:22.04" + flavor: u22 outputs: key: ${{ steps.artifacts.outputs.key }} tag: ${{ steps.script.outputs.tag }} From 022303c96cd8140223a890138f5da484d6be7991 Mon Sep 17 00:00:00 2001 From: Matthijs van der Burgh Date: Tue, 19 Sep 2023 10:18:43 +0200 Subject: [PATCH 02/19] (bootstrap) also support rolling --- installer/bootstrap.bash | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/installer/bootstrap.bash b/installer/bootstrap.bash index e364be820..6d7d902e2 100755 --- a/installer/bootstrap.bash +++ b/installer/bootstrap.bash @@ -49,6 +49,9 @@ case $DISTRIB_RELEASE in elif [[ "${ros_distro}" == "galactic" ]] then TUE_ROS_DISTRO=galactic + elif [[ "${ros_distro}" == "rolling" ]] + then + TUE_ROS_DISTRO=rolling elif [[ -n "${ros_distro}" ]] then echo "[tue-env](bootstrap) Error! ROS ${ros_distro} is unsupported with tue-env." @@ -72,8 +75,27 @@ case $DISTRIB_RELEASE in fi ;; "22.04") - TUE_ROS_DISTRO=humble + if [[ -n "${ros_version}" ]] && [[ "${ros_version}" -ne 2 ]] + then + echo "[tue-env](bootstrap) Error! Only ROS version 2 is supported with ubuntu 22.04 and newer" + exit 1 + fi TUE_ROS_VERSION=2 + + if [[ "${ros_distro}" == "humble" ]] + then + TUE_ROS_DISTRO=humble + elif [[ "${ros_distro}" == "rolling" ]] + then + TUE_ROS_DISTRO=rolling + elif [[ -n "${ros_distro}" ]] + then + echo "[tue-env](bootstrap) Error! ROS ${ros_distro} is unsupported with tue-env." + exit 1 + else + TUE_ROS_DISTRO=humble + echo "[tue-env](bootstrap) Using default ROS_DISTRO '${TUE_ROS_DISTRO}' with ROS_VERSION '${TUE_ROS_VERSION}'" + fi ;; *) echo "[tue-env](bootstrap) Ubuntu $DISTRIB_RELEASE is unsupported. Please use one of Ubuntu 20.04 or 22.04." From 1071c6c63b9b0bf627d942187aedab1181f77c24 Mon Sep 17 00:00:00 2001 From: Matthijs van der Burgh Date: Tue, 19 Sep 2023 11:01:49 +0200 Subject: [PATCH 03/19] (target_setup) paths are relative to TUE_ENV_DIR --- setup/generate_setup_file.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/setup/generate_setup_file.py b/setup/generate_setup_file.py index d66c04f04..98172410a 100755 --- a/setup/generate_setup_file.py +++ b/setup/generate_setup_file.py @@ -1,6 +1,6 @@ #! /usr/bin/env python3 -from typing import IO, List +from typing import List import os import sys @@ -59,7 +59,8 @@ def _generate_setup_file_rec(self, target: str) -> List[str]: target_setup_file = os.path.join(self._tue_env_targets_dir, target, "setup") if os.path.isfile(target_setup_file): - lines.append(f"source {target_setup_file}\n") + rel_target_setup_file = os.path.relpath(target_setup_file, self._tue_env_dir) + lines.append(f"source ${{TUE_ENV_DIR}}/{rel_target_setup_file}\n") return lines From 41524ceed6a295605a1a91bcd85352238934f779 Mon Sep 17 00:00:00 2001 From: Matthijs van der Burgh Date: Tue, 19 Sep 2023 11:53:12 +0200 Subject: [PATCH 04/19] (CI)(organization-packages) new action --- ci/organization-packages.sh | 39 ++++++++++++++++++++++++++++ ci/organization-packages/action.yaml | 36 +++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 ci/organization-packages.sh create mode 100644 ci/organization-packages/action.yaml diff --git a/ci/organization-packages.sh b/ci/organization-packages.sh new file mode 100644 index 000000000..88d116a03 --- /dev/null +++ b/ci/organization-packages.sh @@ -0,0 +1,39 @@ +#! /usr/bin/env bash + +for i in "$@" +do + case $i in + -o=* | --organization=* ) + ORGANIZATION="${i#*=}" + ;; + -t=* | --type=* ) + PACKAGE_TYPE="${i#*=}" + ;; + * ) + # unknown option + if [[ -n "${i}" ]] # Ignore empty arguments + then + echo -e "\e[35m\e[1mUnknown input argument '${i}'. Check CI .yml file\e[0m" + exit 1 + fi + ;; + esac + shift +done + +echo -e "\e[35m\e[1mORGANIZATION = ${ORGANIZATION}\e[0m" +echo -e "\e[35m\e[1mPACKAGE_TYPE = ${PACKAGE_TYPE}\e[0m" + +echo -e "\e[1mgh api -H \"Accept: application/vnd.github+json\" -H \"X-GitHub-Api-Version: 2022-11-28\" /orgs/${ORGANIZATION}/packages?package_type=${PACKAGE_TYPE} | jq -rc '.[].name'\e[0m" +packages=$(gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /orgs/"${ORGANIZATION}"/packages?package_type="${PACKAGE_TYPE}" | jq -rc '.[].name') + +echo -e "\e[35m\e[1mpackages:\e[0m" +for pkg in ${packages} +do +echo -e "\e[35m\e[1m ${pkg}\e[0m" +done +for pkg in ${packages} +do +packages_list="${packages_list:+$packages_list, }'${pkg}'" +done +packages_list="[${packages_list}]" diff --git a/ci/organization-packages/action.yaml b/ci/organization-packages/action.yaml new file mode 100644 index 000000000..d1a25bd97 --- /dev/null +++ b/ci/organization-packages/action.yaml @@ -0,0 +1,36 @@ +name: 'Organization packages' +description: 'Get the names of the packages in an organization' +inputs: + package-type: + description: 'Type of the packages' + required: true + type: string + default: 'container' + organization: + description: 'Name of the organization' + required: true + type: string + default: ${{ github.repository_owner }} + token: + description: 'GitHub token' + required: true + default: ${{ github.token }} +outputs: + packages: + description: 'Package names' + value: ${{ steps.packages.outputs.packages }} +runs: + using: "composite" + steps: + - name: Organization packages + id: packages + run: | + source ${{ github.action_path }}/../organization-packages.sh --organization=${{ inputs.organization }} --type=${{ inputs.package-type }} + echo -e "\e[35m\e[1mpackages=${packages_list} >> \${GITHUB_OUTPUT}\e[0m" + echo "packages=${packages_list}" >> ${GITHUB_OUTPUT} + shell: bash --noprofile --norc -o pipefail {0} + env: + GH_TOKEN: ${{ inputs.token }} + + + From e14ca36edad0b9824559c468d74a7b82c7eee6fe Mon Sep 17 00:00:00 2001 From: Matthijs van der Burgh Date: Tue, 19 Sep 2023 11:59:25 +0200 Subject: [PATCH 05/19] (actions) use organization-packages action --- .github/workflows/cleanup_container_tags.yml | 15 ++++++++++++++- .github/workflows/cleanup_untagged_containers.yml | 15 ++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cleanup_container_tags.yml b/.github/workflows/cleanup_container_tags.yml index 68a30b88e..b73b323a3 100644 --- a/.github/workflows/cleanup_container_tags.yml +++ b/.github/workflows/cleanup_container_tags.yml @@ -3,13 +3,26 @@ name: Cleanup container tags on: delete jobs: + organization_containers: + name: Get all containers in the organization + runs-on: ubuntu-latest + outputs: + packages: ${{ steps.organization-containers.outputs.packages }} + steps: + - name: Organization containers + id: organization_containers + uses: tue-robotics/tue-env/ci/organization-packages@master + with: + package-type: container + delete_container_tag: name: Delete container tag runs-on: ubuntu-latest + needs: organization_containers strategy: fail-fast: false matrix: - package_name: ["tue-env-ros-noetic", "tue-env-ros-galactic", "tue-env-ros-humble"] + package_name: ${{ fromJson(needs.organization_containers.outputs.packages) }} steps: - name: Generate tag id: generate-tag diff --git a/.github/workflows/cleanup_untagged_containers.yml b/.github/workflows/cleanup_untagged_containers.yml index 968f11687..df297b815 100644 --- a/.github/workflows/cleanup_untagged_containers.yml +++ b/.github/workflows/cleanup_untagged_containers.yml @@ -6,13 +6,26 @@ on: workflow_dispatch: jobs: + organization_containers: + name: Get all containers in the organization + runs-on: ubuntu-latest + outputs: + packages: ${{ steps.organization-containers.outputs.packages }} + steps: + - name: Organization containers + id: organization_containers + uses: tue-robotics/tue-env/ci/organization-packages@MatthijsBurgh-patch-1 + with: + package-type: container + delete_untagged_containers: name: Delete untagged containers runs-on: ubuntu-latest + needs: organization_containers strategy: fail-fast: false matrix: - package_name: ["tue-env-ros-noetic", "tue-env-ros-galactic", "tue-env-ros-humble"] + package_name: ${{ fromJson(needs.organization_containers.outputs.packages) }} steps: - uses: actions/delete-package-versions@v4 with: From bdc76f01a8bf92070219916489c193857eb61875 Mon Sep 17 00:00:00 2001 From: Matthijs van der Burgh Date: Tue, 19 Sep 2023 13:57:12 +0200 Subject: [PATCH 06/19] (CI)(organization-packages) add type to token input --- ci/organization-packages/action.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/ci/organization-packages/action.yaml b/ci/organization-packages/action.yaml index d1a25bd97..75645b396 100644 --- a/ci/organization-packages/action.yaml +++ b/ci/organization-packages/action.yaml @@ -14,6 +14,7 @@ inputs: token: description: 'GitHub token' required: true + type: string default: ${{ github.token }} outputs: packages: From 603d450a7732499f28c978afb74dd4508b4362f6 Mon Sep 17 00:00:00 2001 From: Matthijs van der Burgh Date: Tue, 19 Sep 2023 14:01:29 +0200 Subject: [PATCH 07/19] (CI)(organization-packages) use curl instead of GH api --- ci/organization-packages.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/organization-packages.sh b/ci/organization-packages.sh index 88d116a03..ba8eb8173 100644 --- a/ci/organization-packages.sh +++ b/ci/organization-packages.sh @@ -24,8 +24,8 @@ done echo -e "\e[35m\e[1mORGANIZATION = ${ORGANIZATION}\e[0m" echo -e "\e[35m\e[1mPACKAGE_TYPE = ${PACKAGE_TYPE}\e[0m" -echo -e "\e[1mgh api -H \"Accept: application/vnd.github+json\" -H \"X-GitHub-Api-Version: 2022-11-28\" /orgs/${ORGANIZATION}/packages?package_type=${PACKAGE_TYPE} | jq -rc '.[].name'\e[0m" -packages=$(gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /orgs/"${ORGANIZATION}"/packages?package_type="${PACKAGE_TYPE}" | jq -rc '.[].name') +echo -e "\e[1mcurl -L -H \"Accept: application/vnd.github+json\" -H \"Authorization: Bearer \${GH_TOKEN}\" -H \"X-GitHub-Api-Version: 2022-11-28\" https://api.github.com/orgs/${ORGANIZATION}/packages?package_type=${PACKAGE_TYPE} | jq -rc '.[].name'\e0m" +packages=$(curl -L -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${GH_TOKEN}" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/orgs/"${ORGANIZATION}"/packages?package_type="${PACKAGE_TYPE}" | jq -rc '.[].name') echo -e "\e[35m\e[1mpackages:\e[0m" for pkg in ${packages} From 477efd6cd65be28f0132eb045fcf0cbc359d38b2 Mon Sep 17 00:00:00 2001 From: Matthijs van der Burgh Date: Tue, 19 Sep 2023 14:10:45 +0200 Subject: [PATCH 08/19] (CI)(organization-packages) debugging --- ci/organization-packages.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/ci/organization-packages.sh b/ci/organization-packages.sh index ba8eb8173..3d14920da 100644 --- a/ci/organization-packages.sh +++ b/ci/organization-packages.sh @@ -24,8 +24,19 @@ done echo -e "\e[35m\e[1mORGANIZATION = ${ORGANIZATION}\e[0m" echo -e "\e[35m\e[1mPACKAGE_TYPE = ${PACKAGE_TYPE}\e[0m" +echo -e "\e[1mgh api -H \"Accept: application/vnd.github+json\" -H \"X-GitHub-Api-Version: 2022-11-28\" /orgs/${ORGANIZATION}/packages?package_type=${PACKAGE_TYPE} | jq -rc '.[].name'\e[0m" +output=$(gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /orgs/"${ORGANIZATION}"/packages?package_type="${PACKAGE_TYPE}") +echo -e "return value: $?" +echo -e "output: ${output}" +packages=$(jq -rc '.[].name' <<< "${output}") +echo -e "packages:\n${packages}" +packages=$(gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /orgs/"${ORGANIZATION}"/packages?package_type="${PACKAGE_TYPE}" | jq -rc '.[].name') echo -e "\e[1mcurl -L -H \"Accept: application/vnd.github+json\" -H \"Authorization: Bearer \${GH_TOKEN}\" -H \"X-GitHub-Api-Version: 2022-11-28\" https://api.github.com/orgs/${ORGANIZATION}/packages?package_type=${PACKAGE_TYPE} | jq -rc '.[].name'\e0m" -packages=$(curl -L -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${GH_TOKEN}" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/orgs/"${ORGANIZATION}"/packages?package_type="${PACKAGE_TYPE}" | jq -rc '.[].name') +output=$(curl -L -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${GH_TOKEN}" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/orgs/"${ORGANIZATION}"/packages?package_type="${PACKAGE_TYPE}") +echo -e "return value: $?" +echo -e "output: ${output}" +packages=$(jq -rc '.[].name' <<< "${output}") +echo -e "packages:\n${packages} echo -e "\e[35m\e[1mpackages:\e[0m" for pkg in ${packages} From 4f6da4dac89cda870801b91023424752c5c52afb Mon Sep 17 00:00:00 2001 From: Matthijs van der Burgh Date: Tue, 19 Sep 2023 14:14:51 +0200 Subject: [PATCH 09/19] (CI)(organization-packages) add per_page & page --- ci/organization-packages.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ci/organization-packages.sh b/ci/organization-packages.sh index 3d14920da..c757f32b4 100644 --- a/ci/organization-packages.sh +++ b/ci/organization-packages.sh @@ -24,15 +24,14 @@ done echo -e "\e[35m\e[1mORGANIZATION = ${ORGANIZATION}\e[0m" echo -e "\e[35m\e[1mPACKAGE_TYPE = ${PACKAGE_TYPE}\e[0m" -echo -e "\e[1mgh api -H \"Accept: application/vnd.github+json\" -H \"X-GitHub-Api-Version: 2022-11-28\" /orgs/${ORGANIZATION}/packages?package_type=${PACKAGE_TYPE} | jq -rc '.[].name'\e[0m" -output=$(gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /orgs/"${ORGANIZATION}"/packages?package_type="${PACKAGE_TYPE}") +echo -e "\e[1mgh api -H \"Accept: application/vnd.github+json\" -H \"X-GitHub-Api-Version: 2022-11-28\" /orgs/${ORGANIZATION}/packages?package_type=${PACKAGE_TYPE}&per_page=100&page=1 | jq -rc '.[].name'\e[0m" +output=$(gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /orgs/"${ORGANIZATION}"/packages?package_type="${PACKAGE_TYPE}"&per_page=100&page=1) echo -e "return value: $?" echo -e "output: ${output}" packages=$(jq -rc '.[].name' <<< "${output}") echo -e "packages:\n${packages}" -packages=$(gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /orgs/"${ORGANIZATION}"/packages?package_type="${PACKAGE_TYPE}" | jq -rc '.[].name') -echo -e "\e[1mcurl -L -H \"Accept: application/vnd.github+json\" -H \"Authorization: Bearer \${GH_TOKEN}\" -H \"X-GitHub-Api-Version: 2022-11-28\" https://api.github.com/orgs/${ORGANIZATION}/packages?package_type=${PACKAGE_TYPE} | jq -rc '.[].name'\e0m" -output=$(curl -L -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${GH_TOKEN}" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/orgs/"${ORGANIZATION}"/packages?package_type="${PACKAGE_TYPE}") +echo -e "\e[1mcurl -L -H \"Accept: application/vnd.github+json\" -H \"Authorization: Bearer \${GH_TOKEN}\" -H \"X-GitHub-Api-Version: 2022-11-28\" https://api.github.com/orgs/${ORGANIZATION}/packages?package_type=${PACKAGE_TYPE}&per_page=100&page=1 | jq -rc '.[].name'\e0m" +output=$(curl -L -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${GH_TOKEN}" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/orgs/"${ORGANIZATION}"/packages?package_type="${PACKAGE_TYPE}"&per_page=100&page=1) echo -e "return value: $?" echo -e "output: ${output}" packages=$(jq -rc '.[].name' <<< "${output}") From 5e4a273f10490c1f20319e9c9ec62f908889751b Mon Sep 17 00:00:00 2001 From: Matthijs van der Burgh Date: Tue, 19 Sep 2023 14:21:15 +0200 Subject: [PATCH 10/19] (CI)(organization-packages) debugging --- ci/organization-packages.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ci/organization-packages.sh b/ci/organization-packages.sh index c757f32b4..84837f749 100644 --- a/ci/organization-packages.sh +++ b/ci/organization-packages.sh @@ -24,18 +24,18 @@ done echo -e "\e[35m\e[1mORGANIZATION = ${ORGANIZATION}\e[0m" echo -e "\e[35m\e[1mPACKAGE_TYPE = ${PACKAGE_TYPE}\e[0m" -echo -e "\e[1mgh api -H \"Accept: application/vnd.github+json\" -H \"X-GitHub-Api-Version: 2022-11-28\" /orgs/${ORGANIZATION}/packages?package_type=${PACKAGE_TYPE}&per_page=100&page=1 | jq -rc '.[].name'\e[0m" -output=$(gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /orgs/"${ORGANIZATION}"/packages?package_type="${PACKAGE_TYPE}"&per_page=100&page=1) +echo -e "\e[1mgh api -H \"Accept: application/vnd.github+json\" -H \"X-GitHub-Api-Version: 2022-11-28\" \"/orgs/${ORGANIZATION}/packages?package_type=${PACKAGE_TYPE}&per_page=100&page=1\" | jq -rc '.[].name'\e[0m" +output=$(gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" "/orgs/${ORGANIZATION}/packages?package_type=${PACKAGE_TYPE}&per_page=100&page=1") echo -e "return value: $?" echo -e "output: ${output}" packages=$(jq -rc '.[].name' <<< "${output}") echo -e "packages:\n${packages}" -echo -e "\e[1mcurl -L -H \"Accept: application/vnd.github+json\" -H \"Authorization: Bearer \${GH_TOKEN}\" -H \"X-GitHub-Api-Version: 2022-11-28\" https://api.github.com/orgs/${ORGANIZATION}/packages?package_type=${PACKAGE_TYPE}&per_page=100&page=1 | jq -rc '.[].name'\e0m" -output=$(curl -L -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${GH_TOKEN}" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/orgs/"${ORGANIZATION}"/packages?package_type="${PACKAGE_TYPE}"&per_page=100&page=1) +echo -e "\e[1mcurl -L -H \"Accept: application/vnd.github+json\" -H \"Authorization: Bearer \${GH_TOKEN}\" -H \"X-GitHub-Api-Version: 2022-11-28\" \"https://api.github.com/orgs/${ORGANIZATION}/packages?package_type=${PACKAGE_TYPE}&per_page=100&page=1\" | jq -rc '.[].name'\e[0m" +output=$(curl -L -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${GH_TOKEN}" -H "X-GitHub-Api-Version: 2022-11-28" "https://api.github.com/orgs/${ORGANIZATION}/packages?package_type=${PACKAGE_TYPE}&per_page=100&page=1") echo -e "return value: $?" echo -e "output: ${output}" packages=$(jq -rc '.[].name' <<< "${output}") -echo -e "packages:\n${packages} +echo -e "packages:\n${packages}" echo -e "\e[35m\e[1mpackages:\e[0m" for pkg in ${packages} From 30f64c1bd712c0d389578fcc844f6b11ef8aecf5 Mon Sep 17 00:00:00 2001 From: Matthijs van der Burgh Date: Tue, 19 Sep 2023 14:29:15 +0200 Subject: [PATCH 11/19] (CI)(organization-packages)(TEMP) use MATTHIJS_TOKEN --- .github/workflows/cleanup_untagged_containers.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cleanup_untagged_containers.yml b/.github/workflows/cleanup_untagged_containers.yml index df297b815..5d968c406 100644 --- a/.github/workflows/cleanup_untagged_containers.yml +++ b/.github/workflows/cleanup_untagged_containers.yml @@ -17,6 +17,7 @@ jobs: uses: tue-robotics/tue-env/ci/organization-packages@MatthijsBurgh-patch-1 with: package-type: container + token: ${{ secrets.MATTHIJS_TOKEN }} delete_untagged_containers: name: Delete untagged containers From 41c88b7ce84821e407c70b4fcda26f7c51058a0a Mon Sep 17 00:00:00 2001 From: Matthijs van der Burgh Date: Tue, 19 Sep 2023 14:38:44 +0200 Subject: [PATCH 12/19] (actions) use READ_PACKAGES_TOKEN for container cleanup --- .github/workflows/cleanup_container_tags.yml | 1 + .github/workflows/cleanup_untagged_containers.yml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cleanup_container_tags.yml b/.github/workflows/cleanup_container_tags.yml index b73b323a3..e6b94a65a 100644 --- a/.github/workflows/cleanup_container_tags.yml +++ b/.github/workflows/cleanup_container_tags.yml @@ -14,6 +14,7 @@ jobs: uses: tue-robotics/tue-env/ci/organization-packages@master with: package-type: container + token: ${{ secrets.READ_PACKAGES_TOKEN }} delete_container_tag: name: Delete container tag diff --git a/.github/workflows/cleanup_untagged_containers.yml b/.github/workflows/cleanup_untagged_containers.yml index 5d968c406..5bdac57e1 100644 --- a/.github/workflows/cleanup_untagged_containers.yml +++ b/.github/workflows/cleanup_untagged_containers.yml @@ -17,7 +17,7 @@ jobs: uses: tue-robotics/tue-env/ci/organization-packages@MatthijsBurgh-patch-1 with: package-type: container - token: ${{ secrets.MATTHIJS_TOKEN }} + token: ${{ secrets.READ_PACKAGES_TOKEN }} delete_untagged_containers: name: Delete untagged containers From 9c77b4707c0e7ca07e610f8739b340bf2c2273c3 Mon Sep 17 00:00:00 2001 From: Matthijs van der Burgh Date: Tue, 19 Sep 2023 14:58:39 +0200 Subject: [PATCH 13/19] (CI)(organization-packages) working version --- ci/organization-packages.sh | 30 ++++++++++++---------------- ci/organization-packages/action.yaml | 7 +------ 2 files changed, 14 insertions(+), 23 deletions(-) diff --git a/ci/organization-packages.sh b/ci/organization-packages.sh index 84837f749..665964471 100644 --- a/ci/organization-packages.sh +++ b/ci/organization-packages.sh @@ -9,6 +9,9 @@ do -t=* | --type=* ) PACKAGE_TYPE="${i#*=}" ;; + --token=* ) + TOKEN="${i#*=}" + ;; * ) # unknown option if [[ -n "${i}" ]] # Ignore empty arguments @@ -23,27 +26,20 @@ done echo -e "\e[35m\e[1mORGANIZATION = ${ORGANIZATION}\e[0m" echo -e "\e[35m\e[1mPACKAGE_TYPE = ${PACKAGE_TYPE}\e[0m" +echo -e "\e[35m\e[1mTOKEN length = ${#TOKEN}\e[0m" -echo -e "\e[1mgh api -H \"Accept: application/vnd.github+json\" -H \"X-GitHub-Api-Version: 2022-11-28\" \"/orgs/${ORGANIZATION}/packages?package_type=${PACKAGE_TYPE}&per_page=100&page=1\" | jq -rc '.[].name'\e[0m" -output=$(gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" "/orgs/${ORGANIZATION}/packages?package_type=${PACKAGE_TYPE}&per_page=100&page=1") -echo -e "return value: $?" -echo -e "output: ${output}" -packages=$(jq -rc '.[].name' <<< "${output}") -echo -e "packages:\n${packages}" -echo -e "\e[1mcurl -L -H \"Accept: application/vnd.github+json\" -H \"Authorization: Bearer \${GH_TOKEN}\" -H \"X-GitHub-Api-Version: 2022-11-28\" \"https://api.github.com/orgs/${ORGANIZATION}/packages?package_type=${PACKAGE_TYPE}&per_page=100&page=1\" | jq -rc '.[].name'\e[0m" -output=$(curl -L -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${GH_TOKEN}" -H "X-GitHub-Api-Version: 2022-11-28" "https://api.github.com/orgs/${ORGANIZATION}/packages?package_type=${PACKAGE_TYPE}&per_page=100&page=1") -echo -e "return value: $?" -echo -e "output: ${output}" -packages=$(jq -rc '.[].name' <<< "${output}") -echo -e "packages:\n${packages}" +echo "::group::curl -L -H \"Accept: application/vnd.github+json\" -H \"Authorization: Bearer \${TOKEN}\" -H \"X-GitHub-Api-Version: 2022-11-28\" \"https://api.github.com/orgs/${ORGANIZATION}/packages?package_type=${PACKAGE_TYPE}&per_page=100&page=1\"" +echo -e "\e[1mcurl -L -H \"Accept: application/vnd.github+json\" -H \"Authorization: Bearer \${TOKEN}\" -H \"X-GitHub-Api-Version: 2022-11-28\" \"https://api.github.com/orgs/${ORGANIZATION}/packages?package_type=${PACKAGE_TYPE}&per_page=100&page=1\"" +output=$(curl -L -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${TOKEN}" -H "X-GitHub-Api-Version: 2022-11-28" "https://api.github.com/orgs/${ORGANIZATION}/packages?package_type=${PACKAGE_TYPE}&per_page=100&page=1") +echo -e "${output}" | jq +echo "::endgroup::" +echo -e "\e[1mjq -r '.[].name'\e[0m" +packages=$(jq -r '.[].name' <<< "${output}") echo -e "\e[35m\e[1mpackages:\e[0m" for pkg in ${packages} do -echo -e "\e[35m\e[1m ${pkg}\e[0m" -done -for pkg in ${packages} -do -packages_list="${packages_list:+$packages_list, }'${pkg}'" + echo -e "\e[35m\e[1m ${pkg}\e[0m" + packages_list="${packages_list:+$packages_list, }'${pkg}'" done packages_list="[${packages_list}]" diff --git a/ci/organization-packages/action.yaml b/ci/organization-packages/action.yaml index 75645b396..889c35aad 100644 --- a/ci/organization-packages/action.yaml +++ b/ci/organization-packages/action.yaml @@ -26,12 +26,7 @@ runs: - name: Organization packages id: packages run: | - source ${{ github.action_path }}/../organization-packages.sh --organization=${{ inputs.organization }} --type=${{ inputs.package-type }} + source ${{ github.action_path }}/../organization-packages.sh --organization=${{ inputs.organization }} --type=${{ inputs.package-type }} --token=${{ inputs.token }} echo -e "\e[35m\e[1mpackages=${packages_list} >> \${GITHUB_OUTPUT}\e[0m" echo "packages=${packages_list}" >> ${GITHUB_OUTPUT} shell: bash --noprofile --norc -o pipefail {0} - env: - GH_TOKEN: ${{ inputs.token }} - - - From e482e24d5229be7e40a1c0dfddc91f8ebdfdc12e Mon Sep 17 00:00:00 2001 From: Matthijs van der Burgh Date: Tue, 19 Sep 2023 15:02:08 +0200 Subject: [PATCH 14/19] (CI)fix: cleanup workflows --- .github/workflows/cleanup_container_tags.yml | 2 +- .github/workflows/cleanup_untagged_containers.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cleanup_container_tags.yml b/.github/workflows/cleanup_container_tags.yml index e6b94a65a..7a0c15282 100644 --- a/.github/workflows/cleanup_container_tags.yml +++ b/.github/workflows/cleanup_container_tags.yml @@ -7,7 +7,7 @@ jobs: name: Get all containers in the organization runs-on: ubuntu-latest outputs: - packages: ${{ steps.organization-containers.outputs.packages }} + packages: ${{ steps.organization_containers.outputs.packages }} steps: - name: Organization containers id: organization_containers diff --git a/.github/workflows/cleanup_untagged_containers.yml b/.github/workflows/cleanup_untagged_containers.yml index 5bdac57e1..d84729159 100644 --- a/.github/workflows/cleanup_untagged_containers.yml +++ b/.github/workflows/cleanup_untagged_containers.yml @@ -10,7 +10,7 @@ jobs: name: Get all containers in the organization runs-on: ubuntu-latest outputs: - packages: ${{ steps.organization-containers.outputs.packages }} + packages: ${{ steps.organization_containers.outputs.packages }} steps: - name: Organization containers id: organization_containers From ee9894d40ee25d48c40882ca62009e5b98771213 Mon Sep 17 00:00:00 2001 From: Matthijs van der Burgh Date: Tue, 19 Sep 2023 15:09:31 +0200 Subject: [PATCH 15/19] (CI)(organization-packages) colorize jq --- ci/organization-packages.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/organization-packages.sh b/ci/organization-packages.sh index 665964471..0e93ce865 100644 --- a/ci/organization-packages.sh +++ b/ci/organization-packages.sh @@ -31,7 +31,7 @@ echo -e "\e[35m\e[1mTOKEN length = ${#TOKEN}\e[0m" echo "::group::curl -L -H \"Accept: application/vnd.github+json\" -H \"Authorization: Bearer \${TOKEN}\" -H \"X-GitHub-Api-Version: 2022-11-28\" \"https://api.github.com/orgs/${ORGANIZATION}/packages?package_type=${PACKAGE_TYPE}&per_page=100&page=1\"" echo -e "\e[1mcurl -L -H \"Accept: application/vnd.github+json\" -H \"Authorization: Bearer \${TOKEN}\" -H \"X-GitHub-Api-Version: 2022-11-28\" \"https://api.github.com/orgs/${ORGANIZATION}/packages?package_type=${PACKAGE_TYPE}&per_page=100&page=1\"" output=$(curl -L -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${TOKEN}" -H "X-GitHub-Api-Version: 2022-11-28" "https://api.github.com/orgs/${ORGANIZATION}/packages?package_type=${PACKAGE_TYPE}&per_page=100&page=1") -echo -e "${output}" | jq +echo -e "${output}" | jq -C echo "::endgroup::" echo -e "\e[1mjq -r '.[].name'\e[0m" From f8bd95fdb3dc11a83122c39e3dae49cc19e0244d Mon Sep 17 00:00:00 2001 From: Matthijs van der Burgh Date: Tue, 19 Sep 2023 15:15:14 +0200 Subject: [PATCH 16/19] (CI) cleanup workflows using master --- .github/workflows/cleanup_untagged_containers.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cleanup_untagged_containers.yml b/.github/workflows/cleanup_untagged_containers.yml index d84729159..4badcf0fc 100644 --- a/.github/workflows/cleanup_untagged_containers.yml +++ b/.github/workflows/cleanup_untagged_containers.yml @@ -14,7 +14,7 @@ jobs: steps: - name: Organization containers id: organization_containers - uses: tue-robotics/tue-env/ci/organization-packages@MatthijsBurgh-patch-1 + uses: tue-robotics/tue-env/ci/organization-packages@master with: package-type: container token: ${{ secrets.READ_PACKAGES_TOKEN }} From dfe55253b5798c2b11fe51b0486d7d2ed67d21df Mon Sep 17 00:00:00 2001 From: Matthijs van der Burgh Date: Tue, 19 Sep 2023 19:14:02 +0200 Subject: [PATCH 17/19] (actions) don't generate ROS2 U20 containers --- .github/workflows/main.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9e0cc4fe6..02a47d72e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -37,17 +37,10 @@ jobs: - ros-distro: noetic ros-version: 1 platform: "amd64" - - ros-distro: galactic - ros-version: 2 - platform: "amd64" - ros-distro: humble ros-version: 2 platform: "amd64" base-image: "ubuntu:22.04" - - ros-distro: rolling - ros-version: 2 - platform: "amd64" - flavor: u20 - ros-distro: rolling ros-version: 2 platform: "amd64" From fe640ad18c497e5621a2e577aa8c8d2351fdde52 Mon Sep 17 00:00:00 2001 From: Matthijs van der Burgh Date: Tue, 19 Sep 2023 19:14:31 +0200 Subject: [PATCH 18/19] (actions)(docker) default base is u22 --- .github/workflows/main.yml | 2 +- ci/build-docker-image.sh | 2 +- dockerfiles/tue-env.Dockerfile | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 02a47d72e..f1ecdd46f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -37,10 +37,10 @@ jobs: - ros-distro: noetic ros-version: 1 platform: "amd64" + base-image: "ubuntu:20.04" - ros-distro: humble ros-version: 2 platform: "amd64" - base-image: "ubuntu:22.04" - ros-distro: rolling ros-version: 2 platform: "amd64" diff --git a/ci/build-docker-image.sh b/ci/build-docker-image.sh index 699d64454..afe39c71c 100755 --- a/ci/build-docker-image.sh +++ b/ci/build-docker-image.sh @@ -102,7 +102,7 @@ echo -e "\e[35;1mCI_TARGETS_REPO = ${CI_TARGETS_REPO}\e[0m" [[ -z "$CI_DOCKER_LOGIN" ]] && CI_DOCKER_LOGIN="false" echo -e "\e[35;1mCI_DOCKER_LOGIN = ${CI_DOCKER_LOGIN}\e[0m" -[[ -z "$CI_DOCKER_BASE_IMAGE" ]] && CI_DOCKER_BASE_IMAGE="ubuntu:20.04" +[[ -z "$CI_DOCKER_BASE_IMAGE" ]] && CI_DOCKER_BASE_IMAGE="ubuntu:22.04" echo -e "\e[35;1mCI_DOCKER_BASE_IMAGE = ${CI_DOCKER_BASE_IMAGE}\e[0m" echo -e "\e[35;1mCI_DOCKER_REGISTRY = ${CI_DOCKER_REGISTRY}\e[0m" diff --git a/dockerfiles/tue-env.Dockerfile b/dockerfiles/tue-env.Dockerfile index 5d761c1cc..5f123aa27 100644 --- a/dockerfiles/tue-env.Dockerfile +++ b/dockerfiles/tue-env.Dockerfile @@ -3,8 +3,8 @@ # Dockerfile to build working Ubuntu image with tue-env # ---------------------------------------------------------------- -# Set default base image to Ubuntu 20.04 -ARG BASE_IMAGE=ubuntu:20.04 +# Set default base image to Ubuntu 22.04 +ARG BASE_IMAGE=ubuntu:22.04 FROM $BASE_IMAGE as base # ---------------------------------------------------------------- From e249bc5e255ba54e44deecdf7575cd3f761e6ea5 Mon Sep 17 00:00:00 2001 From: Matthijs van der Burgh Date: Tue, 19 Sep 2023 19:14:54 +0200 Subject: [PATCH 19/19] Bump VERSION to 1.13.0 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index f8f4f03b3..feaae22ba 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.12.1 +1.13.0