Skip to content

Commit 4f15576

Browse files
Adding codebase
Signed-off-by: paragchak-sumo <p.chakraborty.ctr@sumologic.com>
1 parent 6349344 commit 4f15576

15 files changed

Lines changed: 4184 additions & 154 deletions

.bonsai.yml

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,59 @@
11
---
2-
description: "#{repo}"
3-
builds:
2+
description: "#{repo}"
3+
builds:
44
- platform: "linux"
55
arch: "amd64"
66
asset_filename: "#{repo}_#{version}_linux_amd64.tar.gz"
77
sha_filename: "#{repo}_#{version}_sha512-checksums.txt"
88
filter:
9-
- "entity.system.os == 'linux'"
10-
- "entity.system.arch == 'amd64'"
11-
9+
- "entity.system.os == 'linux'"
10+
- "entity.system.arch == 'amd64'"
11+
1212
- platform: "linux"
1313
arch: "386"
1414
asset_filename: "#{repo}_#{version}_linux_386.tar.gz"
1515
sha_filename: "#{repo}_#{version}_sha512-checksums.txt"
1616
filter:
17-
- "entity.system.os == 'linux'"
18-
- "entity.system.arch == '386'"
19-
17+
- "entity.system.os == 'linux'"
18+
- "entity.system.arch == '386'"
19+
2020
- platform: "linux"
2121
arch: "arm64"
2222
asset_filename: "#{repo}_#{version}_linux_arm64.tar.gz"
2323
sha_filename: "#{repo}_#{version}_sha512-checksums.txt"
2424
filter:
25-
- "entity.system.os == 'linux'"
26-
- "entity.system.arch == 'arm64'"
27-
25+
- "entity.system.os == 'linux'"
26+
- "entity.system.arch == 'arm64'"
27+
2828
- platform: "linux"
2929
arch: "armv7"
3030
asset_filename: "#{repo}_#{version}_linux_armv7.tar.gz"
3131
sha_filename: "#{repo}_#{version}_sha512-checksums.txt"
3232
filter:
33-
- "entity.system.os == 'linux'"
34-
- "entity.system.arch == 'arm'"
35-
- "entity.system.arm_version == 7"
33+
- "entity.system.os == 'linux'"
34+
- "entity.system.arch == 'armv7'"
3635

37-
- platform: "linux"
38-
arch: "armv6"
39-
asset_filename: "#{repo}_#{version}_linux_armv6.tar.gz"
36+
- platform: "OSX"
37+
arch: "amd64"
38+
asset_filename: "#{repo}_#{version}_darwin_amd64.tar.gz"
4039
sha_filename: "#{repo}_#{version}_sha512-checksums.txt"
4140
filter:
42-
- "entity.system.os == 'linux'"
43-
- "entity.system.arch == 'arm'"
44-
- "entity.system.arm_version == 6"
41+
- "entity.system.os == 'darwin'"
42+
- "entity.system.arch == 'amd64'"
4543

4644
- platform: "OSX"
47-
arch: "amd64"
48-
asset_filename: "#{repo}_#{version}_darwin_amd64.tar.gz"
45+
arch: "arm64"
46+
asset_filename: "#{repo}_#{version}_darwin_arm64.tar.gz"
4947
sha_filename: "#{repo}_#{version}_sha512-checksums.txt"
5048
filter:
51-
- "entity.system.os == 'darwin'"
52-
- "entity.system.arch == 'amd64'"
53-
49+
- "entity.system.os == 'darwin'"
50+
- "entity.system.arch == 'arm64'"
51+
5452
- platform: "Windows"
5553
arch: "amd64"
5654
asset_filename: "#{repo}_#{version}_windows_amd64.tar.gz"
5755
sha_filename: "#{repo}_#{version}_sha512-checksums.txt"
5856
filter:
59-
- "entity.system.os == 'windows'"
60-
- "entity.system.arch == 'amd64'"
57+
- "entity.system.os == 'windows'"
58+
- "entity.system.arch == 'amd64'"
6159

.github/workflows/bonsai.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Bonsai
2+
3+
##
4+
# Only run this workflow after goreleaser completes
5+
##
6+
on:
7+
workflow_run:
8+
workflows:
9+
- goreleaser
10+
types:
11+
- completed
12+
13+
jobs:
14+
##
15+
# Note:
16+
# The Bonsai GitHub webhook integration looks for a GitHub webhook payload matching a worflow_job named: `bonsai-recompile` with status: `completed`
17+
# To enable automatic Bonsai recompiles after building a new release in github make sure webhook_jobs events are enabled for
18+
# the Bonsai GitHub webhook installed in GitHub repository by Bonsai as part of the asset repository resgistration process
19+
##
20+
bonsai-recompile:
21+
##
22+
# Only run this workflow_job after goreleaser completes successfully
23+
##
24+
runs-on: ubuntu-latest
25+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
26+
steps:
27+
- name: bonsai-webhook
28+
continue-on-error: true
29+
run: echo "Trigger recompile on 'completed' workflow_job event matching workflow_job.name 'bonsai-recompile' and workflow.name 'bonsai'"

.github/workflows/lint.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Go Lint
22

3-
on: [push]
3+
on: [push, pull_request]
44

55
jobs:
66
test:
@@ -10,7 +10,9 @@ jobs:
1010
matrix:
1111
os: [ubuntu-latest]
1212
steps:
13-
- name: Checkout code
14-
uses: actions/checkout@v2
15-
- name: Run golangci-lint
16-
uses: golangci/golangci-lint-action@v2
13+
- name: Checkout code
14+
uses: actions/checkout@v2
15+
- name: Run golangci-lint
16+
uses: golangci/golangci-lint-action@v2
17+
with:
18+
args: '--timeout=5m --exclude="SA1019" --exclude="SA9003"'

.github/workflows/release.yml

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,41 @@ jobs:
1313
uses: actions/checkout@v2
1414
- name: Unshallow
1515
run: git fetch --prune --unshallow
16+
- name: Create Release
17+
id: create_release
18+
uses: actions/create-release@v1
19+
env:
20+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21+
with:
22+
tag_name: ${{ github.ref }}
23+
release_name: ${{ github.ref }}
24+
draft: false
25+
prerelease: false
1626
- name: Set up Go
1727
uses: actions/setup-go@v1
1828
with:
19-
go-version: 1.14.x
29+
go-version: 1.23.x
2030
- name: Run GoReleaser
2131
uses: goreleaser/goreleaser-action@v1
2232
with:
2333
version: latest
24-
args: release --rm-dist
34+
args: release
2535
env:
2636
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
- name: Get the version
38+
id: get_version
39+
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
40+
- name: Move GoReleaser dist to builds for Bonsai tar file
41+
run: mv dist builds
42+
- name: Create Bonsai tar file for upload
43+
run: tar czvf ${{ github.event.repository.name }}_${{ steps.get_version.outputs.VERSION }}.tgz .bonsai.yml builds/*.tar.gz builds/*_sha512-checksums.txt *.md
44+
- name: Upload Release Asset
45+
id: upload-release-asset
46+
uses: actions/upload-release-asset@v1
47+
env:
48+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49+
with:
50+
upload_url: ${{ steps.create_release.outputs.upload_url }}
51+
asset_path: ./${{ github.event.repository.name }}_${{ steps.get_version.outputs.VERSION }}.tgz
52+
asset_name: ${{ github.event.repository.name }}_${{ steps.get_version.outputs.VERSION }}.tgz
53+
asset_content_type: application/gzip

.github/workflows/test.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Go Test
22

3-
on: [push]
3+
on: [push, pull_request]
44

55
jobs:
66
test:
@@ -10,12 +10,12 @@ jobs:
1010
matrix:
1111
os: [macos-latest, windows-latest, ubuntu-latest]
1212
steps:
13-
- name: Checkout code
14-
uses: actions/checkout@v2
15-
- name: Set up Go 1.14
16-
uses: actions/setup-go@v1
17-
with:
18-
go-version: 1.14
19-
id: go
20-
- name: Test
21-
run: go test -v ./...
13+
- name: Checkout code
14+
uses: actions/checkout@v2
15+
- name: Set up Go 1.23
16+
uses: actions/setup-go@v1
17+
with:
18+
go-version: 1.23.x
19+
id: go
20+
- name: Test
21+
run: go test -v ./...

.goreleaser.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ builds:
22
# List of builds
33
- # First Build
44
env:
5-
- CGO_ENABLED=0
6-
main: .
5+
- CGO_ENABLED=0
6+
- GO111MODULE=on
7+
main: main.go
78
ldflags: '-s -w -X github.com/sensu/sensu-plugin-sdk/version.version={{.Version}} -X github.com/sensu/sensu-plugin-sdk/version.commit={{.Commit}} -X github.com/sensu/sensu-plugin-sdk/version.date={{.Date}}'
89
# Set the binary output location to bin/ so archive will comply with Sensu Go Asset structure
910
binary: bin/{{ .ProjectName }}
@@ -22,6 +23,7 @@ builds:
2223
- 7
2324
targets:
2425
- darwin_amd64
26+
- darwin_arm64
2527
- linux_386
2628
- linux_amd64
2729
- linux_arm_5

.idea/.gitignore

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/sensu-elasticsearch-check.iml

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)