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

Push commit hash docker image on pushes to main #768

Merged
merged 2 commits into from
Sep 28, 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
70 changes: 48 additions & 22 deletions .drone/drone.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -42,27 +42,29 @@ local pipeline(name) = {
steps: [],
};

local docker(arch) = pipeline('docker-' + arch) {
platform: {
os: 'linux',
arch: arch,
},
steps: [
go('fetch-tags', ['git fetch origin --tags']),
make('static'),
{
name: 'container',
image: 'plugins/docker',
settings: {
repo: 'grafana/tanka',
auto_tag: true,
auto_tag_suffix: arch,
username: { from_secret: vault.dockerhub_username },
password: { from_secret: vault.dockerhub_password },
},
local docker(arch, depends_on=[]) =
pipeline('docker-' + arch) {
platform: {
os: 'linux',
arch: arch,
},
],
};
steps: [
go('fetch-tags', ['git fetch origin --tags']),
make('static'),
{
name: 'container',
image: 'plugins/docker',
settings: {
repo: 'grafana/tanka',
auto_tag: true,
auto_tag_suffix: arch,
username: { from_secret: vault.dockerhub_username },
password: { from_secret: vault.dockerhub_password },
},
},
],
depends_on: depends_on,
};

[
pipeline('check') {
Expand Down Expand Up @@ -92,8 +94,32 @@ local docker(arch) = pipeline('docker-' + arch) {
],
} + { depends_on: ['check'] } + constraints.tags,

docker('amd64') { depends_on: ['check'] } + constraints.tags + constraints.mainPush,
docker('arm64') { depends_on: ['check'] } + constraints.tags + constraints.mainPush,
docker('amd64', depends_on=['check']) + constraints.tags + constraints.mainPush,
docker('arm64', depends_on=['check']) + constraints.tags + constraints.mainPush,

pipeline('manifest-main') {
steps: [
go('fetch-tags', [
'git fetch origin --tags',
'echo "main-$(git describe --tags)" > .tags',
]),
{
name: 'manifest',
image: 'plugins/manifest',
settings: {
ignore_missing: true,
spec: '.drone/docker-manifest.tmpl',
username: { from_secret: vault.dockerhub_username },
password: { from_secret: vault.dockerhub_password },
},
},
],
} + {
depends_on: [
'docker-amd64',
'docker-arm64',
],
} + constraints.mainPush,

pipeline('manifest') {
steps: [{
Expand Down
32 changes: 31 additions & 1 deletion .drone/drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,36 @@ depends_on:
- docker-amd64
- docker-arm64
kind: pipeline
name: manifest-main
steps:
- commands:
- git fetch origin --tags
- echo "main-$(git describe --tags)" > .tags
image: golang:1.19
name: fetch-tags
volumes:
- name: gopath
path: /go
- image: plugins/manifest
name: manifest
settings:
ignore_missing: true
password:
from_secret: dockerhub_password
spec: .drone/docker-manifest.tmpl
username:
from_secret: dockerhub_username
trigger:
ref:
- refs/heads/main
volumes:
- name: gopath
temp: {}
---
depends_on:
- docker-amd64
- docker-arm64
kind: pipeline
name: manifest
steps:
- image: plugins/manifest
Expand Down Expand Up @@ -252,6 +282,6 @@ kind: secret
name: dockerhub_password
---
kind: signature
hmac: 9d1c433944d46ded93d8637f570568e8a9e9887d4a4b3c790a25e9c83cd58921
hmac: adbd6c28d92efbf2968766102c5abe0bbad5a4af1c76e84ada59b2c5cf9c958d

...