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

feat(docker): disable --download-artifacts #19

Merged
merged 40 commits into from
May 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
e03a150
introduce src-imported stage
youtalk May 13, 2024
e5aead0
empty
youtalk May 14, 2024
470a8b5
chore(docker): separate `rosdep install` and `colcon build` RUN comma…
youtalk May 15, 2024
837b486
refactor(ci): reuse `load-env.yaml` to load env (#4734)
youtalk May 17, 2024
2d70277
generate install package lists
youtalk May 17, 2024
05d35ae
append || true
youtalk May 17, 2024
a390066
cat packages
youtalk May 17, 2024
99cd9bf
chore(docker): separate `rosdep install` and `colcon build` RUN comma…
youtalk May 15, 2024
bcc6509
wip
youtalk May 17, 2024
a50e7e5
wip
youtalk May 17, 2024
0fec259
Update Dockerfile
youtalk May 17, 2024
0c65eae
Update Dockerfile
youtalk May 18, 2024
f209622
install pacmod
youtalk May 18, 2024
af11db7
rename
youtalk May 18, 2024
3990ff0
Revert "install pacmod"
youtalk May 18, 2024
3dd8d57
install pacmod3
youtalk May 18, 2024
00d2e3b
register pamod3 repos
youtalk May 18, 2024
35366de
ignore hadolint
youtalk May 18, 2024
3eb3913
revert
youtalk May 18, 2024
b693322
run set-dev-env.sh
youtalk May 18, 2024
99fd7ea
pip install
youtalk May 18, 2024
bdc1316
copy
youtalk May 18, 2024
be49c85
rosdep update
youtalk May 19, 2024
d7effac
Merge branch 'main' into src-imported
youtalk May 19, 2024
92d85cf
vcs import outside dockerfile
youtalk May 20, 2024
5ee2907
refactor(docker): introduce `src-imported` stage (#4712)
youtalk May 20, 2024
3c3edf6
Merge remote-tracking branch 'upstream/main' into upstream-vcs-import…
youtalk May 20, 2024
ae37e00
refine order and remove /autoware/src at last
youtalk May 21, 2024
8c54707
fix hadolint
youtalk May 21, 2024
6a9398d
remove tar files
youtalk May 22, 2024
fbca7d7
shell: bash
youtalk May 22, 2024
1de4b45
refactor(ci): reuse `load-env.yaml` to load env (#4734)
youtalk May 17, 2024
e4923a4
remove --download-artifacts
youtalk May 22, 2024
9047913
remove --download-artifacts
youtalk May 22, 2024
28f636f
add --data-path option
youtalk May 22, 2024
24e076a
wip
youtalk May 22, 2024
d73d2db
Merge branch 'upstream-vcs-import-outside-dockerfile' into disable-do…
youtalk May 22, 2024
e7b7cab
wip
youtalk May 23, 2024
f528182
run download_artifacts
youtalk May 24, 2024
fd08ef8
remove todo
youtalk May 24, 2024
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
18 changes: 18 additions & 0 deletions .github/actions/docker-build-and-push/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,12 @@ runs:
overwrite: true
if-no-files-found: error

- name: Remove tar file - prebuilt
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.artifacts-destination == 'tarball' }}
run: |
rm /tmp/prebuilt.tar
shell: bash

- name: Upload Artifact - devel
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.artifacts-destination == 'tarball' }}
id: artifact-upload-step-devel
Expand All @@ -156,6 +162,12 @@ runs:
overwrite: true
if-no-files-found: error

- name: Remove tar file - devel
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.artifacts-destination == 'tarball' }}
run: |
rm /tmp/devel.tar
shell: bash

- name: Upload Artifact - runtime
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.artifacts-destination == 'tarball' }}
id: artifact-upload-step-runtime
Expand All @@ -168,6 +180,12 @@ runs:
overwrite: true
if-no-files-found: error

- name: Remove tar file - runtime
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.artifacts-destination == 'tarball' }}
run: |
rm /tmp/runtime.tar
shell: bash

- name: Output artifact URLs
id: output-artifact-urls
run: |
Expand Down
17 changes: 7 additions & 10 deletions .github/workflows/build-main-self-hosted.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
17 changes: 7 additions & 10 deletions .github/workflows/build-main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
29 changes: 21 additions & 8 deletions .github/workflows/docker-build-and-push-main-self-hosted.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
on:
push:
tags:
- adkit-v*.*.*

Check warning on line 12 in .github/workflows/docker-build-and-push-main-self-hosted.yaml

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (adkit)

Check warning on line 12 in .github/workflows/docker-build-and-push-main-self-hosted.yaml

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (adkit)
branches:
- main
schedule:
Expand All @@ -25,7 +25,11 @@
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
Expand All @@ -52,28 +56,37 @@
- name: Check out repository
uses: actions/checkout@v4

- name: Install vcstool
run: |
sudo apt-get -y update
sudo apt-get -y install python3-pip
pip install --no-cache-dir vcstool

- name: Set git config
uses: autowarefoundation/autoware-github-actions/set-git-config@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Free disk space
uses: ./.github/actions/free-disk-space

- name: Load env
- name: Run vcs import
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
mkdir src
vcs import src < autoware.repos

- 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
Expand Down
33 changes: 25 additions & 8 deletions .github/workflows/docker-build-and-push-main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@
default: tarball

jobs:
load-env:
uses: ./.github/workflows/load-env.yaml

docker-build-and-push-main:
needs: load-env
runs-on: buildjet-16vcpu-ubuntu-2204

Check warning on line 27 in .github/workflows/docker-build-and-push-main.yaml

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (buildjet)

Check warning on line 27 in .github/workflows/docker-build-and-push-main.yaml

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (vcpu)

Check warning on line 27 in .github/workflows/docker-build-and-push-main.yaml

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (buildjet)

Check warning on line 27 in .github/workflows/docker-build-and-push-main.yaml

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (vcpu)
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -54,12 +58,21 @@
- name: Check out repository
uses: actions/checkout@v4

- name: Load env
- name: Install vcstool
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
sudo apt-get -y update
sudo apt-get -y install python3-pip
pip install --no-cache-dir vcstool

- name: Set git config
uses: autowarefoundation/autoware-github-actions/set-git-config@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Run vcs import
run: |
mkdir src
vcs import src < autoware.repos

- name: Build 'autoware-openadk'
if: steps.author-check.outputs.author-found == 'true' || ${{ github.event_name == 'workflow_dispatch' }}
Expand All @@ -68,10 +81,14 @@
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
run: |
df -h
8 changes: 4 additions & 4 deletions .github/workflows/load-env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ 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 }}

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
Expand All @@ -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
4 changes: 4 additions & 0 deletions ansible/playbooks/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@
when: prompt_install_nvidia == 'y'
- role: autoware.dev_env.docker_engine
- role: autoware.dev_env.nvidia_container_toolkit

# ONNX files and other artifacts
- role: autoware.dev_env.artifacts
when: prompt_download_artifacts == 'y'
10 changes: 10 additions & 0 deletions ansible/playbooks/rosdep.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
- name: Register rosdep package repositories
hosts: localhost
connection: local
pre_tasks:
- name: Verify OS
ansible.builtin.fail:
msg: Only Ubuntu 22.04 is supported for this branch. Please refer to https://autowarefoundation.github.io/autoware-documentation/main/installation/autoware/source-installation/.
when: ansible_distribution != 'Ubuntu' or ansible_distribution_version != '22.04'
roles:
- role: autoware.dev_env.pacmod
58 changes: 45 additions & 13 deletions docker/autoware-openadk/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,39 @@ RUN --mount=type=ssh \
# Create entrypoint
CMD ["/bin/bash"]

FROM $BASE_IMAGE as src-imported
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ARG ROS_DISTRO

# Copy files
COPY setup-dev-env.sh ansible-galaxy-requirements.yaml amd64.env arm64.env /autoware/
COPY ansible/ /autoware/ansible/
WORKDIR /autoware

RUN --mount=type=ssh \
./setup-dev-env.sh -y rosdep \
&& pip uninstall -y ansible ansible-core \
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* "$HOME"/.cache

# Copy repository files
COPY src /autoware/src

# Generate install package lists
RUN rosdep update && rosdep keys --ignore-src --from-paths src \
| xargs rosdep resolve --rosdistro ${ROS_DISTRO} \
| grep -v '^#' \
| sed 's/ \+/\n/g'\
| sort \
> /rosdep-all-depend-packages.txt \
&& cat /rosdep-all-depend-packages.txt
RUN rosdep keys --dependency-types=exec --ignore-src --from-paths src \
| xargs rosdep resolve --rosdistro ${ROS_DISTRO} \
| grep -v '^#' \
| sed 's/ \+/\n/g'\
| sort \
> /rosdep-exec-depend-packages.txt \
&& cat /rosdep-exec-depend-packages.txt

FROM base as prebuilt
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ARG ROS_DISTRO
Expand All @@ -60,15 +93,15 @@ RUN --mount=type=ssh \
COPY autoware.repos /autoware/

# Install rosdep dependencies
COPY --from=src-imported /rosdep-all-depend-packages.txt /tmp/rosdep-all-depend-packages.txt
# hadolint ignore=SC2002
RUN --mount=type=ssh \
mkdir src \
&& vcs import src < autoware.repos \
&& apt-get update \
&& rosdep update \
&& DEBIAN_FRONTEND=noninteractive rosdep install -y --ignore-src --from-paths src --rosdistro "$ROS_DISTRO" \
apt-get update \
&& cat /tmp/rosdep-all-depend-packages.txt | xargs apt-get install -y --no-install-recommends \
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* "$HOME"/.cache

# Build Autoware
COPY --from=src-imported /autoware/src /autoware/src
RUN source /opt/ros/"$ROS_DISTRO"/setup.bash \
&& colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release --cmake-args \
" -Wno-dev" \
Expand All @@ -86,7 +119,7 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"]

# Install development tools and artifacts
RUN --mount=type=ssh \
./setup-dev-env.sh -y --module dev-tools --download-artifacts openadk \
./setup-dev-env.sh -y --module dev-tools openadk \
&& pip uninstall -y ansible ansible-core \
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* "$HOME"/.cache

Expand All @@ -103,20 +136,19 @@ ARG LIB_DIR
ARG SETUP_ARGS

# Set up runtime environment and artifacts
COPY autoware.repos /autoware/
COPY --from=src-imported /rosdep-exec-depend-packages.txt /tmp/rosdep-exec-depend-packages.txt
# hadolint ignore=SC2002
RUN --mount=type=ssh \
./setup-dev-env.sh -y --module all ${SETUP_ARGS} --download-artifacts --no-cuda-drivers --runtime openadk \
./setup-dev-env.sh -y --module all ${SETUP_ARGS} --no-cuda-drivers --runtime openadk \
&& pip uninstall -y ansible ansible-core \
&& mkdir src \
&& vcs import src < autoware.repos \
&& rosdep update \
&& DEBIAN_FRONTEND=noninteractive rosdep install -y --dependency-types=exec --ignore-src --from-paths src --rosdistro "$ROS_DISTRO" \
&& apt-get update \
&& cat /tmp/rosdep-exec-depend-packages.txt | xargs apt-get install -y --no-install-recommends \
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* "$HOME"/.cache \
&& find /usr/lib/$LIB_DIR-linux-gnu -name "*.a" -type f -delete \
&& find / -name "*.o" -type f -delete \
&& find / -name "*.h" -type f -delete \
&& find / -name "*.hpp" -type f -delete \
&& rm -rf /autoware/src /autoware/ansible /autoware/autoware.repos \
&& rm -rf /autoware/ansible \
/root/.local/pipx /opt/ros/"$ROS_DISTRO"/include /etc/apt/sources.list.d/cuda*.list \
/etc/apt/sources.list.d/docker.list /etc/apt/sources.list.d/nvidia-docker.list \
/usr/include /usr/share/doc /usr/lib/gcc /usr/lib/jvm /usr/lib/llvm*
Expand Down
Loading
Loading