From 75b901846404b0381a612480b74277cd8991736a Mon Sep 17 00:00:00 2001 From: Arve Knudsen Date: Tue, 4 May 2021 15:05:39 +0200 Subject: [PATCH] CI: Lint backend after testing, to catch build failures early (#33622) Signed-off-by: Arve Knudsen --- .drone.yml | 220 +++++++++++++++++++++---------------------- scripts/lib.star | 2 +- scripts/master.star | 4 +- scripts/pr.star | 4 +- scripts/release.star | 4 +- 5 files changed, 117 insertions(+), 117 deletions(-) diff --git a/.drone.yml b/.drone.yml index 725cf387623..99f10a5d1dd 100644 --- a/.drone.yml +++ b/.drone.yml @@ -27,15 +27,6 @@ steps: environment: DOCKERIZE_VERSION: 0.6.1 -- name: lint-backend - image: grafana/build-container:1.4.1 - commands: - - ./bin/grabpl lint-backend --edition oss - environment: - CGO_ENABLED: 1 - depends_on: - - initialize - - name: codespell image: grafana/build-container:1.4.1 commands: @@ -59,7 +50,16 @@ steps: - ./bin/grabpl integration-tests --edition oss depends_on: - initialize - - lint-backend + +- name: lint-backend + image: grafana/build-container:1.4.1 + commands: + - ./bin/grabpl lint-backend --edition oss + environment: + CGO_ENABLED: 1 + depends_on: + - initialize + - test-backend - name: test-frontend image: grafana/build-container:1.4.1 @@ -273,15 +273,6 @@ steps: token: from_secret: drone_token -- name: lint-backend - image: grafana/build-container:1.4.1 - commands: - - ./bin/grabpl lint-backend --edition oss - environment: - CGO_ENABLED: 1 - depends_on: - - initialize - - name: codespell image: grafana/build-container:1.4.1 commands: @@ -305,7 +296,16 @@ steps: - ./bin/grabpl integration-tests --edition oss depends_on: - initialize - - lint-backend + +- name: lint-backend + image: grafana/build-container:1.4.1 + commands: + - ./bin/grabpl lint-backend --edition oss + environment: + CGO_ENABLED: 1 + depends_on: + - initialize + - test-backend - name: test-frontend image: grafana/build-container:1.4.1 @@ -721,15 +721,6 @@ steps: environment: DOCKERIZE_VERSION: 0.6.1 -- name: lint-backend - image: grafana/build-container:1.4.1 - commands: - - ./bin/grabpl lint-backend --edition oss - environment: - CGO_ENABLED: 1 - depends_on: - - initialize - - name: codespell image: grafana/build-container:1.4.1 commands: @@ -753,7 +744,16 @@ steps: - ./bin/grabpl integration-tests --edition oss depends_on: - initialize - - lint-backend + +- name: lint-backend + image: grafana/build-container:1.4.1 + commands: + - ./bin/grabpl lint-backend --edition oss + environment: + CGO_ENABLED: 1 + depends_on: + - initialize + - test-backend - name: test-frontend image: grafana/build-container:1.4.1 @@ -1089,15 +1089,6 @@ steps: depends_on: - clone -- name: lint-backend - image: grafana/build-container:1.4.1 - commands: - - ./bin/grabpl lint-backend --edition enterprise - environment: - CGO_ENABLED: 1 - depends_on: - - initialize - - name: codespell image: grafana/build-container:1.4.1 commands: @@ -1121,7 +1112,16 @@ steps: - ./bin/grabpl integration-tests --edition enterprise depends_on: - initialize - - lint-backend + +- name: lint-backend + image: grafana/build-container:1.4.1 + commands: + - ./bin/grabpl lint-backend --edition enterprise + environment: + CGO_ENABLED: 1 + depends_on: + - initialize + - test-backend - name: test-frontend image: grafana/build-container:1.4.1 @@ -1163,15 +1163,6 @@ steps: - initialize - lint-backend -- name: lint-backend-enterprise2 - image: grafana/build-container:1.4.1 - commands: - - ./bin/grabpl lint-backend --edition enterprise2 - environment: - CGO_ENABLED: 1 - depends_on: - - initialize - - name: test-backend-enterprise2 image: grafana/build-container:1.4.1 commands: @@ -1180,7 +1171,16 @@ steps: - ./bin/grabpl integration-tests --edition enterprise2 depends_on: - initialize - - lint-backend-enterprise2 + +- name: lint-backend-enterprise2 + image: grafana/build-container:1.4.1 + commands: + - ./bin/grabpl lint-backend --edition enterprise2 + environment: + CGO_ENABLED: 1 + depends_on: + - initialize + - test-backend-enterprise2 - name: build-backend-enterprise2 image: grafana/build-container:1.4.1 @@ -1656,15 +1656,6 @@ steps: environment: DOCKERIZE_VERSION: 0.6.1 -- name: lint-backend - image: grafana/build-container:1.4.1 - commands: - - ./bin/grabpl lint-backend --edition oss - environment: - CGO_ENABLED: 1 - depends_on: - - initialize - - name: codespell image: grafana/build-container:1.4.1 commands: @@ -1688,7 +1679,16 @@ steps: - ./bin/grabpl integration-tests --edition oss depends_on: - initialize - - lint-backend + +- name: lint-backend + image: grafana/build-container:1.4.1 + commands: + - ./bin/grabpl lint-backend --edition oss + environment: + CGO_ENABLED: 1 + depends_on: + - initialize + - test-backend - name: test-frontend image: grafana/build-container:1.4.1 @@ -2013,15 +2013,6 @@ steps: depends_on: - clone -- name: lint-backend - image: grafana/build-container:1.4.1 - commands: - - ./bin/grabpl lint-backend --edition enterprise - environment: - CGO_ENABLED: 1 - depends_on: - - initialize - - name: codespell image: grafana/build-container:1.4.1 commands: @@ -2045,7 +2036,16 @@ steps: - ./bin/grabpl integration-tests --edition enterprise depends_on: - initialize - - lint-backend + +- name: lint-backend + image: grafana/build-container:1.4.1 + commands: + - ./bin/grabpl lint-backend --edition enterprise + environment: + CGO_ENABLED: 1 + depends_on: + - initialize + - test-backend - name: test-frontend image: grafana/build-container:1.4.1 @@ -2087,15 +2087,6 @@ steps: - initialize - lint-backend -- name: lint-backend-enterprise2 - image: grafana/build-container:1.4.1 - commands: - - ./bin/grabpl lint-backend --edition enterprise2 - environment: - CGO_ENABLED: 1 - depends_on: - - initialize - - name: test-backend-enterprise2 image: grafana/build-container:1.4.1 commands: @@ -2104,7 +2095,16 @@ steps: - ./bin/grabpl integration-tests --edition enterprise2 depends_on: - initialize - - lint-backend-enterprise2 + +- name: lint-backend-enterprise2 + image: grafana/build-container:1.4.1 + commands: + - ./bin/grabpl lint-backend --edition enterprise2 + environment: + CGO_ENABLED: 1 + depends_on: + - initialize + - test-backend-enterprise2 - name: build-backend-enterprise2 image: grafana/build-container:1.4.1 @@ -2573,15 +2573,6 @@ steps: environment: DOCKERIZE_VERSION: 0.6.1 -- name: lint-backend - image: grafana/build-container:1.4.1 - commands: - - ./bin/grabpl lint-backend --edition oss - environment: - CGO_ENABLED: 1 - depends_on: - - initialize - - name: codespell image: grafana/build-container:1.4.1 commands: @@ -2605,7 +2596,16 @@ steps: - ./bin/grabpl integration-tests --edition oss depends_on: - initialize - - lint-backend + +- name: lint-backend + image: grafana/build-container:1.4.1 + commands: + - ./bin/grabpl lint-backend --edition oss + environment: + CGO_ENABLED: 1 + depends_on: + - initialize + - test-backend - name: test-frontend image: grafana/build-container:1.4.1 @@ -2901,15 +2901,6 @@ steps: depends_on: - clone -- name: lint-backend - image: grafana/build-container:1.4.1 - commands: - - ./bin/grabpl lint-backend --edition enterprise - environment: - CGO_ENABLED: 1 - depends_on: - - initialize - - name: codespell image: grafana/build-container:1.4.1 commands: @@ -2933,7 +2924,16 @@ steps: - ./bin/grabpl integration-tests --edition enterprise depends_on: - initialize - - lint-backend + +- name: lint-backend + image: grafana/build-container:1.4.1 + commands: + - ./bin/grabpl lint-backend --edition enterprise + environment: + CGO_ENABLED: 1 + depends_on: + - initialize + - test-backend - name: test-frontend image: grafana/build-container:1.4.1 @@ -2972,15 +2972,6 @@ steps: - initialize - lint-backend -- name: lint-backend-enterprise2 - image: grafana/build-container:1.4.1 - commands: - - ./bin/grabpl lint-backend --edition enterprise2 - environment: - CGO_ENABLED: 1 - depends_on: - - initialize - - name: test-backend-enterprise2 image: grafana/build-container:1.4.1 commands: @@ -2989,7 +2980,16 @@ steps: - ./bin/grabpl integration-tests --edition enterprise2 depends_on: - initialize - - lint-backend-enterprise2 + +- name: lint-backend-enterprise2 + image: grafana/build-container:1.4.1 + commands: + - ./bin/grabpl lint-backend --edition enterprise2 + environment: + CGO_ENABLED: 1 + depends_on: + - initialize + - test-backend-enterprise2 - name: build-backend-enterprise2 image: grafana/build-container:1.4.1 diff --git a/scripts/lib.star b/scripts/lib.star index 1cc0b49ca2f..549ab17c875 100644 --- a/scripts/lib.star +++ b/scripts/lib.star @@ -215,6 +215,7 @@ def lint_backend_step(edition): }, 'depends_on': [ 'initialize', + 'test-backend' + enterprise2_sfx(edition), ], 'commands': [ # Don't use Make since it will re-download the linters @@ -451,7 +452,6 @@ def test_backend_step(edition): 'image': build_image, 'depends_on': [ 'initialize', - 'lint-backend' + enterprise2_sfx(edition), ], 'commands': [ # First make sure that there are no tests with FocusConvey diff --git a/scripts/master.star b/scripts/master.star index eba5fd06e0e..dbfa7266bc7 100644 --- a/scripts/master.star +++ b/scripts/master.star @@ -43,10 +43,10 @@ def get_steps(edition, is_downstream=False): include_enterprise2 = edition == 'enterprise' steps = [ enterprise_downstream_step(edition=edition), - lint_backend_step(edition=edition), codespell_step(), shellcheck_step(), test_backend_step(edition=edition), + lint_backend_step(edition=edition), test_frontend_step(), frontend_metrics_step(edition=edition), build_backend_step(edition=edition, ver_mode=ver_mode, is_downstream=is_downstream), @@ -58,8 +58,8 @@ def get_steps(edition, is_downstream=False): if include_enterprise2: edition2 = 'enterprise2' steps.extend([ - lint_backend_step(edition=edition2), test_backend_step(edition=edition2), + lint_backend_step(edition=edition2), build_backend_step(edition=edition2, ver_mode=ver_mode, variants=['linux-x64'], is_downstream=is_downstream), ]) diff --git a/scripts/pr.star b/scripts/pr.star index de80102dcd7..e98dc7c357b 100644 --- a/scripts/pr.star +++ b/scripts/pr.star @@ -34,10 +34,10 @@ def pr_pipelines(edition): variants = ['linux-x64', 'linux-x64-musl', 'osx64', 'win64',] include_enterprise2 = edition == 'enterprise' steps = [ - lint_backend_step(edition=edition), codespell_step(), shellcheck_step(), test_backend_step(edition=edition), + lint_backend_step(edition=edition), test_frontend_step(), build_backend_step(edition=edition, ver_mode=ver_mode, variants=variants), build_frontend_step(edition=edition, ver_mode=ver_mode), @@ -50,8 +50,8 @@ def pr_pipelines(edition): steps.append(benchmark_ldap_step()) services.append(ldap_service()) steps.extend([ - lint_backend_step(edition=edition2), test_backend_step(edition=edition2), + lint_backend_step(edition=edition2), build_backend_step(edition=edition2, ver_mode=ver_mode, variants=['linux-x64']), ]) diff --git a/scripts/release.star b/scripts/release.star index 099e06b6668..32c2feb098d 100644 --- a/scripts/release.star +++ b/scripts/release.star @@ -68,10 +68,10 @@ def get_steps(edition, ver_mode): include_enterprise2 = edition == 'enterprise' steps = [ - lint_backend_step(edition=edition), codespell_step(), shellcheck_step(), test_backend_step(edition=edition), + lint_backend_step(edition=edition), test_frontend_step(), build_backend_step(edition=edition, ver_mode=ver_mode), build_frontend_step(edition=edition, ver_mode=ver_mode), @@ -82,8 +82,8 @@ def get_steps(edition, ver_mode): if include_enterprise2: edition2 = 'enterprise2' steps.extend([ - lint_backend_step(edition=edition2), test_backend_step(edition=edition2), + lint_backend_step(edition=edition2), build_backend_step(edition=edition2, ver_mode=ver_mode, variants=['linux-x64']), ])