From 3dec785c69566e025440bec145a08b7faec6d39d Mon Sep 17 00:00:00 2001 From: Sergio Date: Wed, 13 Nov 2024 11:30:20 +0100 Subject: [PATCH 1/9] Publisher: Clean up disk space before building Some images (like slc9-gpu-builder) are too big for the free runner, so we need to remove some stuff before, mostly unused language packages Reference for the free disk space: https://github.com/actions/runner-images/issues/2840 Builder error message: ``` ==> docker: At least 11799MB more space needed on the / filesystem. ``` --- .github/workflows/push-docker-image.yml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/push-docker-image.yml b/.github/workflows/push-docker-image.yml index 086fb9f..4dc73bd 100644 --- a/.github/workflows/push-docker-image.yml +++ b/.github/workflows/push-docker-image.yml @@ -20,20 +20,19 @@ jobs: # This workflow contains a single job called "build" build: # The type of runner that the job will run on - runs-on: ubuntu-latest - # GitHub seems to install an odd version of docker on the host, so run in a - # container and only connect to the host's docker daemon. - container: - image: ubuntu:22.04 - volumes: - # Connect to host's docker daemon so we don't run docker inside docker. - - /var/run/docker.sock:/var/run/docker.sock + runs-on: ubuntu-22.04 # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v3 + # Some images are too large and we run out of disk space, so try to free some + - name: Free Disk Space (Ubuntu) + uses: jlumbroso/free-disk-space@v1.3.1 + with: + tool-cache: false + - name: Install prerequisites run: | apt update -y From 8d8e528ebdf74235a10bf1d1131ebce0489f340f Mon Sep 17 00:00:00 2001 From: Sergio Date: Wed, 13 Nov 2024 13:29:14 +0100 Subject: [PATCH 2/9] Fix perms --- .github/workflows/push-docker-image.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/push-docker-image.yml b/.github/workflows/push-docker-image.yml index 4dc73bd..d20390c 100644 --- a/.github/workflows/push-docker-image.yml +++ b/.github/workflows/push-docker-image.yml @@ -35,10 +35,10 @@ jobs: - name: Install prerequisites run: | - apt update -y - apt install -y software-properties-common - add-apt-repository universe - apt install -y docker.io packer + sudo apt update -y + sudo apt install -y software-properties-common + sudo add-apt-repository universe + sudo apt install -y docker.io packer # packer plugins install github.com/hashicorp/docker env: DEBIAN_FRONTEND: noninteractive From 01241f1ca81833e742c35a2ee297a68a0b0cf86b Mon Sep 17 00:00:00 2001 From: Sergio Date: Wed, 13 Nov 2024 13:37:04 +0100 Subject: [PATCH 3/9] Don't depend on outside action --- .github/workflows/push-docker-image.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/push-docker-image.yml b/.github/workflows/push-docker-image.yml index d20390c..80a2504 100644 --- a/.github/workflows/push-docker-image.yml +++ b/.github/workflows/push-docker-image.yml @@ -28,10 +28,15 @@ jobs: - uses: actions/checkout@v3 # Some images are too large and we run out of disk space, so try to free some - - name: Free Disk Space (Ubuntu) - uses: jlumbroso/free-disk-space@v1.3.1 - with: - tool-cache: false + - name: Free disk space + run: | + # https://github.com/jlumbroso/free-disk-space + set -ex + sudo rm -rf /usr/local/lib/android || true + sudo rm -rf /usr/share/dotnet || true + sudo rm -rf /opt/ghc || true + sudo rm -rf /usr/local/.ghcup || true + sudo docker image prune --all --force || true - name: Install prerequisites run: | From 79f3a62e936f4671b306679e696c4b9d9023a42b Mon Sep 17 00:00:00 2001 From: Sergio Date: Wed, 13 Nov 2024 13:44:05 +0100 Subject: [PATCH 4/9] Remove containerd.io --- .github/workflows/push-docker-image.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/push-docker-image.yml b/.github/workflows/push-docker-image.yml index 80a2504..ef710d8 100644 --- a/.github/workflows/push-docker-image.yml +++ b/.github/workflows/push-docker-image.yml @@ -43,6 +43,7 @@ jobs: sudo apt update -y sudo apt install -y software-properties-common sudo add-apt-repository universe + sudo apt-get remove containerd.io sudo apt install -y docker.io packer # packer plugins install github.com/hashicorp/docker env: From e7611ea82cc347231320e3e9c59d5b79612a36ce Mon Sep 17 00:00:00 2001 From: Sergio Date: Wed, 13 Nov 2024 13:46:55 +0100 Subject: [PATCH 5/9] Default to slc9 --- .github/workflows/push-docker-image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/push-docker-image.yml b/.github/workflows/push-docker-image.yml index ef710d8..fe53979 100644 --- a/.github/workflows/push-docker-image.yml +++ b/.github/workflows/push-docker-image.yml @@ -10,7 +10,7 @@ name: Push Docker image image-name: description: Docker image to build required: true - default: slc8-builder + default: slc9-builder permissions: contents: read From e2ae2b2b1a612488bf8507705d9daf1b62488538 Mon Sep 17 00:00:00 2001 From: Sergio Date: Wed, 13 Nov 2024 13:47:17 +0100 Subject: [PATCH 6/9] Install docker plugin again --- .github/workflows/push-docker-image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/push-docker-image.yml b/.github/workflows/push-docker-image.yml index fe53979..62c6d46 100644 --- a/.github/workflows/push-docker-image.yml +++ b/.github/workflows/push-docker-image.yml @@ -45,7 +45,7 @@ jobs: sudo add-apt-repository universe sudo apt-get remove containerd.io sudo apt install -y docker.io packer - # packer plugins install github.com/hashicorp/docker + packer plugins install docker env: DEBIAN_FRONTEND: noninteractive From f195d2a8e97b9b6b20ab9f03fe9b129866b9c976 Mon Sep 17 00:00:00 2001 From: Sergio Date: Wed, 13 Nov 2024 13:54:51 +0100 Subject: [PATCH 7/9] Fix packer --- .github/workflows/push-docker-image.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/push-docker-image.yml b/.github/workflows/push-docker-image.yml index 62c6d46..eda0265 100644 --- a/.github/workflows/push-docker-image.yml +++ b/.github/workflows/push-docker-image.yml @@ -43,8 +43,15 @@ jobs: sudo apt update -y sudo apt install -y software-properties-common sudo add-apt-repository universe + + # containerd.io conflicts with docker.io sudo apt-get remove containerd.io - sudo apt install -y docker.io packer + sudo apt install -y docker.io + + # The packer provided by Ubuntu repos is ancient + curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add - + sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main" + sudo apt-get update && sudo apt-get install packer packer plugins install docker env: DEBIAN_FRONTEND: noninteractive From 5fa0768ee9219acc4e9ba72c9e365575ce9f8114 Mon Sep 17 00:00:00 2001 From: Sergio Date: Wed, 13 Nov 2024 13:59:01 +0100 Subject: [PATCH 8/9] Fix url --- .github/workflows/push-docker-image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/push-docker-image.yml b/.github/workflows/push-docker-image.yml index eda0265..4f85cd5 100644 --- a/.github/workflows/push-docker-image.yml +++ b/.github/workflows/push-docker-image.yml @@ -52,7 +52,7 @@ jobs: curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add - sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main" sudo apt-get update && sudo apt-get install packer - packer plugins install docker + packer plugins install github.com/hashicorp/docker env: DEBIAN_FRONTEND: noninteractive From 0f1adf8f73327bffdf2e9e662ab1d0de1553ca48 Mon Sep 17 00:00:00 2001 From: Sergio Date: Wed, 13 Nov 2024 14:20:20 +0100 Subject: [PATCH 9/9] Remove more things --- .github/workflows/push-docker-image.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/push-docker-image.yml b/.github/workflows/push-docker-image.yml index 4f85cd5..bcb5e8e 100644 --- a/.github/workflows/push-docker-image.yml +++ b/.github/workflows/push-docker-image.yml @@ -37,6 +37,7 @@ jobs: sudo rm -rf /opt/ghc || true sudo rm -rf /usr/local/.ghcup || true sudo docker image prune --all --force || true + sudo rm -rf "$AGENT_TOOLSDIRECTORY" || true - name: Install prerequisites run: |