From b8a2407c1b2da9e11841ab4b94a8fd1a62cc543f Mon Sep 17 00:00:00 2001 From: Trevor Whitney Date: Tue, 10 Dec 2024 13:07:03 -0700 Subject: [PATCH 01/19] ci: fix the docker driver build --- .github/release-workflows.jsonnet | 3 ++- .github/workflows/images.yml | 1 + .github/workflows/minor-release-pr.yml | 6 +++--- .github/workflows/patch-release-pr.yml | 6 +++--- clients/cmd/docker-driver/Dockerfile | 4 ++-- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/release-workflows.jsonnet b/.github/release-workflows.jsonnet index 080dcae2d39c4..1f8c6c1b8de06 100644 --- a/.github/release-workflows.jsonnet +++ b/.github/release-workflows.jsonnet @@ -15,7 +15,7 @@ local imageJobs = { 'loki-canary-boringcrypto': build.image('loki-canary-boringcrypto', 'cmd/loki-canary-boringcrypto'), promtail: build.image('promtail', 'clients/cmd/promtail'), querytee: build.image('loki-query-tee', 'cmd/querytee', platform=['linux/amd64']), - 'loki-docker-driver': build.dockerPlugin('grafana/loki-docker-driver', 'clients/cmd/docker-driver', platform=['linux/amd64', 'linux/arm64']), + 'loki-docker-driver': build.dockerPlugin('loki-docker-driver', 'clients/cmd/docker-driver', platform=['linux/amd64', 'linux/arm64']), }; local weeklyImageJobs = { @@ -105,6 +105,7 @@ local imagePrefix = 'grafana'; 'images.yml': std.manifestYamlDoc({ name: 'publish images', on: { + pull_request: {}, push: { branches: [ 'k[0-9]+*', // This is a weird glob pattern, not a regexp, do not use ".*", see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet diff --git a/.github/workflows/images.yml b/.github/workflows/images.yml index 55bbd64d6c3f9..1af04b2ed0c56 100644 --- a/.github/workflows/images.yml +++ b/.github/workflows/images.yml @@ -193,6 +193,7 @@ "tags": "${{ env.IMAGE_PREFIX }}/promtail:${{ steps.weekly-version.outputs.version }}" "name": "publish images" "on": + "pull_request": {} "push": "branches": - "k[0-9]+*" diff --git a/.github/workflows/minor-release-pr.yml b/.github/workflows/minor-release-pr.yml index 0db833dec9a2f..c85b7dc463717 100644 --- a/.github/workflows/minor-release-pr.yml +++ b/.github/workflows/minor-release-pr.yml @@ -651,10 +651,10 @@ jobs: build-args: "IMAGE_TAG=${{ needs.version.outputs.version }},GOARCH=${{ steps.platform.outputs.platform_short }}" context: "release" file: "release/clients/cmd/docker-driver/Dockerfile" - outputs: "type=docker,dest=release/images/grafana/loki-docker-driver-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" + outputs: "type=docker,dest=release/images/loki-docker-driver-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" platforms: "${{ matrix.platform }}" push: false - tags: "${{ env.IMAGE_PREFIX }}/grafana/loki-docker-driver:${{ needs.version.outputs.version }}-${{ steps.platform.outputs.platform_short }}" + tags: "${{ env.IMAGE_PREFIX }}/loki-docker-driver:${{ needs.version.outputs.version }}-${{ steps.platform.outputs.platform_short }}" - env: BUILD_DIR: "release/clients/cmd/docker-driver" IMAGE_TAG: "${{ needs.version.outputs.version }}" @@ -671,7 +671,7 @@ jobs: uses: "google-github-actions/upload-cloud-storage@v2" with: destination: "${{ env.BUILD_ARTIFACTS_BUCKET }}/${{ github.sha }}/images" - path: "release/images/grafana/loki-docker-driver-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" + path: "release/images/loki-docker-driver-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" process_gcloudignore: false strategy: fail-fast: true diff --git a/.github/workflows/patch-release-pr.yml b/.github/workflows/patch-release-pr.yml index f1b904d22f407..c6ab6c0186775 100644 --- a/.github/workflows/patch-release-pr.yml +++ b/.github/workflows/patch-release-pr.yml @@ -651,10 +651,10 @@ jobs: build-args: "IMAGE_TAG=${{ needs.version.outputs.version }},GOARCH=${{ steps.platform.outputs.platform_short }}" context: "release" file: "release/clients/cmd/docker-driver/Dockerfile" - outputs: "type=docker,dest=release/images/grafana/loki-docker-driver-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" + outputs: "type=docker,dest=release/images/loki-docker-driver-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" platforms: "${{ matrix.platform }}" push: false - tags: "${{ env.IMAGE_PREFIX }}/grafana/loki-docker-driver:${{ needs.version.outputs.version }}-${{ steps.platform.outputs.platform_short }}" + tags: "${{ env.IMAGE_PREFIX }}/loki-docker-driver:${{ needs.version.outputs.version }}-${{ steps.platform.outputs.platform_short }}" - env: BUILD_DIR: "release/clients/cmd/docker-driver" IMAGE_TAG: "${{ needs.version.outputs.version }}" @@ -671,7 +671,7 @@ jobs: uses: "google-github-actions/upload-cloud-storage@v2" with: destination: "${{ env.BUILD_ARTIFACTS_BUCKET }}/${{ github.sha }}/images" - path: "release/images/grafana/loki-docker-driver-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" + path: "release/images/loki-docker-driver-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" process_gcloudignore: false strategy: fail-fast: true diff --git a/clients/cmd/docker-driver/Dockerfile b/clients/cmd/docker-driver/Dockerfile index b06dc05b6f328..8ee07cba1bb17 100644 --- a/clients/cmd/docker-driver/Dockerfile +++ b/clients/cmd/docker-driver/Dockerfile @@ -1,10 +1,10 @@ -ARG BUILD_IMAGE=grafana/loki-build-image:0.34.0 +ARG GO_VERSION=1.23 ARG GOARCH=amd64 # Directories in this file are referenced from the root of the project not this folder # This file is intended to be called from the root like so: # docker build -t grafana/loki-docker-driver -f clients/cmd/docker-driver/Dockerfile . -FROM $BUILD_IMAGE AS build +FROM golang:${GO_VERSION}-bookworm as build COPY . /src/loki WORKDIR /src/loki From 63213cdf93cd1469eab2c8a883f8714735a6e90b Mon Sep 17 00:00:00 2001 From: Trevor Whitney Date: Tue, 10 Dec 2024 14:43:45 -0700 Subject: [PATCH 02/19] ci: pass builds image to loki-docker-driver build --- .github/jsonnetfile.json | 2 +- .github/jsonnetfile.lock.json | 4 +- .github/release-workflows.jsonnet | 18 ++-- .../loki-release/workflows/build.libsonnet | 73 +-------------- .github/workflows/check.yml | 2 +- .github/workflows/images.yml | 89 ++++++++++++++++++- .github/workflows/minor-release-pr.yml | 8 +- .github/workflows/patch-release-pr.yml | 8 +- Makefile | 2 +- clients/cmd/docker-driver/Dockerfile | 4 +- 10 files changed, 117 insertions(+), 93 deletions(-) diff --git a/.github/jsonnetfile.json b/.github/jsonnetfile.json index 731d3c3c82974..82cf3269a0b35 100644 --- a/.github/jsonnetfile.json +++ b/.github/jsonnetfile.json @@ -8,7 +8,7 @@ "subdir": "workflows" } }, - "version": "21f1189544e3976070cbdb6463f64c7a32dcc176" + "version": "844ff60d1a4d5c5e88d324dec0b5d38377fa70e9" } ], "legacyImports": true diff --git a/.github/jsonnetfile.lock.json b/.github/jsonnetfile.lock.json index d11f133725822..40aea699ac3e9 100644 --- a/.github/jsonnetfile.lock.json +++ b/.github/jsonnetfile.lock.json @@ -8,8 +8,8 @@ "subdir": "workflows" } }, - "version": "21f1189544e3976070cbdb6463f64c7a32dcc176", - "sum": "IPS1oGR8k7jk6J2snciTycWFgtISCwXSPhJ3A+nEGvY=" + "version": "844ff60d1a4d5c5e88d324dec0b5d38377fa70e9", + "sum": "y7FKVPstUEnlSokPkoxI2/euZDz800PIW7bBuPQN1Z8=" } ], "legacyImports": false diff --git a/.github/release-workflows.jsonnet b/.github/release-workflows.jsonnet index 1f8c6c1b8de06..425872814f713 100644 --- a/.github/release-workflows.jsonnet +++ b/.github/release-workflows.jsonnet @@ -1,9 +1,13 @@ local lokiRelease = import 'workflows/main.jsonnet'; -local build = lokiRelease.build; +local build = lokiRelease.build; local releaseLibRef = 'main'; - local checkTemplate = 'grafana/loki-release/.github/workflows/check.yml@%s' % releaseLibRef; +local buildImageVersion = std.extVar('BUILD_IMAGE_VERSION'); +local buildImage = 'grafana/loki-build-image:%s' % buildImageVersion; +local golangCiLintVersion = 'v1.60.3'; +local imageBuildTimeoutMin = 60; +local imagePrefix = 'grafana'; local imageJobs = { loki: build.image('loki', 'cmd/loki'), @@ -15,7 +19,7 @@ local imageJobs = { 'loki-canary-boringcrypto': build.image('loki-canary-boringcrypto', 'cmd/loki-canary-boringcrypto'), promtail: build.image('promtail', 'clients/cmd/promtail'), querytee: build.image('loki-query-tee', 'cmd/querytee', platform=['linux/amd64']), - 'loki-docker-driver': build.dockerPlugin('loki-docker-driver', 'clients/cmd/docker-driver', platform=['linux/amd64', 'linux/arm64']), + 'loki-docker-driver': build.dockerPlugin('loki-docker-driver', 'clients/cmd/docker-driver', buildImage=buildImage), }; local weeklyImageJobs = { @@ -23,15 +27,9 @@ local weeklyImageJobs = { 'loki-canary': build.weeklyImage('loki-canary', 'cmd/loki-canary'), 'loki-canary-boringcrypto': build.weeklyImage('loki-canary-boringcrypto', 'cmd/loki-canary-boringcrypto'), promtail: build.weeklyImage('promtail', 'clients/cmd/promtail'), + 'loki-docker-driver': build.dockerPlugin('loki-docker-driver', 'clients/cmd/docker-driver', buildImage=buildImage), }; -local buildImageVersion = std.extVar('BUILD_IMAGE_VERSION'); -local buildImage = 'grafana/loki-build-image:%s' % buildImageVersion; -local golangCiLintVersion = 'v1.60.3'; - -local imageBuildTimeoutMin = 60; -local imagePrefix = 'grafana'; - { 'patch-release-pr.yml': std.manifestYamlDoc( lokiRelease.releasePRWorkflow( diff --git a/.github/vendor/github.com/grafana/loki-release/workflows/build.libsonnet b/.github/vendor/github.com/grafana/loki-release/workflows/build.libsonnet index 72a47e901e890..6f80427cd14af 100644 --- a/.github/vendor/github.com/grafana/loki-release/workflows/build.libsonnet +++ b/.github/vendor/github.com/grafana/loki-release/workflows/build.libsonnet @@ -108,6 +108,7 @@ local releaseLibStep = common.releaseLibStep; dockerPlugin: function( name, path, + buildImage, dockerfile='Dockerfile', context='release', platform=[ @@ -115,7 +116,7 @@ local releaseLibStep = common.releaseLibStep; 'linux/arm64', 'linux/arm', ] - ) + ) job.new() + job.withStrategy({ 'fail-fast': true, @@ -152,6 +153,7 @@ local releaseLibStep = common.releaseLibStep; + step.withIf('${{ fromJSON(needs.version.outputs.pr_created) }}') + step.withEnv({ IMAGE_TAG: '${{ needs.version.outputs.version }}', + BUILD_IMAGE: buildImage, }) + step.with({ context: context, @@ -160,7 +162,7 @@ local releaseLibStep = common.releaseLibStep; push: false, tags: '${{ env.IMAGE_PREFIX }}/%s:${{ needs.version.outputs.version }}-${{ steps.platform.outputs.platform_short }}' % [name], outputs: 'type=docker,dest=release/images/%s-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar' % name, - 'build-args': 'IMAGE_TAG=${{ needs.version.outputs.version }},GOARCH=${{ steps.platform.outputs.platform_short }}', + 'build-args': 'IMAGE_TAG=${{ needs.version.outputs.version }},GOARCH=${{ steps.platform.outputs.platform_short }},BUILD_IMAGE=%s' % buildImage, }), releaseStep('Package as Docker plugin') @@ -185,73 +187,6 @@ local releaseLibStep = common.releaseLibStep; }), ]), - weeklyDockerPlugin: function( - name, - path, - dockerfile='Dockerfile', - context='release', - platform=[ - 'linux/amd64', - 'linux/arm64', - 'linux/arm', - ] - ) - job.new() - + job.withStrategy({ - matrix: { - platform: platform, - }, - }) - + job.withSteps([ - common.fetchReleaseLib, - common.fetchReleaseRepo, - common.setupNode, - - step.new('Set up QEMU', 'docker/setup-qemu-action@v3'), - step.new('set up docker buildx', 'docker/setup-buildx-action@v3'), - step.new('Login to DockerHub (from vault)', 'grafana/shared-workflows/actions/dockerhub-login@main'), - - releaseStep('Get weekly version') - + step.withId('weekly-version') - + step.withRun(||| - echo "version=$(./tools/image-tag)" >> $GITHUB_OUTPUT - - platform="$(echo "${{ matrix.platform}}" | sed "s/\(.*\)\/\(.*\)/\1-\2/")" - echo "platform=${platform}" >> $GITHUB_OUTPUT - echo "platform_short=$(echo ${{ matrix.platform }} | cut -d / -f 2)" >> $GITHUB_OUTPUT - if [[ "${platform}" == "linux/arm64" ]]; then - echo "plugin_arch=-arm64" >> $GITHUB_OUTPUT - else - echo "plugin_arch=" >> $GITHUB_OUTPUT - fi - |||), - - step.new('Build and export', 'docker/build-push-action@v6') - + step.withTimeoutMinutes('${{ fromJSON(env.BUILD_TIMEOUT) }}') - + step.with({ - context: context, - file: 'release/%s/%s' % [path, dockerfile], - platforms: '${{ matrix.platform }}', - push: false, - tags: '${{ env.IMAGE_PREFIX }}/%s:${{ steps.weekly-version.outputs.version }}' % [name], - outputs: 'type=docker,dest=release/images/%s-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar' % name, - 'build-args': 'IMAGE_TAG=${{ steps.weekly-version.outputs.version }},GOARCH=${{ steps.weekly-version.outputs.platform_short }}', - }), - - releaseStep('Package and push as Docker plugin') - + step.withEnv({ - IMAGE_TAG: '${{ steps.weekly-version.outputs.version }}', - BUILD_DIR: 'release/%s' % [path], - }) - + step.withRun(||| - rm -rf "${{ env.BUILD_DIR }}/rootfs" || true - mkdir "${{ env.BUILD_DIR }}/rootfs" - tar -x -C "${{ env.BUILD_DIR }}/rootfs" -f "release/images/%s-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" - docker plugin create "${{ env.IMAGE_TAG }}${{ steps.platform.outputs.plugin_arch }}" "${{ env.BUILD_DIR }}" - docker plugin push "${{ env.IMAGE_TAG }}${{ steps.platform.outputs.plugin_arch }}" - |||), - ]), - version: job.new() + job.withSteps([ diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 5e90ce2c01920..3f5c330c3f4c2 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -2,7 +2,7 @@ "check": "uses": "grafana/loki-release/.github/workflows/check.yml@main" "with": - "build_image": "grafana/loki-build-image:0.34.1" + "build_image": "grafana/loki-build-image:0.34.0" "golang_ci_lint_version": "v1.60.3" "release_lib_ref": "main" "skip_validation": false diff --git a/.github/workflows/images.yml b/.github/workflows/images.yml index 1af04b2ed0c56..8ad9fe0b6ae89 100644 --- a/.github/workflows/images.yml +++ b/.github/workflows/images.yml @@ -2,7 +2,7 @@ "check": "uses": "grafana/loki-release/.github/workflows/check.yml@main" "with": - "build_image": "grafana/loki-build-image:0.34.1" + "build_image": "grafana/loki-build-image:0.34.0" "golang_ci_lint_version": "v1.60.3" "release_lib_ref": "main" "skip_validation": false @@ -145,6 +145,93 @@ "platforms": "linux/amd64,linux/arm64,linux/arm" "push": true "tags": "${{ env.IMAGE_PREFIX }}/loki-canary-boringcrypto:${{ steps.weekly-version.outputs.version }}" + "loki-docker-driver": + "env": + "BUILD_TIMEOUT": 60 + "IMAGE_PREFIX": "grafana" + "RELEASE_LIB_REF": "main" + "RELEASE_REPO": "grafana/loki" + "needs": + - "check" + "runs-on": "ubuntu-latest" + "steps": + - "name": "pull release library code" + "uses": "actions/checkout@v4" + "with": + "path": "lib" + "ref": "${{ env.RELEASE_LIB_REF }}" + "repository": "grafana/loki-release" + - "name": "pull code to release" + "uses": "actions/checkout@v4" + "with": + "path": "release" + "repository": "${{ env.RELEASE_REPO }}" + - "name": "setup node" + "uses": "actions/setup-node@v4" + "with": + "node-version": 20 + - "name": "auth gcs" + "uses": "google-github-actions/auth@v2" + "with": + "credentials_json": "${{ secrets.GCS_SERVICE_ACCOUNT_KEY }}" + - "name": "Set up QEMU" + "uses": "docker/setup-qemu-action@v3" + - "name": "set up docker buildx" + "uses": "docker/setup-buildx-action@v3" + - "id": "platform" + "name": "parse image platform" + "run": | + mkdir -p images + + platform="$(echo "${{ matrix.platform}}" | sed "s/\(.*\)\/\(.*\)/\1-\2/")" + echo "platform=${platform}" >> $GITHUB_OUTPUT + echo "platform_short=$(echo ${{ matrix.platform }} | cut -d / -f 2)" >> $GITHUB_OUTPUT + if [[ "${platform}" == "linux/arm64" ]]; then + echo "plugin_arch=-arm64" >> $GITHUB_OUTPUT + else + echo "plugin_arch=" >> $GITHUB_OUTPUT + fi + "working-directory": "release" + - "env": + "BUILD_IMAGE": "grafana/loki-build-image:0.34.0" + "IMAGE_TAG": "${{ needs.version.outputs.version }}" + "if": "${{ fromJSON(needs.version.outputs.pr_created) }}" + "name": "Build and export" + "timeout-minutes": "${{ fromJSON(env.BUILD_TIMEOUT) }}" + "uses": "docker/build-push-action@v6" + "with": + "build-args": "IMAGE_TAG=${{ needs.version.outputs.version }},GOARCH=${{ steps.platform.outputs.platform_short }},BUILD_IMAGE=grafana/loki-build-image:0.34.0" + "context": "release" + "file": "release/clients/cmd/docker-driver/Dockerfile" + "outputs": "type=docker,dest=release/images/loki-docker-driver-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" + "platforms": "${{ matrix.platform }}" + "push": false + "tags": "${{ env.IMAGE_PREFIX }}/loki-docker-driver:${{ needs.version.outputs.version }}-${{ steps.platform.outputs.platform_short }}" + - "env": + "BUILD_DIR": "release/clients/cmd/docker-driver" + "IMAGE_TAG": "${{ needs.version.outputs.version }}" + "if": "${{ fromJSON(needs.version.outputs.pr_created) }}" + "name": "Package as Docker plugin" + "run": | + rm -rf "${{ env.BUILD_DIR }}/rootfs" || true + mkdir "${{ env.BUILD_DIR }}/rootfs" + tar -x -C "${{ env.BUILD_DIR }}/rootfs" -f "release/images/%s-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" + docker plugin create "${{ env.IMAGE_TAG }}${{ steps.platform.outputs.plugin_arch }}" "${{ env.BUILD_DIR }}" + "working-directory": "release" + - "if": "${{ fromJSON(needs.version.outputs.pr_created) }}" + "name": "upload artifacts" + "uses": "google-github-actions/upload-cloud-storage@v2" + "with": + "destination": "${{ env.BUILD_ARTIFACTS_BUCKET }}/${{ github.sha }}/images" + "path": "release/images/loki-docker-driver-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" + "process_gcloudignore": false + "strategy": + "fail-fast": true + "matrix": + "platform": + - "linux/amd64" + - "linux/arm64" + - "linux/arm" "promtail": "env": "BUILD_TIMEOUT": 60 diff --git a/.github/workflows/minor-release-pr.yml b/.github/workflows/minor-release-pr.yml index c85b7dc463717..582d541af322f 100644 --- a/.github/workflows/minor-release-pr.yml +++ b/.github/workflows/minor-release-pr.yml @@ -16,7 +16,7 @@ jobs: check: uses: "grafana/loki-release/.github/workflows/check.yml@main" with: - build_image: "grafana/loki-build-image:0.34.1" + build_image: "grafana/loki-build-image:0.34.0" golang_ci_lint_version: "v1.60.3" release_lib_ref: "main" skip_validation: false @@ -144,7 +144,7 @@ jobs: --env SKIP_ARM \ --volume .:/src/loki \ --workdir /src/loki \ - --entrypoint /bin/sh "grafana/loki-build-image:0.34.1" + --entrypoint /bin/sh "grafana/loki-build-image:0.34.0" git config --global --add safe.directory /src/loki echo "${NFPM_SIGNING_KEY}" > $NFPM_SIGNING_KEY_FILE make dist packages @@ -642,13 +642,14 @@ jobs: fi working-directory: "release" - env: + BUILD_IMAGE: "grafana/loki-build-image:0.34.0" IMAGE_TAG: "${{ needs.version.outputs.version }}" if: "${{ fromJSON(needs.version.outputs.pr_created) }}" name: "Build and export" timeout-minutes: "${{ fromJSON(env.BUILD_TIMEOUT) }}" uses: "docker/build-push-action@v6" with: - build-args: "IMAGE_TAG=${{ needs.version.outputs.version }},GOARCH=${{ steps.platform.outputs.platform_short }}" + build-args: "IMAGE_TAG=${{ needs.version.outputs.version }},GOARCH=${{ steps.platform.outputs.platform_short }},BUILD_IMAGE=grafana/loki-build-image:0.34.0" context: "release" file: "release/clients/cmd/docker-driver/Dockerfile" outputs: "type=docker,dest=release/images/loki-docker-driver-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" @@ -679,6 +680,7 @@ jobs: platform: - "linux/amd64" - "linux/arm64" + - "linux/arm" promtail: needs: - "version" diff --git a/.github/workflows/patch-release-pr.yml b/.github/workflows/patch-release-pr.yml index c6ab6c0186775..0310434b47a0c 100644 --- a/.github/workflows/patch-release-pr.yml +++ b/.github/workflows/patch-release-pr.yml @@ -16,7 +16,7 @@ jobs: check: uses: "grafana/loki-release/.github/workflows/check.yml@main" with: - build_image: "grafana/loki-build-image:0.34.1" + build_image: "grafana/loki-build-image:0.34.0" golang_ci_lint_version: "v1.60.3" release_lib_ref: "main" skip_validation: false @@ -144,7 +144,7 @@ jobs: --env SKIP_ARM \ --volume .:/src/loki \ --workdir /src/loki \ - --entrypoint /bin/sh "grafana/loki-build-image:0.34.1" + --entrypoint /bin/sh "grafana/loki-build-image:0.34.0" git config --global --add safe.directory /src/loki echo "${NFPM_SIGNING_KEY}" > $NFPM_SIGNING_KEY_FILE make dist packages @@ -642,13 +642,14 @@ jobs: fi working-directory: "release" - env: + BUILD_IMAGE: "grafana/loki-build-image:0.34.0" IMAGE_TAG: "${{ needs.version.outputs.version }}" if: "${{ fromJSON(needs.version.outputs.pr_created) }}" name: "Build and export" timeout-minutes: "${{ fromJSON(env.BUILD_TIMEOUT) }}" uses: "docker/build-push-action@v6" with: - build-args: "IMAGE_TAG=${{ needs.version.outputs.version }},GOARCH=${{ steps.platform.outputs.platform_short }}" + build-args: "IMAGE_TAG=${{ needs.version.outputs.version }},GOARCH=${{ steps.platform.outputs.platform_short }},BUILD_IMAGE=grafana/loki-build-image:0.34.0" context: "release" file: "release/clients/cmd/docker-driver/Dockerfile" outputs: "type=docker,dest=release/images/loki-docker-driver-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" @@ -679,6 +680,7 @@ jobs: platform: - "linux/amd64" - "linux/arm64" + - "linux/arm" promtail: needs: - "version" diff --git a/Makefile b/Makefile index 2b152ac6ae739..940dcd0d861ed 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ CI ?= false # Ensure you run `make release-workflows` after changing this GO_VERSION := 1.23.1 -BUILD_IMAGE_TAG := 0.34.1 +BUILD_IMAGE_TAG := 0.34.2 IMAGE_TAG ?= $(shell ./tools/image-tag) GIT_REVISION := $(shell git rev-parse --short HEAD) diff --git a/clients/cmd/docker-driver/Dockerfile b/clients/cmd/docker-driver/Dockerfile index 8ee07cba1bb17..b06dc05b6f328 100644 --- a/clients/cmd/docker-driver/Dockerfile +++ b/clients/cmd/docker-driver/Dockerfile @@ -1,10 +1,10 @@ -ARG GO_VERSION=1.23 +ARG BUILD_IMAGE=grafana/loki-build-image:0.34.0 ARG GOARCH=amd64 # Directories in this file are referenced from the root of the project not this folder # This file is intended to be called from the root like so: # docker build -t grafana/loki-docker-driver -f clients/cmd/docker-driver/Dockerfile . -FROM golang:${GO_VERSION}-bookworm as build +FROM $BUILD_IMAGE AS build COPY . /src/loki WORKDIR /src/loki From 3e4d3fd5f626449c998d3164daeb512e2b49f541 Mon Sep 17 00:00:00 2001 From: Trevor Whitney Date: Tue, 10 Dec 2024 14:45:18 -0700 Subject: [PATCH 03/19] ci: use verbose --tag --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 940dcd0d861ed..ef271c04d8aff 100644 --- a/Makefile +++ b/Makefile @@ -677,7 +677,7 @@ ifneq (,$(findstring WIP,$(IMAGE_TAG))) @echo "Cannot push a WIP image, commit changes first"; \ false; endif - $(OCI_PUSH) -t $(BUILD_IMAGE) + $(OCI_PUSH) --tag $(BUILD_IMAGE) # Loki Operator loki-operator-image: ## build the operator docker image From f45f8fc3a9d13d5efa24645b98580cef2ce468f4 Mon Sep 17 00:00:00 2001 From: Trevor Whitney Date: Tue, 10 Dec 2024 14:46:09 -0700 Subject: [PATCH 04/19] ci: remove --tag parameter from docker push --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ef271c04d8aff..968ab265426b9 100644 --- a/Makefile +++ b/Makefile @@ -677,7 +677,7 @@ ifneq (,$(findstring WIP,$(IMAGE_TAG))) @echo "Cannot push a WIP image, commit changes first"; \ false; endif - $(OCI_PUSH) --tag $(BUILD_IMAGE) + $(OCI_PUSH) $(BUILD_IMAGE) # Loki Operator loki-operator-image: ## build the operator docker image From 071f0c4c20cb9222804c82757281346505363b25 Mon Sep 17 00:00:00 2001 From: Trevor Whitney Date: Tue, 10 Dec 2024 14:57:09 -0700 Subject: [PATCH 05/19] chore: build-image-push should always push multiarch --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 968ab265426b9..9d51bec931460 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ CI ?= false # Ensure you run `make release-workflows` after changing this GO_VERSION := 1.23.1 -BUILD_IMAGE_TAG := 0.34.2 +BUILD_IMAGE_TAG := 0.34.3 IMAGE_TAG ?= $(shell ./tools/image-tag) GIT_REVISION := $(shell git rev-parse --short HEAD) @@ -672,12 +672,12 @@ logql-analyzer-push: logql-analyzer-image # Build image build-image: ## build the build docker image $(OCI_BUILD) -t $(BUILD_IMAGE) ./loki-build-image -build-image-push: build-image +build-image-push: ifneq (,$(findstring WIP,$(IMAGE_TAG))) @echo "Cannot push a WIP image, commit changes first"; \ false; endif - $(OCI_PUSH) $(BUILD_IMAGE) + DOCKER_BUILDKIT=1 docker buildx build $(OCI_PLATFORMS) $(OCI_BUILD_ARGS) $(OCI_PUSH_ARGS) -t $(BUILD_IMAGE) ./loki-build-image # Loki Operator loki-operator-image: ## build the operator docker image From 6c713f9ffec309425015162abf0330d180df4f52 Mon Sep 17 00:00:00 2001 From: Trevor Whitney Date: Tue, 10 Dec 2024 15:07:34 -0700 Subject: [PATCH 06/19] chore: build for arm too --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 9d51bec931460..4220230c94e80 100644 --- a/Makefile +++ b/Makefile @@ -65,7 +65,7 @@ LOGQL_ANALYZER_IMAGE := $(IMAGE_PREFIX)/logql-analyzer:$(IMAGE_TAG) OPERATOR_IMAGE := $(IMAGE_PREFIX)/loki-operator:$(IMAGE_TAG) # OCI (Docker) setup -OCI_PLATFORMS := --platform=linux/amd64,linux/arm64 +OCI_PLATFORMS := --platform=linux/amd64,linux/arm64,linux/arm OCI_BUILD_ARGS := --build-arg GO_VERSION=$(GO_VERSION) --build-arg BUILD_IMAGE=$(BUILD_IMAGE) OCI_PUSH_ARGS := -o type=registry OCI_PUSH := docker push From 5657927b8fa168597ef0a362449b95124b0f4cc1 Mon Sep 17 00:00:00 2001 From: Trevor Whitney Date: Tue, 10 Dec 2024 15:25:11 -0700 Subject: [PATCH 07/19] ci: let's try this --- .github/jsonnetfile.json | 2 +- .github/jsonnetfile.lock.json | 4 ++-- .github/release-workflows.jsonnet | 4 ++-- .../grafana/loki-release/workflows/build.libsonnet | 10 ++++++++-- .github/workflows/check.yml | 2 +- .github/workflows/images.yml | 11 +++++++---- .github/workflows/minor-release-pr.yml | 13 ++++++++----- .github/workflows/patch-release-pr.yml | 13 ++++++++----- Makefile | 2 +- 9 files changed, 38 insertions(+), 23 deletions(-) diff --git a/.github/jsonnetfile.json b/.github/jsonnetfile.json index 82cf3269a0b35..a215cb50d5ef6 100644 --- a/.github/jsonnetfile.json +++ b/.github/jsonnetfile.json @@ -8,7 +8,7 @@ "subdir": "workflows" } }, - "version": "844ff60d1a4d5c5e88d324dec0b5d38377fa70e9" + "version": "eb3dded9066b016c661282e9b627e4ce8b47ec72" } ], "legacyImports": true diff --git a/.github/jsonnetfile.lock.json b/.github/jsonnetfile.lock.json index 40aea699ac3e9..5427156a6ba83 100644 --- a/.github/jsonnetfile.lock.json +++ b/.github/jsonnetfile.lock.json @@ -8,8 +8,8 @@ "subdir": "workflows" } }, - "version": "844ff60d1a4d5c5e88d324dec0b5d38377fa70e9", - "sum": "y7FKVPstUEnlSokPkoxI2/euZDz800PIW7bBuPQN1Z8=" + "version": "eb3dded9066b016c661282e9b627e4ce8b47ec72", + "sum": "wAHZMWLgXwZynIW2n1e1UqMyLVkWlcxPlfcbZgH7/8Y=" } ], "legacyImports": false diff --git a/.github/release-workflows.jsonnet b/.github/release-workflows.jsonnet index 425872814f713..9c774765b2054 100644 --- a/.github/release-workflows.jsonnet +++ b/.github/release-workflows.jsonnet @@ -19,7 +19,7 @@ local imageJobs = { 'loki-canary-boringcrypto': build.image('loki-canary-boringcrypto', 'cmd/loki-canary-boringcrypto'), promtail: build.image('promtail', 'clients/cmd/promtail'), querytee: build.image('loki-query-tee', 'cmd/querytee', platform=['linux/amd64']), - 'loki-docker-driver': build.dockerPlugin('loki-docker-driver', 'clients/cmd/docker-driver', buildImage=buildImage), + 'loki-docker-driver': build.dockerPlugin('loki-docker-driver', 'clients/cmd/docker-driver', buildImage=buildImage, platform=['linux/amd64', 'linux/arm64']), }; local weeklyImageJobs = { @@ -27,7 +27,7 @@ local weeklyImageJobs = { 'loki-canary': build.weeklyImage('loki-canary', 'cmd/loki-canary'), 'loki-canary-boringcrypto': build.weeklyImage('loki-canary-boringcrypto', 'cmd/loki-canary-boringcrypto'), promtail: build.weeklyImage('promtail', 'clients/cmd/promtail'), - 'loki-docker-driver': build.dockerPlugin('loki-docker-driver', 'clients/cmd/docker-driver', buildImage=buildImage), + 'loki-docker-driver': build.dockerPlugin('loki-docker-driver', 'clients/cmd/docker-driver', buildImage=buildImage, platform=['linux/amd64', 'linux/arm64']), }; { diff --git a/.github/vendor/github.com/grafana/loki-release/workflows/build.libsonnet b/.github/vendor/github.com/grafana/loki-release/workflows/build.libsonnet index 6f80427cd14af..3f2c6b33d62d5 100644 --- a/.github/vendor/github.com/grafana/loki-release/workflows/build.libsonnet +++ b/.github/vendor/github.com/grafana/loki-release/workflows/build.libsonnet @@ -114,7 +114,6 @@ local releaseLibStep = common.releaseLibStep; platform=[ 'linux/amd64', 'linux/arm64', - 'linux/arm', ] ) job.new() @@ -162,7 +161,14 @@ local releaseLibStep = common.releaseLibStep; push: false, tags: '${{ env.IMAGE_PREFIX }}/%s:${{ needs.version.outputs.version }}-${{ steps.platform.outputs.platform_short }}' % [name], outputs: 'type=docker,dest=release/images/%s-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar' % name, - 'build-args': 'IMAGE_TAG=${{ needs.version.outputs.version }},GOARCH=${{ steps.platform.outputs.platform_short }},BUILD_IMAGE=%s' % buildImage, + // 'build-args': 'IMAGE_TAG=${{ needs.version.outputs.version }},GOARCH=${{ steps.platform.outputs.platform_short }},BUILD_IMAGE=%s' % buildImage, + 'build-args': ||| + %s + ||| % std.lines([ + 'IMAGE_TAG=${{ needs.version.outputs.version }}', + 'GOARCH=${{ steps.platform.outputs.platform_short }}', + ('BUILD_IMAGE=%s' % buildImage), + ]), }), releaseStep('Package as Docker plugin') diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 3f5c330c3f4c2..82a801ec8668a 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -2,7 +2,7 @@ "check": "uses": "grafana/loki-release/.github/workflows/check.yml@main" "with": - "build_image": "grafana/loki-build-image:0.34.0" + "build_image": "grafana/loki-build-image:0.34.3" "golang_ci_lint_version": "v1.60.3" "release_lib_ref": "main" "skip_validation": false diff --git a/.github/workflows/images.yml b/.github/workflows/images.yml index 8ad9fe0b6ae89..748f032f1941a 100644 --- a/.github/workflows/images.yml +++ b/.github/workflows/images.yml @@ -2,7 +2,7 @@ "check": "uses": "grafana/loki-release/.github/workflows/check.yml@main" "with": - "build_image": "grafana/loki-build-image:0.34.0" + "build_image": "grafana/loki-build-image:0.34.3" "golang_ci_lint_version": "v1.60.3" "release_lib_ref": "main" "skip_validation": false @@ -193,14 +193,18 @@ fi "working-directory": "release" - "env": - "BUILD_IMAGE": "grafana/loki-build-image:0.34.0" + "BUILD_IMAGE": "grafana/loki-build-image:0.34.3" "IMAGE_TAG": "${{ needs.version.outputs.version }}" "if": "${{ fromJSON(needs.version.outputs.pr_created) }}" "name": "Build and export" "timeout-minutes": "${{ fromJSON(env.BUILD_TIMEOUT) }}" "uses": "docker/build-push-action@v6" "with": - "build-args": "IMAGE_TAG=${{ needs.version.outputs.version }},GOARCH=${{ steps.platform.outputs.platform_short }},BUILD_IMAGE=grafana/loki-build-image:0.34.0" + "build-args": | + IMAGE_TAG=${{ needs.version.outputs.version }} + GOARCH=${{ steps.platform.outputs.platform_short }} + BUILD_IMAGE=grafana/loki-build-image:0.34.3 + "context": "release" "file": "release/clients/cmd/docker-driver/Dockerfile" "outputs": "type=docker,dest=release/images/loki-docker-driver-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" @@ -231,7 +235,6 @@ "platform": - "linux/amd64" - "linux/arm64" - - "linux/arm" "promtail": "env": "BUILD_TIMEOUT": 60 diff --git a/.github/workflows/minor-release-pr.yml b/.github/workflows/minor-release-pr.yml index 582d541af322f..3469c21e36c53 100644 --- a/.github/workflows/minor-release-pr.yml +++ b/.github/workflows/minor-release-pr.yml @@ -16,7 +16,7 @@ jobs: check: uses: "grafana/loki-release/.github/workflows/check.yml@main" with: - build_image: "grafana/loki-build-image:0.34.0" + build_image: "grafana/loki-build-image:0.34.3" golang_ci_lint_version: "v1.60.3" release_lib_ref: "main" skip_validation: false @@ -144,7 +144,7 @@ jobs: --env SKIP_ARM \ --volume .:/src/loki \ --workdir /src/loki \ - --entrypoint /bin/sh "grafana/loki-build-image:0.34.0" + --entrypoint /bin/sh "grafana/loki-build-image:0.34.3" git config --global --add safe.directory /src/loki echo "${NFPM_SIGNING_KEY}" > $NFPM_SIGNING_KEY_FILE make dist packages @@ -642,14 +642,18 @@ jobs: fi working-directory: "release" - env: - BUILD_IMAGE: "grafana/loki-build-image:0.34.0" + BUILD_IMAGE: "grafana/loki-build-image:0.34.3" IMAGE_TAG: "${{ needs.version.outputs.version }}" if: "${{ fromJSON(needs.version.outputs.pr_created) }}" name: "Build and export" timeout-minutes: "${{ fromJSON(env.BUILD_TIMEOUT) }}" uses: "docker/build-push-action@v6" with: - build-args: "IMAGE_TAG=${{ needs.version.outputs.version }},GOARCH=${{ steps.platform.outputs.platform_short }},BUILD_IMAGE=grafana/loki-build-image:0.34.0" + build-args: | + IMAGE_TAG=${{ needs.version.outputs.version }} + GOARCH=${{ steps.platform.outputs.platform_short }} + BUILD_IMAGE=grafana/loki-build-image:0.34.3 + context: "release" file: "release/clients/cmd/docker-driver/Dockerfile" outputs: "type=docker,dest=release/images/loki-docker-driver-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" @@ -680,7 +684,6 @@ jobs: platform: - "linux/amd64" - "linux/arm64" - - "linux/arm" promtail: needs: - "version" diff --git a/.github/workflows/patch-release-pr.yml b/.github/workflows/patch-release-pr.yml index 0310434b47a0c..40a502336f8aa 100644 --- a/.github/workflows/patch-release-pr.yml +++ b/.github/workflows/patch-release-pr.yml @@ -16,7 +16,7 @@ jobs: check: uses: "grafana/loki-release/.github/workflows/check.yml@main" with: - build_image: "grafana/loki-build-image:0.34.0" + build_image: "grafana/loki-build-image:0.34.3" golang_ci_lint_version: "v1.60.3" release_lib_ref: "main" skip_validation: false @@ -144,7 +144,7 @@ jobs: --env SKIP_ARM \ --volume .:/src/loki \ --workdir /src/loki \ - --entrypoint /bin/sh "grafana/loki-build-image:0.34.0" + --entrypoint /bin/sh "grafana/loki-build-image:0.34.3" git config --global --add safe.directory /src/loki echo "${NFPM_SIGNING_KEY}" > $NFPM_SIGNING_KEY_FILE make dist packages @@ -642,14 +642,18 @@ jobs: fi working-directory: "release" - env: - BUILD_IMAGE: "grafana/loki-build-image:0.34.0" + BUILD_IMAGE: "grafana/loki-build-image:0.34.3" IMAGE_TAG: "${{ needs.version.outputs.version }}" if: "${{ fromJSON(needs.version.outputs.pr_created) }}" name: "Build and export" timeout-minutes: "${{ fromJSON(env.BUILD_TIMEOUT) }}" uses: "docker/build-push-action@v6" with: - build-args: "IMAGE_TAG=${{ needs.version.outputs.version }},GOARCH=${{ steps.platform.outputs.platform_short }},BUILD_IMAGE=grafana/loki-build-image:0.34.0" + build-args: | + IMAGE_TAG=${{ needs.version.outputs.version }} + GOARCH=${{ steps.platform.outputs.platform_short }} + BUILD_IMAGE=grafana/loki-build-image:0.34.3 + context: "release" file: "release/clients/cmd/docker-driver/Dockerfile" outputs: "type=docker,dest=release/images/loki-docker-driver-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" @@ -680,7 +684,6 @@ jobs: platform: - "linux/amd64" - "linux/arm64" - - "linux/arm" promtail: needs: - "version" diff --git a/Makefile b/Makefile index 4220230c94e80..9d51bec931460 100644 --- a/Makefile +++ b/Makefile @@ -65,7 +65,7 @@ LOGQL_ANALYZER_IMAGE := $(IMAGE_PREFIX)/logql-analyzer:$(IMAGE_TAG) OPERATOR_IMAGE := $(IMAGE_PREFIX)/loki-operator:$(IMAGE_TAG) # OCI (Docker) setup -OCI_PLATFORMS := --platform=linux/amd64,linux/arm64,linux/arm +OCI_PLATFORMS := --platform=linux/amd64,linux/arm64 OCI_BUILD_ARGS := --build-arg GO_VERSION=$(GO_VERSION) --build-arg BUILD_IMAGE=$(BUILD_IMAGE) OCI_PUSH_ARGS := -o type=registry OCI_PUSH := docker push From 18906e657c2a8987e5007eaa7af48ec6cd341c24 Mon Sep 17 00:00:00 2001 From: Trevor Whitney Date: Tue, 10 Dec 2024 15:35:55 -0700 Subject: [PATCH 08/19] ci: try to get the formatting right --- .github/workflows/images.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/images.yml b/.github/workflows/images.yml index 748f032f1941a..934c01fe85cb8 100644 --- a/.github/workflows/images.yml +++ b/.github/workflows/images.yml @@ -204,7 +204,6 @@ IMAGE_TAG=${{ needs.version.outputs.version }} GOARCH=${{ steps.platform.outputs.platform_short }} BUILD_IMAGE=grafana/loki-build-image:0.34.3 - "context": "release" "file": "release/clients/cmd/docker-driver/Dockerfile" "outputs": "type=docker,dest=release/images/loki-docker-driver-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" From 8a1fb5ff72882d22fa579af92df626833c29c3c3 Mon Sep 17 00:00:00 2001 From: Trevor Whitney Date: Tue, 10 Dec 2024 15:45:31 -0700 Subject: [PATCH 09/19] ci: remove new lines from end of build-args --- .github/jsonnetfile.json | 2 +- .github/jsonnetfile.lock.json | 4 ++-- .../grafana/loki-release/workflows/build.libsonnet | 5 ++--- .github/workflows/minor-release-pr.yml | 1 - .github/workflows/patch-release-pr.yml | 1 - 5 files changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/jsonnetfile.json b/.github/jsonnetfile.json index a215cb50d5ef6..78386ffbfce27 100644 --- a/.github/jsonnetfile.json +++ b/.github/jsonnetfile.json @@ -8,7 +8,7 @@ "subdir": "workflows" } }, - "version": "eb3dded9066b016c661282e9b627e4ce8b47ec72" + "version": "f2b424ceaed7ab6e820c635b62cd40da8cdede73" } ], "legacyImports": true diff --git a/.github/jsonnetfile.lock.json b/.github/jsonnetfile.lock.json index 5427156a6ba83..f493680d13780 100644 --- a/.github/jsonnetfile.lock.json +++ b/.github/jsonnetfile.lock.json @@ -8,8 +8,8 @@ "subdir": "workflows" } }, - "version": "eb3dded9066b016c661282e9b627e4ce8b47ec72", - "sum": "wAHZMWLgXwZynIW2n1e1UqMyLVkWlcxPlfcbZgH7/8Y=" + "version": "f2b424ceaed7ab6e820c635b62cd40da8cdede73", + "sum": "TEv+ee9EM5ezJEtOaLArP+cAO2Zqme7DKzAYgmOq9oE=" } ], "legacyImports": false diff --git a/.github/vendor/github.com/grafana/loki-release/workflows/build.libsonnet b/.github/vendor/github.com/grafana/loki-release/workflows/build.libsonnet index 3f2c6b33d62d5..56680daa79f60 100644 --- a/.github/vendor/github.com/grafana/loki-release/workflows/build.libsonnet +++ b/.github/vendor/github.com/grafana/loki-release/workflows/build.libsonnet @@ -161,14 +161,13 @@ local releaseLibStep = common.releaseLibStep; push: false, tags: '${{ env.IMAGE_PREFIX }}/%s:${{ needs.version.outputs.version }}-${{ steps.platform.outputs.platform_short }}' % [name], outputs: 'type=docker,dest=release/images/%s-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar' % name, - // 'build-args': 'IMAGE_TAG=${{ needs.version.outputs.version }},GOARCH=${{ steps.platform.outputs.platform_short }},BUILD_IMAGE=%s' % buildImage, 'build-args': ||| %s - ||| % std.lines([ + ||| % std.rstripChars(std.lines([ 'IMAGE_TAG=${{ needs.version.outputs.version }}', 'GOARCH=${{ steps.platform.outputs.platform_short }}', ('BUILD_IMAGE=%s' % buildImage), - ]), + ]), '\n'), }), releaseStep('Package as Docker plugin') diff --git a/.github/workflows/minor-release-pr.yml b/.github/workflows/minor-release-pr.yml index 3469c21e36c53..8ff5d37b24bf2 100644 --- a/.github/workflows/minor-release-pr.yml +++ b/.github/workflows/minor-release-pr.yml @@ -653,7 +653,6 @@ jobs: IMAGE_TAG=${{ needs.version.outputs.version }} GOARCH=${{ steps.platform.outputs.platform_short }} BUILD_IMAGE=grafana/loki-build-image:0.34.3 - context: "release" file: "release/clients/cmd/docker-driver/Dockerfile" outputs: "type=docker,dest=release/images/loki-docker-driver-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" diff --git a/.github/workflows/patch-release-pr.yml b/.github/workflows/patch-release-pr.yml index 40a502336f8aa..7f519ed8540de 100644 --- a/.github/workflows/patch-release-pr.yml +++ b/.github/workflows/patch-release-pr.yml @@ -653,7 +653,6 @@ jobs: IMAGE_TAG=${{ needs.version.outputs.version }} GOARCH=${{ steps.platform.outputs.platform_short }} BUILD_IMAGE=grafana/loki-build-image:0.34.3 - context: "release" file: "release/clients/cmd/docker-driver/Dockerfile" outputs: "type=docker,dest=release/images/loki-docker-driver-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" From 0b53e627b87569a9d648f7d1cd92d7a98f7883e6 Mon Sep 17 00:00:00 2001 From: Trevor Whitney Date: Tue, 10 Dec 2024 15:52:54 -0700 Subject: [PATCH 10/19] ci: sanity check --- .github/workflows/images.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/images.yml b/.github/workflows/images.yml index 934c01fe85cb8..a7b6bcd6b7399 100644 --- a/.github/workflows/images.yml +++ b/.github/workflows/images.yml @@ -200,10 +200,6 @@ "timeout-minutes": "${{ fromJSON(env.BUILD_TIMEOUT) }}" "uses": "docker/build-push-action@v6" "with": - "build-args": | - IMAGE_TAG=${{ needs.version.outputs.version }} - GOARCH=${{ steps.platform.outputs.platform_short }} - BUILD_IMAGE=grafana/loki-build-image:0.34.3 "context": "release" "file": "release/clients/cmd/docker-driver/Dockerfile" "outputs": "type=docker,dest=release/images/loki-docker-driver-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" From 6c960c962a87d197a2a579619d35eb4c5fe8285b Mon Sep 17 00:00:00 2001 From: Trevor Whitney Date: Tue, 10 Dec 2024 15:54:36 -0700 Subject: [PATCH 11/19] ci: quote build-args --- .github/workflows/images.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/images.yml b/.github/workflows/images.yml index a7b6bcd6b7399..47e0409307bf9 100644 --- a/.github/workflows/images.yml +++ b/.github/workflows/images.yml @@ -200,6 +200,10 @@ "timeout-minutes": "${{ fromJSON(env.BUILD_TIMEOUT) }}" "uses": "docker/build-push-action@v6" "with": + "build-args": | + "IMAGE_TAG=${{ needs.version.outputs.version }}" + "GOARCH=${{ steps.platform.outputs.platform_short }}" + BUILD_IMAGE=grafana/loki-build-image:0.34.3 "context": "release" "file": "release/clients/cmd/docker-driver/Dockerfile" "outputs": "type=docker,dest=release/images/loki-docker-driver-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" From 03645e760d94ea1bacc69be78482f0fde254c98d Mon Sep 17 00:00:00 2001 From: Trevor Whitney Date: Tue, 10 Dec 2024 16:24:40 -0700 Subject: [PATCH 12/19] ci: need to test this image as part of release build --- .github/release-workflows.jsonnet | 6 +- .github/workflows/images.yml | 90 -------------------------- .github/workflows/patch-release-pr.yml | 5 +- 3 files changed, 5 insertions(+), 96 deletions(-) diff --git a/.github/release-workflows.jsonnet b/.github/release-workflows.jsonnet index 9c774765b2054..dcc1474a37aef 100644 --- a/.github/release-workflows.jsonnet +++ b/.github/release-workflows.jsonnet @@ -27,13 +27,12 @@ local weeklyImageJobs = { 'loki-canary': build.weeklyImage('loki-canary', 'cmd/loki-canary'), 'loki-canary-boringcrypto': build.weeklyImage('loki-canary-boringcrypto', 'cmd/loki-canary-boringcrypto'), promtail: build.weeklyImage('promtail', 'clients/cmd/promtail'), - 'loki-docker-driver': build.dockerPlugin('loki-docker-driver', 'clients/cmd/docker-driver', buildImage=buildImage, platform=['linux/amd64', 'linux/arm64']), }; { 'patch-release-pr.yml': std.manifestYamlDoc( lokiRelease.releasePRWorkflow( - branches=['release-[0-9]+.[0-9]+.x'], + branches=['release-[0-9]+.[0-9]+.x', 'fix-docker-driver-again'], buildImage=buildImage, checkTemplate=checkTemplate, golangCiLintVersion=golangCiLintVersion, @@ -43,7 +42,7 @@ local weeklyImageJobs = { releaseLibRef=releaseLibRef, releaseRepo='grafana/loki', skipArm=false, - skipValidation=false, + skipValidation=true, useGitHubAppToken=true, versioningStrategy='always-bump-patch', ) + { @@ -103,7 +102,6 @@ local weeklyImageJobs = { 'images.yml': std.manifestYamlDoc({ name: 'publish images', on: { - pull_request: {}, push: { branches: [ 'k[0-9]+*', // This is a weird glob pattern, not a regexp, do not use ".*", see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet diff --git a/.github/workflows/images.yml b/.github/workflows/images.yml index 47e0409307bf9..cc56042b4420f 100644 --- a/.github/workflows/images.yml +++ b/.github/workflows/images.yml @@ -145,95 +145,6 @@ "platforms": "linux/amd64,linux/arm64,linux/arm" "push": true "tags": "${{ env.IMAGE_PREFIX }}/loki-canary-boringcrypto:${{ steps.weekly-version.outputs.version }}" - "loki-docker-driver": - "env": - "BUILD_TIMEOUT": 60 - "IMAGE_PREFIX": "grafana" - "RELEASE_LIB_REF": "main" - "RELEASE_REPO": "grafana/loki" - "needs": - - "check" - "runs-on": "ubuntu-latest" - "steps": - - "name": "pull release library code" - "uses": "actions/checkout@v4" - "with": - "path": "lib" - "ref": "${{ env.RELEASE_LIB_REF }}" - "repository": "grafana/loki-release" - - "name": "pull code to release" - "uses": "actions/checkout@v4" - "with": - "path": "release" - "repository": "${{ env.RELEASE_REPO }}" - - "name": "setup node" - "uses": "actions/setup-node@v4" - "with": - "node-version": 20 - - "name": "auth gcs" - "uses": "google-github-actions/auth@v2" - "with": - "credentials_json": "${{ secrets.GCS_SERVICE_ACCOUNT_KEY }}" - - "name": "Set up QEMU" - "uses": "docker/setup-qemu-action@v3" - - "name": "set up docker buildx" - "uses": "docker/setup-buildx-action@v3" - - "id": "platform" - "name": "parse image platform" - "run": | - mkdir -p images - - platform="$(echo "${{ matrix.platform}}" | sed "s/\(.*\)\/\(.*\)/\1-\2/")" - echo "platform=${platform}" >> $GITHUB_OUTPUT - echo "platform_short=$(echo ${{ matrix.platform }} | cut -d / -f 2)" >> $GITHUB_OUTPUT - if [[ "${platform}" == "linux/arm64" ]]; then - echo "plugin_arch=-arm64" >> $GITHUB_OUTPUT - else - echo "plugin_arch=" >> $GITHUB_OUTPUT - fi - "working-directory": "release" - - "env": - "BUILD_IMAGE": "grafana/loki-build-image:0.34.3" - "IMAGE_TAG": "${{ needs.version.outputs.version }}" - "if": "${{ fromJSON(needs.version.outputs.pr_created) }}" - "name": "Build and export" - "timeout-minutes": "${{ fromJSON(env.BUILD_TIMEOUT) }}" - "uses": "docker/build-push-action@v6" - "with": - "build-args": | - "IMAGE_TAG=${{ needs.version.outputs.version }}" - "GOARCH=${{ steps.platform.outputs.platform_short }}" - BUILD_IMAGE=grafana/loki-build-image:0.34.3 - "context": "release" - "file": "release/clients/cmd/docker-driver/Dockerfile" - "outputs": "type=docker,dest=release/images/loki-docker-driver-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" - "platforms": "${{ matrix.platform }}" - "push": false - "tags": "${{ env.IMAGE_PREFIX }}/loki-docker-driver:${{ needs.version.outputs.version }}-${{ steps.platform.outputs.platform_short }}" - - "env": - "BUILD_DIR": "release/clients/cmd/docker-driver" - "IMAGE_TAG": "${{ needs.version.outputs.version }}" - "if": "${{ fromJSON(needs.version.outputs.pr_created) }}" - "name": "Package as Docker plugin" - "run": | - rm -rf "${{ env.BUILD_DIR }}/rootfs" || true - mkdir "${{ env.BUILD_DIR }}/rootfs" - tar -x -C "${{ env.BUILD_DIR }}/rootfs" -f "release/images/%s-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" - docker plugin create "${{ env.IMAGE_TAG }}${{ steps.platform.outputs.plugin_arch }}" "${{ env.BUILD_DIR }}" - "working-directory": "release" - - "if": "${{ fromJSON(needs.version.outputs.pr_created) }}" - "name": "upload artifacts" - "uses": "google-github-actions/upload-cloud-storage@v2" - "with": - "destination": "${{ env.BUILD_ARTIFACTS_BUCKET }}/${{ github.sha }}/images" - "path": "release/images/loki-docker-driver-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" - "process_gcloudignore": false - "strategy": - "fail-fast": true - "matrix": - "platform": - - "linux/amd64" - - "linux/arm64" "promtail": "env": "BUILD_TIMEOUT": 60 @@ -282,7 +193,6 @@ "tags": "${{ env.IMAGE_PREFIX }}/promtail:${{ steps.weekly-version.outputs.version }}" "name": "publish images" "on": - "pull_request": {} "push": "branches": - "k[0-9]+*" diff --git a/.github/workflows/patch-release-pr.yml b/.github/workflows/patch-release-pr.yml index 7f519ed8540de..5d86982cc1c84 100644 --- a/.github/workflows/patch-release-pr.yml +++ b/.github/workflows/patch-release-pr.yml @@ -9,7 +9,7 @@ env: IMAGE_PREFIX: "grafana" RELEASE_LIB_REF: "main" RELEASE_REPO: "grafana/loki" - SKIP_VALIDATION: false + SKIP_VALIDATION: true USE_GITHUB_APP_TOKEN: true VERSIONING_STRATEGY: "always-bump-patch" jobs: @@ -19,7 +19,7 @@ jobs: build_image: "grafana/loki-build-image:0.34.3" golang_ci_lint_version: "v1.60.3" release_lib_ref: "main" - skip_validation: false + skip_validation: true use_github_app_token: true create-release-pr: needs: @@ -910,6 +910,7 @@ name: "Prepare Patch Release PR" push: branches: - "release-[0-9]+.[0-9]+.x" + - "fix-docker-driver-again" permissions: contents: "write" id-token: "write" From b3e5256c7ba3854ebd98653ba7920c5f20cd4ad2 Mon Sep 17 00:00:00 2001 From: Trevor Whitney Date: Tue, 10 Dec 2024 16:30:16 -0700 Subject: [PATCH 13/19] chore: bump loki-release for better quoting --- .github/jsonnetfile.json | 2 +- .github/jsonnetfile.lock.json | 4 ++-- .../github.com/grafana/loki-release/workflows/build.libsonnet | 4 ++-- .github/workflows/minor-release-pr.yml | 4 ++-- .github/workflows/patch-release-pr.yml | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/jsonnetfile.json b/.github/jsonnetfile.json index 78386ffbfce27..f3797602f3fae 100644 --- a/.github/jsonnetfile.json +++ b/.github/jsonnetfile.json @@ -8,7 +8,7 @@ "subdir": "workflows" } }, - "version": "f2b424ceaed7ab6e820c635b62cd40da8cdede73" + "version": "863f36141d0b3f5fa6af0e4624ff2f1fe0409944" } ], "legacyImports": true diff --git a/.github/jsonnetfile.lock.json b/.github/jsonnetfile.lock.json index f493680d13780..66851dd558ab9 100644 --- a/.github/jsonnetfile.lock.json +++ b/.github/jsonnetfile.lock.json @@ -8,8 +8,8 @@ "subdir": "workflows" } }, - "version": "f2b424ceaed7ab6e820c635b62cd40da8cdede73", - "sum": "TEv+ee9EM5ezJEtOaLArP+cAO2Zqme7DKzAYgmOq9oE=" + "version": "863f36141d0b3f5fa6af0e4624ff2f1fe0409944", + "sum": "g2uWtYGTJB/mjSZila6RJDIFHIR36vpukr8dJRwesoY=" } ], "legacyImports": false diff --git a/.github/vendor/github.com/grafana/loki-release/workflows/build.libsonnet b/.github/vendor/github.com/grafana/loki-release/workflows/build.libsonnet index 56680daa79f60..87838b1270d7d 100644 --- a/.github/vendor/github.com/grafana/loki-release/workflows/build.libsonnet +++ b/.github/vendor/github.com/grafana/loki-release/workflows/build.libsonnet @@ -164,8 +164,8 @@ local releaseLibStep = common.releaseLibStep; 'build-args': ||| %s ||| % std.rstripChars(std.lines([ - 'IMAGE_TAG=${{ needs.version.outputs.version }}', - 'GOARCH=${{ steps.platform.outputs.platform_short }}', + 'IMAGE_TAG="${{ needs.version.outputs.version }}"', + 'GOARCH="${{ steps.platform.outputs.platform_short }}"', ('BUILD_IMAGE=%s' % buildImage), ]), '\n'), }), diff --git a/.github/workflows/minor-release-pr.yml b/.github/workflows/minor-release-pr.yml index 8ff5d37b24bf2..3ab1a55406be0 100644 --- a/.github/workflows/minor-release-pr.yml +++ b/.github/workflows/minor-release-pr.yml @@ -650,8 +650,8 @@ jobs: uses: "docker/build-push-action@v6" with: build-args: | - IMAGE_TAG=${{ needs.version.outputs.version }} - GOARCH=${{ steps.platform.outputs.platform_short }} + IMAGE_TAG="${{ needs.version.outputs.version }}" + GOARCH="${{ steps.platform.outputs.platform_short }}" BUILD_IMAGE=grafana/loki-build-image:0.34.3 context: "release" file: "release/clients/cmd/docker-driver/Dockerfile" diff --git a/.github/workflows/patch-release-pr.yml b/.github/workflows/patch-release-pr.yml index 5d86982cc1c84..9e62724758a6c 100644 --- a/.github/workflows/patch-release-pr.yml +++ b/.github/workflows/patch-release-pr.yml @@ -650,8 +650,8 @@ jobs: uses: "docker/build-push-action@v6" with: build-args: | - IMAGE_TAG=${{ needs.version.outputs.version }} - GOARCH=${{ steps.platform.outputs.platform_short }} + IMAGE_TAG="${{ needs.version.outputs.version }}" + GOARCH="${{ steps.platform.outputs.platform_short }}" BUILD_IMAGE=grafana/loki-build-image:0.34.3 context: "release" file: "release/clients/cmd/docker-driver/Dockerfile" From f52b903a06de2fd16bfc373cc07deff59462784c Mon Sep 17 00:00:00 2001 From: Trevor Whitney Date: Tue, 10 Dec 2024 16:47:51 -0700 Subject: [PATCH 14/19] ci: fix docker driver rootfs path --- .github/jsonnetfile.json | 2 +- .github/jsonnetfile.lock.json | 4 ++-- .../grafana/loki-release/workflows/build.libsonnet | 8 ++------ .github/workflows/minor-release-pr.yml | 9 +++------ .github/workflows/patch-release-pr.yml | 9 +++------ 5 files changed, 11 insertions(+), 21 deletions(-) diff --git a/.github/jsonnetfile.json b/.github/jsonnetfile.json index f3797602f3fae..3b2052aeb080f 100644 --- a/.github/jsonnetfile.json +++ b/.github/jsonnetfile.json @@ -8,7 +8,7 @@ "subdir": "workflows" } }, - "version": "863f36141d0b3f5fa6af0e4624ff2f1fe0409944" + "version": "4c6239765a8fea60cb344099f5bc1d4cf8d32abd" } ], "legacyImports": true diff --git a/.github/jsonnetfile.lock.json b/.github/jsonnetfile.lock.json index 66851dd558ab9..3f11144e39a66 100644 --- a/.github/jsonnetfile.lock.json +++ b/.github/jsonnetfile.lock.json @@ -8,8 +8,8 @@ "subdir": "workflows" } }, - "version": "863f36141d0b3f5fa6af0e4624ff2f1fe0409944", - "sum": "g2uWtYGTJB/mjSZila6RJDIFHIR36vpukr8dJRwesoY=" + "version": "4c6239765a8fea60cb344099f5bc1d4cf8d32abd", + "sum": "b/DPZmLBEudcKVH1kif8/BUo0u6eAaAuX7aLEyDnpJM=" } ], "legacyImports": false diff --git a/.github/vendor/github.com/grafana/loki-release/workflows/build.libsonnet b/.github/vendor/github.com/grafana/loki-release/workflows/build.libsonnet index 87838b1270d7d..d6edbcd2de78a 100644 --- a/.github/vendor/github.com/grafana/loki-release/workflows/build.libsonnet +++ b/.github/vendor/github.com/grafana/loki-release/workflows/build.libsonnet @@ -150,10 +150,6 @@ local releaseLibStep = common.releaseLibStep; step.new('Build and export', 'docker/build-push-action@v6') + step.withTimeoutMinutes('${{ fromJSON(env.BUILD_TIMEOUT) }}') + step.withIf('${{ fromJSON(needs.version.outputs.pr_created) }}') - + step.withEnv({ - IMAGE_TAG: '${{ needs.version.outputs.version }}', - BUILD_IMAGE: buildImage, - }) + step.with({ context: context, file: 'release/%s/%s' % [path, dockerfile], @@ -174,12 +170,12 @@ local releaseLibStep = common.releaseLibStep; + step.withIf('${{ fromJSON(needs.version.outputs.pr_created) }}') + step.withEnv({ IMAGE_TAG: '${{ needs.version.outputs.version }}', - BUILD_DIR: 'release/%s' % [path], + BUILD_DIR: path, }) + step.withRun(||| rm -rf "${{ env.BUILD_DIR }}/rootfs" || true mkdir "${{ env.BUILD_DIR }}/rootfs" - tar -x -C "${{ env.BUILD_DIR }}/rootfs" -f "release/images/%s-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" + tar -x -C "${{ env.BUILD_DIR }}/rootfs" -f "images/%s-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" docker plugin create "${{ env.IMAGE_TAG }}${{ steps.platform.outputs.plugin_arch }}" "${{ env.BUILD_DIR }}" |||), diff --git a/.github/workflows/minor-release-pr.yml b/.github/workflows/minor-release-pr.yml index 3ab1a55406be0..3c0ca1d54eea0 100644 --- a/.github/workflows/minor-release-pr.yml +++ b/.github/workflows/minor-release-pr.yml @@ -641,10 +641,7 @@ jobs: echo "plugin_arch=" >> $GITHUB_OUTPUT fi working-directory: "release" - - env: - BUILD_IMAGE: "grafana/loki-build-image:0.34.3" - IMAGE_TAG: "${{ needs.version.outputs.version }}" - if: "${{ fromJSON(needs.version.outputs.pr_created) }}" + - if: "${{ fromJSON(needs.version.outputs.pr_created) }}" name: "Build and export" timeout-minutes: "${{ fromJSON(env.BUILD_TIMEOUT) }}" uses: "docker/build-push-action@v6" @@ -660,14 +657,14 @@ jobs: push: false tags: "${{ env.IMAGE_PREFIX }}/loki-docker-driver:${{ needs.version.outputs.version }}-${{ steps.platform.outputs.platform_short }}" - env: - BUILD_DIR: "release/clients/cmd/docker-driver" + BUILD_DIR: "clients/cmd/docker-driver" IMAGE_TAG: "${{ needs.version.outputs.version }}" if: "${{ fromJSON(needs.version.outputs.pr_created) }}" name: "Package as Docker plugin" run: | rm -rf "${{ env.BUILD_DIR }}/rootfs" || true mkdir "${{ env.BUILD_DIR }}/rootfs" - tar -x -C "${{ env.BUILD_DIR }}/rootfs" -f "release/images/%s-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" + tar -x -C "${{ env.BUILD_DIR }}/rootfs" -f "images/%s-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" docker plugin create "${{ env.IMAGE_TAG }}${{ steps.platform.outputs.plugin_arch }}" "${{ env.BUILD_DIR }}" working-directory: "release" - if: "${{ fromJSON(needs.version.outputs.pr_created) }}" diff --git a/.github/workflows/patch-release-pr.yml b/.github/workflows/patch-release-pr.yml index 9e62724758a6c..6947f440365a7 100644 --- a/.github/workflows/patch-release-pr.yml +++ b/.github/workflows/patch-release-pr.yml @@ -641,10 +641,7 @@ jobs: echo "plugin_arch=" >> $GITHUB_OUTPUT fi working-directory: "release" - - env: - BUILD_IMAGE: "grafana/loki-build-image:0.34.3" - IMAGE_TAG: "${{ needs.version.outputs.version }}" - if: "${{ fromJSON(needs.version.outputs.pr_created) }}" + - if: "${{ fromJSON(needs.version.outputs.pr_created) }}" name: "Build and export" timeout-minutes: "${{ fromJSON(env.BUILD_TIMEOUT) }}" uses: "docker/build-push-action@v6" @@ -660,14 +657,14 @@ jobs: push: false tags: "${{ env.IMAGE_PREFIX }}/loki-docker-driver:${{ needs.version.outputs.version }}-${{ steps.platform.outputs.platform_short }}" - env: - BUILD_DIR: "release/clients/cmd/docker-driver" + BUILD_DIR: "clients/cmd/docker-driver" IMAGE_TAG: "${{ needs.version.outputs.version }}" if: "${{ fromJSON(needs.version.outputs.pr_created) }}" name: "Package as Docker plugin" run: | rm -rf "${{ env.BUILD_DIR }}/rootfs" || true mkdir "${{ env.BUILD_DIR }}/rootfs" - tar -x -C "${{ env.BUILD_DIR }}/rootfs" -f "release/images/%s-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" + tar -x -C "${{ env.BUILD_DIR }}/rootfs" -f "images/%s-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" docker plugin create "${{ env.IMAGE_TAG }}${{ steps.platform.outputs.plugin_arch }}" "${{ env.BUILD_DIR }}" working-directory: "release" - if: "${{ fromJSON(needs.version.outputs.pr_created) }}" From 0a1929dc27296e91b34695c3e5484813e90a37a6 Mon Sep 17 00:00:00 2001 From: Trevor Whitney Date: Tue, 10 Dec 2024 17:06:01 -0700 Subject: [PATCH 15/19] ci: rmeove quoting --- .github/jsonnetfile.json | 2 +- .github/jsonnetfile.lock.json | 4 ++-- .../github.com/grafana/loki-release/workflows/build.libsonnet | 4 ++-- .github/workflows/minor-release-pr.yml | 4 ++-- .github/workflows/patch-release-pr.yml | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/jsonnetfile.json b/.github/jsonnetfile.json index 3b2052aeb080f..06ea1653fe1f2 100644 --- a/.github/jsonnetfile.json +++ b/.github/jsonnetfile.json @@ -8,7 +8,7 @@ "subdir": "workflows" } }, - "version": "4c6239765a8fea60cb344099f5bc1d4cf8d32abd" + "version": "4412f1a7c0dc4590a627e46a534f87454548296a" } ], "legacyImports": true diff --git a/.github/jsonnetfile.lock.json b/.github/jsonnetfile.lock.json index 3f11144e39a66..46609fceb7642 100644 --- a/.github/jsonnetfile.lock.json +++ b/.github/jsonnetfile.lock.json @@ -8,8 +8,8 @@ "subdir": "workflows" } }, - "version": "4c6239765a8fea60cb344099f5bc1d4cf8d32abd", - "sum": "b/DPZmLBEudcKVH1kif8/BUo0u6eAaAuX7aLEyDnpJM=" + "version": "4412f1a7c0dc4590a627e46a534f87454548296a", + "sum": "CtZqSFtQLVXoihwHo8UzqtJFGHBOjCiSML9lgdobAn0=" } ], "legacyImports": false diff --git a/.github/vendor/github.com/grafana/loki-release/workflows/build.libsonnet b/.github/vendor/github.com/grafana/loki-release/workflows/build.libsonnet index d6edbcd2de78a..7ae29a63a5679 100644 --- a/.github/vendor/github.com/grafana/loki-release/workflows/build.libsonnet +++ b/.github/vendor/github.com/grafana/loki-release/workflows/build.libsonnet @@ -160,8 +160,8 @@ local releaseLibStep = common.releaseLibStep; 'build-args': ||| %s ||| % std.rstripChars(std.lines([ - 'IMAGE_TAG="${{ needs.version.outputs.version }}"', - 'GOARCH="${{ steps.platform.outputs.platform_short }}"', + 'IMAGE_TAG=${{ needs.version.outputs.version }}', + 'GOARCH=${{ steps.platform.outputs.platform_short }}', ('BUILD_IMAGE=%s' % buildImage), ]), '\n'), }), diff --git a/.github/workflows/minor-release-pr.yml b/.github/workflows/minor-release-pr.yml index 3c0ca1d54eea0..56d95afbd6a49 100644 --- a/.github/workflows/minor-release-pr.yml +++ b/.github/workflows/minor-release-pr.yml @@ -647,8 +647,8 @@ jobs: uses: "docker/build-push-action@v6" with: build-args: | - IMAGE_TAG="${{ needs.version.outputs.version }}" - GOARCH="${{ steps.platform.outputs.platform_short }}" + IMAGE_TAG=${{ needs.version.outputs.version }} + GOARCH=${{ steps.platform.outputs.platform_short }} BUILD_IMAGE=grafana/loki-build-image:0.34.3 context: "release" file: "release/clients/cmd/docker-driver/Dockerfile" diff --git a/.github/workflows/patch-release-pr.yml b/.github/workflows/patch-release-pr.yml index 6947f440365a7..81248dc0cc4ff 100644 --- a/.github/workflows/patch-release-pr.yml +++ b/.github/workflows/patch-release-pr.yml @@ -647,8 +647,8 @@ jobs: uses: "docker/build-push-action@v6" with: build-args: | - IMAGE_TAG="${{ needs.version.outputs.version }}" - GOARCH="${{ steps.platform.outputs.platform_short }}" + IMAGE_TAG=${{ needs.version.outputs.version }} + GOARCH=${{ steps.platform.outputs.platform_short }} BUILD_IMAGE=grafana/loki-build-image:0.34.3 context: "release" file: "release/clients/cmd/docker-driver/Dockerfile" From 2b3c8cc325a45892236f0edc4bfdca29a12d87cd Mon Sep 17 00:00:00 2001 From: Trevor Whitney Date: Tue, 10 Dec 2024 17:29:49 -0700 Subject: [PATCH 16/19] ci: fix missing interpolation --- .github/jsonnetfile.json | 2 +- .github/jsonnetfile.lock.json | 4 ++-- .../github.com/grafana/loki-release/workflows/build.libsonnet | 2 +- .github/workflows/minor-release-pr.yml | 2 +- .github/workflows/patch-release-pr.yml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/jsonnetfile.json b/.github/jsonnetfile.json index 06ea1653fe1f2..3b9bffc5bca58 100644 --- a/.github/jsonnetfile.json +++ b/.github/jsonnetfile.json @@ -8,7 +8,7 @@ "subdir": "workflows" } }, - "version": "4412f1a7c0dc4590a627e46a534f87454548296a" + "version": "62e4b9937d80cb0300a1364b632563dab20f3fe8" } ], "legacyImports": true diff --git a/.github/jsonnetfile.lock.json b/.github/jsonnetfile.lock.json index 46609fceb7642..15458b4430944 100644 --- a/.github/jsonnetfile.lock.json +++ b/.github/jsonnetfile.lock.json @@ -8,8 +8,8 @@ "subdir": "workflows" } }, - "version": "4412f1a7c0dc4590a627e46a534f87454548296a", - "sum": "CtZqSFtQLVXoihwHo8UzqtJFGHBOjCiSML9lgdobAn0=" + "version": "62e4b9937d80cb0300a1364b632563dab20f3fe8", + "sum": "8XWtvG8Ti+y8sLtrgaZNdr6A7Zc573CGJqqxcUX+N8A=" } ], "legacyImports": false diff --git a/.github/vendor/github.com/grafana/loki-release/workflows/build.libsonnet b/.github/vendor/github.com/grafana/loki-release/workflows/build.libsonnet index 7ae29a63a5679..9656ad07b2f61 100644 --- a/.github/vendor/github.com/grafana/loki-release/workflows/build.libsonnet +++ b/.github/vendor/github.com/grafana/loki-release/workflows/build.libsonnet @@ -177,7 +177,7 @@ local releaseLibStep = common.releaseLibStep; mkdir "${{ env.BUILD_DIR }}/rootfs" tar -x -C "${{ env.BUILD_DIR }}/rootfs" -f "images/%s-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" docker plugin create "${{ env.IMAGE_TAG }}${{ steps.platform.outputs.plugin_arch }}" "${{ env.BUILD_DIR }}" - |||), + ||| % name), step.new('upload artifacts', 'google-github-actions/upload-cloud-storage@v2') + step.withIf('${{ fromJSON(needs.version.outputs.pr_created) }}') diff --git a/.github/workflows/minor-release-pr.yml b/.github/workflows/minor-release-pr.yml index 56d95afbd6a49..ed8542df18ead 100644 --- a/.github/workflows/minor-release-pr.yml +++ b/.github/workflows/minor-release-pr.yml @@ -664,7 +664,7 @@ jobs: run: | rm -rf "${{ env.BUILD_DIR }}/rootfs" || true mkdir "${{ env.BUILD_DIR }}/rootfs" - tar -x -C "${{ env.BUILD_DIR }}/rootfs" -f "images/%s-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" + tar -x -C "${{ env.BUILD_DIR }}/rootfs" -f "images/loki-docker-driver-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" docker plugin create "${{ env.IMAGE_TAG }}${{ steps.platform.outputs.plugin_arch }}" "${{ env.BUILD_DIR }}" working-directory: "release" - if: "${{ fromJSON(needs.version.outputs.pr_created) }}" diff --git a/.github/workflows/patch-release-pr.yml b/.github/workflows/patch-release-pr.yml index 81248dc0cc4ff..827f2e44878c3 100644 --- a/.github/workflows/patch-release-pr.yml +++ b/.github/workflows/patch-release-pr.yml @@ -664,7 +664,7 @@ jobs: run: | rm -rf "${{ env.BUILD_DIR }}/rootfs" || true mkdir "${{ env.BUILD_DIR }}/rootfs" - tar -x -C "${{ env.BUILD_DIR }}/rootfs" -f "images/%s-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" + tar -x -C "${{ env.BUILD_DIR }}/rootfs" -f "images/loki-docker-driver-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" docker plugin create "${{ env.IMAGE_TAG }}${{ steps.platform.outputs.plugin_arch }}" "${{ env.BUILD_DIR }}" working-directory: "release" - if: "${{ fromJSON(needs.version.outputs.pr_created) }}" From fdc505c589bbd36129dc370936d02556ef2a20ad Mon Sep 17 00:00:00 2001 From: Trevor Whitney Date: Wed, 11 Dec 2024 09:24:28 -0700 Subject: [PATCH 17/19] ci: separate out docker plguin build and publish --- .github/jsonnetfile.json | 2 +- .github/jsonnetfile.lock.json | 4 +- .../loki-release/workflows/build.libsonnet | 19 ++------- .../loki-release/workflows/main.jsonnet | 2 + .../loki-release/workflows/release.libsonnet | 41 +++++++++++++++++++ .github/workflows/minor-release-pr.yml | 17 ++------ .github/workflows/patch-release-pr.yml | 17 ++------ .github/workflows/release.yml | 40 ++++++++++++++++++ 8 files changed, 95 insertions(+), 47 deletions(-) diff --git a/.github/jsonnetfile.json b/.github/jsonnetfile.json index 3b9bffc5bca58..4d1e46902efc1 100644 --- a/.github/jsonnetfile.json +++ b/.github/jsonnetfile.json @@ -8,7 +8,7 @@ "subdir": "workflows" } }, - "version": "62e4b9937d80cb0300a1364b632563dab20f3fe8" + "version": "502f98811e3768072698cc5c589c889c60025428" } ], "legacyImports": true diff --git a/.github/jsonnetfile.lock.json b/.github/jsonnetfile.lock.json index 15458b4430944..40008f32baf90 100644 --- a/.github/jsonnetfile.lock.json +++ b/.github/jsonnetfile.lock.json @@ -8,8 +8,8 @@ "subdir": "workflows" } }, - "version": "62e4b9937d80cb0300a1364b632563dab20f3fe8", - "sum": "8XWtvG8Ti+y8sLtrgaZNdr6A7Zc573CGJqqxcUX+N8A=" + "version": "502f98811e3768072698cc5c589c889c60025428", + "sum": "a/V79sNGV4kSBRc2b8UtAKnceSR6fmvSKYlrCPDoBKY=" } ], "legacyImports": false diff --git a/.github/vendor/github.com/grafana/loki-release/workflows/build.libsonnet b/.github/vendor/github.com/grafana/loki-release/workflows/build.libsonnet index 9656ad07b2f61..1ea101a682e2b 100644 --- a/.github/vendor/github.com/grafana/loki-release/workflows/build.libsonnet +++ b/.github/vendor/github.com/grafana/loki-release/workflows/build.libsonnet @@ -156,7 +156,7 @@ local releaseLibStep = common.releaseLibStep; platforms: '${{ matrix.platform }}', push: false, tags: '${{ env.IMAGE_PREFIX }}/%s:${{ needs.version.outputs.version }}-${{ steps.platform.outputs.platform_short }}' % [name], - outputs: 'type=docker,dest=release/images/%s-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar' % name, + outputs: 'type=docker,dest=release/plugins/%s-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar' % name, 'build-args': ||| %s ||| % std.rstripChars(std.lines([ @@ -166,24 +166,11 @@ local releaseLibStep = common.releaseLibStep; ]), '\n'), }), - releaseStep('Package as Docker plugin') - + step.withIf('${{ fromJSON(needs.version.outputs.pr_created) }}') - + step.withEnv({ - IMAGE_TAG: '${{ needs.version.outputs.version }}', - BUILD_DIR: path, - }) - + step.withRun(||| - rm -rf "${{ env.BUILD_DIR }}/rootfs" || true - mkdir "${{ env.BUILD_DIR }}/rootfs" - tar -x -C "${{ env.BUILD_DIR }}/rootfs" -f "images/%s-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" - docker plugin create "${{ env.IMAGE_TAG }}${{ steps.platform.outputs.plugin_arch }}" "${{ env.BUILD_DIR }}" - ||| % name), - step.new('upload artifacts', 'google-github-actions/upload-cloud-storage@v2') + step.withIf('${{ fromJSON(needs.version.outputs.pr_created) }}') + step.with({ - path: 'release/images/%s-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar' % name, - destination: '${{ env.BUILD_ARTIFACTS_BUCKET }}/${{ github.sha }}/images', //TODO: make bucket configurable + path: 'release/plugins/%s-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar' % name, + destination: '${{ env.BUILD_ARTIFACTS_BUCKET }}/${{ github.sha }}/plugins', process_gcloudignore: false, }), ]), diff --git a/.github/vendor/github.com/grafana/loki-release/workflows/main.jsonnet b/.github/vendor/github.com/grafana/loki-release/workflows/main.jsonnet index b4d7b24246cf9..a5b677d1eba73 100644 --- a/.github/vendor/github.com/grafana/loki-release/workflows/main.jsonnet +++ b/.github/vendor/github.com/grafana/loki-release/workflows/main.jsonnet @@ -88,6 +88,7 @@ releaseLibRef='main', releaseRepo='grafana/loki-release', useGitHubAppToken=true, + dockerPluginPath='clients/cmd/docker-driver', ) { name: 'create release', on: { @@ -119,6 +120,7 @@ shouldRelease: $.release.shouldRelease, createRelease: $.release.createRelease, publishImages: $.release.publishImages(getDockerCredsFromVault, dockerUsername), + publishDockerDriver: $.release.publishDockerPlugin('loki-docker-driver', dockerPluginPath, getDockerCredsFromVault, dockerUsername), publishRelease: $.release.publishRelease, }, }, diff --git a/.github/vendor/github.com/grafana/loki-release/workflows/release.libsonnet b/.github/vendor/github.com/grafana/loki-release/workflows/release.libsonnet index b77d8fe615ec9..e62dfe0bbee82 100644 --- a/.github/vendor/github.com/grafana/loki-release/workflows/release.libsonnet +++ b/.github/vendor/github.com/grafana/loki-release/workflows/release.libsonnet @@ -186,6 +186,47 @@ local pullRequestFooter = 'Merging this PR will release the [artifacts](https:// ] ), + publishDockerPlugin: function(name, path, getDockerCredsFromVault=false, dockerUsername='grafanabot') + job.new() + + job.withNeeds(['createRelease']) + + job.withSteps( + [ + common.fetchReleaseLib, + common.googleAuth, + common.setupGoogleCloudSdk, + step.new('Set up QEMU', 'docker/setup-qemu-action@v3'), + step.new('set up docker buildx', 'docker/setup-buildx-action@v3'), + ] + (if getDockerCredsFromVault then [ + step.new('Login to DockerHub (from vault)', 'grafana/shared-workflows/actions/dockerhub-login@main'), + ] else [ + step.new('Login to DockerHub (from secrets)', 'docker/login-action@v3') + + step.with({ + username: dockerUsername, + password: '${{ secrets.DOCKER_PASSWORD }}', + }), + ]) + + [ + step.new('download plugins') + + step.withRun(||| + echo "downloading images to $(pwd)/plugins" + gsutil cp -r gs://${BUILD_ARTIFACTS_BUCKET}/${{ needs.createRelease.outputs.sha }}/plugins . + |||), + step.new('Package as Docker plugin') + + step.withIf('${{ fromJSON(needs.version.outputs.pr_created) }}') + + step.withEnv({ + IMAGE_TAG: '${{ needs.version.outputs.version }}', + BUILD_DIR: path, + }) + + step.withRun(||| + rm -rf "${{ env.BUILD_DIR }}/rootfs" || true + mkdir "${{ env.BUILD_DIR }}/rootfs" + tar -x -C "${{ env.BUILD_DIR }}/rootfs" -f "plugins/%s-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" + docker plugin create "${{ env.IMAGE_PREFIX }}/%s:${{ needs.version.outputs.version }}-${{ steps.platform.outputs.platform_short }}" "${{ env.BUILD_DIR }}" + docker plugin push "${{ env.IMAGE_PREFIX }}/%s:${{ needs.version.outputs.version }}-${{ steps.platform.outputs.platform_short }}" + ||| % [name, name, name]), + ] + ), + publishRelease: job.new() + job.withNeeds(['createRelease', 'publishImages']) + job.withSteps([ diff --git a/.github/workflows/minor-release-pr.yml b/.github/workflows/minor-release-pr.yml index ed8542df18ead..e06d37edcf543 100644 --- a/.github/workflows/minor-release-pr.yml +++ b/.github/workflows/minor-release-pr.yml @@ -652,27 +652,16 @@ jobs: BUILD_IMAGE=grafana/loki-build-image:0.34.3 context: "release" file: "release/clients/cmd/docker-driver/Dockerfile" - outputs: "type=docker,dest=release/images/loki-docker-driver-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" + outputs: "type=docker,dest=release/plugins/loki-docker-driver-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" platforms: "${{ matrix.platform }}" push: false tags: "${{ env.IMAGE_PREFIX }}/loki-docker-driver:${{ needs.version.outputs.version }}-${{ steps.platform.outputs.platform_short }}" - - env: - BUILD_DIR: "clients/cmd/docker-driver" - IMAGE_TAG: "${{ needs.version.outputs.version }}" - if: "${{ fromJSON(needs.version.outputs.pr_created) }}" - name: "Package as Docker plugin" - run: | - rm -rf "${{ env.BUILD_DIR }}/rootfs" || true - mkdir "${{ env.BUILD_DIR }}/rootfs" - tar -x -C "${{ env.BUILD_DIR }}/rootfs" -f "images/loki-docker-driver-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" - docker plugin create "${{ env.IMAGE_TAG }}${{ steps.platform.outputs.plugin_arch }}" "${{ env.BUILD_DIR }}" - working-directory: "release" - if: "${{ fromJSON(needs.version.outputs.pr_created) }}" name: "upload artifacts" uses: "google-github-actions/upload-cloud-storage@v2" with: - destination: "${{ env.BUILD_ARTIFACTS_BUCKET }}/${{ github.sha }}/images" - path: "release/images/loki-docker-driver-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" + destination: "${{ env.BUILD_ARTIFACTS_BUCKET }}/${{ github.sha }}/plugins" + path: "release/plugins/loki-docker-driver-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" process_gcloudignore: false strategy: fail-fast: true diff --git a/.github/workflows/patch-release-pr.yml b/.github/workflows/patch-release-pr.yml index 827f2e44878c3..e77725c2e6f4f 100644 --- a/.github/workflows/patch-release-pr.yml +++ b/.github/workflows/patch-release-pr.yml @@ -652,27 +652,16 @@ jobs: BUILD_IMAGE=grafana/loki-build-image:0.34.3 context: "release" file: "release/clients/cmd/docker-driver/Dockerfile" - outputs: "type=docker,dest=release/images/loki-docker-driver-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" + outputs: "type=docker,dest=release/plugins/loki-docker-driver-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" platforms: "${{ matrix.platform }}" push: false tags: "${{ env.IMAGE_PREFIX }}/loki-docker-driver:${{ needs.version.outputs.version }}-${{ steps.platform.outputs.platform_short }}" - - env: - BUILD_DIR: "clients/cmd/docker-driver" - IMAGE_TAG: "${{ needs.version.outputs.version }}" - if: "${{ fromJSON(needs.version.outputs.pr_created) }}" - name: "Package as Docker plugin" - run: | - rm -rf "${{ env.BUILD_DIR }}/rootfs" || true - mkdir "${{ env.BUILD_DIR }}/rootfs" - tar -x -C "${{ env.BUILD_DIR }}/rootfs" -f "images/loki-docker-driver-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" - docker plugin create "${{ env.IMAGE_TAG }}${{ steps.platform.outputs.plugin_arch }}" "${{ env.BUILD_DIR }}" - working-directory: "release" - if: "${{ fromJSON(needs.version.outputs.pr_created) }}" name: "upload artifacts" uses: "google-github-actions/upload-cloud-storage@v2" with: - destination: "${{ env.BUILD_ARTIFACTS_BUCKET }}/${{ github.sha }}/images" - path: "release/images/loki-docker-driver-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" + destination: "${{ env.BUILD_ARTIFACTS_BUCKET }}/${{ github.sha }}/plugins" + path: "release/plugins/loki-docker-driver-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" process_gcloudignore: false strategy: fail-fast: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1628a0b57dfb5..8a660b62a5c93 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -110,6 +110,46 @@ jobs: parent: false path: "release/dist" process_gcloudignore: false + publishDockerDriver: + needs: + - "createRelease" + runs-on: "ubuntu-latest" + steps: + - name: "pull release library code" + uses: "actions/checkout@v4" + with: + path: "lib" + ref: "${{ env.RELEASE_LIB_REF }}" + repository: "grafana/loki-release" + - name: "auth gcs" + uses: "google-github-actions/auth@v2" + with: + credentials_json: "${{ secrets.GCS_SERVICE_ACCOUNT_KEY }}" + - name: "Set up Cloud SDK" + uses: "google-github-actions/setup-gcloud@v2" + with: + version: ">= 452.0.0" + - name: "Set up QEMU" + uses: "docker/setup-qemu-action@v3" + - name: "set up docker buildx" + uses: "docker/setup-buildx-action@v3" + - name: "Login to DockerHub (from vault)" + uses: "grafana/shared-workflows/actions/dockerhub-login@main" + - name: "download plugins" + run: | + echo "downloading images to $(pwd)/plugins" + gsutil cp -r gs://${BUILD_ARTIFACTS_BUCKET}/${{ needs.createRelease.outputs.sha }}/plugins . + - env: + BUILD_DIR: "clients/cmd/docker-driver" + IMAGE_TAG: "${{ needs.version.outputs.version }}" + if: "${{ fromJSON(needs.version.outputs.pr_created) }}" + name: "Package as Docker plugin" + run: | + rm -rf "${{ env.BUILD_DIR }}/rootfs" || true + mkdir "${{ env.BUILD_DIR }}/rootfs" + tar -x -C "${{ env.BUILD_DIR }}/rootfs" -f "plugins/loki-docker-driver-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar" + docker plugin create "${{ env.IMAGE_PREFIX }}/loki-docker-driver:${{ needs.version.outputs.version }}-${{ steps.platform.outputs.platform_short }}" "${{ env.BUILD_DIR }}" + docker plugin push "${{ env.IMAGE_PREFIX }}/loki-docker-driver:${{ needs.version.outputs.version }}-${{ steps.platform.outputs.platform_short }}" publishImages: needs: - "createRelease" From 595676bacb595f34b4eb2b1d827c535379fa6ded Mon Sep 17 00:00:00 2001 From: Trevor Whitney Date: Thu, 12 Dec 2024 13:43:34 -0700 Subject: [PATCH 18/19] ci: bump loki-release --- .github/jsonnetfile.json | 2 +- .github/jsonnetfile.lock.json | 4 ++-- .../grafana/loki-release/workflows/build.libsonnet | 1 + .../github.com/grafana/loki-release/workflows/main.jsonnet | 1 + .../grafana/loki-release/workflows/workflows.jsonnet | 6 ++++++ .github/workflows/minor-release-pr.yml | 1 + .github/workflows/patch-release-pr.yml | 1 + 7 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/jsonnetfile.json b/.github/jsonnetfile.json index 4d1e46902efc1..8f0adddf2442d 100644 --- a/.github/jsonnetfile.json +++ b/.github/jsonnetfile.json @@ -8,7 +8,7 @@ "subdir": "workflows" } }, - "version": "502f98811e3768072698cc5c589c889c60025428" + "version": "186e3449678a196bf08d9d55355e3b22d8e20ebf" } ], "legacyImports": true diff --git a/.github/jsonnetfile.lock.json b/.github/jsonnetfile.lock.json index 40008f32baf90..9c22d72e13014 100644 --- a/.github/jsonnetfile.lock.json +++ b/.github/jsonnetfile.lock.json @@ -8,8 +8,8 @@ "subdir": "workflows" } }, - "version": "502f98811e3768072698cc5c589c889c60025428", - "sum": "a/V79sNGV4kSBRc2b8UtAKnceSR6fmvSKYlrCPDoBKY=" + "version": "186e3449678a196bf08d9d55355e3b22d8e20ebf", + "sum": "T9x+84EmTZEkrcxzsQYZI5HffdnnIJs6q1tCfe7VVes=" } ], "legacyImports": false diff --git a/.github/vendor/github.com/grafana/loki-release/workflows/build.libsonnet b/.github/vendor/github.com/grafana/loki-release/workflows/build.libsonnet index 1ea101a682e2b..73b8ca79e7451 100644 --- a/.github/vendor/github.com/grafana/loki-release/workflows/build.libsonnet +++ b/.github/vendor/github.com/grafana/loki-release/workflows/build.libsonnet @@ -136,6 +136,7 @@ local releaseLibStep = common.releaseLibStep; + step.withId('platform') + step.withRun(||| mkdir -p images + mkdir -p plugins platform="$(echo "${{ matrix.platform}}" | sed "s/\(.*\)\/\(.*\)/\1-\2/")" echo "platform=${platform}" >> $GITHUB_OUTPUT diff --git a/.github/vendor/github.com/grafana/loki-release/workflows/main.jsonnet b/.github/vendor/github.com/grafana/loki-release/workflows/main.jsonnet index a5b677d1eba73..4006affde90cc 100644 --- a/.github/vendor/github.com/grafana/loki-release/workflows/main.jsonnet +++ b/.github/vendor/github.com/grafana/loki-release/workflows/main.jsonnet @@ -120,6 +120,7 @@ shouldRelease: $.release.shouldRelease, createRelease: $.release.createRelease, publishImages: $.release.publishImages(getDockerCredsFromVault, dockerUsername), + //TODO: this will break if the image was not provided as a build job, and those are configurable, so we need a better way to establish this dependency publishDockerDriver: $.release.publishDockerPlugin('loki-docker-driver', dockerPluginPath, getDockerCredsFromVault, dockerUsername), publishRelease: $.release.publishRelease, }, diff --git a/.github/vendor/github.com/grafana/loki-release/workflows/workflows.jsonnet b/.github/vendor/github.com/grafana/loki-release/workflows/workflows.jsonnet index 1992d23f0d3b9..ca407dd517143 100644 --- a/.github/vendor/github.com/grafana/loki-release/workflows/workflows.jsonnet +++ b/.github/vendor/github.com/grafana/loki-release/workflows/workflows.jsonnet @@ -1,11 +1,16 @@ local lokiRelease = import 'main.jsonnet'; local build = lokiRelease.build; + + +local buildImage = 'grafana/loki-build-image:0.34.3'; + { '.github/workflows/release-pr.yml': std.manifestYamlDoc( lokiRelease.releasePRWorkflow( imageJobs={ loki: build.image('fake-loki', 'cmd/loki'), }, + buildImage=buildImage, buildArtifactsBucket='loki-build-artifacts', branches=['release-[0-9]+.[0-9]+.x'], imagePrefix='trevorwhitney075', @@ -22,6 +27,7 @@ local build = lokiRelease.build; imageJobs={ loki: build.image('fake-loki', 'cmd/loki'), }, + buildImage=buildImage, buildArtifactsBucket='loki-build-artifacts', branches=['release-[0-9]+.[0-9]+.x'], dryRun=true, diff --git a/.github/workflows/minor-release-pr.yml b/.github/workflows/minor-release-pr.yml index e06d37edcf543..62c37adc10457 100644 --- a/.github/workflows/minor-release-pr.yml +++ b/.github/workflows/minor-release-pr.yml @@ -631,6 +631,7 @@ jobs: name: "parse image platform" run: | mkdir -p images + mkdir -p plugins platform="$(echo "${{ matrix.platform}}" | sed "s/\(.*\)\/\(.*\)/\1-\2/")" echo "platform=${platform}" >> $GITHUB_OUTPUT diff --git a/.github/workflows/patch-release-pr.yml b/.github/workflows/patch-release-pr.yml index e77725c2e6f4f..09a4c084ec726 100644 --- a/.github/workflows/patch-release-pr.yml +++ b/.github/workflows/patch-release-pr.yml @@ -631,6 +631,7 @@ jobs: name: "parse image platform" run: | mkdir -p images + mkdir -p plugins platform="$(echo "${{ matrix.platform}}" | sed "s/\(.*\)\/\(.*\)/\1-\2/")" echo "platform=${platform}" >> $GITHUB_OUTPUT From f333413c7073068737c42a0cff1cdf1c12615533 Mon Sep 17 00:00:00 2001 From: Trevor Whitney Date: Thu, 12 Dec 2024 14:15:02 -0700 Subject: [PATCH 19/19] ci: revert temporary workflow changes --- .github/release-workflows.jsonnet | 4 ++-- .github/workflows/patch-release-pr.yml | 5 ++--- Makefile | 4 ++++ 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/release-workflows.jsonnet b/.github/release-workflows.jsonnet index dcc1474a37aef..12a3ab5c5d444 100644 --- a/.github/release-workflows.jsonnet +++ b/.github/release-workflows.jsonnet @@ -32,7 +32,7 @@ local weeklyImageJobs = { { 'patch-release-pr.yml': std.manifestYamlDoc( lokiRelease.releasePRWorkflow( - branches=['release-[0-9]+.[0-9]+.x', 'fix-docker-driver-again'], + branches=['release-[0-9]+.[0-9]+.x'], buildImage=buildImage, checkTemplate=checkTemplate, golangCiLintVersion=golangCiLintVersion, @@ -42,7 +42,7 @@ local weeklyImageJobs = { releaseLibRef=releaseLibRef, releaseRepo='grafana/loki', skipArm=false, - skipValidation=true, + skipValidation=false, useGitHubAppToken=true, versioningStrategy='always-bump-patch', ) + { diff --git a/.github/workflows/patch-release-pr.yml b/.github/workflows/patch-release-pr.yml index 09a4c084ec726..c1d2849fd312d 100644 --- a/.github/workflows/patch-release-pr.yml +++ b/.github/workflows/patch-release-pr.yml @@ -9,7 +9,7 @@ env: IMAGE_PREFIX: "grafana" RELEASE_LIB_REF: "main" RELEASE_REPO: "grafana/loki" - SKIP_VALIDATION: true + SKIP_VALIDATION: false USE_GITHUB_APP_TOKEN: true VERSIONING_STRATEGY: "always-bump-patch" jobs: @@ -19,7 +19,7 @@ jobs: build_image: "grafana/loki-build-image:0.34.3" golang_ci_lint_version: "v1.60.3" release_lib_ref: "main" - skip_validation: true + skip_validation: false use_github_app_token: true create-release-pr: needs: @@ -897,7 +897,6 @@ name: "Prepare Patch Release PR" push: branches: - "release-[0-9]+.[0-9]+.x" - - "fix-docker-driver-again" permissions: contents: "write" id-token: "write" diff --git a/Makefile b/Makefile index 9d51bec931460..76de2fac98dfc 100644 --- a/Makefile +++ b/Makefile @@ -873,8 +873,12 @@ scan-vulnerabilities: trivy snyk .PHONY: release-workflows release-workflows: +ifeq ($(BUILD_IN_CONTAINER),true) + $(run_in_container) +else pushd $(CURDIR)/.github && jb update && popd jsonnet -SJ .github/vendor -m .github/workflows -V BUILD_IMAGE_VERSION=$(BUILD_IMAGE_TAG) .github/release-workflows.jsonnet +endif .PHONY: release-workflows-check release-workflows-check: