From 89be8bf71aa211aca6cda39661727dcb8c70763d Mon Sep 17 00:00:00 2001 From: Michael Kriese Date: Tue, 2 Jul 2024 11:24:23 +0200 Subject: [PATCH 01/13] build: use cdn --- tools/docker/Dockerfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile index 2ff2a4965c0f11..2f4ef4ec1471a2 100644 --- a/tools/docker/Dockerfile +++ b/tools/docker/Dockerfile @@ -17,13 +17,17 @@ FROM slim-base as build WORKDIR /usr/local/renovate -ENV CI=1 npm_config_modules_cache_max_age=0 +ENV CI=1 npm_config_modules_cache_max_age=0 \ + npm_config_better-sqlite3_binary_host=https://cdn.containerbase.dev/github.com/WiseLibs/better-sqlite3/releases/download \ + npm_config_loglevel=info COPY pnpm-lock.yaml ./ # only fetch deps from lockfile https://pnpm.io/cli/fetch RUN corepack pnpm fetch --prod +RUN false + COPY . ./ # install From 90f4375ded613d7426ee5859add5ed3e080212b3 Mon Sep 17 00:00:00 2001 From: Michael Kriese Date: Tue, 2 Jul 2024 11:25:39 +0200 Subject: [PATCH 02/13] ci: test arm64 --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9de54ee6a332a5..ad4a0f23b2a522 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -552,7 +552,7 @@ jobs: run: pnpm build - name: Build docker - run: pnpm build:docker build --tries=3 + run: pnpm build:docker build --tries=3 --platform=linux/amd64,linux/arm64 env: LOG_LEVEL: debug From f4034ac1bbb399092af4b88c639c281ba6f43c23 Mon Sep 17 00:00:00 2001 From: Michael Kriese Date: Tue, 2 Jul 2024 11:27:30 +0200 Subject: [PATCH 03/13] ci: enable build test --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ad4a0f23b2a522..0a16dfb9067484 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -535,7 +535,7 @@ jobs: - setup-build runs-on: ubuntu-latest timeout-minutes: 15 - if: github.event.pull_request.draft != true + # if: github.event.pull_request.draft != true steps: - name: Checkout code uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 From 5d3cfb1a38ce50090e69270ce79b5e8f56229a7b Mon Sep 17 00:00:00 2001 From: Michael Kriese Date: Tue, 2 Jul 2024 11:32:37 +0200 Subject: [PATCH 04/13] ci: enable custom builder --- .github/workflows/build.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0a16dfb9067484..b47a76eed112f1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -542,6 +542,11 @@ jobs: with: show-progress: false + - name: docker-config + uses: containerbase/internal-tools@0b4162e48b68b3521953c3c663376ca22a1f769b # v3.3.2 + with: + command: docker-config + - name: Setup Node.js uses: ./.github/actions/setup-node with: From 4c0415ddfd79527b2aeb93ee17d541a8ac02b5d8 Mon Sep 17 00:00:00 2001 From: Michael Kriese Date: Tue, 2 Jul 2024 11:33:45 +0200 Subject: [PATCH 05/13] build: don't use cdn --- tools/docker/Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile index 2f4ef4ec1471a2..a3c47210251cab 100644 --- a/tools/docker/Dockerfile +++ b/tools/docker/Dockerfile @@ -18,7 +18,6 @@ FROM slim-base as build WORKDIR /usr/local/renovate ENV CI=1 npm_config_modules_cache_max_age=0 \ - npm_config_better-sqlite3_binary_host=https://cdn.containerbase.dev/github.com/WiseLibs/better-sqlite3/releases/download \ npm_config_loglevel=info COPY pnpm-lock.yaml ./ From adb701595c876faeb8b1ff9d7e20210a1963559f Mon Sep 17 00:00:00 2001 From: Michael Kriese Date: Tue, 2 Jul 2024 11:43:51 +0200 Subject: [PATCH 06/13] revert: remove build stopper --- tools/docker/Dockerfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile index a3c47210251cab..1952a769a74108 100644 --- a/tools/docker/Dockerfile +++ b/tools/docker/Dockerfile @@ -25,8 +25,6 @@ COPY pnpm-lock.yaml ./ # only fetch deps from lockfile https://pnpm.io/cli/fetch RUN corepack pnpm fetch --prod -RUN false - COPY . ./ # install From d314e8bd4dee6519aaa8c34e8af05a39990d00df Mon Sep 17 00:00:00 2001 From: Michael Kriese Date: Tue, 2 Jul 2024 12:16:24 +0200 Subject: [PATCH 07/13] revert: revert --- .github/workflows/build.yml | 10 +++++----- tools/docker/Dockerfile | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b47a76eed112f1..4732258a52ec33 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -542,10 +542,10 @@ jobs: with: show-progress: false - - name: docker-config - uses: containerbase/internal-tools@0b4162e48b68b3521953c3c663376ca22a1f769b # v3.3.2 - with: - command: docker-config + # - name: docker-config + # uses: containerbase/internal-tools@0b4162e48b68b3521953c3c663376ca22a1f769b # v3.3.2 + # with: + # command: docker-config - name: Setup Node.js uses: ./.github/actions/setup-node @@ -557,7 +557,7 @@ jobs: run: pnpm build - name: Build docker - run: pnpm build:docker build --tries=3 --platform=linux/amd64,linux/arm64 + run: pnpm build:docker build --tries=3 # --platform=linux/amd64,linux/arm64 env: LOG_LEVEL: debug diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile index 1952a769a74108..168999f9e1cb31 100644 --- a/tools/docker/Dockerfile +++ b/tools/docker/Dockerfile @@ -22,6 +22,8 @@ ENV CI=1 npm_config_modules_cache_max_age=0 \ COPY pnpm-lock.yaml ./ +RUN ldd --version + # only fetch deps from lockfile https://pnpm.io/cli/fetch RUN corepack pnpm fetch --prod From f799a319f8d31a8cdb941d0cc7fcc2afc0cf3440 Mon Sep 17 00:00:00 2001 From: Michael Kriese Date: Tue, 2 Jul 2024 12:17:36 +0200 Subject: [PATCH 08/13] ci: testing --- .github/workflows/build.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4732258a52ec33..32d8aceb88ef93 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -533,7 +533,7 @@ jobs: build: needs: - setup-build - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 timeout-minutes: 15 # if: github.event.pull_request.draft != true steps: @@ -556,6 +556,8 @@ jobs: - name: Build run: pnpm build + - run: ldd --version + - name: Build docker run: pnpm build:docker build --tries=3 # --platform=linux/amd64,linux/arm64 env: From 71fe9ffaff8058745d82b4c5b6a3cb024ef2f5d1 Mon Sep 17 00:00:00 2001 From: Michael Kriese Date: Wed, 3 Jul 2024 08:52:29 +0200 Subject: [PATCH 09/13] fix: wrong casing --- tools/docker/Dockerfile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile index 168999f9e1cb31..afa5b9b5593b4c 100644 --- a/tools/docker/Dockerfile +++ b/tools/docker/Dockerfile @@ -13,7 +13,7 @@ FROM ghcr.io/renovatebot/base-image:2.24.0-full@sha256:323eb53c3a1706e6bf87d4e8e # -------------------------------------- # build image # -------------------------------------- -FROM slim-base as build +FROM slim-base AS build WORKDIR /usr/local/renovate @@ -22,8 +22,6 @@ ENV CI=1 npm_config_modules_cache_max_age=0 \ COPY pnpm-lock.yaml ./ -RUN ldd --version - # only fetch deps from lockfile https://pnpm.io/cli/fetch RUN corepack pnpm fetch --prod From 94b5a0f30568824b54310bfc24ac1185d51cc50c Mon Sep 17 00:00:00 2001 From: Michael Kriese Date: Wed, 3 Jul 2024 08:55:24 +0200 Subject: [PATCH 10/13] ci: validate --- .github/workflows/build.yml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 32d8aceb88ef93..b47a76eed112f1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -533,7 +533,7 @@ jobs: build: needs: - setup-build - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest timeout-minutes: 15 # if: github.event.pull_request.draft != true steps: @@ -542,10 +542,10 @@ jobs: with: show-progress: false - # - name: docker-config - # uses: containerbase/internal-tools@0b4162e48b68b3521953c3c663376ca22a1f769b # v3.3.2 - # with: - # command: docker-config + - name: docker-config + uses: containerbase/internal-tools@0b4162e48b68b3521953c3c663376ca22a1f769b # v3.3.2 + with: + command: docker-config - name: Setup Node.js uses: ./.github/actions/setup-node @@ -556,10 +556,8 @@ jobs: - name: Build run: pnpm build - - run: ldd --version - - name: Build docker - run: pnpm build:docker build --tries=3 # --platform=linux/amd64,linux/arm64 + run: pnpm build:docker build --tries=3 --platform=linux/amd64,linux/arm64 env: LOG_LEVEL: debug From 0f1eea9e12b4cf123e38e28159bda15254a6a861 Mon Sep 17 00:00:00 2001 From: Michael Kriese Date: Wed, 3 Jul 2024 09:13:53 +0200 Subject: [PATCH 11/13] ci: extend timeout --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b47a76eed112f1..c9049cc275afd7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -534,7 +534,7 @@ jobs: needs: - setup-build runs-on: ubuntu-latest - timeout-minutes: 15 + timeout-minutes: 30 # if: github.event.pull_request.draft != true steps: - name: Checkout code From e905fd276e6f27a95c755bad182e1a4c789d690d Mon Sep 17 00:00:00 2001 From: Michael Kriese Date: Thu, 4 Jul 2024 09:55:26 +0200 Subject: [PATCH 12/13] revert: revert changes --- .github/workflows/build.yml | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c9049cc275afd7..9de54ee6a332a5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -534,19 +534,14 @@ jobs: needs: - setup-build runs-on: ubuntu-latest - timeout-minutes: 30 - # if: github.event.pull_request.draft != true + timeout-minutes: 15 + if: github.event.pull_request.draft != true steps: - name: Checkout code uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 with: show-progress: false - - name: docker-config - uses: containerbase/internal-tools@0b4162e48b68b3521953c3c663376ca22a1f769b # v3.3.2 - with: - command: docker-config - - name: Setup Node.js uses: ./.github/actions/setup-node with: @@ -557,7 +552,7 @@ jobs: run: pnpm build - name: Build docker - run: pnpm build:docker build --tries=3 --platform=linux/amd64,linux/arm64 + run: pnpm build:docker build --tries=3 env: LOG_LEVEL: debug From 7cc2e7794a310651a96ca10b7125be3357dfca75 Mon Sep 17 00:00:00 2001 From: Michael Kriese Date: Thu, 4 Jul 2024 11:46:41 +0200 Subject: [PATCH 13/13] build(docker): use cross platform build --- tools/docker/Dockerfile | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile index afa5b9b5593b4c..42bb4c1fb3d9d4 100644 --- a/tools/docker/Dockerfile +++ b/tools/docker/Dockerfile @@ -13,17 +13,34 @@ FROM ghcr.io/renovatebot/base-image:2.24.0-full@sha256:323eb53c3a1706e6bf87d4e8e # -------------------------------------- # build image # -------------------------------------- -FROM slim-base AS build +FROM --platform=$BUILDPLATFORM ghcr.io/renovatebot/base-image:2.24.0@sha256:f659e0c7589ef608805887ab0d668f67c4b5d5ce0612e62538b17322a92f928d AS build + +ARG TARGETPLATFORM +ARG BUILDPLATFORM + +RUN set -ex; \ + echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM"; \ + uname -a; \ + true WORKDIR /usr/local/renovate ENV CI=1 npm_config_modules_cache_max_age=0 \ - npm_config_loglevel=info + npm_config_loglevel=info \ + ARCH=arm64 COPY pnpm-lock.yaml ./ +# trim `linux/` from TARGETPLATFORM +# replace `amd64` with `x64` for `node` +# set `npm_config_arch` for `prebuild-install` +# set `npm_config_platform_arch` for `install-artifact-from-github` # only fetch deps from lockfile https://pnpm.io/cli/fetch -RUN corepack pnpm fetch --prod +RUN set -ex; \ + arch=${TARGETPLATFORM:6}; \ + export npm_config_arch=${arch/amd64/x64} npm_config_platform_arch=${arch/amd64/x64}; \ + corepack pnpm fetch --prod; \ + true COPY . ./ @@ -34,10 +51,11 @@ RUN set -ex; \ # test COPY tools/docker/bin/ /usr/local/bin/ +# RE2 doesn't work on cross compile +ENV RENOVATE_X_IGNORE_RE2=true RUN set -ex; \ renovate --version; \ renovate-config-validator; \ - node -e "new require('re2')('.*').exec('test')"; \ true # -------------------------------------- @@ -69,8 +87,7 @@ RUN set -ex; \ RUN set -ex; \ renovate --version; \ - renovate-config-validator; \ - node -e "new require('re2')('.*').exec('test')"; \ + node -e "new require('re2')('.*').exec('test');new require('better-sqlite3')(':memory:')"; \ true LABEL \