Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: use different chromium versions for different architectures #1053

Merged
merged 1 commit into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,16 @@
{
// Update pinned alpine packages in Dockerfile.
"customType": "regex",
"fileMatch": [ "Dockerfile" ],
"fileMatch": [ "Dockerfile", "Dockerfile.build" ],
"matchStrings": [
// Lines that loosely look like "apk add --repository community something=version".
// Lines that loosely look like "apk add --repository community --arch value something=version".
// To keep this regex simple, only one package per "apk add" is supported.
"\\bapk\\b.+?\\badd\\b.+?(--repository|-X)[ =\\t]+(?<alpineRepo>[a-z]+)\\s+(?<depName>[-\\w]+?)=(?<currentValue>[-.\\w]+)"
"\\bapk\\b.+?\\badd\\b.+?(--repository|-X)[ =\\t]+(?<alpineRepo>[a-z]+)\\s+(--arch[ =\\t]+(?<arch>\\w+)\\s+)?(?<depName>[-\\w]+?)=(?<currentValue>[-.\\w]+)"
],
"versioningTemplate": "loose", // The most lenient versioning renovate supports.
// We use two different datasources for main and community, as alpine serves them in different URLs.
"datasourceTemplate": "custom.alpine-{{alpineRepo}}",
// We use different datasources for main and community, as alpine serves them in different URLs.
// Specifying --arch is optional, if not found it will default to x86_64.
"datasourceTemplate": "custom.alpine-{{alpineRepo}}-{{#if arch}}{{arch}}{{else}}x86_64{{/if}}",
// Extracted "versions" include the package name, so here we strip that prefix using a regex.
"extractVersionTemplate": "{{depName}}-(?<version>.+).apk",
},
Expand All @@ -102,13 +103,21 @@
"customDatasources": {
// Use alpine HTML mirror page as a repository. When using `html` format, renovate produces version strings from
// all links present in the page. The version is extracted from that using extractVersionTemplate above.
"alpine-main": {
"alpine-main-x86_64": {
"defaultRegistryUrlTemplate": "https://dl-cdn.alpinelinux.org/alpine/latest-stable/main/x86_64/",
"format": "html",
},
"alpine-community": {
"alpine-community-x86_64": {
"defaultRegistryUrlTemplate": "https://dl-cdn.alpinelinux.org/alpine/latest-stable/community/x86_64/",
"format": "html",
},
"alpine-main-aarch64": {
"defaultRegistryUrlTemplate": "https://dl-cdn.alpinelinux.org/alpine/latest-stable/main/aarch64/",
"format": "html",
},
"alpine-community-aarch64": {
"defaultRegistryUrlTemplate": "https://dl-cdn.alpinelinux.org/alpine/latest-stable/community/aarch64/",
"format": "html",
},
},
}
9 changes: 7 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

ARG TARGETPLATFORM

FROM --platform=$TARGETPLATFORM alpine:3.20.3 AS release

Check warning on line 10 in Dockerfile

View workflow job for this annotation

GitHub Actions / validate (ubuntu-latest)

Setting platform to predefined $TARGETPLATFORM in FROM is redundant as this is the default behavior

RedundantTargetPlatform: Setting platform to predefined $TARGETPLATFORM in FROM is redundant as this is the default behavior More info: https://docs.docker.com/go/dockerfile/rule/redundant-target-platform/

Check warning on line 10 in Dockerfile

View workflow job for this annotation

GitHub Actions / validate (ubuntu-latest)

Setting platform to predefined $TARGETPLATFORM in FROM is redundant as this is the default behavior

RedundantTargetPlatform: Setting platform to predefined $TARGETPLATFORM in FROM is redundant as this is the default behavior More info: https://docs.docker.com/go/dockerfile/rule/redundant-target-platform/

Check warning on line 10 in Dockerfile

View workflow job for this annotation

GitHub Actions / validate (github-hosted-ubuntu-arm64)

Setting platform to predefined $TARGETPLATFORM in FROM is redundant as this is the default behavior

RedundantTargetPlatform: Setting platform to predefined $TARGETPLATFORM in FROM is redundant as this is the default behavior More info: https://docs.docker.com/go/dockerfile/rule/redundant-target-platform/

Check warning on line 10 in Dockerfile

View workflow job for this annotation

GitHub Actions / validate (github-hosted-ubuntu-arm64)

Setting platform to predefined $TARGETPLATFORM in FROM is redundant as this is the default behavior

RedundantTargetPlatform: Setting platform to predefined $TARGETPLATFORM in FROM is redundant as this is the default behavior More info: https://docs.docker.com/go/dockerfile/rule/redundant-target-platform/
ARG TARGETOS
ARG TARGETARCH
ARG HOST_DIST=$TARGETOS-$TARGETARCH
Expand All @@ -21,13 +21,18 @@

# Third stage copies the setup from the base agent and
# additionally installs Chromium to support browser checks.
FROM --platform=$TARGETPLATFORM alpine:3.20.3 AS with-browser

Check warning on line 24 in Dockerfile

View workflow job for this annotation

GitHub Actions / validate (ubuntu-latest)

Setting platform to predefined $TARGETPLATFORM in FROM is redundant as this is the default behavior

RedundantTargetPlatform: Setting platform to predefined $TARGETPLATFORM in FROM is redundant as this is the default behavior More info: https://docs.docker.com/go/dockerfile/rule/redundant-target-platform/

Check warning on line 24 in Dockerfile

View workflow job for this annotation

GitHub Actions / validate (ubuntu-latest)

Setting platform to predefined $TARGETPLATFORM in FROM is redundant as this is the default behavior

RedundantTargetPlatform: Setting platform to predefined $TARGETPLATFORM in FROM is redundant as this is the default behavior More info: https://docs.docker.com/go/dockerfile/rule/redundant-target-platform/

Check warning on line 24 in Dockerfile

View workflow job for this annotation

GitHub Actions / validate (github-hosted-ubuntu-arm64)

Setting platform to predefined $TARGETPLATFORM in FROM is redundant as this is the default behavior

RedundantTargetPlatform: Setting platform to predefined $TARGETPLATFORM in FROM is redundant as this is the default behavior More info: https://docs.docker.com/go/dockerfile/rule/redundant-target-platform/

Check warning on line 24 in Dockerfile

View workflow job for this annotation

GitHub Actions / validate (github-hosted-ubuntu-arm64)

Setting platform to predefined $TARGETPLATFORM in FROM is redundant as this is the default behavior

RedundantTargetPlatform: Setting platform to predefined $TARGETPLATFORM in FROM is redundant as this is the default behavior More info: https://docs.docker.com/go/dockerfile/rule/redundant-target-platform/

ARG TARGETARCH

# Renovate updates the pinned packages below.
# The --repository arg is required for renovate to know which alpine repo it should look for updates in.
# To keep the renovate regex simple, only keep one package installation per line.
RUN apk --no-cache add --repository community tini=0.19.0-r3 && \
apk --no-cache add --repository community chromium-swiftshader=130.0.6723.116-r0
# Furthermore, we split this into two lines to allow for the arm64 and amd64 versions of chromium to be different, as
# they have drifted in the past.
RUN apk --no-cache add --repository community tini=0.19.0-r3
RUN [[ "$TARGETARCH" != "amd64" ]] || apk --no-cache add --repository community --arch x86_64 chromium-swiftshader=131.0.6778.69-r0
RUN [[ "$TARGETARCH" != "arm64" ]] || apk --no-cache add --repository community --arch aarch64 chromium-swiftshader=130.0.6723.116-r0

COPY --from=release /usr/local/bin/synthetic-monitoring-agent /usr/local/bin/synthetic-monitoring-agent
COPY --from=release /usr/local/bin/sm-k6 /usr/local/bin/sm-k6
Expand Down
10 changes: 9 additions & 1 deletion Dockerfile.build
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,20 @@ ENTRYPOINT ["/usr/local/bin/synthetic-monitoring-agent"]
# Third stage copies the setup from the base agent and
# additionally installs Chromium to support browser checks.
FROM alpine:3.20.3 AS with-browser
ARG TARGETOS
ARG TARGETARCH

# Renovate updates the pinned packages below.
# The --repository arg is required for renovate to know which alpine repo it should look for updates in.
# The --arch flag is necessary so that it knows which architecture to target.
# To keep the renovate regex simple, only keep one package installation per line.
#
# Alpine does not have a consistent set of packages across all the
# architectures, so we have to install different versions depending on which
# one we are targeting.
RUN apk --no-cache add --repository community tini=0.19.0-r3
RUN apk --no-cache add --repository community chromium-swiftshader=130.0.6723.116-r0
RUN if test "$TARGETARCH" = "amd64" ; then apk --no-cache add --repository community --arch x86_64 chromium-swiftshader=131.0.6778.69-r0 ; fi
RUN if test "$TARGETARCH" = "arm64" ; then apk --no-cache add --repository community --arch aarch64 chromium-swiftshader=130.0.6723.116-r0 ; fi

COPY --from=release /usr/local/bin/synthetic-monitoring-agent /usr/local/bin/synthetic-monitoring-agent
COPY --from=release /usr/local/bin/sm-k6 /usr/local/bin/sm-k6
Expand Down
Loading