diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6dc4dce..a52243b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,10 +10,9 @@ on: env: # Common versions - GO_VERSION: '1.19' - GOLANGCI_VERSION: 'v1.50.0' + GO_VERSION: '1.22' + GOLANGCI_VERSION: 'v1.55.2' DOCKER_BUILDX_VERSION: 'v0.8.2' - # Common users. We can't run a step 'if secrets.XXX != ""' but we can run a # step 'if env.XXX != ""', so we copy these to succinctly test whether # credentials have been provided before trying to run steps that need them. @@ -33,6 +32,32 @@ jobs: paths_ignore: '["**.md", "**.png", "**.jpg"]' do_not_skip: '["workflow_dispatch", "schedule", "push"]' + report-breaking-changes: + runs-on: ubuntu-22.04 + needs: detect-noop + if: needs.detect-noop.outputs.noop != 'true' + steps: + - name: Checkout + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 #v3 + with: + submodules: true + + - name: Get modified CRDs + id: modified-crds + uses: tj-actions/changed-files@v41 + with: + files: | + package/crds/** + - name: Report breaking CRD OpenAPI v3 schema changes + if: steps.modified-crds.outputs.any_changed == 'true' + env: + MODIFIED_CRD_LIST: ${{ steps.modified-crds.outputs.all_changed_files }} + run: | + make crddiff + - name: Report native schema version changes + if: ${{ inputs.upjet-based-provider }} + run: | + make schema-version-diff lint: runs-on: ubuntu-22.04 @@ -41,12 +66,12 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 #v3 with: submodules: true - name: Setup Go - uses: actions/setup-go@v2 + uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3 with: go-version: ${{ env.GO_VERSION }} @@ -85,12 +110,12 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 #v3 with: submodules: true - name: Setup Go - uses: actions/setup-go@v2 + uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3 with: go-version: ${{ env.GO_VERSION }} @@ -128,7 +153,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 #v3 with: submodules: true @@ -136,7 +161,7 @@ jobs: run: git fetch --prune --unshallow - name: Setup Go - uses: actions/setup-go@v2 + uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3 with: go-version: ${{ env.GO_VERSION }} @@ -165,7 +190,7 @@ jobs: run: make -j2 test - name: Publish Unit Test Coverage - uses: codecov/codecov-action@v1 + uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3 with: flags: unittests file: _output/tests/linux_amd64/coverage.txt @@ -177,7 +202,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 #v3 with: submodules: true @@ -185,7 +210,7 @@ jobs: run: git fetch --prune --unshallow - name: Setup Go - uses: actions/setup-go@v2 + uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3 with: go-version: ${{ env.GO_VERSION }} @@ -209,6 +234,9 @@ jobs: - name: Vendor Dependencies run: make vendor vendor.check + + - name: Install Tools + run: make tools - name: Deploying locally built provider package run: make local-deploy @@ -220,7 +248,7 @@ jobs: steps: - name: Setup QEMU - uses: docker/setup-qemu-action@v1 + uses: docker/setup-qemu-action@2b82ce82d56a2a04d2637cd93a637ae1b359c0a7 # v2 with: platforms: all @@ -239,7 +267,7 @@ jobs: password: ${{ secrets.UPBOUND_MARKETPLACE_PUSH_ROBOT_PSW }} - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 #v3 with: submodules: true @@ -247,7 +275,7 @@ jobs: run: git fetch --prune --unshallow - name: Setup Go - uses: actions/setup-go@v2 + uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3 with: go-version: ${{ env.GO_VERSION }} @@ -280,10 +308,10 @@ jobs: BUILD_ARGS: "--load" - name: Upload Artifacts to GitHub - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 #v3 with: name: output path: _output/** - name: Publish Artifacts - run: make publish BRANCH_NAME=${GITHUB_REF##*/} + run: make publish BRANCH_NAME=${GITHUB_REF##*/} \ No newline at end of file diff --git a/.golangci.yml b/.golangci.yml index 672165f..e2b6467 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,14 +1,17 @@ run: - deadline: 10m - - skip-files: - - "zz_\\..+\\.go$" + timeout: 10m output: # colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number" - format: colored-line-number + formats: + - format: colored-line-number linters-settings: + revive: + rules: + - name: package-comments + disabled: true + errcheck: # report about not checking of errors in type assetions: `a := b.(MyStruct)`; # default is false: such cases aren't reported by default. @@ -38,11 +41,11 @@ linters-settings: goimports: # put imports beginning with prefix after 3rd-party packages; # it's a comma-separated list of prefixes - local-prefixes: github.com/crossplane-contrib/provider-infoblox-nios + local-prefixes: github.com/crossplane-contrib/provider-upjet-digitalocean gocyclo: # minimal code complexity to report, 30 by default (but we recommend 10-20) - min-complexity: 30 + min-complexity: 10 maligned: # print struct with more effective memory layout or not, false by default @@ -108,23 +111,23 @@ linters: - govet - gocyclo - gocritic - - interfacer - goconst - goimports - gofmt # We enable this as well as goimports for its simplify mode. - prealloc - - golint + - revive - unconvert - misspell - nakedret - presets: - bugs - unused fast: false - issues: + exclude-files: + - "zz_\\..+\\.go$" + # Excluding configuration per-path and per-linter exclude-rules: # Exclude some linters from running on tests files. @@ -136,7 +139,7 @@ issues: - gosec - scopelint - unparam - + # Ease some gocritic warnings on test files. - path: _test\.go text: "(unnamedResult|exitAfterDefer)" @@ -192,4 +195,4 @@ issues: max-per-linter: 0 # Maximum count of issues with the same text. Set to 0 to disable. Default is 3. - max-same-issues: 0 + max-same-issues: 0 \ No newline at end of file diff --git a/Makefile b/Makefile index d54e418..756d50c 100644 --- a/Makefile +++ b/Makefile @@ -178,7 +178,7 @@ uptest: $(UPTEST) $(KUBECTL) $(KUTTL) @KUBECTL=$(KUBECTL) KUTTL=$(KUTTL) $(UPTEST) e2e "${UPTEST_EXAMPLE_LIST}" --setup-script=cluster/test/setup.sh || $(FAIL) @$(OK) running automated tests -local-deploy: build controlplane.up local.xpkg.deploy.provider.$(PROJECT_NAME) infoblox +local-deploy: build controlplane.up local.xpkg.deploy.provider.$(PROJECT_NAME) infoblox tools @$(INFO) running locally built provider @$(KUBECTL) wait provider.pkg $(PROJECT_NAME) --for condition=Healthy --timeout 5m @$(KUBECTL) -n upbound-system wait --for=condition=Available deployment --all --timeout=5m diff --git a/README.md b/README.md index 0d9def8..2c83eb7 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,8 @@ is built using [Upjet](https://github.com/crossplane/upjet) code generation tools and exposes XRM-conformant managed resources for Infoblox IPAM. +Please note this provider is in early development and is looking for maintainers. + ## Getting Started Install the provider by using the following command after changing the image tag diff --git a/internal/clients/infoblox-nios.go b/internal/clients/infoblox-nios.go index 33fb49c..d423be6 100644 --- a/internal/clients/infoblox-nios.go +++ b/internal/clients/infoblox-nios.go @@ -48,7 +48,7 @@ const ( // TerraformSetupBuilder builds Terraform a terraform.SetupFn function which // returns Terraform provider setup configuration -func TerraformSetupBuilder(version, providerSource, providerVersion string) terraform.SetupFn { +func TerraformSetupBuilder(version, providerSource, providerVersion string) terraform.SetupFn { //nolint:gocyclo return func(ctx context.Context, client client.Client, mg resource.Managed) (terraform.Setup, error) { ps := terraform.Setup{ Version: version, diff --git a/internal/controller/providerconfig/config.go b/internal/controller/providerconfig/config.go index e4f2a29..4f1604f 100644 --- a/internal/controller/providerconfig/config.go +++ b/internal/controller/providerconfig/config.go @@ -30,7 +30,6 @@ func Setup(mgr ctrl.Manager, o controller.Options) error { WithOptions(o.ForControllerRuntime()). For(&v1beta1.ProviderConfig{}). Watches(&v1beta1.ProviderConfigUsage{}, &resource.EnqueueRequestForProviderConfig{}). - //Watches(&source.Kind{Type: &v1beta1.ProviderConfigUsage{}}, &resource.EnqueueRequestForProviderConfig{}). Complete(providerconfig.NewReconciler(mgr, of, providerconfig.WithLogger(o.Logger.WithValues("controller", name)), providerconfig.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name)))))