From e83c66410bc0d8999b2a1a7a484944aeb92ebef8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Linhart?= Date: Wed, 9 Feb 2022 14:27:40 +0100 Subject: [PATCH 01/17] Add support for ARM64 to lambda-promtail drone build job --- .drone/drone.jsonnet | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/.drone/drone.jsonnet b/.drone/drone.jsonnet index b1eacd46622cd..4751c81202690 100644 --- a/.drone/drone.jsonnet +++ b/.drone/drone.jsonnet @@ -229,17 +229,9 @@ local promtail(arch) = pipeline('promtail-' + arch) + arch_image(arch) { depends_on: ['check'], }; -local lambda_promtail(tags='') = pipeline('lambda-promtail') { +local lambda_promtail(arch, tags='') = pipeline('lambda-promtail-' + arch) + arch_image(arch, tags) { steps+: [ - { - name: 'image-tag', - image: 'alpine', - commands: [ - 'apk add --no-cache bash git', - 'git fetch origin --tags', - 'echo $(./tools/image-tag)-amd64 > .tags', - ] + if tags != '' then ['echo ",%s" >> .tags' % tags] else [], - }, + // dry run for everything that is not tag or main lambda_promtail_ecr('lambda-promtail') { depends_on: ['image-tag'], when: condition('exclude').tagMain, @@ -459,5 +451,5 @@ local manifest(apps) = pipeline('manifest') { ], }, ] + [promtail_win()] -+ [lambda_promtail('main')] ++ [lambda_promtail(arch, 'main') for arch in ['amd64', 'arm64']] + [github_secret, pull_secret, docker_username_secret, docker_password_secret, ecr_key, ecr_secret_key, deploy_configuration] From b115600b005a8118a9b2d1a46c3ccd5462d6dfba Mon Sep 17 00:00:00 2001 From: Callum Styan Date: Wed, 9 Feb 2022 13:27:43 -0800 Subject: [PATCH 02/17] update drone.yml based on tomas' changes Signed-off-by: Callum Styan --- .drone/drone.yml | 67 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 66 insertions(+), 1 deletion(-) diff --git a/.drone/drone.yml b/.drone/drone.yml index a580f1beadd67..7f7dd1dbbf58e 100644 --- a/.drone/drone.yml +++ b/.drone/drone.yml @@ -965,7 +965,10 @@ trigger: depends_on: - check kind: pipeline -name: lambda-promtail +name: lambda-promtail-amd64 +platform: + arch: amd64 + os: linux steps: - commands: - apk add --no-cache bash git @@ -1021,6 +1024,68 @@ trigger: - push - pull_request --- +depends_on: +- check +kind: pipeline +name: lambda-promtail-arm64 +platform: + arch: arm64 + os: linux +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 + name: build-lambda-promtail-image + 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 + name: publish-lambda-promtail-image + 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 +--- get: name: pat path: infra/data/ci/github/grafanabot From 4d080306c545ed5e604b6670cb1c8a22ce18c198 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Linhart?= Date: Thu, 10 Feb 2022 18:55:49 +0100 Subject: [PATCH 03/17] Add entry to CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4405e6a7e8cba..fbd1e0ea4834a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ * [5392](https://github.com/grafana/loki/pull/5392) **MichelHollands**: Etcd credentials are parsed as secrets instead of plain text now. * [5361](https://github.com/grafana/loki/pull/5361) **ctovena**: Add usage report to grafana.com. +* [5354](https://github.com/grafana/loki/pull/5354) **tlinhart**: Add support for ARM64 to lambda-promtail drone build job. * [5289](https://github.com/grafana/loki/pull/5289) **ctovena**: Fix deduplication bug in queries when mutating labels. * [5302](https://github.com/grafana/loki/pull/5302) **MasslessParticle** Update azure blobstore client to use new sdk. * [5243](https://github.com/grafana/loki/pull/5290) **ssncferreira**: Update Promtail to support duration string formats. From fccb5c387dba0cb98a7051be0dbebf7132fb481c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Linhart?= Date: Wed, 16 Feb 2022 09:45:28 +0100 Subject: [PATCH 04/17] Change Docker image for building Promtail Lambda --- .drone/drone.jsonnet | 2 +- .drone/drone.yml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.drone/drone.jsonnet b/.drone/drone.jsonnet index 4751c81202690..e1f0504780443 100644 --- a/.drone/drone.jsonnet +++ b/.drone/drone.jsonnet @@ -83,7 +83,7 @@ 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', + image: 'tlinhart/drone-ecr-public', privileged: true, settings: { repo: 'public.ecr.aws/grafana/lambda-promtail', diff --git a/.drone/drone.yml b/.drone/drone.yml index 7f7dd1dbbf58e..08051a93c0eaf 100644 --- a/.drone/drone.yml +++ b/.drone/drone.yml @@ -979,7 +979,7 @@ steps: name: image-tag - depends_on: - image-tag - image: cstyan/ecr + image: tlinhart/drone-ecr-public name: build-lambda-promtail-image privileged: true settings: @@ -1000,7 +1000,7 @@ steps: - refs/tags/v* - depends_on: - image-tag - image: cstyan/ecr + image: tlinhart/drone-ecr-public name: publish-lambda-promtail-image privileged: true settings: @@ -1041,7 +1041,7 @@ steps: name: image-tag - depends_on: - image-tag - image: cstyan/ecr + image: tlinhart/drone-ecr-public name: build-lambda-promtail-image privileged: true settings: @@ -1062,7 +1062,7 @@ steps: - refs/tags/v* - depends_on: - image-tag - image: cstyan/ecr + image: tlinhart/drone-ecr-public name: publish-lambda-promtail-image privileged: true settings: From e2c5a9b0d0dc90018264138d0c739e86bf75a117 Mon Sep 17 00:00:00 2001 From: Callum Styan Date: Thu, 17 Feb 2022 12:07:08 -0800 Subject: [PATCH 05/17] reverse previous commit Signed-off-by: Callum Styan --- .drone/drone.jsonnet | 2 +- .drone/drone.yml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.drone/drone.jsonnet b/.drone/drone.jsonnet index e1f0504780443..4751c81202690 100644 --- a/.drone/drone.jsonnet +++ b/.drone/drone.jsonnet @@ -83,7 +83,7 @@ local clients_docker(arch, app) = { local lambda_promtail_ecr(app) = { name: '%s-image' % if $.settings.dry_run then 'build-' + app else 'publish-' + app, - image: 'tlinhart/drone-ecr-public', + image: 'cstyan/ecr', privileged: true, settings: { repo: 'public.ecr.aws/grafana/lambda-promtail', diff --git a/.drone/drone.yml b/.drone/drone.yml index 08051a93c0eaf..786133d674f60 100644 --- a/.drone/drone.yml +++ b/.drone/drone.yml @@ -979,7 +979,7 @@ steps: name: image-tag - depends_on: - image-tag - image: tlinhart/drone-ecr-public + image: cstyan/ecr name: build-lambda-promtail-image privileged: true settings: @@ -1000,7 +1000,7 @@ steps: - refs/tags/v* - depends_on: - image-tag - image: tlinhart/drone-ecr-public + image: cstyan/ecr name: publish-lambda-promtail-image privileged: true settings: @@ -1041,7 +1041,7 @@ steps: name: image-tag - depends_on: - image-tag - image: tlinhart/drone-ecr-public + image: cstyan/ecr name: build-lambda-promtail-image privileged: true settings: @@ -1062,7 +1062,7 @@ steps: - refs/tags/v* - depends_on: - image-tag - image: tlinhart/drone-ecr-public + image: cstyan/ecr name: publish-lambda-promtail-image privileged: true settings: @@ -1129,6 +1129,6 @@ kind: secret name: deploy_config --- kind: signature -hmac: ca18b0336abbfa2af076bcf301c13450ce1a8cdad68b0d7c4a5a3e6fbb6a3140 +hmac: 9426d6c35e6147d2cd8bfbcec1ed0323d376a8878614a7fbe4c91dd17257ddf9 ... From 3f6ad7abf9e88c924d9cb7176d7025893b5908da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Linhart?= Date: Wed, 13 Apr 2022 14:59:54 +0200 Subject: [PATCH 06/17] Add manifest for ECR Public images --- .drone/docker-manifest-ecr.tmpl | 26 ++++++++++++ .drone/drone.jsonnet | 70 +++++++++++++++++++++++++++++++-- 2 files changed, 93 insertions(+), 3 deletions(-) create mode 100644 .drone/docker-manifest-ecr.tmpl diff --git a/.drone/docker-manifest-ecr.tmpl b/.drone/docker-manifest-ecr.tmpl new file mode 100644 index 0000000000000..0d91c91f9957c --- /dev/null +++ b/.drone/docker-manifest-ecr.tmpl @@ -0,0 +1,26 @@ +image: public.ecr.aws/grafana/{{config.target}}:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}{{build.branch}}-{{substr 0 7 build.commit}}{{/if}} +tags: + - main +{{#if build.tag}} + - latest +{{/if}} +{{#if build.tags}} +{{#each build.tags}} + - {{this}} +{{/each}} +{{/if}} +manifests: + - image: public.ecr.aws/grafana/{{config.target}}:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}{{build.branch}}-{{substr 0 7 build.commit}}{{/if}}-amd64 + platform: + architecture: amd64 + os: linux + - image: public.ecr.aws/grafana/{{config.target}}:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}{{build.branch}}-{{substr 0 7 build.commit}}{{/if}}-arm64 + platform: + architecture: arm64 + os: linux + variant: v8 + - image: public.ecr.aws/grafana/{{config.target}}:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}{{build.branch}}-{{substr 0 7 build.commit}}{{/if}}-arm + platform: + architecture: arm + os: linux + variant: v7 diff --git a/.drone/drone.jsonnet b/.drone/drone.jsonnet index 4751c81202690..f37bcf2e3d2ca 100644 --- a/.drone/drone.jsonnet +++ b/.drone/drone.jsonnet @@ -229,7 +229,7 @@ local promtail(arch) = pipeline('promtail-' + arch) + arch_image(arch) { depends_on: ['check'], }; -local lambda_promtail(arch, tags='') = pipeline('lambda-promtail-' + arch) + arch_image(arch, tags) { +local lambda_promtail(arch) = pipeline('lambda-promtail-' + arch) + arch_image(arch) { steps+: [ // dry run for everything that is not tag or main lambda_promtail_ecr('lambda-promtail') { @@ -306,6 +306,54 @@ local manifest(apps) = pipeline('manifest') { ], }; +local manifest_ecr(apps, archs) = pipeline('manifest-ecr') { + steps: std.foldl( + function(acc, app) acc + [{ + name: 'manifest-' + app, + image: 'plugins/manifest', + volumes: { + name: 'dockerconf', + path: '/.docker', + }, + settings: { + // the target parameter is abused for the app's name, + // as it is unused in spec mode. See docker-manifest-ecr.tmpl + target: app, + spec: '.drone/docker-manifest-ecr.tmpl', + ignore_missing: true, + }, + depends_on: ['clone'] + ( + // Depend on the previous app, if any. + if std.length(acc) > 0 + then [acc[std.length(acc) - 1].name] + else [] + ), + }], + apps, + [{ + name: 'ecr-login', + image: 'docker:dind', + volumes: { + name: 'dockerconf', + path: '/root/.docker', + }, + environment: { + AWS_ACCESS_KEY_ID: { from_secret: ecr_key.name }, + AWS_SECRET_ACCESS_KEY: { from_secret: ecr_secret_key.name }, + }, + commands: [ + 'apk add --no-cache aws-cli', + 'docker login --username AWS --password $(aws ecr-public get-login-password --region us-east-1) public.ecr.aws', + ], + depends_on: ['clone'], + }], + ), + depends_on: [ + 'lambda-promtail-%s' % arch + for arch in archs + ], +}; + [ pipeline('loki-build-image') { workspace: { @@ -451,5 +499,21 @@ local manifest(apps) = pipeline('manifest') { ], }, ] + [promtail_win()] -+ [lambda_promtail(arch, 'main') for arch in ['amd64', 'arm64']] -+ [github_secret, pull_secret, docker_username_secret, docker_password_secret, ecr_key, ecr_secret_key, deploy_configuration] ++ [ + lambda_promtail(arch) + for arch in ['amd64', 'arm64'] +] + [ + manifest_ecr(['lambda-promtail'], ['amd64', 'arm64']) { + trigger: condition('include').tagMain { + event: ['push'], + }, + }, +] + [ + github_secret, + pull_secret, + docker_username_secret, + docker_password_secret, + ecr_key, + ecr_secret_key, + deploy_configuration, +] From 0b5d0341aeb4ca9ca9f5be9bec005ddd6cd2de91 Mon Sep 17 00:00:00 2001 From: Callum Styan Date: Wed, 13 Apr 2022 12:18:10 -0700 Subject: [PATCH 07/17] Minor change to drone.yml for volume mounts + generate drone.jsonnet again. Signed-off-by: Callum Styan --- .drone/drone.jsonnet | 8 ++++---- .drone/drone.yml | 47 +++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 48 insertions(+), 7 deletions(-) diff --git a/.drone/drone.jsonnet b/.drone/drone.jsonnet index f37bcf2e3d2ca..12904c55229a5 100644 --- a/.drone/drone.jsonnet +++ b/.drone/drone.jsonnet @@ -311,10 +311,10 @@ local manifest_ecr(apps, archs) = pipeline('manifest-ecr') { function(acc, app) acc + [{ name: 'manifest-' + app, image: 'plugins/manifest', - volumes: { + volumes: [{ name: 'dockerconf', path: '/.docker', - }, + },], settings: { // the target parameter is abused for the app's name, // as it is unused in spec mode. See docker-manifest-ecr.tmpl @@ -333,10 +333,10 @@ local manifest_ecr(apps, archs) = pipeline('manifest-ecr') { [{ name: 'ecr-login', image: 'docker:dind', - volumes: { + volumes: [{ name: 'dockerconf', path: '/root/.docker', - }, + },], environment: { AWS_ACCESS_KEY_ID: { from_secret: ecr_key.name }, AWS_SECRET_ACCESS_KEY: { from_secret: ecr_secret_key.name }, diff --git a/.drone/drone.yml b/.drone/drone.yml index 786133d674f60..ee9857fc0ce87 100644 --- a/.drone/drone.yml +++ b/.drone/drone.yml @@ -974,7 +974,6 @@ steps: - apk add --no-cache bash git - git fetch origin --tags - echo $(./tools/image-tag)-amd64 > .tags - - echo ",main" >> .tags image: alpine name: image-tag - depends_on: @@ -1036,7 +1035,6 @@ steps: - 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: @@ -1086,6 +1084,49 @@ trigger: - push - pull_request --- +depends_on: +- lambda-promtail-amd64 +- lambda-promtail-arm64 +kind: pipeline +name: manifest-ecr +steps: +- commands: + - apk add --no-cache aws-cli + - docker login --username AWS --password $(aws ecr-public get-login-password --region + us-east-1) public.ecr.aws + depends_on: + - clone + environment: + AWS_ACCESS_KEY_ID: + from_secret: ecr_key + AWS_SECRET_ACCESS_KEY: + from_secret: ecr_secret_key + image: docker:dind + name: ecr-login + volumes: + - name: dockerconf + path: /root/.docker +- depends_on: + - clone + - ecr-login + image: plugins/manifest + name: manifest-lambda-promtail + settings: + ignore_missing: true + spec: .drone/docker-manifest-ecr.tmpl + target: lambda-promtail + volumes: + - name: dockerconf + path: /.docker +trigger: + event: + - push + ref: + include: + - refs/heads/main + - refs/heads/k?? + - refs/tags/v* +--- get: name: pat path: infra/data/ci/github/grafanabot @@ -1129,6 +1170,6 @@ kind: secret name: deploy_config --- kind: signature -hmac: 9426d6c35e6147d2cd8bfbcec1ed0323d376a8878614a7fbe4c91dd17257ddf9 +hmac: 757a1016e9c3e6f2ba72b57a849face119f2a19318827123396107ed84411708 ... From 9a0103891c1f2dfdd116aa56419bd9e61ff1dd9c Mon Sep 17 00:00:00 2001 From: Callum Styan Date: Wed, 13 Apr 2022 12:22:25 -0700 Subject: [PATCH 08/17] temp, test drone changes without having to push to main branch Signed-off-by: Callum Styan --- .drone/drone.jsonnet | 6 +++--- .drone/drone.yml | 8 ++------ 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/.drone/drone.jsonnet b/.drone/drone.jsonnet index 12904c55229a5..d978ae741a28f 100644 --- a/.drone/drone.jsonnet +++ b/.drone/drone.jsonnet @@ -504,9 +504,9 @@ local manifest_ecr(apps, archs) = pipeline('manifest-ecr') { for arch in ['amd64', 'arm64'] ] + [ manifest_ecr(['lambda-promtail'], ['amd64', 'arm64']) { - trigger: condition('include').tagMain { - event: ['push'], - }, + // trigger: condition('include').tagMain { + // event: ['push'], + // }, }, ] + [ github_secret, diff --git a/.drone/drone.yml b/.drone/drone.yml index ee9857fc0ce87..b27727d67f48b 100644 --- a/.drone/drone.yml +++ b/.drone/drone.yml @@ -1121,11 +1121,7 @@ steps: trigger: event: - push - ref: - include: - - refs/heads/main - - refs/heads/k?? - - refs/tags/v* + - pull_request --- get: name: pat @@ -1170,6 +1166,6 @@ kind: secret name: deploy_config --- kind: signature -hmac: 757a1016e9c3e6f2ba72b57a849face119f2a19318827123396107ed84411708 +hmac: 5739e12cb87751c5b8ce5b236872586cd725b4a79d215ada64ac7135c5f722cd ... From 604276aa923d76a66ecbf9fde3b7931c39c079ca Mon Sep 17 00:00:00 2001 From: Callum Styan Date: Wed, 13 Apr 2022 12:46:28 -0700 Subject: [PATCH 09/17] Fix linting issues Signed-off-by: Callum Styan --- .drone/drone.jsonnet | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.drone/drone.jsonnet b/.drone/drone.jsonnet index da4877f2811ef..50929505c7240 100644 --- a/.drone/drone.jsonnet +++ b/.drone/drone.jsonnet @@ -338,7 +338,7 @@ local manifest_ecr(apps, archs) = pipeline('manifest-ecr') { volumes: [{ name: 'dockerconf', path: '/.docker', - },], + }], settings: { // the target parameter is abused for the app's name, // as it is unused in spec mode. See docker-manifest-ecr.tmpl @@ -360,7 +360,7 @@ local manifest_ecr(apps, archs) = pipeline('manifest-ecr') { volumes: [{ name: 'dockerconf', path: '/root/.docker', - },], + }], environment: { AWS_ACCESS_KEY_ID: { from_secret: ecr_key.name }, AWS_SECRET_ACCESS_KEY: { from_secret: ecr_secret_key.name }, From a240b732244f0e5bf91bf790134ed3d7270e73be Mon Sep 17 00:00:00 2001 From: Callum Styan Date: Wed, 13 Apr 2022 13:01:43 -0700 Subject: [PATCH 10/17] temp, push the lambda-promtail images always so we can test the manifest task Signed-off-by: Callum Styan --- .drone/drone.jsonnet | 2 +- .drone/drone.yml | 14 +------------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/.drone/drone.jsonnet b/.drone/drone.jsonnet index 50929505c7240..767eb908bdfdc 100644 --- a/.drone/drone.jsonnet +++ b/.drone/drone.jsonnet @@ -267,7 +267,7 @@ local lambda_promtail(arch) = pipeline('lambda-promtail-' + arch) + arch_image(a // publish for tag or main lambda_promtail_ecr('lambda-promtail') { depends_on: ['image-tag'], - when: condition('include').tagMain, + // when: condition('include').tagMain, settings+: {}, }, ], diff --git a/.drone/drone.yml b/.drone/drone.yml index b70d7cb77ec3c..433e28ce7a1f3 100644 --- a/.drone/drone.yml +++ b/.drone/drone.yml @@ -1065,12 +1065,6 @@ steps: 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 @@ -1127,12 +1121,6 @@ steps: 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 @@ -1222,6 +1210,6 @@ kind: secret name: deploy_config --- kind: signature -hmac: e892094649b59c07210f1db262662e506cf389f45b74cfc58c7f1226d51571a3 +hmac: 478dc9ae6430f5b9b460c1f73e406a042f4621c8b1c72fb1d0734aeb6d0669d3 ... From 33763a28535f7eb1648ec668abd013d7454fe773 Mon Sep 17 00:00:00 2001 From: Callum Styan Date: Wed, 13 Apr 2022 13:18:14 -0700 Subject: [PATCH 11/17] We don't build a base arm image, only arm64 Signed-off-by: Callum Styan --- .drone/docker-manifest-ecr.tmpl | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.drone/docker-manifest-ecr.tmpl b/.drone/docker-manifest-ecr.tmpl index 0d91c91f9957c..1c8c98417ac05 100644 --- a/.drone/docker-manifest-ecr.tmpl +++ b/.drone/docker-manifest-ecr.tmpl @@ -19,8 +19,3 @@ manifests: architecture: arm64 os: linux variant: v8 - - image: public.ecr.aws/grafana/{{config.target}}:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}{{build.branch}}-{{substr 0 7 build.commit}}{{/if}}-arm - platform: - architecture: arm - os: linux - variant: v7 From 730ee368ae26cfa346152853ab70db58e499133b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Linhart?= Date: Thu, 14 Apr 2022 12:38:29 +0200 Subject: [PATCH 12/17] Add volumes definition to ECR manifest pipeline --- .drone/drone.jsonnet | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.drone/drone.jsonnet b/.drone/drone.jsonnet index 767eb908bdfdc..8ec8112d02d6f 100644 --- a/.drone/drone.jsonnet +++ b/.drone/drone.jsonnet @@ -372,6 +372,10 @@ local manifest_ecr(apps, archs) = pipeline('manifest-ecr') { depends_on: ['clone'], }], ), + volumes: [{ + name: 'dockerconf', + temp: {}, + }], depends_on: [ 'lambda-promtail-%s' % arch for arch in archs From 39bb9bef2206fe67e3e2eaf03e9ad60f7f950965 Mon Sep 17 00:00:00 2001 From: Callum Styan Date: Thu, 14 Apr 2022 12:29:49 -0700 Subject: [PATCH 13/17] Regenerate drone.yml with Tomas' most recent commit Signed-off-by: Callum Styan --- .drone/drone.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.drone/drone.yml b/.drone/drone.yml index 433e28ce7a1f3..535dfdf7d1861 100644 --- a/.drone/drone.yml +++ b/.drone/drone.yml @@ -1166,6 +1166,9 @@ trigger: - push - pull_request - tag +volumes: +- name: dockerconf + temp: {} --- get: name: pat @@ -1210,6 +1213,6 @@ kind: secret name: deploy_config --- kind: signature -hmac: 478dc9ae6430f5b9b460c1f73e406a042f4621c8b1c72fb1d0734aeb6d0669d3 +hmac: e98ddc9174d237a28edf544b30008645e2732b57640af1835c383c87bcd48dc9 ... From 15a7bd0c74c05d8259fe019a4907016462bba097 Mon Sep 17 00:00:00 2001 From: Callum Styan Date: Thu, 14 Apr 2022 13:11:07 -0700 Subject: [PATCH 14/17] Test some some drone changes. Signed-off-by: Callum Styan --- .drone/drone.jsonnet | 17 +++++++++-------- .drone/drone.yml | 45 ++------------------------------------------ 2 files changed, 11 insertions(+), 51 deletions(-) diff --git a/.drone/drone.jsonnet b/.drone/drone.jsonnet index 8ec8112d02d6f..0b44b3212630a 100644 --- a/.drone/drone.jsonnet +++ b/.drone/drone.jsonnet @@ -256,14 +256,14 @@ local promtail(arch) = pipeline('promtail-' + arch) + arch_image(arch) { local lambda_promtail(arch) = pipeline('lambda-promtail-' + arch) + arch_image(arch) { steps+: [ // dry run for everything that is not tag or main - lambda_promtail_ecr('lambda-promtail') { - depends_on: ['image-tag'], - when: condition('exclude').tagMain, - settings+: { - dry_run: true, - }, - }, - ] + [ + // lambda_promtail_ecr('lambda-promtail') { + // depends_on: ['image-tag'], + // when: condition('exclude').tagMain, + // settings+: { + // dry_run: true, + // }, + // }, + // ] + [ // publish for tag or main lambda_promtail_ecr('lambda-promtail') { depends_on: ['image-tag'], @@ -493,6 +493,7 @@ local manifest_ecr(apps, archs) = pipeline('manifest-ecr') { commands: [ 'apk add --no-cache bash git', 'git fetch origin --tags', + 'echo $(./tools/image-tag)', 'echo $(./tools/image-tag) > .tag', ], depends_on: ['clone'], diff --git a/.drone/drone.yml b/.drone/drone.yml index 535dfdf7d1861..4d4ed4d6d8d74 100644 --- a/.drone/drone.yml +++ b/.drone/drone.yml @@ -968,6 +968,7 @@ steps: - commands: - apk add --no-cache bash git - git fetch origin --tags + - echo $(./tools/image-tag) - echo $(./tools/image-tag) > .tag depends_on: - clone @@ -1029,27 +1030,6 @@ steps: - echo $(./tools/image-tag)-amd64 > .tags image: alpine name: image-tag -- depends_on: - - image-tag - image: cstyan/ecr - name: build-lambda-promtail-image - 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 @@ -1085,27 +1065,6 @@ steps: - echo $(./tools/image-tag)-arm64 > .tags image: alpine name: image-tag -- depends_on: - - image-tag - image: cstyan/ecr - name: build-lambda-promtail-image - 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 @@ -1213,6 +1172,6 @@ kind: secret name: deploy_config --- kind: signature -hmac: e98ddc9174d237a28edf544b30008645e2732b57640af1835c383c87bcd48dc9 +hmac: e26d025503f2d6b6e3aed4ea3396dcbf45a0c332e30b93a968f2bca517e52385 ... From 9c908daf7d6c8b3a138e9e7bf9ee5578ac5e281f Mon Sep 17 00:00:00 2001 From: Callum Styan Date: Sun, 17 Apr 2022 16:21:49 -0700 Subject: [PATCH 15/17] fix lint error in drone.jsonnet Signed-off-by: Callum Styan --- .drone/drone.jsonnet | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone/drone.jsonnet b/.drone/drone.jsonnet index 0b44b3212630a..a139c648dfa22 100644 --- a/.drone/drone.jsonnet +++ b/.drone/drone.jsonnet @@ -263,7 +263,7 @@ local lambda_promtail(arch) = pipeline('lambda-promtail-' + arch) + arch_image(a // dry_run: true, // }, // }, - // ] + [ + // ] + [ // publish for tag or main lambda_promtail_ecr('lambda-promtail') { depends_on: ['image-tag'], From 17d2382d5b7ca8d0c1eeb607670a46b5144c6c08 Mon Sep 17 00:00:00 2001 From: Callum Styan Date: Sun, 17 Apr 2022 16:54:54 -0700 Subject: [PATCH 16/17] Drop out one of my more recent test changes. Signed-off-by: Callum Styan --- .drone/drone.jsonnet | 16 ++++++++-------- .drone/drone.yml | 44 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 51 insertions(+), 9 deletions(-) diff --git a/.drone/drone.jsonnet b/.drone/drone.jsonnet index a139c648dfa22..5a4ea4fa1ca32 100644 --- a/.drone/drone.jsonnet +++ b/.drone/drone.jsonnet @@ -256,14 +256,14 @@ local promtail(arch) = pipeline('promtail-' + arch) + arch_image(arch) { local lambda_promtail(arch) = pipeline('lambda-promtail-' + arch) + arch_image(arch) { steps+: [ // dry run for everything that is not tag or main - // lambda_promtail_ecr('lambda-promtail') { - // depends_on: ['image-tag'], - // when: condition('exclude').tagMain, - // settings+: { - // dry_run: true, - // }, - // }, - // ] + [ + lambda_promtail_ecr('lambda-promtail') { + depends_on: ['image-tag'], + when: condition('exclude').tagMain, + settings+: { + dry_run: true, + }, + }, + ] + [ // publish for tag or main lambda_promtail_ecr('lambda-promtail') { depends_on: ['image-tag'], diff --git a/.drone/drone.yml b/.drone/drone.yml index 4d4ed4d6d8d74..0e8090dd7cb74 100644 --- a/.drone/drone.yml +++ b/.drone/drone.yml @@ -1030,6 +1030,27 @@ steps: - echo $(./tools/image-tag)-amd64 > .tags image: alpine name: image-tag +- depends_on: + - image-tag + image: cstyan/ecr + name: build-lambda-promtail-image + 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 @@ -1065,6 +1086,27 @@ steps: - echo $(./tools/image-tag)-arm64 > .tags image: alpine name: image-tag +- depends_on: + - image-tag + image: cstyan/ecr + name: build-lambda-promtail-image + 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 @@ -1172,6 +1214,6 @@ kind: secret name: deploy_config --- kind: signature -hmac: e26d025503f2d6b6e3aed4ea3396dcbf45a0c332e30b93a968f2bca517e52385 +hmac: 148248704c13a760220b6375dab1c7b498ca47dba64f9330cd75ccf6a8fd14ef ... From f47d91a2a08d5dc2b9eb904b99b20a74e0097c90 Mon Sep 17 00:00:00 2001 From: Callum Styan Date: Wed, 15 Jun 2022 13:56:52 -0700 Subject: [PATCH 17/17] Regenerate drone config. Signed-off-by: Callum Styan --- .drone/drone.jsonnet | 8 ++++---- .drone/drone.yml | 21 ++++++++++++++++++--- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/.drone/drone.jsonnet b/.drone/drone.jsonnet index 5a4ea4fa1ca32..643c3a4e09427 100644 --- a/.drone/drone.jsonnet +++ b/.drone/drone.jsonnet @@ -267,7 +267,7 @@ local lambda_promtail(arch) = pipeline('lambda-promtail-' + arch) + arch_image(a // publish for tag or main lambda_promtail_ecr('lambda-promtail') { depends_on: ['image-tag'], - // when: condition('include').tagMain, + when: condition('include').tagMain, settings+: {}, }, ], @@ -516,9 +516,9 @@ local manifest_ecr(apps, archs) = pipeline('manifest-ecr') { for arch in ['amd64', 'arm64'] ] + [ manifest_ecr(['lambda-promtail'], ['amd64', 'arm64']) { - // trigger: condition('include').tagMain { - // event: ['push'], - // }, + trigger: condition('include').tagMain { + event: ['push'], + }, }, ] + [ github_secret, diff --git a/.drone/drone.yml b/.drone/drone.yml index 0e8090dd7cb74..44b6e7daef0d9 100644 --- a/.drone/drone.yml +++ b/.drone/drone.yml @@ -1066,6 +1066,12 @@ steps: 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 @@ -1122,6 +1128,12 @@ steps: 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 @@ -1165,8 +1177,11 @@ steps: trigger: event: - push - - pull_request - - tag + ref: + include: + - refs/heads/main + - refs/heads/k?? + - refs/tags/v* volumes: - name: dockerconf temp: {} @@ -1214,6 +1229,6 @@ kind: secret name: deploy_config --- kind: signature -hmac: 148248704c13a760220b6375dab1c7b498ca47dba64f9330cd75ccf6a8fd14ef +hmac: eb40205df6ed6142c474536e1bc42c71411c6acf15e66274d43a38bccbeee711 ...