Add drone step for creating & pushing docker manifest list + cleanup (#434)
* add drone step for creating & pushing docker manifest + cleanup * drone sign
This commit is contained in:
parent
2650a09d02
commit
cb2f03eeb8
1 changed files with 98 additions and 50 deletions
144
.drone.yml
144
.drone.yml
|
|
@ -158,17 +158,10 @@ trigger:
|
||||||
---
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: docker
|
type: docker
|
||||||
name: OSS Release
|
name: OSS plugin release
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check Promote
|
- name: build plugin
|
||||||
image: alpine
|
|
||||||
commands:
|
|
||||||
- if [ -z "$DRONE_DEPLOY_TO" ]; then echo "Missing DRONE_DEPLOY_TO (Target)"; exit 1; fi
|
|
||||||
- if [ -z "$DRONE_TAG" ]; then echo "Missing DRONE_TAG"; exit 1; fi
|
|
||||||
- echo Promoting $DRONE_TAG to $DRONE_DEPLOY_TO
|
|
||||||
|
|
||||||
- name: Build Plugin
|
|
||||||
image: node:14.6.0-stretch
|
image: node:14.6.0-stretch
|
||||||
commands:
|
commands:
|
||||||
- apt-get update
|
- apt-get update
|
||||||
|
|
@ -178,23 +171,14 @@ steps:
|
||||||
- yarn --network-timeout 500000
|
- yarn --network-timeout 500000
|
||||||
- yarn build
|
- yarn build
|
||||||
- ls ./
|
- ls ./
|
||||||
depends_on:
|
|
||||||
- Check Promote
|
|
||||||
when:
|
|
||||||
event:
|
|
||||||
- promote
|
|
||||||
target:
|
|
||||||
- oss
|
|
||||||
ref:
|
|
||||||
- refs/tags/v*.*.*
|
|
||||||
|
|
||||||
- name: Sign and Package Plugin
|
- name: sign and package plugin
|
||||||
image: node:14.6.0-stretch
|
image: node:14.6.0-stretch
|
||||||
environment:
|
environment:
|
||||||
GRAFANA_API_KEY:
|
GRAFANA_API_KEY:
|
||||||
from_secret: gcom_plugin_publisher_api_key
|
from_secret: gcom_plugin_publisher_api_key
|
||||||
depends_on:
|
depends_on:
|
||||||
- Build Plugin
|
- build plugin
|
||||||
commands:
|
commands:
|
||||||
- apt-get update
|
- apt-get update
|
||||||
- apt-get install zip
|
- apt-get install zip
|
||||||
|
|
@ -206,7 +190,7 @@ steps:
|
||||||
- zip -r grafana-oncall-app.zip ./grafana-oncall-app
|
- zip -r grafana-oncall-app.zip ./grafana-oncall-app
|
||||||
- if [ -z "$DRONE_TAG" ]; then echo "No tag, skipping archive"; else cp grafana-oncall-app.zip grafana-oncall-app-${DRONE_TAG}.zip; fi
|
- if [ -z "$DRONE_TAG" ]; then echo "No tag, skipping archive"; else cp grafana-oncall-app.zip grafana-oncall-app-${DRONE_TAG}.zip; fi
|
||||||
|
|
||||||
- name: Publish Plugin to grafana.com (release)
|
- name: publish plugin to grafana.com (release)
|
||||||
image: curlimages/curl:7.73.0
|
image: curlimages/curl:7.73.0
|
||||||
environment:
|
environment:
|
||||||
GRAFANA_API_KEY:
|
GRAFANA_API_KEY:
|
||||||
|
|
@ -214,21 +198,9 @@ steps:
|
||||||
commands:
|
commands:
|
||||||
- "curl -f -s -H \"Authorization: Bearer $${GRAFANA_API_KEY}\" -d \"download[any][url]=https://storage.googleapis.com/grafana-oncall-app/releases/grafana-oncall-app-${DRONE_TAG}.zip\" -d \"download[any][md5]=$$(curl -sL https://storage.googleapis.com/grafana-oncall-app/releases/grafana-oncall-app-${DRONE_TAG}.zip | md5sum | cut -d' ' -f1)\" -d url=https://github.com/grafana/oncall/grafana-plugin https://grafana.com/api/plugins"
|
- "curl -f -s -H \"Authorization: Bearer $${GRAFANA_API_KEY}\" -d \"download[any][url]=https://storage.googleapis.com/grafana-oncall-app/releases/grafana-oncall-app-${DRONE_TAG}.zip\" -d \"download[any][md5]=$$(curl -sL https://storage.googleapis.com/grafana-oncall-app/releases/grafana-oncall-app-${DRONE_TAG}.zip | md5sum | cut -d' ' -f1)\" -d url=https://github.com/grafana/oncall/grafana-plugin https://grafana.com/api/plugins"
|
||||||
depends_on:
|
depends_on:
|
||||||
- Sign and Package Plugin
|
- sign and package plugin
|
||||||
|
|
||||||
- name: Image Tag
|
trigger:
|
||||||
image: alpine
|
|
||||||
commands:
|
|
||||||
- apk add --no-cache bash git sed
|
|
||||||
- git fetch origin --tags
|
|
||||||
- chmod +x ./tools/image-tag.sh
|
|
||||||
- echo $(./tools/image-tag.sh)
|
|
||||||
- echo $(./tools/image-tag.sh) > .tags
|
|
||||||
- if [ -z "$DRONE_TAG" ]; then echo "No tag, not modifying version"; else sed "0,/VERSION.*/ s/VERSION.*/VERSION = \"${DRONE_TAG}\"/g" engine/settings/base.py > engine/settings/base.temp && mv engine/settings/base.temp engine/settings/base.py; fi
|
|
||||||
- cat engine/settings/base.py | grep VERSION | head -1
|
|
||||||
depends_on:
|
|
||||||
- Check Promote
|
|
||||||
when:
|
|
||||||
event:
|
event:
|
||||||
- promote
|
- promote
|
||||||
target:
|
target:
|
||||||
|
|
@ -236,10 +208,26 @@ steps:
|
||||||
ref:
|
ref:
|
||||||
- refs/tags/v*.*.*
|
- refs/tags/v*.*.*
|
||||||
|
|
||||||
- name: Build and Push Engine Docker Image Backend to Dockerhub
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: OSS engine release (amd64)
|
||||||
|
platform:
|
||||||
|
os: linux
|
||||||
|
arch: amd64
|
||||||
|
steps:
|
||||||
|
- name: set engine version
|
||||||
|
image: alpine
|
||||||
|
commands:
|
||||||
|
- apk add --no-cache bash sed
|
||||||
|
- if [ -z "$DRONE_TAG" ]; then echo "No tag, not modifying version"; else sed "0,/VERSION.*/ s/VERSION.*/VERSION = \"${DRONE_TAG}\"/g" engine/settings/base.py > engine/settings/base.temp && mv engine/settings/base.temp engine/settings/base.py; fi
|
||||||
|
- cat engine/settings/base.py | grep VERSION | head -1
|
||||||
|
|
||||||
|
- name: build and push docker image
|
||||||
image: plugins/docker
|
image: plugins/docker
|
||||||
settings:
|
settings:
|
||||||
repo: grafana/oncall
|
repo: grafana/oncall
|
||||||
|
tags: ${DRONE_TAG}-amd64-linux
|
||||||
dockerfile: engine/Dockerfile
|
dockerfile: engine/Dockerfile
|
||||||
context: engine/
|
context: engine/
|
||||||
password:
|
password:
|
||||||
|
|
@ -247,21 +235,81 @@ steps:
|
||||||
username:
|
username:
|
||||||
from_secret: docker_username
|
from_secret: docker_username
|
||||||
depends_on:
|
depends_on:
|
||||||
- Image Tag
|
- set engine version
|
||||||
|
|
||||||
- name: Unrecognized Promote Target
|
|
||||||
image: alpine
|
|
||||||
commands:
|
|
||||||
- echo $DRONE_DEPLOY_TO is not a recognized promote target!
|
|
||||||
- exit 1
|
|
||||||
when:
|
|
||||||
target:
|
|
||||||
exclude:
|
|
||||||
- oss
|
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
event:
|
event:
|
||||||
- promote
|
- promote
|
||||||
|
target:
|
||||||
|
- oss
|
||||||
|
ref:
|
||||||
|
- refs/tags/v*.*.*
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: OSS engine release (arm64)
|
||||||
|
platform:
|
||||||
|
os: linux
|
||||||
|
arch: arm64
|
||||||
|
steps:
|
||||||
|
- name: set engine version
|
||||||
|
image: alpine
|
||||||
|
commands:
|
||||||
|
- apk add --no-cache bash sed
|
||||||
|
- if [ -z "$DRONE_TAG" ]; then echo "No tag, not modifying version"; else sed "0,/VERSION.*/ s/VERSION.*/VERSION = \"${DRONE_TAG}\"/g" engine/settings/base.py > engine/settings/base.temp && mv engine/settings/base.temp engine/settings/base.py; fi
|
||||||
|
- cat engine/settings/base.py | grep VERSION | head -1
|
||||||
|
|
||||||
|
- name: build and push docker image
|
||||||
|
image: plugins/docker
|
||||||
|
settings:
|
||||||
|
repo: grafana/oncall
|
||||||
|
tags: ${DRONE_TAG}-arm64-linux
|
||||||
|
dockerfile: engine/Dockerfile
|
||||||
|
context: engine/
|
||||||
|
password:
|
||||||
|
from_secret: docker_password
|
||||||
|
username:
|
||||||
|
from_secret: docker_username
|
||||||
|
depends_on:
|
||||||
|
- set engine version
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
event:
|
||||||
|
- promote
|
||||||
|
target:
|
||||||
|
- oss
|
||||||
|
ref:
|
||||||
|
- refs/tags/v*.*.*
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: manifest
|
||||||
|
steps:
|
||||||
|
- name: manifest
|
||||||
|
image: plugins/manifest
|
||||||
|
settings:
|
||||||
|
username:
|
||||||
|
from_secret: docker_username
|
||||||
|
password:
|
||||||
|
from_secret: docker_password
|
||||||
|
target: grafana/oncall:${DRONE_TAG}
|
||||||
|
template: grafana/oncall:${DRONE_TAG}-ARCH-OS
|
||||||
|
platforms:
|
||||||
|
- linux/amd64
|
||||||
|
- linux/arm64
|
||||||
|
depends_on:
|
||||||
|
- OSS engine release (amd64)
|
||||||
|
- OSS engine release (arm64)
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
event:
|
||||||
|
- promote
|
||||||
|
target:
|
||||||
|
- oss
|
||||||
|
ref:
|
||||||
|
- refs/tags/v*.*.*
|
||||||
|
|
||||||
---
|
---
|
||||||
# Secret for pulling docker images.
|
# Secret for pulling docker images.
|
||||||
|
|
@ -334,6 +382,6 @@ kind: secret
|
||||||
name: drone_token
|
name: drone_token
|
||||||
---
|
---
|
||||||
kind: signature
|
kind: signature
|
||||||
hmac: a74dd831a3d0a87b8fc1db45699a6a834ea769da9f437c55979ae665948c3b3f
|
hmac: a52e4cea86ef50bbf7b19a05bec619368281e58927206709ef1e9dfd1df44e0e
|
||||||
|
|
||||||
...
|
...
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue