-
Notifications
You must be signed in to change notification settings - Fork 510
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for multi-arch/arm64 images (#552)
* drone Signed-off-by: Joe Elliott <number101010@gmail.com> * /wave * yaml cleanup Signed-off-by: Joe Elliott <number101010@gmail.com> * Require arch to image-tags Signed-off-by: Joe Elliott <number101010@gmail.com> * Revert "Require arch to image-tags" This reverts commit 8143bf4. * reverse course! image-tag doesn't take arch Signed-off-by: Joe Elliott <number101010@gmail.com> * changed path Signed-off-by: Joe Elliott <number101010@gmail.com> * added tags to manifest Signed-off-by: Joe Elliott <number101010@gmail.com> * fixed path to template Signed-off-by: Joe Elliott <number101010@gmail.com> * fixed to only support one build tag Signed-off-by: Joe Elliott <number101010@gmail.com> * reference build tags differently Signed-off-by: Joe Elliott <number101010@gmail.com> * Linusw Torvalds would not approve Signed-off-by: Joe Elliott <number101010@gmail.com> * Added readme Signed-off-by: Joe Elliott <number101010@gmail.com>
- Loading branch information
1 parent
f44fb72
commit 7182326
Showing
5 changed files
with
241 additions
and
86 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
image: grafana/{{config.target}} | ||
tags: | ||
- latest | ||
- {{build.tags}} | ||
manifests: | ||
- image: grafana/{{config.target}}:{{build.tags}}-amd64 | ||
platform: | ||
architecture: amd64 | ||
os: linux | ||
- image: grafana/{{config.target}}:{{build.tags}}-arm64 | ||
platform: | ||
architecture: arm64 | ||
os: linux |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,193 @@ | ||
--- | ||
## AMD64 ## | ||
kind: pipeline | ||
name: docker-amd64 | ||
|
||
platform: | ||
os: linux | ||
arch: amd64 | ||
|
||
steps: | ||
- name: image-tag | ||
image: alpine/git | ||
commands: | ||
- git fetch origin --tags | ||
- echo $(./tools/image-tag)-amd64 > .tags | ||
|
||
# binaries | ||
- name: build-tempo-binaries | ||
image: golang:1.15.3-alpine | ||
commands: | ||
- apk add make git | ||
- COMPONENT=tempo GOARCH=amd64 make exe | ||
- COMPONENT=tempo-query GOARCH=amd64 make exe | ||
- COMPONENT=tempo-vulture GOARCH=amd64 make exe | ||
|
||
# docker images | ||
- name: build-tempo-image | ||
image: plugins/docker | ||
settings: | ||
dockerfile: cmd/tempo/Dockerfile | ||
repo: grafana/tempo | ||
username: | ||
from_secret: docker_username | ||
password: | ||
from_secret: docker_password | ||
build_args: | ||
- TARGETARCH=amd64 | ||
|
||
- name: build-tempo-query-image | ||
image: plugins/docker | ||
settings: | ||
dockerfile: cmd/tempo-query/Dockerfile | ||
repo: grafana/tempo-query | ||
username: | ||
from_secret: docker_username | ||
password: | ||
from_secret: docker_password | ||
build_args: | ||
- TARGETARCH=amd64 | ||
|
||
- name: build-tempo-vulture-image | ||
image: plugins/docker | ||
settings: | ||
dockerfile: cmd/tempo-vulture/Dockerfile | ||
repo: grafana/tempo-vulture | ||
username: | ||
from_secret: docker_username | ||
password: | ||
from_secret: docker_password | ||
build_args: | ||
- TARGETARCH=amd64 | ||
|
||
--- | ||
## ARM64 ## | ||
kind: pipeline | ||
name: docker-arm64 | ||
|
||
platform: | ||
os: linux | ||
arch: arm64 | ||
|
||
steps: | ||
- name: image-tag | ||
image: alpine/git | ||
commands: | ||
- git fetch origin --tags | ||
- echo $(./tools/image-tag)-arm64 > .tags | ||
|
||
# binaries | ||
- name: build-tempo-binaries | ||
image: golang:1.15.3-alpine | ||
commands: | ||
- apk add make git | ||
- COMPONENT=tempo GOARCH=arm64 make exe | ||
- COMPONENT=tempo-query GOARCH=arm64 make exe | ||
- COMPONENT=tempo-vulture GOARCH=arm64 make exe | ||
|
||
# docker images | ||
- name: build-tempo-image | ||
image: plugins/docker | ||
settings: | ||
dockerfile: cmd/tempo/Dockerfile | ||
repo: grafana/tempo | ||
username: | ||
from_secret: docker_username | ||
password: | ||
from_secret: docker_password | ||
build_args: | ||
- TARGETARCH=arm64 | ||
|
||
- name: build-tempo-query-image | ||
image: plugins/docker | ||
settings: | ||
dockerfile: cmd/tempo-query/Dockerfile | ||
repo: grafana/tempo-query | ||
username: | ||
from_secret: docker_username | ||
password: | ||
from_secret: docker_password | ||
build_args: | ||
- TARGETARCH=arm64 | ||
|
||
- name: build-tempo-vulture-image | ||
image: plugins/docker | ||
settings: | ||
dockerfile: cmd/tempo-vulture/Dockerfile | ||
repo: grafana/tempo-vulture | ||
username: | ||
from_secret: docker_username | ||
password: | ||
from_secret: docker_password | ||
build_args: | ||
- TARGETARCH=arm64 | ||
|
||
--- | ||
## MANIFEST ## | ||
kind: pipeline | ||
name: manifest | ||
|
||
platform: | ||
os: linux | ||
arch: amd64 | ||
|
||
steps: | ||
- name: image-tag | ||
image: alpine/git | ||
commands: | ||
- git fetch origin --tags | ||
- echo $(./tools/image-tag) > .tags | ||
|
||
- name: manifest-tempo | ||
image: plugins/manifest | ||
settings: | ||
username: | ||
from_secret: docker_username | ||
password: | ||
from_secret: docker_password | ||
spec: .drone/docker-manifest.tmpl | ||
target: tempo | ||
|
||
- name: manifest-tempo-query | ||
image: plugins/manifest | ||
settings: | ||
username: | ||
from_secret: docker_username | ||
password: | ||
from_secret: docker_password | ||
spec: .drone/docker-manifest.tmpl | ||
target: tempo-query | ||
|
||
- name: manifest-tempo-vulture | ||
image: plugins/manifest | ||
settings: | ||
username: | ||
from_secret: docker_username | ||
password: | ||
from_secret: docker_password | ||
spec: .drone/docker-manifest.tmpl | ||
target: tempo-vulture | ||
|
||
depends_on: | ||
- docker-amd64 | ||
- docker-arm64 | ||
|
||
--- | ||
kind: secret | ||
name: docker_username | ||
|
||
get: | ||
path: infra/data/ci/docker_hub | ||
name: username | ||
|
||
--- | ||
kind: secret | ||
name: docker_password | ||
|
||
get: | ||
path: infra/data/ci/docker_hub | ||
name: password | ||
|
||
--- | ||
kind: signature | ||
hmac: 7b4fba65b74d2143b31f7f03d3a1cfbccba6960b0037cee65a7406df9f507370 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Drone | ||
|
||
Drone is used for our building our official dockerhub images. It is broken into 3 | ||
pipelines. Note that none of the pipelines include testing so it's important that | ||
the codebase is otherwise tested when it begins this process. Currently we use GHA | ||
for testing on PR and only build the master branch. | ||
|
||
# Pipelines | ||
|
||
The pipelines are docker-amd64, docker-arm64, and manifest. The two docker pipelines | ||
run concurrently and create images tagged like this: `tempo:<tag>-<arch>`. e.g. | ||
`tempo-2.3.0-arm64` or `tempo-e2a314-amd64`. The manifest step then creates a manifest | ||
that combines the mentioned images into one multiarch image named as you would expect: | ||
`tempo-2.3.0` or `tempo-e2a314`. | ||
|
||
The documentation on the manifest step is basically non-existent. There's some very | ||
weak documentation in the drone docs, but it's not even worth looking at. To understand | ||
how to use the manifest step I'd recommend looking at the code itself: | ||
|
||
https://github.com/drone-plugins/drone-manifest | ||
|
||
It is a very simple wrapper that takes the configuration options and runs the following | ||
cli tool: | ||
|
||
https://github.com/estesp/manifest-tool | ||
|
||
`docker-manifest.tmpl` is pushed through the standard go templating library with access | ||
to these objects: https://github.com/drone-plugins/drone-manifest/blob/master/plugin.go#L23 | ||
|
||
# Future work | ||
|
||
If we extend this any further we should probably generate drone.yml. It has a lot of | ||
repeated lines that will become difficult to maintain. Currently loki uses a jsonnet file | ||
and we should perhaps follow suit: https://github.com/grafana/loki/blob/master/.drone/drone.jsonnet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters