CI: Make shellcheck a standalone pipeline (#55082)

* Make shellcheck standalone pipeline

* Run shellcheck on every .sh change

* Change base image

* Trigger on script changes

* Run shellcheck on PRs only
This commit is contained in:
Dimitris Sotirakis 2022-09-14 09:00:06 +03:00 committed by GitHub
parent ed5d617cb9
commit 716bdde3f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 97 additions and 49 deletions

View File

@ -179,13 +179,6 @@ steps:
- rm words_to_ignore.txt
image: grafana/build-container:1.6.2
name: codespell
- commands:
- ./bin/build shellcheck
depends_on:
- grabpl
- compile-build-cmd
image: grafana/build-container:1.6.2
name: shellcheck
- commands:
- make lint-go
depends_on:
@ -686,6 +679,47 @@ clone:
retries: 3
depends_on: []
kind: pipeline
name: pr-shellcheck
node:
type: no-parallel
platform:
arch: amd64
os: linux
services: []
steps:
- commands:
- go build -o ./bin/build -ldflags '-extldflags -static' ./pkg/build/cmd
depends_on: []
environment:
CGO_ENABLED: 0
image: golang:1.19.1
name: compile-build-cmd
- commands:
- ./bin/build shellcheck
depends_on:
- compile-build-cmd
image: grafana/build-container:1.6.2
name: shellcheck
trigger:
event:
- pull_request
paths:
exclude:
- '*.md'
- docs/**
- latest.json
include:
- scripts/**/*.sh
type: docker
volumes:
- host:
path: /var/run/docker.sock
name: docker
---
clone:
retries: 3
depends_on: []
kind: pipeline
name: main-docs
node:
type: no-parallel
@ -899,13 +933,6 @@ steps:
- rm words_to_ignore.txt
image: grafana/build-container:1.6.2
name: codespell
- commands:
- ./bin/build shellcheck
depends_on:
- grabpl
- compile-build-cmd
image: grafana/build-container:1.6.2
name: shellcheck
- commands:
- make lint-go
depends_on:
@ -2044,13 +2071,6 @@ steps:
CGO_ENABLED: 0
image: golang:1.19.1
name: compile-build-cmd
- commands:
- ./bin/build shellcheck
depends_on:
- grabpl
- compile-build-cmd
image: grafana/build-container:1.6.2
name: shellcheck
- commands:
- |-
echo -e "unknwon
@ -3988,13 +4008,6 @@ steps:
CGO_ENABLED: 0
image: golang:1.19.1
name: compile-build-cmd
- commands:
- ./bin/build shellcheck
depends_on:
- grabpl
- compile-build-cmd
image: grafana/build-container:1.6.2
name: shellcheck
- commands:
- |-
echo -e "unknwon
@ -5114,6 +5127,6 @@ kind: secret
name: packages_secret_access_key
---
kind: signature
hmac: 4dab9811ddd4be2ca5cd598be69ce216e82406ca4197fdaeb75691156d356382
hmac: f8201ab7fe1632df9158ee66cc0a9bff140e9a7e4b2044b34b8e4e30d424aaad
...

View File

@ -34,6 +34,11 @@ load(
'trigger_docs_pr',
)
load(
'scripts/drone/pipelines/shellcheck.star',
'shellcheck_pipeline',
)
ver_mode = 'pr'
trigger = {
'event': [
@ -56,7 +61,8 @@ def pr_pipelines(edition):
test_backend(get_pr_trigger(include_paths=['pkg/**', 'packaging/**', '.drone.yml', 'conf/**', 'go.sum', 'go.mod', 'public/app/plugins/**/plugin.json', 'devenv/**']), ver_mode),
build_e2e(trigger, ver_mode, edition),
integration_tests(get_pr_trigger(include_paths=['pkg/**', 'packaging/**', '.drone.yml', 'conf/**', 'go.sum', 'go.mod', 'public/app/plugins/**/plugin.json']), ver_mode, edition),
docs_pipelines(edition, ver_mode, trigger_docs_pr())
docs_pipelines(edition, ver_mode, trigger_docs_pr()),
shellcheck_pipeline(),
]

View File

@ -13,7 +13,6 @@ load(
'lint_backend_step',
'lint_frontend_step',
'codespell_step',
'shellcheck_step',
'test_backend_step',
'test_backend_integration_step',
'test_frontend_step',
@ -170,8 +169,6 @@ def get_steps(edition, ver_mode):
]
test_steps = []
if edition != 'enterprise':
test_steps.extend([shellcheck_step()])
test_steps.extend([
codespell_step(),

View File

@ -0,0 +1,48 @@
load(
'scripts/drone/steps/lib.star',
'build_image',
'compile_build_cmd'
)
load(
'scripts/drone/utils/utils.star',
'pipeline',
)
trigger = {
'event': [
'pull_request',
],
'paths': {
'exclude': [
'*.md',
'docs/**',
'latest.json',
],
'include': [
'scripts/**/*.sh'
],
},
}
def shellcheck_step():
return {
'name': 'shellcheck',
'image': build_image,
'depends_on': [
'compile-build-cmd',
],
'commands': [
'./bin/build shellcheck',
],
}
def shellcheck_pipeline():
steps = [
compile_build_cmd(),
shellcheck_step(),
]
return pipeline(
name='pr-shellcheck', edition="oss", trigger=trigger, services=[], steps=steps,
)

View File

@ -4,7 +4,6 @@ load(
'download_grabpl_step',
'wire_install_step',
'codespell_step',
'shellcheck_step',
'lint_backend_step',
'lint_drone_step',
'test_backend_step',
@ -28,7 +27,6 @@ def test_backend(trigger, ver_mode):
]
test_steps = [
codespell_step(),
shellcheck_step(),
lint_backend_step(edition="oss"),
test_backend_step(edition="oss"),
test_backend_integration_step(edition="oss"),

View File

@ -630,20 +630,6 @@ def codespell_step():
}
def shellcheck_step():
return {
'name': 'shellcheck',
'image': build_image,
'depends_on': [
'grabpl',
'compile-build-cmd',
],
'commands': [
'./bin/build shellcheck',
],
}
def package_step(edition, ver_mode, include_enterprise2=False, variants=None):
deps = [
'build-plugins',