-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor using latest goharbor-client (#33)
* WIP: Refactor with updated goharbor-client * add unit tests & mocked runtime.Client Along with this, - reduce magic numbers - add code generation verification action to GH workflow - add (some) missing periods to comments * re-generate using operator-sdk * re-add sdk version as env * fix codegen action, re-generate via operator-sdk v0.16.0 * drop mockery test, fix annotation * fix renaming codegen action * bump golangci-lint version, raise timeout * ensure naming conventions, apply suggestions * fix deprecated tag
- Loading branch information
Showing
59 changed files
with
1,523 additions
and
870 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Verify code generation integrity | ||
|
||
on: pull_request | ||
|
||
env: | ||
OPERATOR_SDK_VERSION: v0.16.0 | ||
|
||
jobs: | ||
verify-operator-sdk: | ||
name: Verify Operator-SDK Codegen | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Go 1.13 | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.13 | ||
id: go | ||
|
||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install operator-sdk | ||
run: sudo curl -L -o /usr/local/bin/operator-sdk "https://github.com/operator-framework/operator-sdk/releases/download/${OPERATOR_SDK_VERSION}/operator-sdk-${OPERATOR_SDK_VERSION}-x86_64-linux-gnu" && sudo chmod +x /usr/local/bin/operator-sdk | ||
|
||
- name: Run code generation | ||
run: operator-sdk generate k8s && operator-sdk generate crds | ||
|
||
- name: Test diff | ||
run: | | ||
git diff | cat | ||
git status --porcelain=v1 | ||
test $(git status --porcelain=v1 | wc -l) -eq 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,4 +34,14 @@ fmt: | |
.PHONY: build | ||
build: | ||
operator-sdk build --go-build-args "-ldflags -X=version.Version=${SECRET_OPERATOR_VERSION}" ${DOCKER_IMAGE} | ||
@exit $(.SHELLSTATUS) | ||
@exit $(.SHELLSTATUS) | ||
|
||
.PHONY: mock | ||
mock: | ||
@echo generating mocked k8s runtime client via | ||
@echo sigs.k8s.io/[email protected]/pkg/client.Client | ||
curl -sO https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/v0.5.2/pkg/client/interfaces.go | ||
mockery --quiet --dir $(PWD) \ | ||
--name Client --structname MockClient --filename=runtime_client_mock.go \ | ||
--output "$(PWD)/pkg/internal/mocks" | ||
rm $(PWD)/interfaces.go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.