Skip to content

Commit

Permalink
refactor: update workflow to use jsonnet fmt/lint container image (#263)
Browse files Browse the repository at this point in the history
* refactor: update workflow to use jsonnet fmt/lint container image

* refactor: add fmt/lint version
  • Loading branch information
mahrufiqbalHO authored Sep 30, 2022
1 parent e962d5c commit a56a05a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 30 deletions.
30 changes: 2 additions & 28 deletions .github/workflows/docker-build-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,39 +30,13 @@ jobs:
with:
dockerfile: ./monitoring-as-code/Dockerfile

- uses: actions/setup-go@v3

- name: Set up jsonnet
run: |
go install github.com/google/go-jsonnet/cmd/[email protected]
go install github.com/jsonnet-bundler/jsonnet-bundler/cmd/[email protected]
go install github.com/google/go-jsonnet/cmd/[email protected]
go install github.com/google/go-jsonnet/cmd/[email protected]
eval "$(go env)"
PATH=$PATH:$GOPATH/bin
jb init
jb install https://github.com/grafana/grafonnet-lib/grafonnet
jb install https://github.com/grafana/jsonnet-libs/grafana-builder
- name: Jsonnet format check
run: |
eval "$(go env)"
PATH=$PATH:$GOPATH/bin
jsonnetfmt -v
find . -name 'vendor' -prune -o -name '*.libsonnet' -print -o -name '*.jsonnet' -print | xargs -n 1 jsonnetfmt -n 2 --max-blank-lines 2 --string-style s --comment-style s --no-sort-imports -i && git diff --exit-code --color
sh ${{ github.workspace }}/monitoring-as-code/fmt.sh && git diff --exit-code --color
- name: Jsonnet lint check
run: |
eval "$(go env)"
PATH=$PATH:$GOPATH/bin
jsonnet-lint -v
find . -name 'vendor' -prune -o -name '*.libsonnet' -print -o -name '*.jsonnet' -print | xargs -n 1 jsonnet-lint -J vendor
sh ${{ github.workspace }}/monitoring-as-code/lint.sh
#Logs into Github registry
- name: Login to GitHub Container Registry
Expand Down
2 changes: 1 addition & 1 deletion monitoring-as-code/fmt.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
set -e

echo "find . -name 'pkg' -prune -o -name 'vendor' -prune -o -name '*.libsonnet' -print -o -name '*.jsonnet' -print | xargs -n 1 jsonnetfmt -n 2 --max-blank-lines 2 --string-style s --comment-style s --no-sort-imports -i" | docker run -i -v "$(pwd):/app/MaC" jsonnet-dev-tool /bin/sh
echo "jsonnetfmt -v && find . -name 'pkg' -prune -o -name 'vendor' -prune -o -name '*.libsonnet' -print -o -name '*.jsonnet' -print | xargs -n 1 jsonnetfmt -n 2 --max-blank-lines 2 --string-style s --comment-style s --no-sort-imports -i" | docker run -i -v "$(pwd):/app/MaC" ghcr.io/ho-cto/sre-fmt-lint:latest /bin/sh
2 changes: 1 addition & 1 deletion monitoring-as-code/lint.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
set -e

echo "find . -name 'pkg' -prune -o -name 'vendor' -prune -o -name '*.libsonnet' -print -o -name '*.jsonnet' -print | xargs -n 1 jsonnet-lint -J vendor" | docker run -i -v "$(pwd):/app/MaC" jsonnet-dev-tool /bin/sh
echo "jsonnet-lint -v && find . -name 'pkg' -prune -o -name 'vendor' -prune -o -name '*.libsonnet' -print -o -name '*.jsonnet' -print | xargs -n 1 jsonnet-lint -J vendor" | docker run -i -v "$(pwd):/app/MaC" ghcr.io/ho-cto/sre-fmt-lint:latest /bin/sh

0 comments on commit a56a05a

Please sign in to comment.