CI: Move windows-tests into promotion pipeline (#68218)

This commit is contained in:
Horst Gutmann 2023-05-10 16:16:59 +02:00 committed by GitHub
parent 260c4544cb
commit acd02e8a48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 84 additions and 304 deletions

View File

@ -35,6 +35,10 @@ load(
)
load("scripts/drone/pipelines/github.star", "publish_github_pipeline")
load("scripts/drone/pipelines/aws_marketplace.star", "publish_aws_marketplace_pipeline")
load(
"scripts/drone/pipelines/windows.star",
"windows_test_backend",
)
load("scripts/drone/version.star", "version_branch_pipelines")
load("scripts/drone/events/cron.star", "cronjobs")
load("scripts/drone/vault.star", "secrets")
@ -56,6 +60,10 @@ def main(_ctx):
publish_npm_pipelines() +
publish_packages_pipeline() +
rgm() +
[windows_test_backend({
"event": ["promote"],
"target": ["test-windows"],
}, "oss", "testing")] +
artifacts_page_pipeline() +
version_branch_pipelines() +
integration_test_pipelines() +

View File

@ -373,56 +373,6 @@ environment:
image_pull_secrets:
- dockerconfigjson
kind: pipeline
name: pr-oss-test-backend-windows
platform:
arch: amd64
os: windows
version: "1809"
services: []
steps:
- commands: []
image: grafana/grafana-ci-windows-test:0.1.0
name: windows-init
- commands:
- go install github.com/google/wire/cmd/wire@v0.5.0
- wire gen -tags oss ./pkg/server
depends_on:
- windows-init
image: grafana/grafana-ci-windows-test:0.1.0
name: wire-install
- commands:
- go test -tags requires_buildifer -short -covermode=atomic -timeout=5m ./pkg/...
depends_on:
- wire-install
failure: ignore
image: grafana/grafana-ci-windows-test:0.1.0
name: test-backend
trigger:
event:
- pull_request
paths:
exclude:
- docs/**
- '*.md'
- pkg/**
- packaging/**
- go.sum
- go.mod
include: []
type: docker
volumes:
- host:
path: //./pipe/docker_engine/
name: docker
---
clone:
retries: 3
depends_on: []
environment:
EDITION: oss
image_pull_secrets:
- dockerconfigjson
kind: pipeline
name: pr-lint-backend
node:
type: no-parallel
@ -2144,126 +2094,6 @@ volumes:
clone:
retries: 3
depends_on: []
environment:
EDITION: oss
image_pull_secrets:
- dockerconfigjson
kind: pipeline
name: main-oss-test-backend-windows
platform:
arch: amd64
os: windows
version: "1809"
services: []
steps:
- commands: []
image: grafana/grafana-ci-windows-test:0.1.0
name: windows-init
- commands:
- go install github.com/google/wire/cmd/wire@v0.5.0
- wire gen -tags oss ./pkg/server
depends_on:
- windows-init
image: grafana/grafana-ci-windows-test:0.1.0
name: wire-install
- commands:
- go test -tags requires_buildifer -short -covermode=atomic -timeout=5m ./pkg/...
depends_on:
- wire-install
failure: ignore
image: grafana/grafana-ci-windows-test:0.1.0
name: test-backend
trigger:
branch: main
event:
- push
paths:
exclude:
- '*.md'
- docs/**
- latest.json
type: docker
volumes:
- host:
path: //./pipe/docker_engine/
name: docker
---
clone:
disable: true
depends_on: []
environment:
EDITION: enterprise
image_pull_secrets:
- dockerconfigjson
kind: pipeline
name: main-enterprise-test-backend-windows
platform:
arch: amd64
os: windows
version: "1809"
services: []
steps:
- commands:
- $$ProgressPreference = "SilentlyContinue"
- Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.30/windows/grabpl.exe
-OutFile grabpl.exe
image: grafana/ci-wix:0.1.1
name: grabpl
- commands:
- git clone "https://$$env:GITHUB_TOKEN@github.com/grafana/grafana-enterprise.git"
- cd grafana-enterprise
- git checkout main
environment:
GITHUB_TOKEN:
from_secret: github_token
image: grafana/ci-wix:0.1.1
name: clone
- commands:
- cp -r grafana-enterprise C:\App\grafana-enterprise
- rm -r -force grafana-enterprise
- cp grabpl.exe C:\App\grabpl.exe
- rm -force grabpl.exe
- C:\App\grabpl.exe init-enterprise --github-token $$env:GITHUB_TOKEN C:\App\grafana-enterprise
- cp C:\App\grabpl.exe grabpl.exe
depends_on:
- clone
environment:
GITHUB_TOKEN:
from_secret: github_token
image: grafana/ci-wix:0.1.1
name: windows-init
- commands:
- go install github.com/google/wire/cmd/wire@v0.5.0
- wire gen -tags enterprise ./pkg/server
depends_on:
- windows-init
image: grafana/grafana-ci-windows-test:0.1.0
name: wire-install
- commands:
- go test -tags requires_buildifer -short -covermode=atomic -timeout=5m ./pkg/...
depends_on:
- wire-install
failure: ignore
image: grafana/grafana-ci-windows-test:0.1.0
name: test-backend
trigger:
branch: main
event:
- push
paths:
exclude:
- '*.md'
- docs/**
- latest.json
type: docker
volumes:
- host:
path: //./pipe/docker_engine/
name: docker
---
clone:
retries: 3
depends_on: []
kind: pipeline
name: notify-drone-changes
platform:
@ -4637,6 +4467,58 @@ volumes:
clone:
disable: true
depends_on: []
environment:
EDITION: oss
image_pull_secrets:
- dockerconfigjson
kind: pipeline
name: testing-oss-test-backend-windows
platform:
arch: amd64
os: windows
version: "1809"
services: []
steps:
- commands:
- git clone "https://$$env:GITHUB_TOKEN@github.com/$$env:DRONE_REPO.git" .
- git checkout -f $$env:DRONE_COMMIT
environment:
GITHUB_TOKEN:
from_secret: github_token
image: grafana/ci-wix:0.1.1
name: clone
- commands: []
depends_on:
- clone
image: grafana/grafana-ci-windows-test:0.1.0
name: windows-init
- commands:
- go install github.com/google/wire/cmd/wire@v0.5.0
- wire gen -tags oss ./pkg/server
depends_on:
- windows-init
image: grafana/grafana-ci-windows-test:0.1.0
name: wire-install
- commands:
- go test -tags requires_buildifer -short -covermode=atomic -timeout=5m ./pkg/...
depends_on:
- wire-install
image: grafana/grafana-ci-windows-test:0.1.0
name: test-backend
trigger:
event:
- promote
target:
- test-windows
type: docker
volumes:
- host:
path: //./pipe/docker_engine/
name: docker
---
clone:
disable: true
depends_on: []
environment:
EDITION: enterprise
image_pull_secrets:
@ -5128,114 +5010,6 @@ environment:
image_pull_secrets:
- dockerconfigjson
kind: pipeline
name: release-branch-oss-test-backend-windows
platform:
arch: amd64
os: windows
version: "1809"
services: []
steps:
- commands: []
image: grafana/grafana-ci-windows-test:0.1.0
name: windows-init
- commands:
- go install github.com/google/wire/cmd/wire@v0.5.0
- wire gen -tags oss ./pkg/server
depends_on:
- windows-init
image: grafana/grafana-ci-windows-test:0.1.0
name: wire-install
- commands:
- go test -tags requires_buildifer -short -covermode=atomic -timeout=5m ./pkg/...
depends_on:
- wire-install
failure: ignore
image: grafana/grafana-ci-windows-test:0.1.0
name: test-backend
trigger:
ref:
- refs/heads/v[0-9]*
type: docker
volumes:
- host:
path: //./pipe/docker_engine/
name: docker
---
clone:
disable: true
depends_on: []
environment:
EDITION: enterprise
image_pull_secrets:
- dockerconfigjson
kind: pipeline
name: release-branch-enterprise-test-backend-windows
platform:
arch: amd64
os: windows
version: "1809"
services: []
steps:
- commands:
- $$ProgressPreference = "SilentlyContinue"
- Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.30/windows/grabpl.exe
-OutFile grabpl.exe
image: grafana/ci-wix:0.1.1
name: grabpl
- commands:
- git clone "https://$$env:GITHUB_TOKEN@github.com/grafana/grafana-enterprise.git"
- cd grafana-enterprise
- git checkout $$env:DRONE_BRANCH
environment:
GITHUB_TOKEN:
from_secret: github_token
image: grafana/ci-wix:0.1.1
name: clone
- commands:
- cp -r grafana-enterprise C:\App\grafana-enterprise
- rm -r -force grafana-enterprise
- cp grabpl.exe C:\App\grabpl.exe
- rm -force grabpl.exe
- C:\App\grabpl.exe init-enterprise --github-token $$env:GITHUB_TOKEN C:\App\grafana-enterprise
- cp C:\App\grabpl.exe grabpl.exe
depends_on:
- clone
environment:
GITHUB_TOKEN:
from_secret: github_token
image: grafana/ci-wix:0.1.1
name: windows-init
- commands:
- go install github.com/google/wire/cmd/wire@v0.5.0
- wire gen -tags enterprise ./pkg/server
depends_on:
- windows-init
image: grafana/grafana-ci-windows-test:0.1.0
name: wire-install
- commands:
- go test -tags requires_buildifer -short -covermode=atomic -timeout=5m ./pkg/...
depends_on:
- wire-install
failure: ignore
image: grafana/grafana-ci-windows-test:0.1.0
name: test-backend
trigger:
ref:
- refs/heads/v[0-9]*
type: docker
volumes:
- host:
path: //./pipe/docker_engine/
name: docker
---
clone:
retries: 3
depends_on: []
environment:
EDITION: oss
image_pull_secrets:
- dockerconfigjson
kind: pipeline
name: release-branch-oss-integration-tests
node:
type: no-parallel
@ -5409,7 +5183,6 @@ clone:
depends_on:
- release-branch-oss-build-e2e-publish
- release-branch-oss-test-frontend
- release-branch-oss-test-backend-windows
environment:
EDITION: oss
image_pull_secrets:
@ -7222,6 +6995,6 @@ kind: secret
name: github_token
---
kind: signature
hmac: 3e9459f86eb6cc4301481b61d507a8c27b15309c096f7608db29ced62f571689
hmac: 4a99b404fa59910566c088700c4aacf6cc00de65aa8955f58f7dc3e313f932c8
...

View File

@ -32,7 +32,6 @@ load(
load(
"scripts/drone/pipelines/windows.star",
"windows",
"windows_test_backend",
)
load(
"scripts/drone/pipelines/trigger_downstream.star",
@ -90,8 +89,6 @@ def main_pipelines():
build_e2e(trigger, ver_mode),
integration_tests(trigger, prefix = ver_mode, ver_mode = ver_mode),
windows(trigger, edition = "oss", ver_mode = ver_mode),
windows_test_backend(trigger, "oss", ver_mode),
windows_test_backend(trigger, "enterprise", ver_mode),
notify_pipeline(
name = "notify-drone-changes",
slack_channel = "slack-webhooks-test",

View File

@ -15,10 +15,6 @@ load(
"scripts/drone/pipelines/integration_tests.star",
"integration_tests",
)
load(
"scripts/drone/pipelines/windows.star",
"windows_test_backend",
)
load(
"scripts/drone/pipelines/build.star",
"build_e2e",
@ -104,13 +100,6 @@ def pr_pipelines():
),
ver_mode,
),
windows_test_backend(
get_pr_trigger(
exclude_paths = ["pkg/**", "packaging/**", "go.sum", "go.mod"],
),
"oss",
ver_mode,
),
lint_backend_pipeline(
get_pr_trigger(
include_paths = [

View File

@ -61,10 +61,6 @@ load(
"test_backend",
"test_backend_enterprise",
)
load(
"scripts/drone/pipelines/windows.star",
"windows_test_backend",
)
load("scripts/drone/vault.star", "from_secret", "prerelease_bucket")
ver_mode = "release"
@ -237,9 +233,6 @@ def oss_pipelines(ver_mode = ver_mode, trigger = release_trigger):
]
if ver_mode not in ("release"):
pipelines.append(windows_test_backend(trigger, "oss", ver_mode))
pipelines.append(windows_test_backend(trigger, "enterprise", ver_mode))
windows_pipeline_dependencies.append("{}-oss-test-backend-windows".format(ver_mode))
pipelines.append(pipeline(
name = "{}-oss-integration-tests".format(ver_mode),
edition = "oss",

View File

@ -9,6 +9,7 @@ load(
load(
"scripts/drone/steps/lib.star",
"get_windows_steps",
"windows_clone_step",
"windows_go_image",
"windows_init_enterprise_steps",
"windows_test_backend_step",
@ -26,7 +27,9 @@ def windows_test_backend(trigger, edition, ver_mode):
A single pipeline running backend tests for Windows
"""
environment = {"EDITION": edition}
steps = []
steps = [
windows_clone_step(),
]
if edition == "enterprise":
steps.extend(windows_init_enterprise_steps(ver_mode))
@ -34,6 +37,7 @@ def windows_test_backend(trigger, edition, ver_mode):
steps.extend([{
"name": "windows-init",
"image": windows_go_image,
"depends_on": ["clone"],
"commands": [],
}])
@ -41,7 +45,7 @@ def windows_test_backend(trigger, edition, ver_mode):
windows_wire_install_step(edition),
windows_test_backend_step(),
])
return pipeline(
pl = pipeline(
name = "{}-{}-test-backend-windows".format(ver_mode, edition),
edition = edition,
trigger = trigger,
@ -50,6 +54,10 @@ def windows_test_backend(trigger, edition, ver_mode):
platform = "windows",
environment = environment,
)
pl["clone"] = {
"disable": True,
}
return pl
def windows(trigger, edition, ver_mode):
"""Generates the pipeline used for building Grafana on Windows.

View File

@ -688,7 +688,6 @@ def test_backend_step(image = build_image):
def windows_test_backend_step():
step = test_backend_step(image = windows_go_image)
step["failure"] = "ignore"
return step
def test_backend_integration_step():
@ -1371,6 +1370,19 @@ def publish_linux_packages_step(edition, package_manager = "deb"):
},
}
def windows_clone_step():
return {
"name": "clone",
"image": wix_image,
"environment": {
"GITHUB_TOKEN": from_secret("github_token"),
},
"commands": [
'git clone "https://$$env:GITHUB_TOKEN@github.com/$$env:DRONE_REPO.git" .',
"git checkout -f $$env:DRONE_COMMIT",
],
}
def get_windows_steps(edition, ver_mode):
"""Generate the list of Windows steps.