From 6d830eb40635559538ddfc6410acf3865b68df40 Mon Sep 17 00:00:00 2001 From: Yutaka Kondo Date: Fri, 17 May 2024 17:57:54 +0900 Subject: [PATCH] refactor(ci): reuse `load-env.yaml` to load env (#4734) * reuse load-env.yaml to load env * update base_image Signed-off-by: Yutaka Kondo * fix base_image Signed-off-by: Yutaka Kondo --------- Signed-off-by: Yutaka Kondo --- .github/workflows/build-main-self-hosted.yaml | 17 +++++++---------- .github/workflows/build-main.yaml | 17 +++++++---------- .../docker-build-and-push-main-self-hosted.yaml | 17 +++++++---------- .../workflows/docker-build-and-push-main.yaml | 17 +++++++---------- .github/workflows/load-env.yaml | 8 ++++---- 5 files changed, 32 insertions(+), 44 deletions(-) diff --git a/.github/workflows/build-main-self-hosted.yaml b/.github/workflows/build-main-self-hosted.yaml index e4cc44884e3..c0bba91845b 100644 --- a/.github/workflows/build-main-self-hosted.yaml +++ b/.github/workflows/build-main-self-hosted.yaml @@ -13,7 +13,11 @@ on: default: tarball jobs: + load-env: + uses: ./.github/workflows/load-env.yaml + build-main-self-hosted: + needs: load-env runs-on: [self-hosted, linux, ARM64] strategy: fail-fast: false @@ -43,25 +47,18 @@ jobs: - name: Free disk space uses: ./.github/actions/free-disk-space - - name: Load env - run: | - cat amd64.env | sed -e "s/^\s*//" -e "/^#/d" >> $GITHUB_ENV - if [ "$(uname -m)" = "aarch64" ]; then - cat arm64.env | sed -e "s/^\s*//" -e "/^#/d" >> $GITHUB_ENV - fi - - name: Build 'autoware-universe' uses: ./.github/actions/docker-build-and-push with: bake-target: autoware-openadk build-args: | *.platform=linux/arm64 - *.args.ROS_DISTRO=${{ env.rosdistro }} - *.args.BASE_IMAGE=${{ env[format('{0}', matrix.base_image_env)] }} + *.args.ROS_DISTRO=${{ needs.load-env.outputs.rosdistro }} + *.args.BASE_IMAGE=${{ needs.load-env.outputs[format('{0}', matrix.base_image_env)] }} *.args.SETUP_ARGS=${{ matrix.setup-args }} *.args.LIB_DIR=${{ matrix.lib_dir }} tag-suffix: ${{ matrix.additional-tag-suffix }}-arm64 - tag-prefix: ${{ env.rosdistro }} + tag-prefix: ${{ needs.load-env.outputs.rosdistro }} allow-push: false - name: Show disk space diff --git a/.github/workflows/build-main.yaml b/.github/workflows/build-main.yaml index 7b21980574a..4b276a7ad32 100644 --- a/.github/workflows/build-main.yaml +++ b/.github/workflows/build-main.yaml @@ -13,7 +13,11 @@ on: default: tarball jobs: + load-env: + uses: ./.github/workflows/load-env.yaml + build-main: + needs: load-env runs-on: ubuntu-latest strategy: fail-fast: false @@ -38,25 +42,18 @@ jobs: - name: Free disk space uses: ./.github/actions/free-disk-space - - name: Load env - run: | - cat amd64.env | sed -e "s/^\s*//" -e "/^#/d" >> $GITHUB_ENV - if [ "$(uname -m)" = "aarch64" ]; then - cat arm64.env | sed -e "s/^\s*//" -e "/^#/d" >> $GITHUB_ENV - fi - - name: Build 'autoware-universe' uses: ./.github/actions/docker-build-and-push with: bake-target: autoware-openadk build-args: | *.platform=linux/amd64 - *.args.ROS_DISTRO=${{ env.rosdistro }} - *.args.BASE_IMAGE=${{ env[format('{0}', matrix.base_image_env)] }} + *.args.ROS_DISTRO=${{ needs.load-env.outputs.rosdistro }} + *.args.BASE_IMAGE=${{ needs.load-env.outputs[format('{0}', matrix.base_image_env)] }} *.args.SETUP_ARGS=${{ matrix.setup-args }} *.args.LIB_DIR=${{ matrix.lib_dir }} tag-suffix: ${{ matrix.additional-tag-suffix }}-amd64 - tag-prefix: ${{ env.rosdistro }} + tag-prefix: ${{ needs.load-env.outputs.rosdistro }} allow-push: false - name: Show disk space diff --git a/.github/workflows/docker-build-and-push-main-self-hosted.yaml b/.github/workflows/docker-build-and-push-main-self-hosted.yaml index 315e5b1ed07..69a553a6cb0 100644 --- a/.github/workflows/docker-build-and-push-main-self-hosted.yaml +++ b/.github/workflows/docker-build-and-push-main-self-hosted.yaml @@ -25,7 +25,11 @@ on: default: tarball jobs: + load-env: + uses: ./.github/workflows/load-env.yaml + docker-build-and-push-main-self-hosted: + needs: load-env runs-on: [self-hosted, linux, ARM64] strategy: fail-fast: false @@ -55,25 +59,18 @@ jobs: - name: Free disk space uses: ./.github/actions/free-disk-space - - name: Load env - run: | - cat amd64.env | sed -e "s/^\s*//" -e "/^#/d" >> $GITHUB_ENV - if [ "$(uname -m)" = "aarch64" ]; then - cat arm64.env | sed -e "s/^\s*//" -e "/^#/d" >> $GITHUB_ENV - fi - - name: Build 'autoware-openadk' uses: ./.github/actions/docker-build-and-push with: bake-target: autoware-openadk build-args: | *.platform=linux/arm64 - *.args.ROS_DISTRO=${{ env.rosdistro }} - *.args.BASE_IMAGE=${{ env[format('{0}', matrix.base_image_env)] }} + *.args.ROS_DISTRO=${{ needs.load-env.outputs.rosdistro }} + *.args.BASE_IMAGE=${{ needs.load-env.outputs[format('{0}', matrix.base_image_env)] }} *.args.SETUP_ARGS=${{ matrix.setup-args }} *.args.LIB_DIR=${{ matrix.lib_dir }} tag-suffix: ${{ matrix.additional-tag-suffix }}-arm64 - tag-prefix: ${{ env.rosdistro }} + tag-prefix: ${{ needs.load-env.outputs.rosdistro }} allow-push: true - name: Show disk space diff --git a/.github/workflows/docker-build-and-push-main.yaml b/.github/workflows/docker-build-and-push-main.yaml index d5fe698bccf..bea0df4a950 100644 --- a/.github/workflows/docker-build-and-push-main.yaml +++ b/.github/workflows/docker-build-and-push-main.yaml @@ -25,7 +25,11 @@ on: default: tarball jobs: + load-env: + uses: ./.github/workflows/load-env.yaml + docker-build-and-push-main: + needs: load-env runs-on: ubuntu-latest strategy: fail-fast: false @@ -50,25 +54,18 @@ jobs: - name: Free disk space uses: ./.github/actions/free-disk-space - - name: Load env - run: | - cat amd64.env | sed -e "s/^\s*//" -e "/^#/d" >> $GITHUB_ENV - if [ "$(uname -m)" = "aarch64" ]; then - cat arm64.env | sed -e "s/^\s*//" -e "/^#/d" >> $GITHUB_ENV - fi - - name: Build 'autoware-openadk' uses: ./.github/actions/docker-build-and-push with: bake-target: autoware-openadk build-args: | *.platform=linux/amd64 - *.args.ROS_DISTRO=${{ env.rosdistro }} - *.args.BASE_IMAGE=${{ env[format('{0}', matrix.base_image_env)] }} + *.args.ROS_DISTRO=${{ needs.load-env.outputs.rosdistro }} + *.args.BASE_IMAGE=${{ needs.load-env.outputs[format('{0}', matrix.base_image_env)] }} *.args.SETUP_ARGS=${{ matrix.setup-args }} *.args.LIB_DIR=${{ matrix.lib_dir }} tag-suffix: ${{ matrix.additional-tag-suffix }}-amd64 - tag-prefix: ${{ env.rosdistro }} + tag-prefix: ${{ needs.load-env.outputs.rosdistro }} allow-push: true - name: Show disk space diff --git a/.github/workflows/load-env.yaml b/.github/workflows/load-env.yaml index 508a30bf74a..e65389426b1 100644 --- a/.github/workflows/load-env.yaml +++ b/.github/workflows/load-env.yaml @@ -3,8 +3,8 @@ name: load-env on: workflow_call: outputs: - base-image: - value: ${{ jobs.load-env.outputs.base-image }} + base_image: + value: ${{ jobs.load-env.outputs.base_image }} rosdistro: value: ${{ jobs.load-env.outputs.rosdistro }} @@ -12,7 +12,7 @@ jobs: load-env: runs-on: ubuntu-latest outputs: - base-image: ${{ steps.set-env.outputs.base-image }} + base_image: ${{ steps.set-env.outputs.base_image }} rosdistro: ${{ steps.set-env.outputs.rosdistro }} steps: - name: Check out repository @@ -28,5 +28,5 @@ jobs: - name: Set env id: set-env run: | - echo "base-image=${{ env.base_image }}" >> $GITHUB_OUTPUT + echo "base_image=${{ env.base_image }}" >> $GITHUB_OUTPUT echo "rosdistro=${{ env.rosdistro }}" >> $GITHUB_OUTPUT