CI: Make grabpl and lint-drone standalone steps (#41644)

* Extract grabpl download as separate step

* Change image to alpine

* Change image to curlimage

* Change image to alpine-curl

* Extract lint-drone step

* Add lint-drone to release and main pipelines

* Rename lint_drone to lint_drone_step

* Sign drone
This commit is contained in:
Dimitris Sotirakis
2021-11-15 17:14:33 +00:00
committed by GitHub
parent b39859bdfe
commit 99900cbdd8
6 changed files with 199 additions and 60 deletions
+2
View File
@@ -1,5 +1,6 @@
load(
'scripts/drone/steps/lib.star',
'lint_drone_step',
'lint_backend_step',
'lint_frontend_step',
'codespell_step',
@@ -53,6 +54,7 @@ def get_steps(edition, is_downstream=False):
publish = edition != 'enterprise' or is_downstream
include_enterprise2 = edition == 'enterprise'
steps = [
lint_drone_step(),
enterprise_downstream_step(edition=edition),
codespell_step(),
shellcheck_step(),
+2
View File
@@ -1,5 +1,6 @@
load(
'scripts/drone/steps/lib.star',
'lint_drone_step',
'lint_backend_step',
'lint_frontend_step',
'codespell_step',
@@ -46,6 +47,7 @@ def pr_pipelines(edition):
variants = ['linux-x64', 'linux-x64-musl', 'osx64', 'win64', 'armv6',]
include_enterprise2 = edition == 'enterprise'
steps = [
lint_drone_step(),
codespell_step(),
shellcheck_step(),
lint_backend_step(edition=edition),
+2
View File
@@ -1,5 +1,6 @@
load(
'scripts/drone/steps/lib.star',
'lint_drone_step',
'test_release_ver',
'build_image',
'publish_image',
@@ -82,6 +83,7 @@ def get_steps(edition, ver_mode):
tries = 5
steps = [
lint_drone_step(),
codespell_step(),
shellcheck_step(),
lint_backend_step(edition=edition),
+29 -11
View File
@@ -6,6 +6,7 @@ publish_image = 'grafana/grafana-ci-deploy:1.3.1'
grafana_docker_image = 'grafana/drone-grafana-docker:0.3.2'
deploy_docker_image = 'us.gcr.io/kubernetes-dev/drone/plugins/deploy-image'
alpine_image = 'alpine:3.14.2'
curl_image = 'byrnedo/alpine-curl:0.1.8'
windows_image = 'mcr.microsoft.com/windows:1809'
wix_image = 'grafana/ci-wix:0.1.1'
test_release_ver = 'v7.3.0-test'
@@ -33,15 +34,7 @@ def initialize_step(edition, platform, ver_mode, is_downstream=False, install_de
},
]
download_grabpl_cmds = [
'mkdir -p bin',
'curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v{}/grabpl'.format(
grabpl_version
),
'chmod +x bin/grabpl',
]
common_cmds = [
'./bin/grabpl verify-drone',
# Generate Go code, will install Wire
# TODO: Install Wire in Docker image instead
'make gen-go',
@@ -94,7 +87,7 @@ def initialize_step(edition, platform, ver_mode, is_downstream=False, install_de
'environment': {
'GITHUB_TOKEN': from_secret(github_token),
},
'commands': download_grabpl_cmds + [
'commands': [
'git clone "https://$${GITHUB_TOKEN}@github.com/grafana/grafana-enterprise.git"',
'cd grafana-enterprise',
'git checkout {}'.format(committish),
@@ -104,7 +97,7 @@ def initialize_step(edition, platform, ver_mode, is_downstream=False, install_de
'name': 'initialize',
'image': build_image,
'depends_on': [
'clone',
'grabpl',
],
'commands': [
'mv bin/grabpl /tmp/',
@@ -125,12 +118,37 @@ def initialize_step(edition, platform, ver_mode, is_downstream=False, install_de
{
'name': 'initialize',
'image': build_image,
'commands': download_grabpl_cmds + common_cmds,
'commands': common_cmds,
},
]
return steps
def download_grabpl():
return {
'name': 'grabpl',
'image': curl_image,
'commands': [
'mkdir -p bin',
'curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v{}/grabpl'.format(
grabpl_version
),
'chmod +x bin/grabpl',
]
}
def lint_drone_step():
return {
'name': 'lint-drone',
'image': curl_image,
'commands': [
'./bin/grabpl verify-drone',
],
'depends_on': [
'grabpl',
],
}
def enterprise_downstream_step(edition):
if edition in ('enterprise', 'enterprise2'):
return None
+4 -1
View File
@@ -1,6 +1,7 @@
load(
'scripts/drone/steps/lib.star',
'initialize_step',
'download_grabpl',
'slack_step',
)
@@ -31,13 +32,15 @@ def pipeline(
}
}
grabpl_step = [download_grabpl()]
pipeline = {
'kind': 'pipeline',
'type': 'docker',
'name': name,
'trigger': trigger,
'services': services,
'steps': initialize_step(
'steps': grabpl_step + initialize_step(
edition, platform, is_downstream=is_downstream, install_deps=install_deps, ver_mode=ver_mode,
) + steps,
'depends_on': depends_on,