From 35079afcb914044612bd984c4e1b4b8ce19fd4ec Mon Sep 17 00:00:00 2001 From: Callum Styan Date: Tue, 15 Feb 2022 10:32:45 -0800 Subject: [PATCH 1/3] add build job for lambda-promtail-arm64 image Signed-off-by: Callum Styan --- .drone/drone.jsonnet | 57 +++++++++++++++++++++++++- .drone/drone.yml | 75 +++++++++++++++++++++++++++++++++- wal/00000033 | 0 wal/00000034 | 0 wal/00000035 | 0 wal/00000036 | 0 wal/00000037 | 0 wal/00000038 | 0 wal/00000039 | 0 wal/checkpoint.000032/00000000 | 0 10 files changed, 128 insertions(+), 4 deletions(-) create mode 100644 wal/00000033 create mode 100644 wal/00000034 create mode 100644 wal/00000035 create mode 100644 wal/00000036 create mode 100644 wal/00000037 create mode 100644 wal/00000038 create mode 100644 wal/00000039 create mode 100644 wal/checkpoint.000032/00000000 diff --git a/.drone/drone.jsonnet b/.drone/drone.jsonnet index b1eacd46622cd..c4290d374d8f8 100644 --- a/.drone/drone.jsonnet +++ b/.drone/drone.jsonnet @@ -84,6 +84,29 @@ local clients_docker(arch, app) = { local lambda_promtail_ecr(app) = { name: '%s-image' % if $.settings.dry_run then 'build-' + app else 'publish-' + app, image: 'cstyan/ecr', + platform: { + os: 'linux', + arch: 'amd64', + }, + privileged: true, + settings: { + repo: 'public.ecr.aws/grafana/lambda-promtail', + registry: 'public.ecr.aws/grafana', + dockerfile: 'tools/%s/Dockerfile' % app, + access_key: { from_secret: ecr_key.name }, + secret_key: { from_secret: ecr_secret_key.name }, + dry_run: false, + region: 'us-east-1', + }, +}; + +local lambda_promtail_ecr_arm64(app) = { + name: '%s-image' % if $.settings.dry_run then 'build-' + app else 'publish-' + app, + image: 'cstyan/ecr:arm64', + platform: { + os: 'linux', + arch: 'arm64', + }, privileged: true, settings: { repo: 'public.ecr.aws/grafana/lambda-promtail', @@ -229,7 +252,7 @@ local promtail(arch) = pipeline('promtail-' + arch) + arch_image(arch) { depends_on: ['check'], }; -local lambda_promtail(tags='') = pipeline('lambda-promtail') { +local lambda_promtail_amd64(tags='') = pipeline('lambda-promtail-amd64') { steps+: [ { name: 'image-tag', @@ -258,6 +281,35 @@ local lambda_promtail(tags='') = pipeline('lambda-promtail') { depends_on: ['check'], }; +local lambda_promtail_arm64(tags='') = pipeline('lambda-promtail-arm64') { + steps+: [ + { + name: 'image-tag', + image: 'alpine', + commands: [ + 'apk add --no-cache bash git', + 'git fetch origin --tags', + 'echo $(./tools/image-tag)-arm64 > .tags', + ] + if tags != '' then ['echo ",%s" >> .tags' % tags] else [], + }, + lambda_promtail_ecr_arm64('lambda-promtail') { + depends_on: ['image-tag'], + when: condition('exclude').tagMain, + settings+: { + dry_run: true, + }, + }, + ] + [ + // publish for tag or main + lambda_promtail_ecr_arm64('lambda-promtail') { + depends_on: ['image-tag'], + when: condition('include').tagMain, + settings+: {}, + }, + ], + depends_on: ['check'], +}; + local multiarch_image(arch) = pipeline('docker-' + arch) + arch_image(arch) { steps+: [ // dry run for everything that is not tag or main @@ -459,5 +511,6 @@ local manifest(apps) = pipeline('manifest') { ], }, ] + [promtail_win()] -+ [lambda_promtail('main')] ++ [lambda_promtail_amd64('main')] ++ [lambda_promtail_arm64('main')] + [github_secret, pull_secret, docker_username_secret, docker_password_secret, ecr_key, ecr_secret_key, deploy_configuration] diff --git a/.drone/drone.yml b/.drone/drone.yml index d97f5a081840b..aea0da31d2649 100644 --- a/.drone/drone.yml +++ b/.drone/drone.yml @@ -965,7 +965,7 @@ trigger: depends_on: - check kind: pipeline -name: lambda-promtail +name: lambda-promtail-amd64 steps: - commands: - apk add --no-cache bash git @@ -978,6 +978,9 @@ steps: - image-tag image: cstyan/ecr name: build-lambda-promtail-image + platform: + arch: amd64 + os: linux privileged: true settings: access_key: @@ -999,6 +1002,74 @@ steps: - image-tag image: cstyan/ecr name: publish-lambda-promtail-image + platform: + arch: amd64 + os: linux + privileged: true + settings: + access_key: + from_secret: ecr_key + dockerfile: tools/lambda-promtail/Dockerfile + dry_run: false + region: us-east-1 + registry: public.ecr.aws/grafana + repo: public.ecr.aws/grafana/lambda-promtail + secret_key: + from_secret: ecr_secret_key + when: + ref: + include: + - refs/heads/main + - refs/heads/k?? + - refs/tags/v* +trigger: + event: + - push + - pull_request +--- +depends_on: +- check +kind: pipeline +name: lambda-promtail-arm64 +steps: +- commands: + - apk add --no-cache bash git + - git fetch origin --tags + - echo $(./tools/image-tag)-arm64 > .tags + - echo ",main" >> .tags + image: alpine + name: image-tag +- depends_on: + - image-tag + image: cstyan/ecr:arm64 + name: build-lambda-promtail-image + platform: + arch: arm64 + os: linux + privileged: true + settings: + access_key: + from_secret: ecr_key + dockerfile: tools/lambda-promtail/Dockerfile + dry_run: true + region: us-east-1 + registry: public.ecr.aws/grafana + repo: public.ecr.aws/grafana/lambda-promtail + secret_key: + from_secret: ecr_secret_key + when: + ref: + exclude: + - refs/heads/main + - refs/heads/k?? + - refs/tags/v* +- depends_on: + - image-tag + image: cstyan/ecr:arm64 + name: publish-lambda-promtail-image + platform: + arch: arm64 + os: linux privileged: true settings: access_key: @@ -1064,6 +1135,6 @@ kind: secret name: deploy_config --- kind: signature -hmac: 8b3b13c0697e37fe9e39c422c375bb95c250ca3614bed5bb4697328ab89d1e68 +hmac: 05a7531bc4521d0d0dbf8cbcfdc030eec25a86daf99d2cc72c801fd57f4a1cc1 ... diff --git a/wal/00000033 b/wal/00000033 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/wal/00000034 b/wal/00000034 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/wal/00000035 b/wal/00000035 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/wal/00000036 b/wal/00000036 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/wal/00000037 b/wal/00000037 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/wal/00000038 b/wal/00000038 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/wal/00000039 b/wal/00000039 new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/wal/checkpoint.000032/00000000 b/wal/checkpoint.000032/00000000 new file mode 100644 index 0000000000000..e69de29bb2d1d From 8e0c2f0c8924708715a04f845296792a49f18377 Mon Sep 17 00:00:00 2001 From: Callum Styan Date: Tue, 15 Feb 2022 12:49:25 -0800 Subject: [PATCH 2/3] Update go build image version for lambda-promtail Signed-off-by: Callum Styan --- tools/lambda-promtail/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/lambda-promtail/Dockerfile b/tools/lambda-promtail/Dockerfile index 293b9f6d2ca07..23eafd2665d93 100644 --- a/tools/lambda-promtail/Dockerfile +++ b/tools/lambda-promtail/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1-alpine3.14 AS build-image +FROM golang:alpine3.15 AS build-image COPY tools/lambda-promtail /src/lambda-promtail WORKDIR /src/lambda-promtail From 504753367cb06df13fa8a7bde9879ca6d226bce6 Mon Sep 17 00:00:00 2001 From: Callum Styan Date: Tue, 15 Feb 2022 13:06:25 -0800 Subject: [PATCH 3/3] Try another way of building the arm64 image. Signed-off-by: Callum Styan --- .drone/drone.jsonnet | 25 ++++++++++++++++++++++--- .drone/drone.yml | 14 +++++++------- tools/lambda-promtail/Dockerfile.arm64 | 23 +++++++++++++++++++++++ 3 files changed, 52 insertions(+), 10 deletions(-) create mode 100644 tools/lambda-promtail/Dockerfile.arm64 diff --git a/.drone/drone.jsonnet b/.drone/drone.jsonnet index c4290d374d8f8..747b6e8130785 100644 --- a/.drone/drone.jsonnet +++ b/.drone/drone.jsonnet @@ -102,16 +102,16 @@ local lambda_promtail_ecr(app) = { local lambda_promtail_ecr_arm64(app) = { name: '%s-image' % if $.settings.dry_run then 'build-' + app else 'publish-' + app, - image: 'cstyan/ecr:arm64', + image: 'cstyan/ecr', platform: { os: 'linux', - arch: 'arm64', + arch: 'amd64', }, privileged: true, settings: { repo: 'public.ecr.aws/grafana/lambda-promtail', registry: 'public.ecr.aws/grafana', - dockerfile: 'tools/%s/Dockerfile' % app, + dockerfile: 'tools/%s/Dockerfile.arm64' % app, access_key: { from_secret: ecr_key.name }, secret_key: { from_secret: ecr_secret_key.name }, dry_run: false, @@ -119,6 +119,25 @@ local lambda_promtail_ecr_arm64(app) = { }, }; +// local lambda_promtail_ecr_arm64(app) = { +// name: '%s-image' % if $.settings.dry_run then 'build-' + app else 'publish-' + app, +// image: 'cstyan/ecr:arm64', +// platform: { +// os: 'linux', +// arch: 'arm64', +// }, +// privileged: true, +// settings: { +// repo: 'public.ecr.aws/grafana/lambda-promtail', +// registry: 'public.ecr.aws/grafana', +// dockerfile: 'tools/%s/Dockerfile' % app, +// access_key: { from_secret: ecr_key.name }, +// secret_key: { from_secret: ecr_secret_key.name }, +// dry_run: false, +// region: 'us-east-1', +// }, +// }; + local arch_image(arch, tags='') = { platform: { os: 'linux', diff --git a/.drone/drone.yml b/.drone/drone.yml index aea0da31d2649..f5f4b2248b599 100644 --- a/.drone/drone.yml +++ b/.drone/drone.yml @@ -1041,16 +1041,16 @@ steps: name: image-tag - depends_on: - image-tag - image: cstyan/ecr:arm64 + image: cstyan/ecr name: build-lambda-promtail-image platform: - arch: arm64 + arch: amd64 os: linux privileged: true settings: access_key: from_secret: ecr_key - dockerfile: tools/lambda-promtail/Dockerfile + dockerfile: tools/lambda-promtail/Dockerfile.arm64 dry_run: true region: us-east-1 registry: public.ecr.aws/grafana @@ -1065,16 +1065,16 @@ steps: - refs/tags/v* - depends_on: - image-tag - image: cstyan/ecr:arm64 + image: cstyan/ecr name: publish-lambda-promtail-image platform: - arch: arm64 + arch: amd64 os: linux privileged: true settings: access_key: from_secret: ecr_key - dockerfile: tools/lambda-promtail/Dockerfile + dockerfile: tools/lambda-promtail/Dockerfile.arm64 dry_run: false region: us-east-1 registry: public.ecr.aws/grafana @@ -1135,6 +1135,6 @@ kind: secret name: deploy_config --- kind: signature -hmac: 05a7531bc4521d0d0dbf8cbcfdc030eec25a86daf99d2cc72c801fd57f4a1cc1 +hmac: 278bcda31d5ffb54849fc0cc766d893b4e1afaceea13d7383f8e473260180f9a ... diff --git a/tools/lambda-promtail/Dockerfile.arm64 b/tools/lambda-promtail/Dockerfile.arm64 new file mode 100644 index 0000000000000..87855f84676f4 --- /dev/null +++ b/tools/lambda-promtail/Dockerfile.arm64 @@ -0,0 +1,23 @@ +FROM golang:alpine3.15 AS build-image + +ENV GOARCH=arm64 + +COPY tools/lambda-promtail /src/lambda-promtail +WORKDIR /src/lambda-promtail + +RUN go version + +RUN apk update && apk upgrade && \ + apk add --no-cache bash git + +RUN go mod download +RUN go build -o ./main -tags lambda.norpc -ldflags="-s -w" lambda-promtail/*.go + + +FROM alpine:3.14 + +WORKDIR /app + +COPY --from=build-image /src/lambda-promtail/main ./ + +ENTRYPOINT ["/app/main"]