Skip to content

Commit c4a9d3c

Browse files
authored
Merge pull request #27 from linode/update_upjet_version
Bump upjet to v1.1.0, enable cli-less provisioning models
2 parents 08c05b2 + 14a015e commit c4a9d3c

File tree

265 files changed

+17935
-4997
lines changed

Some content is hidden

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

265 files changed

+17935
-4997
lines changed

.github/workflows/ci.yml

Lines changed: 34 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,14 @@ on:
1818

1919
env:
2020
# Common versions
21-
GO_VERSION: '1.19'
22-
GOLANGCI_VERSION: 'v1.50.0'
21+
GO_VERSION: '1.21'
22+
GOLANGCI_VERSION: 'v1.54.2'
2323
DOCKER_BUILDX_VERSION: 'v0.8.2'
2424

2525
# Common users. We can't run a step 'if secrets.XXX != ""' but we can run a
26-
# step 'if env.XXX != ""', so we copy these to succinctly test whether
26+
# step 'if env.XXX' != ""', so we copy these to succinctly test whether
2727
# credentials have been provided before trying to run steps that need them.
2828
UPBOUND_MARKETPLACE_PUSH_ROBOT_USR: ${{ secrets.UPBOUND_MARKETPLACE_PUSH_ROBOT_USR }}
29-
3029
jobs:
3130
detect-noop:
3231
runs-on: ubuntu-22.04
@@ -35,54 +34,48 @@ jobs:
3534
steps:
3635
- name: Detect No-op Changes
3736
id: noop
38-
uses: fkirc/[email protected]
37+
uses: fkirc/skip-duplicate-actions@12aca0a884f6137d619d6a8a09fcc3406ced5281 # v5.3.0
3938
with:
4039
github_token: ${{ secrets.GITHUB_TOKEN }}
4140
paths_ignore: '["**.md", "**.png", "**.jpg"]'
4241
do_not_skip: '["workflow_dispatch", "schedule", "push"]'
4342

44-
4543
lint:
4644
runs-on: ubuntu-22.04
4745
needs: detect-noop
4846
if: needs.detect-noop.outputs.noop != 'true'
4947

5048
steps:
5149
- name: Checkout
52-
uses: actions/checkout@v2
50+
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
5351
with:
5452
submodules: true
5553

5654
- name: Setup Go
57-
uses: actions/setup-go@v2
55+
uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3
5856
with:
57+
# turn off caching as it currently conflicts with the golangci-lint action https://github.com/golangci/golangci-lint-action/issues/863
58+
cache: false
5959
go-version: ${{ env.GO_VERSION }}
6060

6161
- name: Find the Go Build Cache
6262
id: go
6363
run: echo "cache=$(make go.cachedir)" >> $GITHUB_OUTPUT
6464

6565
- name: Cache the Go Build Cache
66-
uses: actions/cache@v3
66+
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3
6767
with:
6868
path: ${{ steps.go.outputs.cache }}
6969
key: ${{ runner.os }}-build-lint-${{ hashFiles('**/go.sum') }}
7070
restore-keys: ${{ runner.os }}-build-lint-
7171

72-
- name: Cache Go Dependencies
73-
uses: actions/cache@v3
74-
with:
75-
path: .work/pkg
76-
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
77-
restore-keys: ${{ runner.os }}-pkg-
78-
7972
- name: Vendor Dependencies
8073
run: make vendor vendor.check
8174

8275
# We could run 'make lint' but we prefer this action because it leaves
8376
# 'annotations' (i.e. it comments on PRs to point out linter violations).
8477
- name: Lint
85-
uses: golangci/golangci-lint-action@v3
78+
uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # v3
8679
with:
8780
version: ${{ env.GOLANGCI_VERSION }}
8881

@@ -93,41 +86,42 @@ jobs:
9386

9487
steps:
9588
- name: Checkout
96-
uses: actions/checkout@v2
89+
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
9790
with:
9891
submodules: true
9992

10093
- name: Setup Go
101-
uses: actions/setup-go@v2
94+
uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3
10295
with:
10396
go-version: ${{ env.GO_VERSION }}
10497

10598
- name: Install goimports
106-
run: go install golang.org/x/tools/cmd/goimports
99+
run: |
100+
cd /tmp
101+
go install golang.org/x/tools/cmd/[email protected]
107102
108103
- name: Find the Go Build Cache
109104
id: go
110105
run: echo "cache=$(make go.cachedir)" >> $GITHUB_OUTPUT
111106

112107
- name: Cache the Go Build Cache
113-
uses: actions/cache@v3
108+
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3
114109
with:
115110
path: ${{ steps.go.outputs.cache }}
116111
key: ${{ runner.os }}-build-check-diff-${{ hashFiles('**/go.sum') }}
117112
restore-keys: ${{ runner.os }}-build-check-diff-
118113

119-
- name: Cache Go Dependencies
120-
uses: actions/cache@v3
121-
with:
122-
path: .work/pkg
123-
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
124-
restore-keys: ${{ runner.os }}-pkg-
125-
126114
- name: Vendor Dependencies
127115
run: make vendor vendor.check
128116

129117
- name: Check Diff
130-
run: make check-diff
118+
id: check-diff
119+
run: |
120+
make check-diff
121+
122+
- name: Show diff
123+
if: failure() && steps.check-diff.outcome == 'failure'
124+
run: git diff
131125

132126
unit-tests:
133127
runs-on: ubuntu-22.04
@@ -136,15 +130,15 @@ jobs:
136130

137131
steps:
138132
- name: Checkout
139-
uses: actions/checkout@v2
133+
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
140134
with:
141135
submodules: true
142136

143137
- name: Fetch History
144138
run: git fetch --prune --unshallow
145139

146140
- name: Setup Go
147-
uses: actions/setup-go@v2
141+
uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3
148142
with:
149143
go-version: ${{ env.GO_VERSION }}
150144

@@ -153,109 +147,51 @@ jobs:
153147
run: echo "cache=$(make go.cachedir)" >> $GITHUB_OUTPUT
154148

155149
- name: Cache the Go Build Cache
156-
uses: actions/cache@v3
150+
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3
157151
with:
158152
path: ${{ steps.go.outputs.cache }}
159153
key: ${{ runner.os }}-build-unit-tests-${{ hashFiles('**/go.sum') }}
160154
restore-keys: ${{ runner.os }}-build-unit-tests-
161155

162-
- name: Cache Go Dependencies
163-
uses: actions/cache@v3
164-
with:
165-
path: .work/pkg
166-
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
167-
restore-keys: ${{ runner.os }}-pkg-
168-
169156
- name: Vendor Dependencies
170157
run: make vendor vendor.check
171158

172159
- name: Run Unit Tests
173160
run: make -j2 test
174161

175162
- name: Publish Unit Test Coverage
176-
uses: codecov/codecov-action@v1
163+
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3
177164
with:
178165
flags: unittests
179166
file: _output/tests/linux_amd64/coverage.txt
180167

181-
local-deploy:
182-
runs-on: ubuntu-22.04
183-
needs: detect-noop
184-
if: needs.detect-noop.outputs.noop != 'true'
185-
186-
steps:
187-
- name: Checkout
188-
uses: actions/checkout@v2
189-
with:
190-
submodules: true
191-
192-
- name: Fetch History
193-
run: git fetch --prune --unshallow
194-
195-
- name: Setup Go
196-
uses: actions/setup-go@v2
197-
with:
198-
go-version: ${{ env.GO_VERSION }}
199-
200-
- name: Find the Go Build Cache
201-
id: go
202-
run: echo "cache=$(make go.cachedir)" >> $GITHUB_OUTPUT
203-
204-
- name: Cache the Go Build Cache
205-
uses: actions/cache@v3
206-
with:
207-
path: ${{ steps.go.outputs.cache }}
208-
key: ${{ runner.os }}-build-unit-tests-${{ hashFiles('**/go.sum') }}
209-
restore-keys: ${{ runner.os }}-build-unit-tests-
210-
211-
- name: Cache Go Dependencies
212-
uses: actions/cache@v3
213-
with:
214-
path: .work/pkg
215-
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
216-
restore-keys: ${{ runner.os }}-pkg-
217-
218-
- name: Vendor Dependencies
219-
run: make vendor vendor.check
220-
221-
- name: Deploying locally built provider package
222-
run: make local-deploy
223-
224168
publish-artifacts:
225169
runs-on: ubuntu-22.04
226170
needs: detect-noop
227171
if: needs.detect-noop.outputs.noop != 'true'
228172

229173
steps:
230174
- name: Setup QEMU
231-
uses: docker/setup-qemu-action@v1
175+
uses: docker/setup-qemu-action@2b82ce82d56a2a04d2637cd93a637ae1b359c0a7 # v2
232176
with:
233177
platforms: all
234178

235179
- name: Setup Docker Buildx
236-
uses: docker/setup-buildx-action@v2
180+
uses: docker/setup-buildx-action@885d1462b80bc1c1c7f0b00334ad271f09369c55 # v2
237181
with:
238182
version: ${{ env.DOCKER_BUILDX_VERSION }}
239183
install: true
240184

241-
- name: Login to Upbound
242-
uses: docker/login-action@v2
243-
if: env.UPBOUND_MARKETPLACE_PUSH_ROBOT_USR != ''
244-
with:
245-
registry: xpkg.upbound.io
246-
username: ${{ secrets.UPBOUND_MARKETPLACE_PUSH_ROBOT_USR }}
247-
password: ${{ secrets.UPBOUND_MARKETPLACE_PUSH_ROBOT_PSW }}
248-
249185
- name: Checkout
250-
uses: actions/checkout@v2
186+
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
251187
with:
252188
submodules: true
253189

254190
- name: Fetch History
255191
run: git fetch --prune --unshallow
256192

257193
- name: Setup Go
258-
uses: actions/setup-go@v2
194+
uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3
259195
with:
260196
go-version: ${{ env.GO_VERSION }}
261197

@@ -264,19 +200,12 @@ jobs:
264200
run: echo "cache=$(make go.cachedir)" >> $GITHUB_OUTPUT
265201

266202
- name: Cache the Go Build Cache
267-
uses: actions/cache@v3
203+
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3
268204
with:
269205
path: ${{ steps.go.outputs.cache }}
270206
key: ${{ runner.os }}-build-publish-artifacts-${{ hashFiles('**/go.sum') }}
271207
restore-keys: ${{ runner.os }}-build-publish-artifacts-
272208

273-
- name: Cache Go Dependencies
274-
uses: actions/cache@v3
275-
with:
276-
path: .work/pkg
277-
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
278-
restore-keys: ${{ runner.os }}-pkg-
279-
280209
- name: Vendor Dependencies
281210
run: make vendor vendor.check
282211

@@ -287,11 +216,8 @@ jobs:
287216
# builds by default. Specifying --load does so.
288217
BUILD_ARGS: "--load"
289218

290-
- name: Upload Artifacts to GitHub
291-
uses: actions/upload-artifact@v2
219+
- name: Publish Artifacts to GitHub
220+
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3
292221
with:
293222
name: output
294223
path: _output/**
295-
296-
- name: Publish Artifacts
297-
run: make publish BRANCH_NAME=${GITHUB_REF##*/}

.golangci.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
run:
2-
deadline: 10m
2+
deadline: 20m
33

44
skip-files:
5-
- "zz_\\..+\\.go$"
5+
- "zz_\\..+\\.go$"
66

77
output:
88
# colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
@@ -27,9 +27,9 @@ linters-settings:
2727
# report about shadowed variables
2828
check-shadowing: false
2929

30-
golint:
31-
# minimal confidence for issues, default is 0.8
32-
min-confidence: 0.8
30+
revive:
31+
# confidence for issues, default is 0.8
32+
confidence: 0.8
3333

3434
gofmt:
3535
# simplify code: gofmt with `-s` option, true by default
@@ -38,7 +38,7 @@ linters-settings:
3838
goimports:
3939
# put imports beginning with prefix after 3rd-party packages;
4040
# it's a comma-separated list of prefixes
41-
local-prefixes: github.com/upbound/upjet-provider-template
41+
local-prefixes: github.com/linode/provider-linode
4242

4343
gocyclo:
4444
# minimal code complexity to report, 30 by default (but we recommend 10-20)
@@ -113,7 +113,7 @@ linters:
113113
- goimports
114114
- gofmt # We enable this as well as goimports for its simplify mode.
115115
- prealloc
116-
- golint
116+
- revive
117117
- unconvert
118118
- misspell
119119
- nakedret
@@ -136,7 +136,7 @@ issues:
136136
- gosec
137137
- scopelint
138138
- unparam
139-
139+
140140
# Ease some gocritic warnings on test files.
141141
- path: _test\.go
142142
text: "(unnamedResult|exitAfterDefer)"
@@ -148,31 +148,31 @@ issues:
148148
# rather than using a pointer.
149149
- text: "(hugeParam|rangeValCopy):"
150150
linters:
151-
- gocritic
151+
- gocritic
152152

153153
# This "TestMain should call os.Exit to set exit code" warning is not clever
154154
# enough to notice that we call a helper method that calls os.Exit.
155155
- text: "SA3000:"
156156
linters:
157-
- staticcheck
157+
- staticcheck
158158

159159
- text: "k8s.io/api/core/v1"
160160
linters:
161-
- goimports
161+
- goimports
162162

163163
# This is a "potential hardcoded credentials" warning. It's triggered by
164164
# any variable with 'secret' in the same, and thus hits a lot of false
165165
# positives in Kubernetes land where a Secret is an object type.
166166
- text: "G101:"
167167
linters:
168-
- gosec
169-
- gas
168+
- gosec
169+
- gas
170170

171171
# This is an 'errors unhandled' warning that duplicates errcheck.
172172
- text: "G104:"
173173
linters:
174-
- gosec
175-
- gas
174+
- gosec
175+
- gas
176176

177177
# Independently from option `exclude` we use default exclude patterns,
178178
# it can be disabled by this option. To list all

0 commit comments

Comments
 (0)