diff --git a/.github/workflows/images.yml b/.github/workflows/images.yml index 8ba365d6e9696..1b5b962560f86 100644 --- a/.github/workflows/images.yml +++ b/.github/workflows/images.yml @@ -439,6 +439,131 @@ ${{ needs.promtail-image.outputs.image_name }}@${{ needs.promtail-image.outputs.image_digest_linux_arm64 }} \ ${{ needs.promtail-image.outputs.image_name }}@${{ needs.promtail-image.outputs.image_digest_linux_arm }} docker buildx imagetools inspect $IMAGE + "lambda-promtail-image": + "env": + "BUILD_TIMEOUT": 60 + "GO_VERSION": "1.23.5" + "IMAGE_PREFIX": "public.ecr.aws/grafana" + "RELEASE_LIB_REF": "main" + "RELEASE_REPO": "grafana/loki" + "needs": + - "check" + "outputs": + "image_digest_linux_amd64": "${{ steps.digest.outputs.digest_linux_amd64 }}" + "image_digest_linux_arm": "${{ steps.digest.outputs.digest_linux_arm }}" + "image_digest_linux_arm64": "${{ steps.digest.outputs.digest_linux_arm64 }}" + "image_name": "${{ steps.weekly-version.outputs.image_name }}" + "image_tag": "${{ steps.weekly-version.outputs.image_version }}" + "runs-on": "${{ matrix.runs_on }}" + "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": "Set up Docker buildx" + "uses": "docker/setup-buildx-action@v3" + - "name": "Configure AWS credentials" + "uses": "aws-actions/configure-aws-credentials@v4" + "with": + "aws-access-key-id": "${{ secrets.ECR_ACCESS_KEY }}" + "aws-secret-access-key": "${{ secrets.ECR_SECRET_KEY }}" + "aws-region": "us-east-1" + - "name": "Login to Amazon ECR Public" + "uses": "aws-actions/amazon-ecr-login@v2" + "with": + "registry-type": "public" + - "id": "weekly-version" + "name": "Get weekly version" + "run": | + version=$(./tools/image-tag) + echo "image_version=$version" >> $GITHUB_OUTPUT + echo "image_name=${{ env.IMAGE_PREFIX }}/lambda-promtail" >> $GITHUB_OUTPUT + echo "image_full_name=${{ env.IMAGE_PREFIX }}/lambda-promtail:$version" >> $GITHUB_OUTPUT + "working-directory": "release" + - "id": "platform" + "name": "Parse image platform" + "run": | + platform="$(echo "${{ matrix.arch }}" | sed "s/\(.*\)\/\(.*\)/\1-\2/")" + echo "platform=${platform}" >> $GITHUB_OUTPUT + echo "platform_short=$(echo ${{ matrix.arch }} | cut -d / -f 2)" >> $GITHUB_OUTPUT + "working-directory": "release" + - "id": "build-push" + "name": "Build and push" + "timeout-minutes": "${{ fromJSON(env.BUILD_TIMEOUT) }}" + "uses": "docker/build-push-action@v6" + "with": + "build-args": | + IMAGE_TAG=${{ steps.weekly-version.outputs.image_version }} + GO_VERSION=${{ env.GO_VERSION }} + "context": "release" + "file": "release/tools/lambda-promtail/Dockerfile" + "outputs": "push-by-digest=true,type=image,name=${{ steps.weekly-version.outputs.image_name }},push=true" + "platforms": "${{ matrix.arch }}" + "provenance": true + "tags": "${{ steps.weekly-version.outputs.image_name }}" + - "id": "digest" + "name": "Process image digest" + "run": | + arch=$(echo ${{ matrix.arch }} | tr "/" "_") + echo "digest_$arch=${{ steps.build-push.outputs.digest }}" >> $GITHUB_OUTPUT + "working-directory": "release" + "strategy": + "fail-fast": true + "matrix": + "include": + - "arch": "linux/amd64" + "runs_on": + - "github-hosted-ubuntu-x64-small" + - "arch": "linux/arm64" + "runs_on": + - "github-hosted-ubuntu-arm64-small" + - "arch": "linux/arm" + "runs_on": + - "github-hosted-ubuntu-arm64-small" + "lambda-promtail-manifest": + "env": + "BUILD_TIMEOUT": 60 + "IMAGE_PREFIX": "public.ecr.aws/grafana" + "needs": + - "lambda-promtail-image" + "runs-on": "ubuntu-latest" + "steps": + - "name": "Set up Docker buildx" + "uses": "docker/setup-buildx-action@v3" + - "name": "Configure AWS credentials" + "uses": "aws-actions/configure-aws-credentials@v4" + "with": + "aws-access-key-id": "${{ secrets.ECR_ACCESS_KEY }}" + "aws-secret-access-key": "${{ secrets.ECR_SECRET_KEY }}" + "aws-region": "us-east-1" + - "name": "Login to Amazon ECR Public" + "uses": "aws-actions/amazon-ecr-login@v2" + "with": + "registry-type": "public" + - "name": "Publish multi-arch manifest" + "run": | + # Unfortunately there is no better way atm than having a separate named output for each digest + echo 'linux/arm64 ${{ needs.lambda-promtail-image.outputs.image_digest_linux_amd64 }}' + echo 'linux/amd64 ${{ needs.lambda-promtail-image.outputs.image_digest_linux_arm64 }}' + echo 'linux/arm ${{ needs.lambda-promtail-image.outputs.image_digest_linux_arm }}' + IMAGE=${{ needs.lambda-promtail-image.outputs.image_name }}:${{ needs.lambda-promtail-image.outputs.image_tag }} + echo "Create multi-arch manifest for $IMAGE" + docker buildx imagetools create -t $IMAGE \ + ${{ needs.lambda-promtail-image.outputs.image_name }}@${{ needs.lambda-promtail-image.outputs.image_digest_linux_amd64 }} \ + ${{ needs.lambda-promtail-image.outputs.image_name }}@${{ needs.lambda-promtail-image.outputs.image_digest_linux_arm64 }} \ + ${{ needs.lambda-promtail-image.outputs.image_name }}@${{ needs.lambda-promtail-image.outputs.image_digest_linux_arm }} + docker buildx imagetools inspect $IMAGE "name": "Publish images" "on": "push": @@ -449,4 +574,4 @@ "permissions": "contents": "write" "id-token": "write" - "pull-requests": "write" \ No newline at end of file + "pull-requests": "write"