From cc7d9477384aed561be6a589e0ee1df1be6a156c Mon Sep 17 00:00:00 2001 From: Matheus Castello Date: Tue, 14 Jan 2025 11:08:37 -0300 Subject: [PATCH] github: workflow: add docker daemon to sdk build jobs A from scratch docker daemon is required to build with the sdk containers, this is because the default docker in docker uses a abstracted docker socket that is hard to map the host folders to the container. Also the check is more complete when using a clean docker daemon. Signed-off-by: Matheus Castello --- .github/workflows/build-ccpp.yaml | 22 ++++++++++++++-- .github/workflows/build-debug-ccpp.yaml | 31 ++++++++++++++++------- .github/workflows/build-debug-python.yaml | 5 ++++ .github/workflows/build-debug-rust.yaml | 26 +++++++++++++++---- .github/workflows/build-python.yaml | 5 ++++ .github/workflows/build-rust.yaml | 22 ++++++++++++++-- 6 files changed, 93 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build-ccpp.yaml b/.github/workflows/build-ccpp.yaml index 04fefd11..51ccd655 100644 --- a/.github/workflows/build-ccpp.yaml +++ b/.github/workflows/build-ccpp.yaml @@ -7,10 +7,10 @@ on: jobs: ccpp: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 container: image: torizonextras/torizon-dev:dev - options: --user root + options: --privileged --user root if: github.ref == 'refs/heads/bookworm' || github.ref == 'refs/heads/dev' name: C/C++ Container strategy: @@ -32,6 +32,23 @@ jobs: echo "${{ github.workspace }}" >> abs-path cat abs-path + - name: Update torizon-utils module + run: | + chmod a+rwx . -R + sudo -u torizon pipx inject xonsh ./scripts/utils/pip/ + + - name: Run Docker Daemon + run: | + mkdir -p /var/lib/docker + dockerd \ + --data-root=/var/lib/docker \ + --host=unix:///var/run/docker-alt.sock \ + --tls=false \ + --host=tcp://0.0.0.0:2376 \ + --userland-proxy-path=/usr/libexec/docker/docker-proxy \ + --userland-proxy=false & + sleep 10 + - name: Build ${{ matrix.project.folder }} Dockerfile shell: xonsh {0} env: @@ -39,6 +56,7 @@ jobs: PROJECT_CONTAINER: ${{ matrix.project.container }} VENDOR: ${{ matrix.project.vendor }} DOCKER_LOGIN: localhost:5002 + GITHUB_WORKSPACE_DOCKER: 2376 run: | import os diff --git a/.github/workflows/build-debug-ccpp.yaml b/.github/workflows/build-debug-ccpp.yaml index 25842f22..b2a295d4 100644 --- a/.github/workflows/build-debug-ccpp.yaml +++ b/.github/workflows/build-debug-ccpp.yaml @@ -8,17 +8,14 @@ on: jobs: ccpp-debug: runs-on: ubuntu-latest - container: - image: torizonextras/torizon-dev:dev - options: --user root if: github.ref == 'refs/heads/bookworm' || github.ref == 'refs/heads/dev' name: C/C++ Container Debug strategy: matrix: project: - - folder: cppQML - container: cpp-qml - vendor: '{ "arch": "arm64", "torizon_arch": "aarch64" }' + # - folder: cppQML + # container: cpp-qml + # vendor: '{ "arch": "arm64", "torizon_arch": "aarch64" }' - folder: cppSlint container: cpp-slint @@ -32,13 +29,26 @@ jobs: echo "${{ github.workspace }}" >> abs-path cat abs-path + - name: Setup Xonsh + run: | + apt-get update + apt-get install -y python3 python3-pip pipx + bash ./scripts/bash/setup-xonsh.sh + ln -s /root/.local/bin/xonsh /usr/bin/xonsh + + - name: Update torizon-utils module + run: | + pipx inject xonsh ./scripts/utils/pip/ + - name: Build ${{ matrix.project.folder }} Dockerfile shell: xonsh {0} + continue-on-error: true env: PROJECT_FOLDER: ${{ matrix.project.folder }} PROJECT_CONTAINER: ${{ matrix.project.container }} VENDOR: ${{ matrix.project.vendor }} DOCKER_LOGIN: localhost:5002 + TASKS_DEBUG: "true" run: | import os @@ -70,9 +80,12 @@ jobs: with open(".vscode/settings.json", "w") as file: json.dump(settings_json, file, indent=4) - # FIXME: this is bad, but it's the only to make it work here - chmod 777 . -R - + chmod a+rwx . -R xonsh ./.vscode/tasks.xsh run run-torizon-binfmt xonsh ./.vscode/tasks.xsh run @(f"build-debug-{os.environ['PROJECT_ARCH']}") xonsh ./.vscode/tasks.xsh run @(f"build-container-torizon-debug-{os.environ['PROJECT_ARCH']}") + + - name: Check + run: | + pwd + ls -lah . diff --git a/.github/workflows/build-debug-python.yaml b/.github/workflows/build-debug-python.yaml index 94b76e83..4e64e1fa 100644 --- a/.github/workflows/build-debug-python.yaml +++ b/.github/workflows/build-debug-python.yaml @@ -28,6 +28,11 @@ jobs: echo "${{ github.workspace }}" >> abs-path cat abs-path + - name: Update torizon-utils module + run: | + chmod a+rwx . -R + sudo -u torizon pipx inject xonsh ./scripts/utils/pip/ + - name: Build ${{ matrix.project.folder }} Dockerfile shell: xonsh {0} env: diff --git a/.github/workflows/build-debug-rust.yaml b/.github/workflows/build-debug-rust.yaml index eafc7e5a..06c0b813 100644 --- a/.github/workflows/build-debug-rust.yaml +++ b/.github/workflows/build-debug-rust.yaml @@ -7,10 +7,10 @@ on: jobs: rust-debug: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 container: image: torizonextras/torizon-dev:dev - options: --user root + options: --privileged --user root if: github.ref == 'refs/heads/bookworm' || github.ref == 'refs/heads/dev' name: Rust Container Debug strategy: @@ -28,6 +28,23 @@ jobs: echo "${{ github.workspace }}" >> abs-path cat abs-path + - name: Update torizon-utils module + run: | + chmod a+rwx . -R + sudo -u torizon pipx inject xonsh ./scripts/utils/pip/ + + - name: Run Docker Daemon + run: | + mkdir -p /var/lib/docker + dockerd \ + --data-root=/var/lib/docker \ + --host=unix:///var/run/docker-alt.sock \ + --tls=false \ + --host=tcp://0.0.0.0:2376 \ + --userland-proxy-path=/usr/libexec/docker/docker-proxy \ + --userland-proxy=false & + sleep 10 + - name: Build ${{ matrix.project.folder }} Dockerfile shell: xonsh {0} env: @@ -35,6 +52,7 @@ jobs: PROJECT_CONTAINER: ${{ matrix.project.container }} VENDOR: ${{ matrix.project.vendor }} DOCKER_LOGIN: localhost:5002 + GITHUB_WORKSPACE_DOCKER: 2376 run: | import os @@ -66,9 +84,7 @@ jobs: with open(".vscode/settings.json", "w") as file: json.dump(settings_json, file, indent=4) - # FIXME: this is bad, but it's the only to make it work here - chmod 777 . -R - + chmod a+rwx . -R xonsh ./.vscode/tasks.xsh run run-torizon-binfmt xonsh ./.vscode/tasks.xsh run @(f"build-debug-{os.environ['PROJECT_ARCH']}") xonsh ./.vscode/tasks.xsh run @(f"copy-debug-executable-{os.environ['PROJECT_ARCH']}") diff --git a/.github/workflows/build-python.yaml b/.github/workflows/build-python.yaml index db621547..8eb46c22 100644 --- a/.github/workflows/build-python.yaml +++ b/.github/workflows/build-python.yaml @@ -28,6 +28,11 @@ jobs: echo "${{ github.workspace }}" >> abs-path cat abs-path + - name: Update torizon-utils module + run: | + chmod a+rwx . -R + sudo -u torizon pipx inject xonsh ./scripts/utils/pip/ + - name: Build ${{ matrix.project.folder }} Dockerfile shell: xonsh {0} env: diff --git a/.github/workflows/build-rust.yaml b/.github/workflows/build-rust.yaml index 2d2226ce..688d9a98 100644 --- a/.github/workflows/build-rust.yaml +++ b/.github/workflows/build-rust.yaml @@ -7,10 +7,10 @@ on: jobs: rust: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 container: image: torizonextras/torizon-dev:dev - options: --user root + options: --privileged --user root if: github.ref == 'refs/heads/bookworm' || github.ref == 'refs/heads/dev' name: Rust Container strategy: @@ -28,6 +28,23 @@ jobs: echo "${{ github.workspace }}" >> abs-path cat abs-path + - name: Update torizon-utils module + run: | + chmod a+rwx . -R + sudo -u torizon pipx inject xonsh ./scripts/utils/pip/ + + - name: Run Docker Daemon + run: | + mkdir -p /var/lib/docker + dockerd \ + --data-root=/var/lib/docker \ + --host=unix:///var/run/docker-alt.sock \ + --tls=false \ + --host=tcp://0.0.0.0:2376 \ + --userland-proxy-path=/usr/libexec/docker/docker-proxy \ + --userland-proxy=false & + sleep 10 + - name: Build ${{ matrix.project.folder }} Dockerfile shell: xonsh {0} env: @@ -35,6 +52,7 @@ jobs: PROJECT_CONTAINER: ${{ matrix.project.container }} VENDOR: ${{ matrix.project.vendor }} DOCKER_LOGIN: localhost:5002 + GITHUB_WORKSPACE_DOCKER: 2376 run: | import os