CI: add promotion step for publish grafanacom (#93851)

* add promotion step for publish grafanacom

* publish-grafanacom depends on compile-build-cmd

* use DRONE_TAG

* add docstring comment for depends_on
This commit is contained in:
Kevin Minehart 2024-09-26 16:19:19 -05:00 committed by GitHub
parent 6951feff88
commit a847608061
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 59 additions and 6 deletions

View File

@ -4165,6 +4165,49 @@ volumes:
path: /var/run/docker.sock
name: docker
---
clone:
retries: 3
depends_on: []
image_pull_secrets:
- gcr
- gar
kind: pipeline
name: publish-grafanacom
node:
type: no-parallel
platform:
arch: amd64
os: linux
services: []
steps:
- commands:
- go build -o ./bin/build -ldflags '-extldflags -static' ./pkg/build/cmd
depends_on: []
environment:
CGO_ENABLED: 0
image: golang:1.23.1-alpine
name: compile-build-cmd
- commands:
- ./bin/build publish grafana-com --edition oss ${DRONE_TAG}
depends_on:
- compile-build-cmd
environment:
GCP_KEY:
from_secret: gcp_grafanauploads_base64
GRAFANA_COM_API_KEY:
from_secret: grafana_api_key
image: grafana/grafana-ci-deploy:1.3.3
name: publish-grafanacom
trigger:
event:
- promote
target: publish-grafanacom
type: docker
volumes:
- host:
path: /var/run/docker.sock
name: docker
---
clone:
retries: 3
depends_on:
@ -6108,6 +6151,6 @@ kind: secret
name: gcr_credentials
---
kind: signature
hmac: 7335b2e56769f72716f5dac524741e423abb99eacf775fa635e59c2d658c8aee
hmac: 4a043d63a119ebf5920b600fce404d98f570504e855039cc4787c2fa1ab04669
...

View File

@ -242,6 +242,17 @@ def publish_packages_pipeline():
depends_on = deps,
environment = {"EDITION": "oss"},
),
pipeline(
name = "publish-grafanacom",
trigger = {
"event": ["promote"],
"target": "publish-grafanacom",
},
steps = [
compile_build_cmd(),
publish_grafanacom_step(ver_mode = "release", depends_on = ["compile-build-cmd"]),
],
),
]
def publish_npm_pipelines():

View File

@ -727,6 +727,7 @@ def frontend_metrics_step(trigger = None):
Returns:
Drone step.
"""
step = {
"name": "publish-frontend-metrics",
"image": images["node"],
@ -1178,7 +1179,7 @@ def upload_packages_step(ver_mode, trigger = None):
step = dict(step, when = trigger)
return step
def publish_grafanacom_step(ver_mode):
def publish_grafanacom_step(ver_mode, depends_on = ["publish-linux-packages-deb", "publish-linux-packages-rpm"]):
"""Publishes Grafana packages to grafana.com.
Args:
@ -1186,6 +1187,7 @@ def publish_grafanacom_step(ver_mode):
variable as the value for the --build-id option.
TODO: is this actually used by the grafanacom subcommand? I think it might
just use the environment variable directly.
depends_on: what other steps this one depends on (strings)
Returns:
Drone step.
@ -1203,10 +1205,7 @@ def publish_grafanacom_step(ver_mode):
return {
"name": "publish-grafanacom",
"image": images["publish"],
"depends_on": [
"publish-linux-packages-deb",
"publish-linux-packages-rpm",
],
"depends_on": depends_on,
"environment": {
"GRAFANA_COM_API_KEY": from_secret("grafana_api_key"),
"GCP_KEY": from_secret(gcp_grafanauploads_base64),