2023-05-03 13:56:02 -05:00
|
|
|
"""
|
|
|
|
rgm uses 'github.com/grafana/grafana-build' to build Grafana on the following events:
|
|
|
|
* A merge to main
|
|
|
|
* A tag that begins with a 'v'
|
|
|
|
"""
|
|
|
|
|
|
|
|
load(
|
|
|
|
"scripts/drone/utils/utils.star",
|
|
|
|
"pipeline",
|
|
|
|
)
|
2023-05-23 03:01:09 -05:00
|
|
|
load(
|
|
|
|
"scripts/drone/events/release.star",
|
|
|
|
"verify_release_pipeline",
|
|
|
|
)
|
2023-05-03 13:56:02 -05:00
|
|
|
load(
|
|
|
|
"scripts/drone/vault.star",
|
|
|
|
"from_secret",
|
2023-05-17 12:19:53 -05:00
|
|
|
"rgm_dagger_token",
|
2023-05-03 13:56:02 -05:00
|
|
|
"rgm_destination",
|
|
|
|
"rgm_gcp_key_base64",
|
|
|
|
"rgm_github_token",
|
|
|
|
)
|
|
|
|
|
|
|
|
rgm_env_secrets = {
|
|
|
|
"GCP_KEY_BASE64": from_secret(rgm_gcp_key_base64),
|
|
|
|
"DESTINATION": from_secret(rgm_destination),
|
|
|
|
"GITHUB_TOKEN": from_secret(rgm_github_token),
|
2023-05-17 12:19:53 -05:00
|
|
|
"_EXPERIMENTAL_DAGGER_CLOUD_TOKEN": from_secret(rgm_dagger_token),
|
2023-05-03 13:56:02 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
def rgm_build(script = "drone_publish_main.sh"):
|
|
|
|
clone_step = {
|
|
|
|
"name": "clone-rgm",
|
|
|
|
"image": "alpine/git",
|
|
|
|
"commands": [
|
|
|
|
"git clone https://github.com/grafana/grafana-build.git rgm",
|
|
|
|
],
|
|
|
|
"failure": "ignore",
|
|
|
|
}
|
|
|
|
|
|
|
|
rgm_build_step = {
|
|
|
|
"name": "rgm-build",
|
|
|
|
"image": "golang:1.20.3-alpine",
|
|
|
|
"commands": [
|
|
|
|
# the docker program is a requirement for running dagger programs
|
2023-06-13 08:40:07 -05:00
|
|
|
"apk update && apk add docker bash",
|
2023-05-03 13:56:02 -05:00
|
|
|
"export GRAFANA_DIR=$$(pwd)",
|
|
|
|
"cd rgm && ./scripts/{}".format(script),
|
|
|
|
],
|
|
|
|
"environment": rgm_env_secrets,
|
|
|
|
# The docker socket is a requirement for running dagger programs
|
|
|
|
# In the future we should find a way to use dagger without mounting the docker socket.
|
|
|
|
"volumes": [{"name": "docker", "path": "/var/run/docker.sock"}],
|
|
|
|
"failure": "ignore",
|
|
|
|
}
|
|
|
|
|
|
|
|
return [
|
|
|
|
clone_step,
|
|
|
|
rgm_build_step,
|
|
|
|
]
|
|
|
|
|
2023-05-30 10:17:53 -05:00
|
|
|
docs_paths = {
|
|
|
|
"exclude": [
|
|
|
|
"*.md",
|
|
|
|
"docs/**",
|
|
|
|
"packages/**/*.md",
|
|
|
|
"latest.json",
|
|
|
|
],
|
|
|
|
}
|
|
|
|
|
2023-05-03 13:56:02 -05:00
|
|
|
def rgm_main():
|
|
|
|
trigger = {
|
|
|
|
"event": [
|
|
|
|
"push",
|
|
|
|
],
|
|
|
|
"branch": "main",
|
2023-05-30 10:17:53 -05:00
|
|
|
"paths": docs_paths,
|
2023-05-03 13:56:02 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
return pipeline(
|
2023-05-23 03:01:09 -05:00
|
|
|
name = "rgm-main-prerelease",
|
2023-05-03 13:56:02 -05:00
|
|
|
edition = "all",
|
|
|
|
trigger = trigger,
|
|
|
|
steps = rgm_build(),
|
2023-05-03 14:08:01 -05:00
|
|
|
depends_on = ["main-test-backend", "main-test-frontend"],
|
2023-05-03 13:56:02 -05:00
|
|
|
)
|
|
|
|
|
2023-05-23 03:01:09 -05:00
|
|
|
tag_trigger = {
|
|
|
|
"event": {
|
|
|
|
"exclude": [
|
|
|
|
"promote",
|
|
|
|
],
|
|
|
|
},
|
|
|
|
"ref": {
|
|
|
|
"include": [
|
|
|
|
"refs/tags/v*",
|
|
|
|
],
|
|
|
|
"exclude": [
|
|
|
|
"refs/tags/*-cloud*",
|
|
|
|
],
|
|
|
|
},
|
|
|
|
}
|
2023-05-03 13:56:02 -05:00
|
|
|
|
2023-05-23 03:01:09 -05:00
|
|
|
def rgm_tag():
|
2023-05-03 13:56:02 -05:00
|
|
|
return pipeline(
|
2023-05-23 03:01:09 -05:00
|
|
|
name = "rgm-tag-prerelease",
|
2023-05-03 13:56:02 -05:00
|
|
|
edition = "all",
|
2023-05-23 03:01:09 -05:00
|
|
|
trigger = tag_trigger,
|
2023-05-03 13:56:02 -05:00
|
|
|
steps = rgm_build(script = "drone_publish_tag.sh"),
|
2023-05-03 14:08:01 -05:00
|
|
|
depends_on = [],
|
2023-05-03 13:56:02 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
def rgm():
|
|
|
|
return [
|
|
|
|
rgm_main(),
|
|
|
|
rgm_tag(),
|
2023-05-23 03:01:09 -05:00
|
|
|
verify_release_pipeline(
|
|
|
|
name = "rgm-tag-verify-prerelease-assets",
|
|
|
|
trigger = tag_trigger,
|
|
|
|
depends_on = ["rgm-tag-prerelease"],
|
|
|
|
bucket = "grafana-prerelease-dev",
|
|
|
|
),
|
2023-05-03 13:56:02 -05:00
|
|
|
]
|