From 536ef90260855ab73ab6c8de553ca152516827af Mon Sep 17 00:00:00 2001 From: Friedrich Gonzalez Date: Sat, 29 Apr 2023 16:16:49 +0200 Subject: [PATCH] Upgrade build image (#20) * Upgrade alpine to 3.17 Signed-off-by: Friedrich Gonzalez * Upgrade to golang 1.20 Signed-off-by: Friedrich Gonzalez * Upgrade jsonnet to v0.20.0 Signed-off-by: Friedrich Gonzalez * Upgrade to jsonnet-bundler v0.5.1 Signed-off-by: Friedrich Gonzalez * Upgrade tanka to v0.24.0 Signed-off-by: Friedrich Gonzalez * Update ci.yaml Signed-off-by: Friedrich Gonzalez --------- Signed-off-by: Friedrich Gonzalez --- .github/workflows/ci.yaml | 8 ++++---- README.md | 6 +++--- build-image/Dockerfile | 28 ++++++++++++---------------- 3 files changed, 19 insertions(+), 23 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index dbfd6c0..e0eac22 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -9,7 +9,7 @@ on: jobs: lint: runs-on: ubuntu-latest - container: quay.io/cortexproject/cortex-jsonnet-build-image:c924d52 + container: quay.io/cortexproject/cortex-jsonnet-build-image:e63d87f steps: - uses: actions/checkout@v2 name: Checkout @@ -23,7 +23,7 @@ jobs: run: make lint-playbooks build: runs-on: ubuntu-latest - container: quay.io/cortexproject/cortex-jsonnet-build-image:c924d52 + container: quay.io/cortexproject/cortex-jsonnet-build-image:e63d87f steps: - uses: actions/checkout@v2 name: Checkout @@ -34,7 +34,7 @@ jobs: run: make build-mixin readme: runs-on: ubuntu-latest - container: quay.io/cortexproject/cortex-jsonnet-build-image:c924d52 + container: quay.io/cortexproject/cortex-jsonnet-build-image:e63d87f steps: - uses: actions/checkout@v2 name: Checkout @@ -42,4 +42,4 @@ jobs: fetch-depth: 0 - name: "Test readme" - run: make test-readme + run: make test-readme diff --git a/README.md b/README.md index 4226c7e..a3bbc2b 100644 --- a/README.md +++ b/README.md @@ -17,8 +17,8 @@ To generate the YAMLs for deploying Cortex: ```console $ # make sure to be outside of GOPATH or a go.mod project - $ GO111MODULE=on go install github.com/grafana/tanka/cmd/tk@v0.21.0 - $ GO111MODULE=on go install github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb@v0.4.0 + $ GO111MODULE=on go install github.com/grafana/tanka/cmd/tk@v0.24.0 + $ GO111MODULE=on go install github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb@v0.5.1 ``` 1. Initialise the Tanka repo, install the Cortex and Kubernetes Jsonnet libraries. @@ -68,7 +68,7 @@ To generate the Grafana dashboards and Prometheus alerts for Cortex: ```console $ GO111MODULE=on go install github.com/monitoring-mixins/mixtool/cmd/mixtool@2ff523ea63d1cdeee2a10e01d1d48d20adcc7030 -$ GO111MODULE=on go install github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb@v0.4.0 +$ GO111MODULE=on go install github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb@v0.5.1 $ git clone https://github.com/cortexproject/cortex-jsonnet $ cd cortex-jsonnet $ make build-mixin diff --git a/build-image/Dockerfile b/build-image/Dockerfile index dc37595..a874e69 100644 --- a/build-image/Dockerfile +++ b/build-image/Dockerfile @@ -1,43 +1,39 @@ # Build jsonnet -FROM alpine:3.13 AS jsonnet-builder +FROM alpine:3.17 AS jsonnet-builder RUN apk add --no-cache git make g++ RUN git clone https://github.com/google/jsonnet && \ - git -C jsonnet checkout v0.15.0 && \ + git -C jsonnet checkout v0.20.0 && \ make -C jsonnet 2LDFLAGS=-static && \ cp jsonnet/jsonnet /usr/bin && \ cp jsonnet/jsonnetfmt /usr/bin # Build jb -FROM alpine:3.13 AS jb-builder -ARG JSONNET_BUNDLER_VERSION=0.4.0 -ARG JSONNET_BUNDLER_CHECKSUM="433edab5554a88a0371e11e93080408b225d41c31decf321c02b50d2e44993ce /usr/bin/jb" +FROM alpine:3.17 AS jb-builder +ARG JSONNET_BUNDLER_VERSION=0.5.1 +ARG JSONNET_BUNDLER_CHECKSUM="f5bccc94d28fbbe8ad1d46fd4f208619e45d368a5d7924f6335f4ecfa0605c85 /usr/bin/jb" RUN apk add --no-cache curl RUN curl -fSL -o "/usr/bin/jb" "https://github.com/jsonnet-bundler/jsonnet-bundler/releases/download/v${JSONNET_BUNDLER_VERSION}/jb-linux-amd64" RUN echo "${JSONNET_BUNDLER_CHECKSUM}" | sha256sum -c || (printf "wanted: %s\n got: %s\n" "${JSONNET_BUNDLER_CHECKSUM}" "$(sha256sum /usr/bin/jb)"; exit 1) RUN chmod +x /usr/bin/jb # Build tanka -FROM alpine:3.13 AS tk-builder -ARG TANKA_VERSION=0.21.0 -ARG TANKA_CHECKSUM="cd60a005f84fd99763f26d07d4cb626e7585a62800aae97234d8187129eed1ec /usr/bin/tk" +FROM alpine:3.17 AS tk-builder +ARG TANKA_VERSION=0.24.0 +ARG TANKA_CHECKSUM="82c8c533c29eefea0af9c28f487203b19dec84ce2624702f99196e777f946ddc /usr/bin/tk" RUN apk add --no-cache curl RUN curl -fSL -o "/usr/bin/tk" "https://github.com/grafana/tanka/releases/download/v${TANKA_VERSION}/tk-linux-amd64" RUN echo "${TANKA_CHECKSUM}" | sha256sum -c || (printf "wanted: %s\n got: %s\n" "${TANKA_CHECKSUM}" "$(sha256sum /usr/bin/tk)"; exit 1) RUN chmod +x /usr/bin/tk # Build mixtool -FROM golang:1.15-alpine AS mixtool-builder -RUN GO111MODULE=on go get github.com/monitoring-mixins/mixtool/cmd/mixtool@ae18e31161ea10545b9c1ac0d23c10122f2c12b5 +FROM golang:1.20-alpine AS mixtool-builder +RUN GO111MODULE=on go install github.com/monitoring-mixins/mixtool/cmd/mixtool@ae18e31161ea10545b9c1ac0d23c10122f2c12b5 -FROM alpine:3.13 -RUN apk add --no-cache git make libgcc libstdc++ zip findutils sed +FROM alpine:3.17 +RUN apk add --no-cache git make libgcc libstdc++ zip findutils sed yq COPY --from=jsonnet-builder /usr/bin/jsonnetfmt /usr/bin COPY --from=jsonnet-builder /usr/bin/jsonnet /usr/bin COPY --from=jb-builder /usr/bin/jb /usr/bin COPY --from=tk-builder /usr/bin/tk /usr/bin COPY --from=mixtool-builder /go/bin/mixtool /usr/bin -# Install yq. -# TODO We can install it via apk once alpine 3.14 or above will be released. Previous versions don't package v4. -RUN wget -O /usr/bin/yq https://github.com/mikefarah/yq/releases/download/v4.9.3/yq_linux_amd64 && \ - chmod +x /usr/bin/yq