Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for ARM64 to lambda-promtail drone build job #5354

Merged
merged 19 commits into from
Jun 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .drone/docker-manifest-ecr.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
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
85 changes: 73 additions & 12 deletions .drone/drone.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -257,17 +257,9 @@ local promtail(arch) = pipeline('promtail-' + arch) + arch_image(arch) {
depends_on: ['check'],
};

local lambda_promtail(tags='') = pipeline('lambda-promtail') {
local lambda_promtail(arch) = pipeline('lambda-promtail-' + arch) + arch_image(arch) {
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,
Expand Down Expand Up @@ -342,6 +334,58 @@ 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'],
}],
),
volumes: [{
name: 'dockerconf',
temp: {},
}],
depends_on: [
'lambda-promtail-%s' % arch
for arch in archs
],
};

[
pipeline('loki-build-image') {
workspace: {
Expand Down Expand Up @@ -472,6 +516,7 @@ local manifest(apps) = pipeline('manifest') {
commands: [
'apk add --no-cache bash git',
'git fetch origin --tags',
'echo $(./tools/image-tag)',
'echo $(./tools/image-tag) > .tag',
],
depends_on: ['clone'],
Expand All @@ -489,5 +534,21 @@ local manifest(apps) = pipeline('manifest') {
],
},
] + [promtail_win()]
+ [lambda_promtail('main')]
+ [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,
]
117 changes: 114 additions & 3 deletions .drone/drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1024,6 +1024,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
Expand Down Expand Up @@ -1074,13 +1075,15 @@ 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
- git fetch origin --tags
- echo $(./tools/image-tag)-amd64 > .tags
- echo ",main" >> .tags
image: alpine
name: image-tag
- depends_on:
Expand Down Expand Up @@ -1131,6 +1134,114 @@ trigger:
- pull_request
- tag
---
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
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
- tag
---
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*
volumes:
- name: dockerconf
temp: {}
---
get:
name: pat
path: infra/data/ci/github/grafanabot
Expand Down Expand Up @@ -1174,6 +1285,6 @@ kind: secret
name: deploy_config
---
kind: signature
hmac: 81be9fce60976703815abf1fd2f1c9255a142d615b90d4b5278ff4a64fa25e92
hmac: 8335495d285498f513bb265cf90079175c25f5b6c5717deab7abfae65341726a

...
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ to include only the most relevant.
* [5409](https://github.com/grafana/loki/pull/5409) **ldb**: Enable best effort parsing for Syslog messages
* [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.
Expand Down