[v9.5.x] CI: Run only Grafana builds on RGM for grafana/grafana (#72160)

* CI: Try setting the vault secret for 'grafana_api_key' (#71981)

* Try setting the vault secret

* Maybe?

* forgot .drone.yml

* CI: Use GCP keys in vault and not drone secrets (#72023)

* CI: Run only Grafana builds on RGM for grafana/grafana (#72144)

* Run only OSS builds on RGM for grafana/grafana

* Update script name

* Ignore windows step failure for RGM

---------

Co-authored-by: Guilherme Caulada <guilherme.caulada@grafana.com>
This commit is contained in:
Kevin Minehart
2023-07-21 18:27:50 -03:00
committed by GitHub
co-authored by Guilherme Caulada
parent 36f1080ba6
commit a7302e7cc4
7 changed files with 94 additions and 181 deletions
+18 -24
View File
@@ -5,6 +5,9 @@ This module is a library of Drone steps and other pipeline components.
load(
"scripts/drone/vault.star",
"from_secret",
"gcp_grafanauploads",
"gcp_grafanauploads_base64",
"gcp_upload_artifacts_key",
"prerelease_bucket",
)
load(
@@ -302,7 +305,7 @@ def store_storybook_step(ver_mode, trigger = None):
] +
end_to_end_tests_deps(),
"environment": {
"GCP_KEY": from_secret("gcp_key"),
"GCP_KEY": from_secret(gcp_grafanauploads),
"PRERELEASE_BUCKET": from_secret(prerelease_bucket),
},
"commands": commands,
@@ -341,7 +344,7 @@ def e2e_tests_artifacts():
],
},
"environment": {
"GCP_GRAFANA_UPLOAD_ARTIFACTS_KEY": from_secret("gcp_upload_artifacts_key"),
"GCP_GRAFANA_UPLOAD_ARTIFACTS_KEY": from_secret(gcp_upload_artifacts_key),
"E2E_TEST_ARTIFACTS_BUCKET": "releng-pipeline-artifacts-dev",
"GITHUB_TOKEN": from_secret("github_token"),
},
@@ -379,7 +382,7 @@ def upload_cdn_step(ver_mode, trigger = None):
"grafana-server",
],
"environment": {
"GCP_KEY": from_secret("gcp_key"),
"GCP_KEY": from_secret(gcp_grafanauploads),
"PRERELEASE_BUCKET": from_secret(prerelease_bucket),
},
"commands": [
@@ -901,7 +904,7 @@ def build_docker_images_step(archs = None, ubuntu = False, publish = False):
cmd += " -archs {}".format(",".join(archs))
environment = {
"GCP_KEY": from_secret("gcp_key"),
"GCP_KEY": from_secret(gcp_grafanauploads),
}
return {
@@ -921,7 +924,7 @@ def fetch_images_step():
"name": "fetch-images",
"image": images["cloudsdk_image"],
"environment": {
"GCP_KEY": from_secret("gcp_key"),
"GCP_KEY": from_secret(gcp_grafanauploads),
"DOCKER_USER": from_secret("docker_username"),
"DOCKER_PASSWORD": from_secret("docker_password"),
},
@@ -948,7 +951,7 @@ def publish_images_step(ver_mode, docker_repo, trigger = None):
docker_repo = "grafana/{}".format(docker_repo)
environment = {
"GCP_KEY": from_secret("gcp_key"),
"GCP_KEY": from_secret(gcp_grafanauploads),
"DOCKER_USER": from_secret("docker_username"),
"DOCKER_PASSWORD": from_secret("docker_password"),
"GITHUB_APP_ID": from_secret("delivery-bot-app-id"),
@@ -1105,7 +1108,7 @@ def upload_packages_step(ver_mode, trigger = None):
"image": images["publish_image"],
"depends_on": end_to_end_tests_deps(),
"environment": {
"GCP_KEY": from_secret("gcp_key"),
"GCP_KEY": from_secret(gcp_grafanauploads_base64),
"PRERELEASE_BUCKET": from_secret("prerelease_bucket"),
},
"commands": [
@@ -1147,7 +1150,7 @@ def publish_grafanacom_step(ver_mode):
],
"environment": {
"GRAFANA_COM_API_KEY": from_secret("grafana_api_key"),
"GCP_KEY": from_secret("gcp_key"),
"GCP_KEY": from_secret(gcp_grafanauploads),
},
"commands": [
cmd,
@@ -1189,13 +1192,12 @@ def windows_clone_step():
],
}
def get_windows_steps(ver_mode, bucket = "%PRERELEASE_BUCKET%", edition = "oss"):
def get_windows_steps(ver_mode, bucket = "%PRERELEASE_BUCKET%"):
"""Generate the list of Windows steps.
Args:
ver_mode: used to differentiate steps for different version modes.
bucket: used to override prerelease bucket.
edition: used to override edition for RGM builds.
Returns:
List of Drone steps.
@@ -1244,17 +1246,12 @@ def get_windows_steps(ver_mode, bucket = "%PRERELEASE_BUCKET%", edition = "oss")
"cp C:\\App\\nssm-2.24.zip .",
]
sfx = ""
if edition != "oss":
sfx = "-{}".format(edition)
if ver_mode in ("release",):
version = "${DRONE_TAG:1}"
installer_commands.extend(
[
".\\grabpl.exe windows-installer --target {} --edition {} {}".format(
"gs://{}/{}/{}/{}/grafana{}-{}.windows-amd64.zip".format(gcp_bucket, ver_part, edition, ver_mode, sfx, version),
edition,
".\\grabpl.exe windows-installer --target {} --edition oss {}".format(
"gs://{}/{}/oss/{}/grafana-{}.windows-amd64.zip".format(gcp_bucket, ver_part, ver_mode, version),
ver_part,
),
'$$fname = ((Get-Childitem grafana*.msi -name) -split "`n")[0]',
@@ -1263,10 +1260,9 @@ def get_windows_steps(ver_mode, bucket = "%PRERELEASE_BUCKET%", edition = "oss")
if ver_mode == "main":
installer_commands.extend(
[
"gsutil cp $$fname gs://{}/{}/{}/".format(gcp_bucket, edition, dir),
'gsutil cp "$$fname.sha256" gs://{}/{}/{}/'.format(
"gsutil cp $$fname gs://{}/oss/{}/".format(gcp_bucket, dir),
'gsutil cp "$$fname.sha256" gs://{}/oss/{}/'.format(
gcp_bucket,
edition,
dir,
),
],
@@ -1274,16 +1270,14 @@ def get_windows_steps(ver_mode, bucket = "%PRERELEASE_BUCKET%", edition = "oss")
else:
installer_commands.extend(
[
"gsutil cp $$fname gs://{}/{}/{}/{}/".format(
"gsutil cp $$fname gs://{}/{}/oss/{}/".format(
gcp_bucket,
ver_part,
edition,
dir,
),
'gsutil cp "$$fname.sha256" gs://{}/{}/{}/{}/'.format(
'gsutil cp "$$fname.sha256" gs://{}/{}/oss/{}/'.format(
gcp_bucket,
ver_part,
edition,
dir,
),
],