diff --git a/.github/actions/bake/action.yml b/.github/actions/bake/action.yml new file mode 100644 index 0000000000..691bf6e8e4 --- /dev/null +++ b/.github/actions/bake/action.yml @@ -0,0 +1,38 @@ +name: 'bake' +description: 'builds a containerbase image using Docker Buildx' +inputs: + token: + description: 'GitHub token' + default: ${{ github.token }} + required: true + args: + description: 'Arguments for Docker Buildx bake' + default: '' + +runs: + using: 'composite' + + steps: + - name: fetch dist + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: dist + path: dist + + - name: fix executable + shell: bash + run: | + chmod +x dist/cli/* + chmod +x dist/docker/usr/local/containerbase/bin/* + chmod +x dist/docker/usr/local/sbin/* + + - name: bake + uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3.0.2 + with: + timeout_minutes: 10 + max_attempts: 3 + retry_wait_seconds: 60 + polling_interval_seconds: 5 + command: docker buildx bake --set settings.secrets=type=env,id=GITHUB_TOKEN ${{ inputs.args }} + env: + GITHUB_TOKEN: ${{ inputs.token }} diff --git a/.github/actions/check/action.yml b/.github/actions/check/action.yml index 7b7266426d..fe382c1a7c 100644 --- a/.github/actions/check/action.yml +++ b/.github/actions/check/action.yml @@ -5,6 +5,16 @@ runs: using: 'composite' steps: + - name: Set Up contained image store + shell: bash + run: | + if [ ! -f /etc/docker/daemon.json ]; then + echo "{}" | sudo tee /etc/docker/daemon.json + fi + cat /etc/docker/daemon.json | jq '. | .+{"features": {"containerd-snapshotter": true}}' | sudo tee /etc/docker/daemon.json + cat /etc/docker/daemon.json + sudo systemctl restart docker + - name: ⚙️ Check docker service shell: bash run: | diff --git a/.github/actions/prepare-proxy/action.yml b/.github/actions/prepare-proxy/action.yml deleted file mode 100644 index 69f4f71976..0000000000 --- a/.github/actions/prepare-proxy/action.yml +++ /dev/null @@ -1,11 +0,0 @@ -name: 'Prepare propxy' -description: 'Prepares the apt proxy for the build' - -runs: - using: 'composite' - - steps: - - name: ⚙️ Prepare proxy - shell: bash - run: | - sudo $(command -v node) tools/prepare-proxy.js diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 865dc58b3c..75df8c4776 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -154,6 +154,9 @@ jobs: steps: - name: ⚙️ Setup uses: containerbase/internal-tools/setup@5deae3a281a98870784309f9017eff5e54d2bf31 # v4.5.0 + with: + node: false + apt-proxy: true - name: Check system uses: ./.github/actions/check @@ -163,32 +166,14 @@ jobs: echo "OWNER=${OWNER,,}" >> ${GITHUB_ENV} echo "BASE=ttl.sh/${{ needs.setup.outputs.uid }}/${{ matrix.arch.tag }}:1d" >> ${GITHUB_ENV} - - name: prepare apt proxy - uses: ./.github/actions/prepare-proxy - - - name: fetch dist - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + - name: build base + uses: ./.github/actions/bake with: - name: dist - path: dist - - - name: fix executable - run: | - chmod +x dist/cli/* - chmod +x dist/docker/usr/local/containerbase/bin/* - chmod +x dist/docker/usr/local/sbin/* - - - name: test distro - uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3.0.2 - with: - timeout_minutes: 10 - max_attempts: 3 - retry_wait_seconds: 60 - polling_interval_seconds: 5 - command: docker buildx bake --set build-ttl.tags=${{env.BASE}} build-ttl - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # CONTAINERBASE_CDN: ${{ vars.CONTAINERBASE_CDN }} + args: >- + --set build-ttl.tags=${{env.BASE}} + --set build-ttl.cache-to=type=gha,mode=max,scope=${{ needs.setup.outputs.uid }}-${{ matrix.arch.tag }} + --set settings.cache-from+=type=gha,scope=${{ needs.setup.outputs.uid }}-${{ matrix.arch.tag }} + build-ttl distro: runs-on: ubuntu-24.04 @@ -211,6 +196,9 @@ jobs: steps: - name: ⚙️ Setup uses: containerbase/internal-tools/setup@5deae3a281a98870784309f9017eff5e54d2bf31 # v4.5.0 + with: + node: false + apt-proxy: true - name: Check system uses: ./.github/actions/check @@ -219,32 +207,10 @@ jobs: run: | echo "OWNER=${OWNER,,}" >> ${GITHUB_ENV} - - name: prepare apt proxy - uses: ./.github/actions/prepare-proxy - - - name: fetch dist - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - with: - name: dist - path: dist - - - name: fix executable - run: | - chmod +x dist/cli/* - chmod +x dist/docker/usr/local/containerbase/bin/* - chmod +x dist/docker/usr/local/sbin/* - - name: test distro - uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3.0.2 + uses: ./.github/actions/bake with: - timeout_minutes: 10 - max_attempts: 3 - retry_wait_seconds: 60 - polling_interval_seconds: 5 - command: docker buildx bake test-distro --set settings.secrets=type=env,id=GITHUB_TOKEN - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # CONTAINERBASE_CDN: ${{ vars.CONTAINERBASE_CDN }} + args: test-distro # test old distros on arm64 base-arm64: @@ -268,6 +234,9 @@ jobs: steps: - name: ⚙️ Setup uses: containerbase/internal-tools/setup@5deae3a281a98870784309f9017eff5e54d2bf31 # v4.5.0 + with: + node: false + apt-proxy: true - name: Check system uses: ./.github/actions/check @@ -276,32 +245,10 @@ jobs: run: | echo "OWNER=${OWNER,,}" >> ${GITHUB_ENV} - - name: prepare apt proxy - uses: ./.github/actions/prepare-proxy - - - name: fetch dist - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - with: - name: dist - path: dist - - - name: fix executable - run: | - chmod +x dist/cli/* - chmod +x dist/docker/usr/local/containerbase/bin/* - chmod +x dist/docker/usr/local/sbin/* - - name: test distro - uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3.0.2 + uses: ./.github/actions/bake with: - timeout_minutes: 10 - max_attempts: 3 - retry_wait_seconds: 60 - polling_interval_seconds: 5 - command: docker buildx bake test-base --set settings.secrets=type=env,id=GITHUB_TOKEN - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # CONTAINERBASE_CDN: ${{ vars.CONTAINERBASE_CDN }} + args: test-base lang: runs-on: ${{ matrix.arch.os }} @@ -358,6 +305,9 @@ jobs: steps: - name: ⚙️ Setup uses: containerbase/internal-tools/setup@5deae3a281a98870784309f9017eff5e54d2bf31 # v4.5.0 + with: + node: false + apt-proxy: true - name: Check system uses: ./.github/actions/check @@ -367,20 +317,19 @@ jobs: echo "OWNER=${OWNER,,}" >> ${GITHUB_ENV} echo "BASE_IMAGE=ttl.sh/${{ needs.setup.outputs.uid }}/${{ matrix.arch.tag }}:1d" >> ${GITHUB_ENV} - - name: prepare apt proxy - uses: ./.github/actions/prepare-proxy + - name: build base + uses: ./.github/actions/bake + with: + args: >- + --set build-ttl.tags=${{env.BASE_IMAGE}} + --set build-ttl.cache-to=type=gha,mode=max,scope=${{ needs.setup.outputs.uid }}-${{ matrix.arch.tag }} + --set settings.cache-from+=type=gha,scope=${{ needs.setup.outputs.uid }}-${{ matrix.arch.tag }} + build-ttl - - name: test - uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3.0.2 + - name: test distro + uses: ./.github/actions/bake with: - timeout_minutes: 10 - max_attempts: 3 - retry_wait_seconds: 60 - polling_interval_seconds: 5 - command: docker buildx bake test-${{ matrix.arch.name }} --set settings.secrets=type=env,id=GITHUB_TOKEN - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # CONTAINERBASE_CDN: ${{ vars.CONTAINERBASE_CDN }} + args: test-${{ matrix.arch.name }} # Catch-all required check for test matrix test-success: diff --git a/package.json b/package.json index 105ea8c2f5..771fe7cba1 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,6 @@ "lint-fix": "run-s prettier-fix eslint-fix 'lint-fix:*'", "lint-fix:markdown": "markdownlint-cli2 --fix '**/*.md'", "prepare": "husky", - "prepare:proxy": "node tools/prepare-proxy.js", "prettier": "prettier --cache -c -u \"**/*.*\"", "prettier-fix": "prettier --cache -w -u \"**/*.*\"", "release:prepare": "node tools/prepare-release.js", diff --git a/tools/containerbase.acl b/tools/containerbase.acl deleted file mode 100644 index 8358ecb110..0000000000 --- a/tools/containerbase.acl +++ /dev/null @@ -1,2 +0,0 @@ -ppa.launchpad.net -binaries.erlang-solutions.com diff --git a/tools/prepare-proxy.js b/tools/prepare-proxy.js deleted file mode 100644 index b8743a2c8d..0000000000 --- a/tools/prepare-proxy.js +++ /dev/null @@ -1,12 +0,0 @@ -import shell from 'shelljs'; - -shell.config.fatal = true; - -shell.echo(`Preparing squid-deb-proxy`); - -shell.exec('apt-get -qq update'); -shell.exec('apt-get install -y squid-deb-proxy'); -shell - .cat('./tools/containerbase.acl') - .to('/etc/squid-deb-proxy/mirror-dstdomain.acl.d/containerbase.acl'); -shell.exec('systemctl reload squid-deb-proxy');