Skip to content

Commit bb697d3

Browse files
authored
Merge pull request #1357 from mackerelio/workflow-sha-pinning
update CI
2 parents e605cb8 + 9a8f9e0 commit bb697d3

File tree

18 files changed

+69
-49
lines changed

18 files changed

+69
-49
lines changed

.github/workflows/create-release-pr.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ jobs:
1717
steps:
1818
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
1919

20-
- uses: shogo82148/actions-setup-perl@5796a908661aa68fc0a5b8f55c6791af2376d72e # v1.35.0
20+
- uses: shogo82148/actions-setup-perl@f9f0bf89e0d19ddbabb2f40d43db2e944bce7d2f # v1.36.0
2121
with:
2222
perl-version: "5.34"
2323

24-
- uses: mackerelio/mackerel-create-release-pull-request-action@main
24+
- uses: mackerelio/mackerel-create-release-pull-request-action@c30e6538510d81ac7acb49cbadd7a6d15162006d # v0.0.1
2525
id: start
2626
with:
2727
github_token: ${{ secrets.MACKERELBOT_GITHUB_TOKEN }}
@@ -30,7 +30,7 @@ jobs:
3030
version_go_file_path: mackerel-plugin.go
3131
ignore_update_program_files: "true"
3232

33-
- uses: mackerelio/mackerel-create-release-pull-request-action@main
33+
- uses: mackerelio/mackerel-create-release-pull-request-action@c30e6538510d81ac7acb49cbadd7a6d15162006d # v0.0.1
3434
with:
3535
github_token: ${{ secrets.MACKERELBOT_GITHUB_TOKEN }}
3636
finished: "true"

.github/workflows/test.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,29 @@ env:
1212
DEBIAN_FRONTEND: noninteractive
1313
jobs:
1414
lint:
15-
uses: mackerelio/workflows/.github/workflows/go-lint.yml@c7e130d3908894f18068ca4a877e80539b535881 # v1.5.0
15+
uses: mackerelio/workflows/.github/workflows/go-lint.yml@7653987676cc233af59a390d142b5cf6e65a526f # v1.6.0
1616
with:
1717
os-versions: '["ubuntu-latest", "windows-2025"]'
1818
test:
19-
uses: mackerelio/workflows/.github/workflows/go-test.yml@c7e130d3908894f18068ca4a877e80539b535881 # v1.5.0
19+
uses: mackerelio/workflows/.github/workflows/go-test.yml@7653987676cc233af59a390d142b5cf6e65a526f # v1.6.0
2020
with:
2121
os-versions: '["ubuntu-latest", "windows-2025"]'
22+
pre: |
23+
echo "GOTOOLCHAIN=auto" >> $GITHUB_ENV
2224
integration-test-linux:
23-
uses: mackerelio/workflows/.github/workflows/setup-go-matrix.yml@c7e130d3908894f18068ca4a877e80539b535881 # v1.5.0
25+
uses: mackerelio/workflows/.github/workflows/setup-go-matrix.yml@7653987676cc233af59a390d142b5cf6e65a526f # v1.6.0
2426
with:
2527
os-versions: '["ubuntu-latest"]'
2628
run: |
29+
export GOTOOLCHAIN=auto
2730
make testconvention
2831
./test.bash
2932
integration-test-windows:
30-
uses: mackerelio/workflows/.github/workflows/setup-go-matrix.yml@c7e130d3908894f18068ca4a877e80539b535881 # v1.5.0
33+
uses: mackerelio/workflows/.github/workflows/setup-go-matrix.yml@7653987676cc233af59a390d142b5cf6e65a526f # v1.6.0
3134
with:
3235
os-versions: '["windows-2025"]'
3336
run: |
37+
export GOTOOLCHAIN=auto
3438
go build -o mackerel-plugin-mssql/mackerel-plugin-mssql.exe ./mackerel-plugin-mssql
3539
go build -o mackerel-plugin-windows-server-sessions/mackerel-plugin-windows-server-sessions.exe ./mackerel-plugin-windows-server-sessions
3640
build:
@@ -49,7 +53,7 @@ jobs:
4953
with:
5054
go-version: 1.24.x
5155
- run: make clean rpm deb tar
52-
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
56+
- uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
5357
with:
5458
name: linux-build-artifacts
5559
path: |
@@ -62,17 +66,17 @@ jobs:
6266
runs-on: ubuntu-latest
6367
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')
6468
steps:
65-
- uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
69+
- uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
6670
with:
6771
name: linux-build-artifacts
6872
path: artifacts/
69-
- uses: mackerelio/staging-release-update-action@main
73+
- uses: mackerelio/staging-release-update-action@bc0e3a9f7bd0d890dc044592a798bc307bacc956 # v0.0.1
7074
if: github.ref == 'refs/heads/master'
7175
with:
7276
directory: artifacts/
7377
github-token: ${{ secrets.GITHUB_TOKEN }}
7478
tag: staging
75-
- uses: mackerelio/create-release-action@main
79+
- uses: mackerelio/create-release-action@5af34070474b72efdb3f5057e50d2f3836453c56 # v0.0.4
7680
if: startsWith(github.ref, 'refs/tags/v')
7781
with:
7882
directory: artifacts/

.golangci.yml

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,28 @@
1-
run:
2-
timeout: 5m
1+
version: "2"
32
linters:
4-
# see also https://golangci-lint.run/usage/linters/#enabled-by-default
3+
exclusions:
4+
generated: lax
5+
presets:
6+
- comments
7+
- common-false-positives
8+
- legacy
9+
- std-error-handling
10+
rules:
11+
- linters:
12+
- errcheck
13+
- ineffassign
14+
- staticcheck
15+
path: _test\.go
16+
paths:
17+
- third_party$
18+
- builtin$
19+
- examples$
20+
formatters:
521
enable:
6-
- gofmt
7-
issues:
8-
exclude-rules:
9-
- path: _test\.go
10-
linters:
11-
- errcheck
12-
- gosimple
13-
- staticcheck
14-
- ineffassign
22+
- gofmt
23+
exclusions:
24+
generated: lax
25+
paths:
26+
- third_party$
27+
- builtin$
28+
- examples$

mackerel-plugin-aws-ec2-ebs/lib/aws-ec2-ebs.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ func (p EBSPlugin) FetchMetrics() (map[string]interface{}, error) {
422422
return nil, err
423423
}
424424
} else {
425-
stat[strings.Replace(metricKey, "#", volumeID, -1)] = val
425+
stat[strings.ReplaceAll(metricKey, "#", volumeID)] = val
426426
}
427427
}
428428
}
@@ -436,7 +436,7 @@ func (p EBSPlugin) GraphDefinition() map[string]mp.Graphs {
436436
}
437437

438438
func normalizeVolumeID(volumeID string) string {
439-
return strings.Replace(volumeID, ".", "_", -1)
439+
return strings.ReplaceAll(volumeID, ".", "_")
440440
}
441441

442442
// overwritten with syscall.SIGTERM on unix environment (see aws-ec2-ebs_unix.go)

mackerel-plugin-conntrack/lib/conntrack.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func FindFile(paths []string) (f string, err error) {
3535
}
3636
}
3737

38-
return "", fmt.Errorf("Cannot find files %s", paths)
38+
return "", fmt.Errorf("Cannot find files %s", paths) // nolint
3939
}
4040

4141
// CurrentValue returns a value from a file.

mackerel-plugin-elasticsearch/lib/elasticsearch.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,14 @@ func getFloatValue(s map[string]interface{}, keys []string) (float64, error) {
7777
case map[string]interface{}:
7878
sm = sm[k].(map[string]interface{})
7979
default:
80-
return 0, errors.New("Cannot handle as a hash")
80+
return 0, errors.New("Cannot handle as a hash") // nolint
8181
}
8282
} else {
8383
switch sm[k].(type) {
8484
case float64:
8585
val = sm[k].(float64)
8686
default:
87-
return 0, errors.New("Not float64")
87+
return 0, errors.New("Not float64") // nolint
8888
}
8989
}
9090
}
@@ -137,7 +137,7 @@ func (p ElasticsearchPlugin) FetchMetrics() (map[string]float64, error) {
137137
n := ""
138138
for k := range nodes {
139139
if n != "" {
140-
return nil, errors.New("Multiple node found")
140+
return nil, errors.New("Multiple node found") // nolint
141141
}
142142
n = k
143143
}

mackerel-plugin-haproxy/lib/haproxy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func (p HAProxyPlugin) fetchMetricsFromTCP() (map[string]float64, error) {
8383
defer resp.Body.Close()
8484

8585
if resp.StatusCode != 200 {
86-
return nil, fmt.Errorf("Request failed. Status: %s, URI: %s", resp.Status, requestURI)
86+
return nil, fmt.Errorf("Request failed. Status: %s, URI: %s", resp.Status, requestURI) // nolint
8787
}
8888

8989
return p.parseStats(resp.Body)

mackerel-plugin-linux/lib/linux.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,12 @@ func parseProcStat(r io.Reader, p *map[string]interface{}) error {
243243
return errParse
244244
}
245245

246-
if name == "intr" {
246+
switch name {
247+
case "intr":
247248
(*p)["interrupts"] = value
248-
} else if name == "ctxt" {
249+
case "ctxt":
249250
(*p)["context_switches"] = value
250-
} else if name == "processes" {
251+
case "processes":
251252
(*p)["forks"] = value
252253
}
253254
}

mackerel-plugin-mssql/lib/mssql_windows.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ func (m MSSQLPlugin) FetchMetrics() (map[string]float64, error) {
7979

8080
// GraphDefinition interface for mackerelplugin
8181
func (m MSSQLPlugin) GraphDefinition() map[string](mp.Graphs) {
82-
labelPrefix := cases.Title(language.Und, cases.NoLower).String(strings.Replace(m.MetricKeyPrefix(), "mssql", "MSSQL", -1))
82+
labelPrefix := cases.Title(language.Und, cases.NoLower).String(strings.ReplaceAll(m.MetricKeyPrefix(), "mssql", "MSSQL"))
8383
return map[string](mp.Graphs){
8484
"buffer": mp.Graphs{
8585
Label: labelPrefix + " Buffer",

mackerel-plugin-multicore/lib/multicore.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ func fetchSavedItem(tempFileName string) (*saveItem, error) {
186186

187187
func calcCPUUsage(currentValues map[string]procStats, now time.Time, savedItem *saveItem) ([]cpuPercentages, error) {
188188
if now.Sub(savedItem.LastTime).Seconds() > 600 {
189-
return nil, errors.New("Too long duration")
189+
return nil, errors.New("Too long duration") // nolint
190190
}
191191

192192
var result []cpuPercentages

0 commit comments

Comments
 (0)