diff --git a/.drone/drone.jsonnet b/.drone/drone.jsonnet index 92d647cf1..e736a7775 100644 --- a/.drone/drone.jsonnet +++ b/.drone/drone.jsonnet @@ -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') { @@ -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: [{ diff --git a/.drone/drone.yml b/.drone/drone.yml index 5ac6f2883..bb0b0e73b 100644 --- a/.drone/drone.yml +++ b/.drone/drone.yml @@ -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 @@ -252,6 +282,6 @@ kind: secret name: dockerhub_password --- kind: signature -hmac: 9d1c433944d46ded93d8637f570568e8a9e9887d4a4b3c790a25e9c83cd58921 +hmac: adbd6c28d92efbf2968766102c5abe0bbad5a4af1c76e84ada59b2c5cf9c958d ...