Skip to content

Commit

Permalink
workflows: build-local: Set up and run in own docker
Browse files Browse the repository at this point in the history
Remove github's docker engine and replace it by setting up a
docker environment that is run in the background. Stop and remove
the docker environment at the end of the workflow.

Run the commands in the created container.

Any Node16 issues are solved by running commands in the
container.

Signed-off-by: Louis Peens <[email protected]>
Co-developed-by: Annemie Potgieter <[email protected]>
Reviewed-by: Charles Murcott <[email protected]>
Reviewed-by: Ryno Swart <[email protected]>
Reviewed-by: Shivasen Govender <[email protected]>
  • Loading branch information
louis-peens committed Dec 3, 2024
1 parent ccba14a commit f3a9280
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/actions/build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ runs:
using: "composite"
steps:
- name: Build
shell: bash
shell: docker exec ci_drv_container bash {0}
run: |
set -o pipefail
export MAKEFLAGS="${{ env.MAKEFLAGS }} -s -j$(nproc) M=$(pwd)/src CFLAGS_EXTRA+=-Werror"
Expand Down
48 changes: 41 additions & 7 deletions .github/workflows/build-local.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ jobs:
releases: ${{ steps.matrix.outputs.releases }}
env:
BASE_DIR: binaries/misc/kernel-devel-c4c
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
steps:
- name: Clean old artifacts
run: |
Expand Down Expand Up @@ -170,17 +169,35 @@ jobs:
timeout-minutes: 90
env:
KVER: "*"
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
strategy:
fail-fast: false
matrix:
release: ${{ fromJSON(needs.prepare.outputs.releases) }}
container:
image: ${{ matrix.release.container }}
steps:
- name: Stop all previous docker containers
if: always()
run: |
docker stop ci_drv_container
docker rm -f ci_drv_container
continue-on-error: true

- name: Set up docker environment
run: |
docker pull ${{ matrix.release.container }}
docker run -d \
--name ci_drv_container \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /mnt/cloud:/mnt/cloud \
-v /mnt/local:/mnt/local \
-v /tmp/ccache:/tmp/ccache \
-v /home/${USER}/actions-runner:/home/${USER}/actions-runner \
-e "HOME=/github/home" -e GITHUB_ACTIONS=true -e CI=true \
--workdir ${{ github.workspace }} \
--entrypoint tail \
${{ matrix.release.container }} -f /dev/null
- name: Check for pre-requisite packages
id: provision_check
shell: bash
run: |
if [[ "${{ matrix.release.arch }}" == "x86_64" && \
"${{ matrix.release.name }}" == "anolisos-7.9" ]]; then
Expand Down Expand Up @@ -238,6 +255,7 @@ jobs:
if: >-
steps.provision_check.outputs.provision == 'true' &&
startsWith(matrix.release.name, 'openeuler')
shell: docker exec ci_drv_container bash {0}
run: |
version=$(echo "${ matrix.release.upload_dir }" | cut -d "-" -f2)
if [[ ! -f /etc/yum.repos.d/openEuler.repo ]]; then
Expand All @@ -257,6 +275,7 @@ jobs:
if: >-
steps.provision_check.outputs.provision == 'true' &&
matrix.release.name == 'anolisos-7.9'
shell: docker exec ci_drv_container bash {0}
run: |
if [[ "${{ matrix.release.arch }}" == "x86_64" ]]; then
if ! yum list installed | grep -q ius-release-el7; then
Expand All @@ -274,6 +293,7 @@ jobs:
steps.provision_check.outputs.provision == 'true' &&
matrix.release.name != 'anolisos-7.9' &&
!contains(matrix.release.name, 'opensuse')
shell: docker exec ci_drv_container bash {0}
run: |
dnf clean all
dnf distro-sync -y
Expand All @@ -289,6 +309,7 @@ jobs:
if: >-
steps.provision_check.outputs.provision == 'true' &&
contains(matrix.release.name, 'opensuse')
shell: docker exec ci_drv_container bash {0}
run: |
PACKAGES="${{ steps.provision_check.outputs.missing_deps }}"
Expand All @@ -312,6 +333,7 @@ jobs:
zypper -n install ${PACKAGES}
- name: Clean old artifacts
shell: docker exec ci_drv_container bash {0}
run: |
sudo find -delete
Expand All @@ -333,6 +355,7 @@ jobs:
- name: Install azcopy binary
if: >-
steps.provision_check.outputs.provision == 'true'
shell: docker exec ci_drv_container bash {0}
run: |
if [[ '${{ matrix.release.arch }}' == 'aarch64' ]]; then
binary_link=https://azcopyvnext.azureedge.net/releases/release-10.24.0-20240326/azcopy_linux_arm64_10.24.0.tar.gz
Expand Down Expand Up @@ -361,9 +384,13 @@ jobs:

- name: Set build environment variables | openSUSE
if: contains(matrix.release.name, 'opensuse')
working-directory: ${{ env.UNPACKED }}/usr/src
shell: bash
shell: docker exec ci_drv_container bash {0}
run: |
# Note: Using the github 'working-directory' option does not
# get propagated through to the docker environment, so use 'cd'
# to navigate to the correct location
cd ${{ env.UNPACKED }}/usr/src
mkdir -p kernels
VERSIONS=$(ls ./ | grep "linux-.*[0-9]$")
Expand All @@ -379,3 +406,10 @@ jobs:
with:
search-path: "${{ env.UNPACKED }}/usr/src/kernels"
redirect-stderr: ${{ contains(matrix.release.name, 'opensuse') && 'false' || 'true' }}

- name: Stop docker container environment
if: always()
run: |
docker stop ci_drv_container
docker rm -f ci_drv_container
continue-on-error: true

0 comments on commit f3a9280

Please sign in to comment.