|
|
@ -2,6 +2,8 @@ build_image = 'grafana/build-container:1.2.24' |
|
|
|
publish_image = 'grafana/grafana-ci-deploy:1.2.5' |
|
|
|
publish_image = 'grafana/grafana-ci-deploy:1.2.5' |
|
|
|
grafana_docker_image = 'grafana/drone-grafana-docker:0.2.0' |
|
|
|
grafana_docker_image = 'grafana/drone-grafana-docker:0.2.0' |
|
|
|
alpine_image = 'alpine:3.12' |
|
|
|
alpine_image = 'alpine:3.12' |
|
|
|
|
|
|
|
windows_image = 'mcr.microsoft.com/windows:1809' |
|
|
|
|
|
|
|
grabpl_version = '0.5.1' |
|
|
|
|
|
|
|
|
|
|
|
def pr_pipelines(edition): |
|
|
|
def pr_pipelines(edition): |
|
|
|
services = [ |
|
|
|
services = [ |
|
|
@ -95,47 +97,79 @@ def master_pipelines(edition): |
|
|
|
build_docker_images_step(edition=edition, ubuntu=True), |
|
|
|
build_docker_images_step(edition=edition, ubuntu=True), |
|
|
|
postgres_integration_tests_step(), |
|
|
|
postgres_integration_tests_step(), |
|
|
|
mysql_integration_tests_step(), |
|
|
|
mysql_integration_tests_step(), |
|
|
|
build_windows_installer_step(), |
|
|
|
|
|
|
|
release_next_npm_packages_step(edition), |
|
|
|
release_next_npm_packages_step(edition), |
|
|
|
publish_packages_step(edition), |
|
|
|
publish_packages_step(edition), |
|
|
|
deploy_to_kubernetes_step(edition), |
|
|
|
deploy_to_kubernetes_step(edition), |
|
|
|
] |
|
|
|
] |
|
|
|
|
|
|
|
windows_steps = [ |
|
|
|
|
|
|
|
windows_installer_step(edition), |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
trigger = { |
|
|
|
|
|
|
|
'event': ['push',], |
|
|
|
|
|
|
|
'branch': 'master', |
|
|
|
|
|
|
|
} |
|
|
|
return [ |
|
|
|
return [ |
|
|
|
pipeline( |
|
|
|
pipeline( |
|
|
|
name='test-master', edition=edition, trigger={ |
|
|
|
name='test-master', edition=edition, trigger=trigger, services=services, steps=steps |
|
|
|
'event': ['push',], |
|
|
|
), |
|
|
|
'branch': 'master', |
|
|
|
pipeline( |
|
|
|
}, services=services, steps=steps |
|
|
|
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 = { |
|
|
|
pipeline = { |
|
|
|
'kind': 'pipeline', |
|
|
|
'kind': 'pipeline', |
|
|
|
'type': 'docker', |
|
|
|
'type': 'docker', |
|
|
|
|
|
|
|
'platform': platform_conf, |
|
|
|
'name': name, |
|
|
|
'name': name, |
|
|
|
'trigger': trigger, |
|
|
|
'trigger': trigger, |
|
|
|
'services': services, |
|
|
|
'services': services, |
|
|
|
'steps': init_steps(edition) + steps, |
|
|
|
'steps': init_steps(edition, platform) + steps, |
|
|
|
|
|
|
|
'depends_on': depends_on, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if edition == 'enterprise': |
|
|
|
if edition == 'enterprise': |
|
|
|
# We have a custom clone step for enterprise |
|
|
|
# We have a custom clone step for enterprise |
|
|
|
pipeline['clone'] = { |
|
|
|
pipeline['clone'] = { |
|
|
|
'disable': True, |
|
|
|
'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', |
|
|
|
'name': 'identify-runner', |
|
|
|
'image': alpine_image, |
|
|
|
'image': alpine_image, |
|
|
|
'commands': [ |
|
|
|
'commands': [ |
|
|
|
'echo $DRONE_RUNNER_NAME', |
|
|
|
'echo $DRONE_RUNNER_NAME', |
|
|
|
], |
|
|
|
], |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return pipeline |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def init_steps(edition): |
|
|
|
|
|
|
|
grabpl_version = '0.5.0' |
|
|
|
|
|
|
|
common_cmds = [ |
|
|
|
common_cmds = [ |
|
|
|
'curl -fLO https://github.com/jwilder/dockerize/releases/download/v$${DOCKERIZE_VERSION}/dockerize-linux-amd64-v$${DOCKERIZE_VERSION}.tar.gz', |
|
|
|
'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', |
|
|
|
'tar -C bin -xzvf dockerize-linux-amd64-v$${DOCKERIZE_VERSION}.tar.gz', |
|
|
@ -144,6 +178,7 @@ def init_steps(edition): |
|
|
|
] |
|
|
|
] |
|
|
|
if edition == 'enterprise': |
|
|
|
if edition == 'enterprise': |
|
|
|
return [ |
|
|
|
return [ |
|
|
|
|
|
|
|
identify_runner_step, |
|
|
|
{ |
|
|
|
{ |
|
|
|
'name': 'clone', |
|
|
|
'name': 'clone', |
|
|
|
'image': 'alpine/git:v2.26.2', |
|
|
|
'image': 'alpine/git:v2.26.2', |
|
|
@ -181,6 +216,7 @@ def init_steps(edition): |
|
|
|
] |
|
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
return [ |
|
|
|
return [ |
|
|
|
|
|
|
|
identify_runner_step, |
|
|
|
{ |
|
|
|
{ |
|
|
|
'name': 'initialize', |
|
|
|
'name': 'initialize', |
|
|
|
'image': build_image, |
|
|
|
'image': build_image, |
|
|
@ -568,8 +604,6 @@ def publish_packages_step(edition): |
|
|
|
'image': publish_image, |
|
|
|
'image': publish_image, |
|
|
|
'depends_on': [ |
|
|
|
'depends_on': [ |
|
|
|
'package', |
|
|
|
'package', |
|
|
|
# TODO |
|
|
|
|
|
|
|
# 'build-windows-installer', |
|
|
|
|
|
|
|
'end-to-end-tests', |
|
|
|
'end-to-end-tests', |
|
|
|
'mysql-integration-tests', |
|
|
|
'mysql-integration-tests', |
|
|
|
'postgres-integration-tests', |
|
|
|
'postgres-integration-tests', |
|
|
@ -580,17 +614,33 @@ def publish_packages_step(edition): |
|
|
|
], |
|
|
|
], |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
def build_windows_installer_step(): |
|
|
|
def windows_installer_step(edition): |
|
|
|
# TODO: Build Windows installer, waiting on Brian to fix the build image |
|
|
|
sfx = '' |
|
|
|
|
|
|
|
if edition == 'enterprise': |
|
|
|
|
|
|
|
sfx = '-enterprise' |
|
|
|
return { |
|
|
|
return { |
|
|
|
'name': 'build-windows-installer', |
|
|
|
'name': 'build-windows-installer', |
|
|
|
# TODO: Need new image that can execute as root |
|
|
|
'image': 'grafana/ci-wix:0.1.1', |
|
|
|
'image': 'grafana/wix-toolset-ci:v3', |
|
|
|
'environment': { |
|
|
|
'depends_on': [ |
|
|
|
'GCP_KEY': { |
|
|
|
'package', |
|
|
|
'from_secret': 'gcp_key', |
|
|
|
], |
|
|
|
}, |
|
|
|
|
|
|
|
}, |
|
|
|
'commands': [ |
|
|
|
'commands': [ |
|
|
|
# TODO: Enable. Waiting on Brian to fix image. |
|
|
|
'$$gcpKey = $$env:GCP_KEY', |
|
|
|
'echo ./scripts/build/ci-msi-build/ci-msi-build-oss.sh', |
|
|
|
'[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), |
|
|
|
], |
|
|
|
], |
|
|
|
} |
|
|
|
} |
|
|
|