From a23924806d34d94fef85992fa0cb3606881c6afa Mon Sep 17 00:00:00 2001 From: Michael Kriese Date: Fri, 17 Mar 2023 11:19:00 +0100 Subject: [PATCH] feat(dart): support arm64 and checksums (#772) --- src/usr/local/buildpack/tools/v2/dart.sh | 21 ++++++++- src/usr/local/buildpack/utils/constants.sh | 4 ++ test/Dockerfile.arm64 | 52 +++++++++++++--------- test/Dockerfile.jammy | 16 ++++--- 4 files changed, 62 insertions(+), 31 deletions(-) diff --git a/src/usr/local/buildpack/tools/v2/dart.sh b/src/usr/local/buildpack/tools/v2/dart.sh index 05774b344..17ba2b3cc 100644 --- a/src/usr/local/buildpack/tools/v2/dart.sh +++ b/src/usr/local/buildpack/tools/v2/dart.sh @@ -10,11 +10,23 @@ function prepare_tool() { # https://storage.googleapis.com/dart-archive/channels/stable/release/1.11.0/sdk/dartsdk-linux-x64-release.zip # https://storage.googleapis.com/dart-archive/channels/stable/release/2.18.0/sdk/dartsdk-linux-x64-release.zip +# https://storage.googleapis.com/dart-archive/channels/stable/release/2.19.4/sdk/dartsdk-linux-x64-release.zip.sha256sum +# https://storage.googleapis.com/dart-archive/channels/stable/release/2.19.4/sdk/dartsdk-linux-arm64-release.zip +# https://storage.googleapis.com/dart-archive/channels/stable/release/2.19.4/sdk/dartsdk-linux-arm64-release.zip.sha256sum function install_tool () { local versioned_tool_path local DART_SDK_CHANNEL="stable" - local DART_SDK_URL="https://storage.googleapis.com/dart-archive/channels/${DART_SDK_CHANNEL}/release/${TOOL_VERSION}/sdk/dartsdk-linux-x64-release.zip" + local DART_SDK_URL="https://storage.googleapis.com/dart-archive/channels/${DART_SDK_CHANNEL}/release/${TOOL_VERSION}/sdk" local file + local arch=x64 + + local dart_file + local checksum_file + local expected_checksum + + if [[ "${ARCHITECTURE}" = "aarch64" ]]; then + arch=arm64 + fi # do we need those old unsupported dart versions? # if [[ $MAJOR -lt 1 || ($MAJOR -eq 1 && $MINOR -lt 11) ]]; then @@ -27,7 +39,12 @@ function install_tool () { exit 1 fi - file=$(get_from_url "$DART_SDK_URL") + dart_file="dartsdk-linux-${arch}-release.zip" + checksum_file=$(get_from_url "${DART_SDK_URL}/${dart_file}.sha256sum") + # get checksum from file + expected_checksum=$(grep "\\*${dart_file}" "${checksum_file}" | cut -d' ' -f1) + + file=$(get_from_url "${DART_SDK_URL}/${dart_file}" "${dart_file}" "${expected_checksum}" "sha256sum") versioned_tool_path=$(create_versioned_tool_path) bsdtar -C "${versioned_tool_path}" --strip 1 -xf "${file}" diff --git a/src/usr/local/buildpack/utils/constants.sh b/src/usr/local/buildpack/utils/constants.sh index 8b351acd0..83d4c2c52 100644 --- a/src/usr/local/buildpack/utils/constants.sh +++ b/src/usr/local/buildpack/utils/constants.sh @@ -27,3 +27,7 @@ export TEMP_DIR=/tmp # used to source helper from tools export BUILDPACK_DIR=$ROOT_DIR/buildpack + +# Used to find matching tool downloads +ARCHITECTURE=$(uname -p) +export ARCHITECTURE diff --git a/test/Dockerfile.arm64 b/test/Dockerfile.arm64 index 455ffa20a..9b9ab901b 100644 --- a/test/Dockerfile.arm64 +++ b/test/Dockerfile.arm64 @@ -17,6 +17,8 @@ RUN install-buildpack # renovate: datasource=github-tags packageName=git/git RUN install-tool git v2.39.2 +# lerna fails for some unknown reason +ARG IGNORED_TOOLS=erlang,elixir,flutter,lerna,php,composer,python,hashin,pipenv,poetry,ruby,bundler,cocoapods,swift #-------------------------------------- # Image: test @@ -27,6 +29,9 @@ ARG APT_HTTP_PROXY RUN uname -p | tee | grep aarch64 +# renovate datasource=docker +RUN install-tool dart 2.18.0 + # renovate: datasource=github-releases packageName=moby/moby RUN install-tool docker v23.0.1 @@ -34,16 +39,19 @@ RUN install-tool docker v23.0.1 RUN install-tool dotnet 7.0.202 # renovate: datasource=github-releases packageName=containerbase/erlang-prebuild versioning=docker -#RUN install-tool erlang 25.2.2.0 +RUN install-tool erlang 25.3.0.0 # renovate: datasource=docker versioning=docker -#RUN install-tool elixir 1.14.3 +RUN install-tool elixir 1.14.3 # renovate datasource=flutter-version -#RUN install-tool flutter 3.0.2 +RUN install-tool flutter 3.0.2 # renovate: datasource=github-releases packageName=fluxcd/flux2 RUN install-tool flux v0.39.0 +# renovate: datasource=github-releases packageName=git-lfs/git-lfs +RUN install-tool git-lfs v3.3.0 + # renovate: datasource=docker versioning=docker RUN install-tool golang 1.20.0 @@ -54,59 +62,59 @@ RUN install-tool helm v3.11.2 RUN install-tool helmfile v0.150.0 # renovate: datasource=adoptium-java packageName=java-jre -#RUN install-tool java 17.0.6+10 +RUN install-tool java 17.0.6+10 # renovate: datasource=gradle-version packageName=gradle versioning=gradle -#RUN install-tool gradle 7.6 +RUN install-tool gradle 7.6 + + +# renovate: datasource=github-releases packageName=kubernetes-sigs/kustomize +RUN install-tool kustomize 5.0.0 # renovate: datasource=github-tags packageName=NixOS/nix RUN install-tool nix 2.13.2 # renovate: datasource=node -RUN install-tool node v18.14.0 +RUN install-tool node v18.15.0 # renovate: datasource=npm RUN install-tool pnpm 7.26.2 # renovate: datasource=npm RUN install-tool yarn 1.22.19 # renovate: datasource=npm -# fails for some reason -#RUN install-tool lerna 6.4.1 +RUN install-tool lerna 6.5.1 # renovate: datasource=github-releases packageName=containerbase/php-prebuild -#RUN install-tool php 8.2.2 +RUN install-tool php 8.2.3 # renovate: datasource=github-releases packageName=composer/composer -#RUN install-tool composer 2.5.2 +RUN install-tool composer 2.5.4 # renovate: datasource=github-releases packageName=PowerShell/PowerShell -RUN install-tool powershell v7.3.2 +RUN install-tool powershell v7.3.3 # renovate: datasource=github-releases packageName=containerbase/python-prebuild -#RUN install-tool python 3.11.1 +RUN install-tool python 3.11.2 # renovate: datasource=pypi -#RUN install-pip pipenv 2023.2.4 +RUN install-tool pipenv 2023.2.18 # renovate: datasource=pypi -#RUN install-pip hashin 0.17.0 +RUN install-tool hashin 0.17.0 # renovate: datasource=pypi -#RUN install-tool poetry 1.3.2 +RUN install-tool poetry 1.4.0 # renovate: datasource=github-releases packageName=containerbase/ruby-prebuild versioning=ruby -#RUN install-tool ruby 3.2.0 +RUN install-tool ruby 3.2.1 # renovate: datasource=rubygems versioning=ruby -#RUN install-tool bundler 2.4.6 +RUN install-tool bundler 2.4.8 # renovate: datasource=rubygems versioning=ruby -#RUN install-tool cocoapods 1.11.3 +RUN install-tool cocoapods 1.12.0 # renovate: datasource=docker versioning=docker RUN install-tool rust 1.67.0 # renovate: datasource=docker versioning=docker -#RUN install-tool swift 5.7.3 +RUN install-tool swift 5.7.3 # renovate: datasource=docker packageName=hashicorp/terraform versioning=docker RUN install-tool terraform 1.3.7 -# renovate: datasource=github-releases packageName=git-lfs/git-lfs -RUN install-tool git-lfs v3.3.0 - # renovate: datasource=github-releases packageName=jsonnet-bundler/jsonnet-bundler RUN install-tool jb v0.5.1 diff --git a/test/Dockerfile.jammy b/test/Dockerfile.jammy index 75b4fdded..cd38d85b7 100644 --- a/test/Dockerfile.jammy +++ b/test/Dockerfile.jammy @@ -25,6 +25,9 @@ FROM base as test ARG APT_HTTP_PROXY +# renovate datasource=docker +RUN install-tool dart 2.18.0 + # renovate: datasource=dotnet packageName=dotnet-sdk RUN install-tool dotnet 7.0.202 @@ -39,12 +42,12 @@ RUN install-tool flutter 3.0.2 # renovate: datasource=github-releases packageName=fluxcd/flux2 RUN install-tool flux v0.41.1 +# renovate: datasource=github-releases packageName=git-lfs/git-lfs +RUN install-tool git-lfs v3.3.0 + # renovate: datasource=docker versioning=docker RUN install-tool golang 1.20.2 -# renovate: datasource=github-releases packageName=kubernetes-sigs/kustomize -RUN install-tool kustomize 5.0.0 - # renovate: datasource=github-releases packageName=helm/helm RUN install-tool helm v3.11.2 @@ -56,6 +59,9 @@ RUN install-tool java 17.0.6+10 # renovate: datasource=gradle-version packageName=gradle versioning=gradle RUN install-tool gradle 8.0.2 +# renovate: datasource=github-releases packageName=kubernetes-sigs/kustomize +RUN install-tool kustomize 5.0.0 + # renovate: datasource=github-tags packageName=NixOS/nix RUN install-tool nix 2.14.1 @@ -101,10 +107,6 @@ RUN install-tool swift 5.7.3 # renovate: datasource=docker packageName=hashicorp/terraform versioning=docker RUN install-tool terraform 1.4.1 -# renovate: datasource=github-releases packageName=git-lfs/git-lfs -RUN install-tool git-lfs v3.3.0 -RUN git lfs version - # renovate: datasource=github-releases packageName=jsonnet-bundler/jsonnet-bundler RUN install-tool jb v0.5.1