From f128a9780d8ec49129c6b2039fe54fffdb667f5c Mon Sep 17 00:00:00 2001 From: Guilherme Caulada Date: Tue, 18 Jul 2023 13:51:32 -0300 Subject: [PATCH] [v10.0.x] CI: Add rgm compatible windows msi pipeline (#71858) CI: Add rgm compatible windows msi pipeline (#71678) * Add rgm compatible windows msi pipeline * Fix dependencies and platform * Fix missing arg comment * Fix linting issues * Try to fix version on file path * Fix dependency on verify release pipeline (cherry picked from commit 4caa773401deedb232d4073230bf09ee33367d28) --- .drone.yml | 103 +++++++++++++++++++++++++++++------ scripts/drone/rgm.star | 20 ++++++- scripts/drone/steps/lib.star | 21 ++++--- 3 files changed, 116 insertions(+), 28 deletions(-) diff --git a/.drone.yml b/.drone.yml index dcb2ab77bb7..26240bee370 100644 --- a/.drone.yml +++ b/.drone.yml @@ -120,7 +120,7 @@ steps: name: identify-runner - commands: - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.39/grabpl + - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.40/grabpl - chmod +x bin/grabpl image: byrnedo/alpine-curl:0.1.8 name: grabpl @@ -467,7 +467,7 @@ steps: name: identify-runner - commands: - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.39/grabpl + - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.40/grabpl - chmod +x bin/grabpl image: byrnedo/alpine-curl:0.1.8 name: grabpl @@ -862,7 +862,7 @@ steps: name: clone-enterprise - commands: - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.39/grabpl + - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.40/grabpl - chmod +x bin/grabpl image: byrnedo/alpine-curl:0.1.8 name: grabpl @@ -1181,7 +1181,7 @@ steps: name: identify-runner - commands: - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.39/grabpl + - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.40/grabpl - chmod +x bin/grabpl image: byrnedo/alpine-curl:0.1.8 name: grabpl @@ -1433,7 +1433,7 @@ steps: name: identify-runner - commands: - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.39/grabpl + - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.40/grabpl - chmod +x bin/grabpl image: byrnedo/alpine-curl:0.1.8 name: grabpl @@ -1887,7 +1887,7 @@ services: steps: - commands: - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.39/grabpl + - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.40/grabpl - chmod +x bin/grabpl image: byrnedo/alpine-curl:0.1.8 name: grabpl @@ -2025,7 +2025,7 @@ steps: name: identify-runner - commands: - $$ProgressPreference = "SilentlyContinue" - - Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.39/windows/grabpl.exe + - Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.40/windows/grabpl.exe -OutFile grabpl.exe image: grafana/ci-wix:0.1.1 name: windows-init @@ -2225,7 +2225,7 @@ steps: name: identify-runner - commands: - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.39/grabpl + - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.40/grabpl - chmod +x bin/grabpl image: byrnedo/alpine-curl:0.1.8 name: grabpl @@ -2528,7 +2528,7 @@ steps: name: identify-runner - commands: - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.39/grabpl + - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.40/grabpl - chmod +x bin/grabpl image: byrnedo/alpine-curl:0.1.8 name: grabpl @@ -2668,7 +2668,7 @@ steps: name: identify-runner - commands: - $$ProgressPreference = "SilentlyContinue" - - Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.39/windows/grabpl.exe + - Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.40/windows/grabpl.exe -OutFile grabpl.exe image: grafana/ci-wix:0.1.1 name: windows-init @@ -2680,7 +2680,8 @@ steps: - gcloud auth activate-service-account --key-file=gcpkey.json - rm gcpkey.json - cp C:\App\nssm-2.24.zip . - - .\grabpl.exe windows-installer --edition oss ${DRONE_TAG} + - .\grabpl.exe windows-installer --target gs://%PRERELEASE_BUCKET%/artifacts/downloads/${DRONE_TAG}/oss/release/grafana-${DRONE_TAG:1}.windows-amd64.zip + --edition oss ${DRONE_TAG} - $$fname = ((Get-Childitem grafana*.msi -name) -split "`n")[0] - gsutil cp $$fname gs://%PRERELEASE_BUCKET%/artifacts/downloads/${DRONE_TAG}/oss/release/ - gsutil cp "$$fname.sha256" gs://%PRERELEASE_BUCKET%/artifacts/downloads/${DRONE_TAG}/oss/release/ @@ -2732,7 +2733,7 @@ steps: name: identify-runner - commands: - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.39/grabpl + - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.40/grabpl - chmod +x bin/grabpl image: byrnedo/alpine-curl:0.1.8 name: grabpl @@ -3249,6 +3250,72 @@ clone: retries: 3 depends_on: - rgm-tag-prerelease +environment: + EDITION: oss +image_pull_secrets: +- dockerconfigjson +kind: pipeline +name: rgm-tag-prerelease-windows +platform: + arch: amd64 + os: windows + version: "1809" +services: [] +steps: +- commands: + - echo $env:DRONE_RUNNER_NAME + image: mcr.microsoft.com/windows:1809 + name: identify-runner +- commands: + - $$ProgressPreference = "SilentlyContinue" + - Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.40/windows/grabpl.exe + -OutFile grabpl.exe + image: grafana/ci-wix:0.1.1 + name: windows-init +- commands: + - $$gcpKey = $$env:GCP_KEY + - '[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($$gcpKey)) + > gcpkey.json' + - dos2unix gcpkey.json + - gcloud auth activate-service-account --key-file=gcpkey.json + - rm gcpkey.json + - cp C:\App\nssm-2.24.zip . + - .\grabpl.exe windows-installer --target gs://grafana-prerelease-dev/artifacts/downloads/${DRONE_TAG}/oss/release/grafana-${DRONE_TAG:1}.windows-amd64.zip + --edition oss ${DRONE_TAG} + - $$fname = ((Get-Childitem grafana*.msi -name) -split "`n")[0] + - gsutil cp $$fname gs://grafana-prerelease-dev/artifacts/downloads/${DRONE_TAG}/oss/release/ + - gsutil cp "$$fname.sha256" gs://grafana-prerelease-dev/artifacts/downloads/${DRONE_TAG}/oss/release/ + depends_on: + - windows-init + environment: + GCP_KEY: + from_secret: gcp_key + GITHUB_TOKEN: + from_secret: github_token + PRERELEASE_BUCKET: + from_secret: prerelease_bucket + image: grafana/ci-wix:0.1.1 + name: build-windows-installer +trigger: + event: + exclude: + - promote + ref: + exclude: + - refs/tags/*-cloud* + include: + - refs/tags/v* +type: docker +volumes: +- host: + path: //./pipe/docker_engine/ + name: docker +--- +clone: + retries: 3 +depends_on: +- rgm-tag-prerelease +- rgm-tag-prerelease-windows image_pull_secrets: - dockerconfigjson kind: pipeline @@ -3311,7 +3378,7 @@ steps: name: identify-runner - commands: - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.39/grabpl + - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.40/grabpl - chmod +x bin/grabpl image: byrnedo/alpine-curl:0.1.8 name: grabpl @@ -3592,7 +3659,7 @@ steps: name: identify-runner - commands: - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.39/grabpl + - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.40/grabpl - chmod +x bin/grabpl image: byrnedo/alpine-curl:0.1.8 name: grabpl @@ -3741,7 +3808,7 @@ services: steps: - commands: - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.39/grabpl + - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.40/grabpl - chmod +x bin/grabpl image: byrnedo/alpine-curl:0.1.8 name: grabpl @@ -3864,7 +3931,7 @@ steps: name: identify-runner - commands: - $$ProgressPreference = "SilentlyContinue" - - Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.39/windows/grabpl.exe + - Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.40/windows/grabpl.exe -OutFile grabpl.exe image: grafana/ci-wix:0.1.1 name: windows-init @@ -3940,7 +4007,7 @@ services: steps: - commands: - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.39/grabpl + - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.40/grabpl - chmod +x bin/grabpl image: byrnedo/alpine-curl:0.1.8 name: grabpl @@ -4524,6 +4591,6 @@ kind: secret name: delivery-bot-app-private-key --- kind: signature -hmac: 450d910200cd287cf3eb109496a67d1c87172bc1bea5362921ad80064051a354 +hmac: cc19be14d5b32c128e12df8f03805fca4d7c828f05aea6843a40e2cb40a9d053 ... diff --git a/scripts/drone/rgm.star b/scripts/drone/rgm.star index 2d78a8a8aaf..dc9a7e20db4 100644 --- a/scripts/drone/rgm.star +++ b/scripts/drone/rgm.star @@ -4,6 +4,10 @@ rgm uses 'github.com/grafana/grafana-build' to build Grafana on the following ev * A tag that begins with a 'v' """ +load( + "scripts/drone/steps/lib.star", + "get_windows_steps", +) load( "scripts/drone/utils/utils.star", "pipeline", @@ -99,14 +103,28 @@ def rgm_tag(): depends_on = [], ) +def rgm_windows(): + return pipeline( + name = "rgm-tag-prerelease-windows", + trigger = tag_trigger, + steps = get_windows_steps( + ver_mode = "release", + bucket = "grafana-prerelease-dev", + ), + depends_on = ["rgm-tag-prerelease"], + platform = "windows", + environment = {"EDITION": "oss"}, + ) + def rgm(): return [ rgm_main(), rgm_tag(), + rgm_windows(), verify_release_pipeline( name = "rgm-tag-verify-prerelease-assets", trigger = tag_trigger, - depends_on = ["rgm-tag-prerelease"], + depends_on = ["rgm-tag-prerelease", "rgm-tag-prerelease-windows"], bucket = "grafana-prerelease-dev", ), ] diff --git a/scripts/drone/steps/lib.star b/scripts/drone/steps/lib.star index cddba24083c..dacd11354cd 100644 --- a/scripts/drone/steps/lib.star +++ b/scripts/drone/steps/lib.star @@ -16,7 +16,7 @@ load( "windows_images", ) -grabpl_version = "v3.0.39" +grabpl_version = "v3.0.40" trigger_oss = { "repo": [ @@ -1199,11 +1199,12 @@ def windows_clone_step(): ], } -def get_windows_steps(ver_mode): +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. Returns: List of Drone steps. @@ -1233,13 +1234,13 @@ def get_windows_steps(ver_mode): "release", "release-branch", ): - bucket = "%PRERELEASE_BUCKET%/artifacts/downloads" + gcp_bucket = "{}/artifacts/downloads".format(bucket) if ver_mode == "release": ver_part = "${DRONE_TAG}" dir = "release" else: dir = "main" - bucket = "grafana-downloads" + gcp_bucket = "grafana-downloads" build_no = "DRONE_BUILD_NUMBER" ver_part = "--build-id $$env:{}".format(build_no) installer_commands = [ @@ -1253,9 +1254,11 @@ def get_windows_steps(ver_mode): ] if ver_mode in ("release",): + version = "${DRONE_TAG:1}" installer_commands.extend( [ - ".\\grabpl.exe windows-installer --edition oss {}".format( + ".\\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]', @@ -1264,9 +1267,9 @@ def get_windows_steps(ver_mode): if ver_mode == "main": installer_commands.extend( [ - "gsutil cp $$fname gs://{}/oss/{}/".format(bucket, dir), + "gsutil cp $$fname gs://{}/oss/{}/".format(gcp_bucket, dir), 'gsutil cp "$$fname.sha256" gs://{}/oss/{}/'.format( - bucket, + gcp_bucket, dir, ), ], @@ -1275,12 +1278,12 @@ def get_windows_steps(ver_mode): installer_commands.extend( [ "gsutil cp $$fname gs://{}/{}/oss/{}/".format( - bucket, + gcp_bucket, ver_part, dir, ), 'gsutil cp "$$fname.sha256" gs://{}/{}/oss/{}/'.format( - bucket, + gcp_bucket, ver_part, dir, ),