mirror of
https://github.com/grafana/grafana.git
synced 2025-07-30 16:32:13 +08:00
Drone: Add Windows PR pipeline (#26589)
* Drone: Add Windows PR pipeline * CI: Add Dockerfile for WiX image
This commit is contained in:
@ -2,6 +2,8 @@ build_image = 'grafana/build-container:1.2.24'
|
||||
publish_image = 'grafana/grafana-ci-deploy:1.2.5'
|
||||
grafana_docker_image = 'grafana/drone-grafana-docker:0.2.0'
|
||||
alpine_image = 'alpine:3.12'
|
||||
windows_image = 'mcr.microsoft.com/windows:1809'
|
||||
grabpl_version = '0.5.1'
|
||||
|
||||
def pr_pipelines(edition):
|
||||
services = [
|
||||
@ -95,47 +97,79 @@ def master_pipelines(edition):
|
||||
build_docker_images_step(edition=edition, ubuntu=True),
|
||||
postgres_integration_tests_step(),
|
||||
mysql_integration_tests_step(),
|
||||
build_windows_installer_step(),
|
||||
release_next_npm_packages_step(edition),
|
||||
publish_packages_step(edition),
|
||||
deploy_to_kubernetes_step(edition),
|
||||
]
|
||||
windows_steps = [
|
||||
windows_installer_step(edition),
|
||||
]
|
||||
trigger = {
|
||||
'event': ['push',],
|
||||
'branch': 'master',
|
||||
}
|
||||
return [
|
||||
pipeline(
|
||||
name='test-master', edition=edition, trigger={
|
||||
'event': ['push',],
|
||||
'branch': 'master',
|
||||
}, services=services, steps=steps
|
||||
name='test-master', edition=edition, trigger=trigger, services=services, steps=steps
|
||||
),
|
||||
pipeline(
|
||||
name='windows-installer-master', edition=edition, trigger=trigger,
|
||||
steps=windows_steps, platform='windows', depends_on=['test-master'],
|
||||
),
|
||||
]
|
||||
|
||||
def pipeline(name, edition, trigger, steps, services=[]):
|
||||
def pipeline(name, edition, trigger, steps, services=[], platform='linux', depends_on=[]):
|
||||
if platform != 'windows':
|
||||
platform_conf = {
|
||||
'os': 'linux',
|
||||
'arch': 'amd64',
|
||||
}
|
||||
else:
|
||||
platform_conf = {
|
||||
'os': 'windows',
|
||||
'arch': 'amd64',
|
||||
'version': '1809',
|
||||
}
|
||||
|
||||
pipeline = {
|
||||
'kind': 'pipeline',
|
||||
'type': 'docker',
|
||||
'platform': platform_conf,
|
||||
'name': name,
|
||||
'trigger': trigger,
|
||||
'services': services,
|
||||
'steps': init_steps(edition) + steps,
|
||||
'steps': init_steps(edition, platform) + steps,
|
||||
'depends_on': depends_on,
|
||||
}
|
||||
|
||||
if edition == 'enterprise':
|
||||
# We have a custom clone step for enterprise
|
||||
pipeline['clone'] = {
|
||||
'disable': True,
|
||||
}
|
||||
|
||||
pipeline['steps'].insert(0, {
|
||||
return pipeline
|
||||
|
||||
def init_steps(edition, platform):
|
||||
if platform == 'windows':
|
||||
return [
|
||||
{
|
||||
'name': 'identify-runner',
|
||||
'image': windows_image,
|
||||
'commands': [
|
||||
'echo $Env:DRONE_RUNNER_NAME',
|
||||
],
|
||||
},
|
||||
]
|
||||
|
||||
identify_runner_step = {
|
||||
'name': 'identify-runner',
|
||||
'image': alpine_image,
|
||||
'commands': [
|
||||
'echo $DRONE_RUNNER_NAME',
|
||||
],
|
||||
})
|
||||
}
|
||||
|
||||
return pipeline
|
||||
|
||||
def init_steps(edition):
|
||||
grabpl_version = '0.5.0'
|
||||
common_cmds = [
|
||||
'curl -fLO https://github.com/jwilder/dockerize/releases/download/v$${DOCKERIZE_VERSION}/dockerize-linux-amd64-v$${DOCKERIZE_VERSION}.tar.gz',
|
||||
'tar -C bin -xzvf dockerize-linux-amd64-v$${DOCKERIZE_VERSION}.tar.gz',
|
||||
@ -144,6 +178,7 @@ def init_steps(edition):
|
||||
]
|
||||
if edition == 'enterprise':
|
||||
return [
|
||||
identify_runner_step,
|
||||
{
|
||||
'name': 'clone',
|
||||
'image': 'alpine/git:v2.26.2',
|
||||
@ -181,6 +216,7 @@ def init_steps(edition):
|
||||
]
|
||||
|
||||
return [
|
||||
identify_runner_step,
|
||||
{
|
||||
'name': 'initialize',
|
||||
'image': build_image,
|
||||
@ -568,8 +604,6 @@ def publish_packages_step(edition):
|
||||
'image': publish_image,
|
||||
'depends_on': [
|
||||
'package',
|
||||
# TODO
|
||||
# 'build-windows-installer',
|
||||
'end-to-end-tests',
|
||||
'mysql-integration-tests',
|
||||
'postgres-integration-tests',
|
||||
@ -580,17 +614,33 @@ def publish_packages_step(edition):
|
||||
],
|
||||
}
|
||||
|
||||
def build_windows_installer_step():
|
||||
# TODO: Build Windows installer, waiting on Brian to fix the build image
|
||||
def windows_installer_step(edition):
|
||||
sfx = ''
|
||||
if edition == 'enterprise':
|
||||
sfx = '-enterprise'
|
||||
return {
|
||||
'name': 'build-windows-installer',
|
||||
# TODO: Need new image that can execute as root
|
||||
'image': 'grafana/wix-toolset-ci:v3',
|
||||
'depends_on': [
|
||||
'package',
|
||||
],
|
||||
'image': 'grafana/ci-wix:0.1.1',
|
||||
'environment': {
|
||||
'GCP_KEY': {
|
||||
'from_secret': 'gcp_key',
|
||||
},
|
||||
},
|
||||
'commands': [
|
||||
# TODO: Enable. Waiting on Brian to fix image.
|
||||
'echo ./scripts/build/ci-msi-build/ci-msi-build-oss.sh',
|
||||
'$$gcpKey = $$env:GCP_KEY',
|
||||
'[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($$gcpKey)) > gcpkey.json',
|
||||
# gcloud fails to read the file unless converted with dos2unix
|
||||
'dos2unix gcpkey.json',
|
||||
'gcloud auth activate-service-account --key-file=gcpkey.json',
|
||||
'rm gcpkey.json',
|
||||
'$$ProgressPreference = "SilentlyContinue"',
|
||||
'Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v{}/windows/grabpl.exe -OutFile grabpl.exe'.format(grabpl_version),
|
||||
# TODO: Infer correct Grafana version
|
||||
'Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/{}/master/grafana{}-7.2.0-9fffe273pre.windows-amd64.zip -OutFile grafana.zip'.format(edition, sfx),
|
||||
'cp C:\\App\\nssm-2.24.zip .',
|
||||
'./grabpl.exe windows-installer --edition {} grafana.zip'.format(edition),
|
||||
'$$fname = ((Get-Childitem grafana*.msi -name) -split "`n")[0]',
|
||||
'echo "gsutil cp $$fname gs://grafana-downloads/{}/master/"'.format(edition),
|
||||
'echo "gsutil cp $$fname.sha256 gs://grafana-downloads/{}/master/"'.format(edition),
|
||||
],
|
||||
}
|
||||
|
Reference in New Issue
Block a user