mirror of
https://github.com/grafana/grafana.git
synced 2025-02-20 11:48:34 -06:00
CI: move grabpl shellcheck
from grabpl to grafana (#53076)
* add grabpl shellcheck * grabpl shellcheck -> ./bin/build shellcheck
This commit is contained in:
parent
7f43839813
commit
d1d237f30a
14
.drone.yml
14
.drone.yml
@ -192,9 +192,10 @@ steps:
|
||||
image: grafana/build-container:1.5.9
|
||||
name: codespell
|
||||
- commands:
|
||||
- ./bin/grabpl shellcheck
|
||||
- ./bin/build shellcheck
|
||||
depends_on:
|
||||
- grabpl
|
||||
- compile-build-cmd
|
||||
image: grafana/build-container:1.5.9
|
||||
name: shellcheck
|
||||
- commands:
|
||||
@ -956,9 +957,10 @@ steps:
|
||||
image: grafana/build-container:1.5.9
|
||||
name: codespell
|
||||
- commands:
|
||||
- ./bin/grabpl shellcheck
|
||||
- ./bin/build shellcheck
|
||||
depends_on:
|
||||
- grabpl
|
||||
- compile-build-cmd
|
||||
image: grafana/build-container:1.5.9
|
||||
name: shellcheck
|
||||
- commands:
|
||||
@ -2112,9 +2114,10 @@ steps:
|
||||
image: golang:1.17
|
||||
name: compile-build-cmd
|
||||
- commands:
|
||||
- ./bin/grabpl shellcheck
|
||||
- ./bin/build shellcheck
|
||||
depends_on:
|
||||
- grabpl
|
||||
- compile-build-cmd
|
||||
image: grafana/build-container:1.5.9
|
||||
name: shellcheck
|
||||
- commands:
|
||||
@ -4030,9 +4033,10 @@ steps:
|
||||
image: golang:1.17
|
||||
name: compile-build-cmd
|
||||
- commands:
|
||||
- ./bin/grabpl shellcheck
|
||||
- ./bin/build shellcheck
|
||||
depends_on:
|
||||
- grabpl
|
||||
- compile-build-cmd
|
||||
image: grafana/build-container:1.5.9
|
||||
name: shellcheck
|
||||
- commands:
|
||||
@ -5133,6 +5137,6 @@ kind: secret
|
||||
name: gcp_upload_artifacts_key
|
||||
---
|
||||
kind: signature
|
||||
hmac: 7d799b8c9888eeb4b72f6aa1721fe335d4eb74c6fb2db9612970adbb9462d395
|
||||
hmac: 0397ad1da4fa12ba9bbe6654866329df4f7854339610f1dc513bd14ac518ce7b
|
||||
|
||||
...
|
||||
|
@ -24,6 +24,10 @@ func main() {
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "shellcheck",
|
||||
Usage: "Run shellcheck on shell scripts",
|
||||
Action: Shellcheck,
|
||||
}, {
|
||||
Name: "build-plugins",
|
||||
Usage: "Build internal plug-ins",
|
||||
Action: ArgCountWrapper(1, BuildInternalPlugins),
|
||||
|
42
pkg/build/cmd/shellcheck.go
Normal file
42
pkg/build/cmd/shellcheck.go
Normal file
@ -0,0 +1,42 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
func Shellcheck(c *cli.Context) error {
|
||||
log.Println("Running shellcheck...")
|
||||
|
||||
fpaths := []string{}
|
||||
if err := filepath.Walk("scripts", func(path string, info os.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if strings.HasSuffix(path, ".sh") {
|
||||
fpaths = append(fpaths, path)
|
||||
}
|
||||
|
||||
return nil
|
||||
}); err != nil {
|
||||
return fmt.Errorf("couldn't traverse scripts/: %w", err)
|
||||
}
|
||||
|
||||
log.Printf("Running shellcheck on %s", strings.Join(fpaths, ","))
|
||||
args := append([]string{"-e", "SC1071", "-e", "SC2162"}, fpaths...)
|
||||
//nolint:gosec
|
||||
cmd := exec.Command("shellcheck", args...)
|
||||
if output, err := cmd.CombinedOutput(); err != nil {
|
||||
return fmt.Errorf("shellcheck failed: %s", output)
|
||||
}
|
||||
|
||||
log.Println("Successfully ran shellcheck!")
|
||||
return nil
|
||||
}
|
@ -654,9 +654,10 @@ def shellcheck_step():
|
||||
'image': build_image,
|
||||
'depends_on': [
|
||||
'grabpl',
|
||||
'compile-build-cmd',
|
||||
],
|
||||
'commands': [
|
||||
'./bin/grabpl shellcheck',
|
||||
'./bin/build shellcheck',
|
||||
],
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user