Skip to content

Commit 128d649

Browse files
authored
fix(lint): modernize actions and solve linting issues (#649)
* fix(lint): solve linting issues * ci: modernize actions
1 parent 7b8efbc commit 128d649

File tree

220 files changed

+3277
-3019
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

220 files changed

+3277
-3019
lines changed

.github/workflows/ci-provider-docs.yaml

Lines changed: 15 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -7,72 +7,28 @@ on:
77

88
env:
99
TERRAFORM_VERSION: "0.14.8"
10-
GO_VERSION: "^1.17"
1110

1211
jobs:
13-
go_build:
12+
ci-provider-docs:
1413
name: go build
1514
runs-on: ubuntu-latest
1615
steps:
17-
- uses: actions/checkout@v2
18-
- uses: actions/cache@v4
19-
continue-on-error: true
20-
id: cache-terraform-plugin-dir
21-
timeout-minutes: 2
22-
with:
23-
path: terraform-plugin-dir
24-
key: ${{ runner.os }}-terraform-plugin-dir-${{ hashFiles('go.sum') }}-${{ hashFiles('sysdig/**') }}
25-
- if: steps.cache-terraform-plugin-dir.outputs.cache-hit != 'true' || steps.cache-terraform-plugin-dir.outcome == 'failure'
26-
uses: actions/setup-go@v3
27-
with:
28-
go-version: ${{ env.GO_VERSION }}
29-
check-latest: true
30-
cache: true
31-
# See also: https://github.com/actions/setup-go/issues/54
32-
- if: steps.cache-terraform-plugin-dir.outputs.cache-hit != 'true' || steps.cache-terraform-plugin-dir.outcome == 'failure'
33-
name: go env
34-
run: |
35-
echo "GOCACHE=$(go env GOCACHE)" >> $GITHUB_ENV
36-
- if: steps.cache-terraform-plugin-dir.outputs.cache-hit != 'true' || steps.cache-terraform-plugin-dir.outcome == 'failure'
37-
uses: actions/cache@v4
38-
with:
39-
path: ${{ env.GOCACHE }}
40-
key: ${{ runner.os }}-GOCACHE-${{ hashFiles('go.sum') }}-${{ hashFiles('sysdig/**') }}
41-
- if: steps.cache-terraform-plugin-dir.outputs.cache-hit != 'true' || steps.cache-terraform-plugin-dir.outcome == 'failure'
42-
uses: actions/cache@v4
16+
- uses: actions/checkout@v4
17+
18+
- name: Set up Go
19+
uses: actions/setup-go@v5
4320
with:
44-
path: ~/go/pkg/mod
45-
key: ${{ runner.os }}-go-pkg-mod-${{ hashFiles('go.sum') }}
46-
- if: steps.cache-terraform-plugin-dir.outputs.cache-hit != 'true' || steps.cache-terraform-plugin-dir.outcome == 'failure'
47-
name: go build
21+
go-version-file: go.mod
22+
23+
- name: go build
4824
run: go build -o terraform-plugin-dir/registry.terraform.io/sysdiglabs/sysdig/99.99.99/$(go env GOOS)_$(go env GOARCH)/terraform-provider-sysdig .
4925

50-
terraform_providers_schema:
51-
name: terraform providers schema
52-
needs: [ go_build ]
53-
runs-on: ubuntu-latest
54-
steps:
55-
- uses: actions/checkout@v2
56-
- uses: actions/cache@v4
57-
continue-on-error: true
58-
id: cache-terraform-providers-schema
59-
timeout-minutes: 2
60-
with:
61-
path: terraform-providers-schema
62-
key: ${{ runner.os }}-terraform-providers-schema-${{ hashFiles('go.sum') }}-${{ hashFiles('sysdig/**') }}
63-
- if: steps.cache-terraform-providers-schema.outputs.cache-hit != 'true' || steps.cache-terraform-providers-schema.outcome == 'failure'
64-
uses: actions/cache@v4
65-
timeout-minutes: 2
66-
with:
67-
path: terraform-plugin-dir
68-
key: ${{ runner.os }}-terraform-plugin-dir-${{ hashFiles('go.sum') }}-${{ hashFiles('sysdig/**') }}
69-
- if: steps.cache-terraform-providers-schema.outputs.cache-hit != 'true' || steps.cache-terraform-providers-schema.outcome == 'failure'
70-
uses: hashicorp/setup-terraform@v1
26+
- uses: hashicorp/setup-terraform@v1
7127
with:
7228
terraform_version: ${{ env.TERRAFORM_VERSION }}
7329
terraform_wrapper: false
74-
- if: steps.cache-terraform-providers-schema.outputs.cache-hit != 'true' || steps.cache-terraform-providers-schema.outcome == 'failure'
75-
name: terraform init
30+
31+
- name: terraform init
7632
run: |
7733
# We need a file to initialize the provider
7834
cat <<EOF > main.tf
@@ -81,34 +37,14 @@ jobs:
8137
}
8238
EOF
8339
terraform init -plugin-dir terraform-plugin-dir
84-
- if: steps.cache-terraform-providers-schema.outputs.cache-hit != 'true' || steps.cache-terraform-providers-schema.outcome == 'failure'
85-
name: terraform providers schema
40+
41+
- name: terraform providers schema
8642
run: |
87-
mkdir terraform-providers-schema
43+
mkdir -p terraform-providers-schema
8844
terraform providers schema -json > terraform-providers-schema/schema.json
8945
90-
tfproviderdocs:
91-
needs: [ terraform_providers_schema ]
92-
runs-on: ubuntu-latest
93-
steps:
94-
- uses: actions/checkout@v2
95-
- uses: actions/setup-go@v3
96-
with:
97-
go-version: ${{ env.GO_VERSION }}
98-
check-latest: true
99-
cache: true
100-
- uses: actions/cache@v4
101-
continue-on-error: true
102-
timeout-minutes: 2
103-
with:
104-
path: ~/go/pkg/mod
105-
key: ${{ runner.os }}-go-pkg-mod-${{ hashFiles('go.sum') }}
10646
- run: cd /tmp && go install github.com/bflad/tfproviderdocs@latest
107-
- uses: actions/cache@v4
108-
timeout-minutes: 2
109-
with:
110-
path: terraform-providers-schema
111-
key: ${{ runner.os }}-terraform-providers-schema-${{ hashFiles('go.sum') }}-${{ hashFiles('sysdig/**') }}
47+
11248
- name: tfproviderdocs check
11349
run: |
11450
tfproviderdocs check \

.github/workflows/ci-pull-request.yml

Lines changed: 0 additions & 59 deletions
This file was deleted.

.github/workflows/ci-scheduled-tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ on:
55
- cron: "0 11 * * *"
66
workflow_dispatch:
77

8-
env:
9-
GO_VERSION: "^1.19" # any 1.x version, see go.mod file for minimum
10-
118
jobs:
129
test:
1310
name: Test

.github/workflows/ci-master.yml renamed to .github/workflows/ci.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ on:
44
push:
55
branches:
66
- master
7-
8-
env:
9-
GO_VERSION: "^1.17"
7+
pull_request:
8+
branches:
9+
- master
1010

1111
jobs:
1212
build-multiarch:
@@ -41,14 +41,12 @@ jobs:
4141
arch: amd64
4242
steps:
4343
- name: Checkout code
44-
uses: actions/checkout@v2
44+
uses: actions/checkout@v4
4545

4646
- name: Set up Go
47-
uses: actions/setup-go@v3
47+
uses: actions/setup-go@v5
4848
with:
49-
go-version: ${{ env.GO_VERSION }}
50-
check-latest: true
51-
cache: true
49+
go-version-file: go.mod
5250

5351
- name: Build project
5452
run: GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} go build -o terraform-provider-sysdig

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030

3131
steps:
3232
- name: Checkout repository
33-
uses: actions/checkout@v2
33+
uses: actions/checkout@v4
3434
with:
3535
# We must fetch at least the immediate parents so that if this is
3636
# a pull request then we can checkout the head.

.github/workflows/issues-slack-notify.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
name: Slack Notification
88
runs-on: ubuntu-latest
99
steps:
10-
- uses: actions/checkout@v2
10+
- uses: actions/checkout@v4
1111
- name: Slack Notification
1212
uses: rtCamp/action-slack-notify@v2
1313
env:
@@ -23,4 +23,4 @@ jobs:
2323
status: ${{ job.status }}
2424
fields: message,author,ref
2525
env:
26-
SLACK_WEBHOOK_URL: {{ secrets.SLACK_WEBHOOK }}
26+
SLACK_WEBHOOK_URL: "{{ secrets.SLACK_WEBHOOK }}"

.github/workflows/release.yml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,28 @@ on:
1515
tags:
1616
- 'v*'
1717

18-
env:
19-
GO_VERSION: "^1.19" # any 1.x version, see go.mod file for minimum
20-
2118
jobs:
2219
goreleaser:
2320
runs-on: ubuntu-latest
2421
steps:
2522
- name: Checkout
26-
uses: actions/checkout@v2
27-
- name: Unshallow
28-
run: git fetch --prune --unshallow
23+
uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
fetch-tags: true
27+
2928
- name: Set up Go
30-
uses: actions/setup-go@v3
29+
uses: actions/setup-go@v5
3130
with:
32-
go-version: ${{ env.GO_VERSION }}
33-
check-latest: true
34-
cache: true
31+
go-version-file: go.mod
32+
3533
- name: Import GPG key
3634
id: import_gpg
3735
uses: paultyng/[email protected]
3836
env:
3937
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
4038
PASSPHRASE: ${{ secrets.PASSPHRASE }}
39+
4140
- name: Run GoReleaser
4241
uses: goreleaser/goreleaser-action@v6
4342
with:

.github/workflows/test.yml

Lines changed: 17 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ jobs:
1010

1111
steps:
1212
- name: Check out code
13-
uses: actions/checkout@v2
13+
uses: actions/checkout@v4
1414

1515
- name: Lint
16-
uses: golangci/golangci-lint-action@v2
16+
uses: golangci/golangci-lint-action@v8
1717
with:
1818
args: --timeout 30m --build-tags unit,tf_acc_sysdig_monitor,tf_acc_sysdig_secure,tf_acc_ibm_monitor,tf_acc_ibm_secure
1919

@@ -23,14 +23,12 @@ jobs:
2323

2424
steps:
2525
- name: Check out code
26-
uses: actions/checkout@v2
26+
uses: actions/checkout@v4
2727

2828
- name: Set up Go
29-
uses: actions/setup-go@v3
29+
uses: actions/setup-go@v5
3030
with:
31-
go-version: ${{ env.GO_VERSION }}
32-
check-latest: true
33-
cache: true
31+
go-version-file: go.mod
3432

3533
- name: Test
3634
run: make test
@@ -42,14 +40,12 @@ jobs:
4240

4341
steps:
4442
- name: Check out code
45-
uses: actions/checkout@v2
43+
uses: actions/checkout@v4
4644

4745
- name: Set up Go
48-
uses: actions/setup-go@v3
46+
uses: actions/setup-go@v5
4947
with:
50-
go-version: ${{ env.GO_VERSION }}
51-
check-latest: true
52-
cache: true
48+
go-version-file: go.mod
5349

5450
- name: Test
5551
run: make testacc
@@ -65,14 +61,12 @@ jobs:
6561

6662
steps:
6763
- name: Check out code
68-
uses: actions/checkout@v2
64+
uses: actions/checkout@v4
6965

7066
- name: Set up Go
71-
uses: actions/setup-go@v3
67+
uses: actions/setup-go@v5
7268
with:
73-
go-version: ${{ env.GO_VERSION }}
74-
check-latest: true
75-
cache: true
69+
go-version-file: go.mod
7670

7771
- name: Test
7872
run: make testacc
@@ -88,14 +82,12 @@ jobs:
8882

8983
steps:
9084
- name: Check out code
91-
uses: actions/checkout@v2
85+
uses: actions/checkout@v4
9286

9387
- name: Set up Go
94-
uses: actions/setup-go@v3
88+
uses: actions/setup-go@v5
9589
with:
96-
go-version: ${{ env.GO_VERSION }}
97-
check-latest: true
98-
cache: true
90+
go-version-file: go.mod
9991

10092
- name: Test
10193
run: make testacc
@@ -114,14 +106,12 @@ jobs:
114106

115107
steps:
116108
- name: Check out code
117-
uses: actions/checkout@v2
109+
uses: actions/checkout@v4
118110

119111
- name: Set up Go
120-
uses: actions/setup-go@v3
112+
uses: actions/setup-go@v5
121113
with:
122-
go-version: ${{ env.GO_VERSION }}
123-
check-latest: true
124-
cache: true
114+
go-version-file: go.mod
125115

126116
- name: Test
127117
run: make testacc

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
.DS_Store
44
.envrc
55
.env
6+
.direnv/
67
example.tf
78
terraform.tfplan
89
terraform.tfstate

0 commit comments

Comments
 (0)