diff --git a/.github/workflows/build-loki-image.yml b/.github/workflows/build-loki-image.yml index 4d512dbe..e2363b89 100644 --- a/.github/workflows/build-loki-image.yml +++ b/.github/workflows/build-loki-image.yml @@ -13,6 +13,13 @@ on: jobs: loki-image: runs-on: ubuntu-latest + strategy: + fail-fast: true + matrix: + platform: + - linux/amd64 + - linux/arm64 + - linux/arm steps: - name: pull loki code uses: actions/checkout@v3 @@ -21,13 +28,30 @@ jobs: - uses: actions/setup-go@v4 with: go-version: ">=1.21.3" + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 - name: set up docker buildx uses: docker/setup-buildx-action@v3 - with: - platforms: linux/amd64,linux/arm64,linux/arm - driver: docker-container - install: true # setup docker build alias - driver-opts: --output "type=image" - - name: build image + - name: parse image metadata + id: parse-metadata + shell: bash + # TODO: this version will come from key cmd/loki in release manifest + # version=$(jq -r '."cmd/loki"' .release-please-manifest.json) run: | - make BUILD_IN_CONTAINER=false loki-image + platform="$(echo "${{ matrix.platform}}" | sed "s/\(.*\)\/\(.*\)/\1-\2/" + echo "platform=${platform}" >> $GITHUB_OUTPUT + + version="1.2.0" + echo "version=${version}" >> $GITHUB_OUTPUT + - name: Build and export + uses: docker/build-push-action@v5 + with: + context: cmd/loki + platforms: ${{ matrix.platform }} + tags: grafana/loki:${{ steps.parse-metadata.outputs.version }} + outputs: type=docker,dest=/dist/loki-${{ steps.parse-metadata.outputs.version}}-${{ steps.parse-metadata.outputs.platform) }}.tar + - name: upload artifacts + uses: actions/upload-artifact@v3 + with: + name: loki-image-${{ matrix.platform }} + path: dist/loki-${{ steps.parse-metadata.outputs.platform) }}.tar