diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 48e4b3d..10d9c5d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,14 +11,13 @@ on: env: # Common versions GO_VERSION: '1.19' - GOLANGCI_VERSION: 'v1.50' - DOCKER_BUILDX_VERSION: 'v0.9.1' + GOLANGCI_VERSION: 'v1.50.0' + DOCKER_BUILDX_VERSION: 'v0.8.2' - # Common users. We can't run a step 'if secrets.AWS_USR != ""' but we can run - # a step 'if env.AWS_USR' != ""', so we copy these to succinctly test whether + # 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. - DOCKER_USR: ${{ secrets.DOCKER_USR }} - AWS_USR: ${{ secrets.AWS_USR }} + UPBOUND_MARKETPLACE_PUSH_ROBOT_USR: ${{ secrets.UPBOUND_MARKETPLACE_PUSH_ROBOT_USR }} jobs: detect-noop: @@ -28,13 +27,38 @@ jobs: steps: - name: Detect No-op Changes id: noop - uses: fkirc/skip-duplicate-actions@v5.2.0 + uses: fkirc/skip-duplicate-actions@v5.3.0 with: github_token: ${{ secrets.GITHUB_TOKEN }} paths_ignore: '["**.md", "**.png", "**.jpg"]' do_not_skip: '["workflow_dispatch", "schedule", "push"]' - concurrent_skipping: false + report-breaking-changes: + runs-on: ubuntu-22.04 + needs: detect-noop + if: needs.detect-noop.outputs.noop != 'true' + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + submodules: true + + - name: Get modified CRDs + id: modified-crds + uses: tj-actions/changed-files@v34 + 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 @@ -54,17 +78,17 @@ jobs: - name: Find the Go Build Cache id: go - run: echo "::set-output name=cache::$(make go.cachedir)" + run: echo "cache=$(make go.cachedir)" >> $GITHUB_OUTPUT - name: Cache the Go Build Cache - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ${{ steps.go.outputs.cache }} key: ${{ runner.os }}-build-lint-${{ hashFiles('**/go.sum') }} restore-keys: ${{ runner.os }}-build-lint- - name: Cache Go Dependencies - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: .work/pkg key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }} @@ -73,14 +97,12 @@ jobs: - name: Vendor Dependencies run: make vendor vendor.check - # We could run 'make lint' to ensure our desired Go version, but we prefer - # this action because it leaves 'annotations' (i.e. it comments on PRs to - # point out linter violations). + # We could run 'make lint' but we prefer this action because it leaves + # 'annotations' (i.e. it comments on PRs to point out linter violations). - name: Lint - uses: golangci/golangci-lint-action@v2 + uses: golangci/golangci-lint-action@v3 with: version: ${{ env.GOLANGCI_VERSION }} - skip-go-installation: true check-diff: runs-on: ubuntu-22.04 @@ -98,19 +120,22 @@ jobs: with: go-version: ${{ env.GO_VERSION }} + - name: Install goimports + run: go install golang.org/x/tools/cmd/goimports + - name: Find the Go Build Cache id: go - run: echo "::set-output name=cache::$(make go.cachedir)" + run: echo "cache=$(make go.cachedir)" >> $GITHUB_OUTPUT - name: Cache the Go Build Cache - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ${{ steps.go.outputs.cache }} key: ${{ runner.os }}-build-check-diff-${{ hashFiles('**/go.sum') }} restore-keys: ${{ runner.os }}-build-check-diff- - name: Cache Go Dependencies - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: .work/pkg key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }} @@ -143,17 +168,17 @@ jobs: - name: Find the Go Build Cache id: go - run: echo "::set-output name=cache::$(make go.cachedir)" + run: echo "cache=$(make go.cachedir)" >> $GITHUB_OUTPUT - name: Cache the Go Build Cache - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ${{ steps.go.outputs.cache }} key: ${{ runner.os }}-build-unit-tests-${{ hashFiles('**/go.sum') }} restore-keys: ${{ runner.os }}-build-unit-tests- - name: Cache Go Dependencies - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: .work/pkg key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }} @@ -171,23 +196,12 @@ jobs: flags: unittests file: _output/tests/linux_amd64/coverage.txt - e2e-tests: + local-deploy: runs-on: ubuntu-22.04 needs: detect-noop if: needs.detect-noop.outputs.noop != 'true' steps: - - name: Setup QEMU - uses: docker/setup-qemu-action@v1 - with: - platforms: all - - - name: Setup Docker Buildx - uses: docker/setup-buildx-action@v1 - with: - version: ${{ env.DOCKER_BUILDX_VERSION }} - install: true - - name: Checkout uses: actions/checkout@v2 with: @@ -203,35 +217,27 @@ jobs: - name: Find the Go Build Cache id: go - run: echo "::set-output name=cache::$(make go.cachedir)" + run: echo "cache=$(make go.cachedir)" >> $GITHUB_OUTPUT - name: Cache the Go Build Cache - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ${{ steps.go.outputs.cache }} - key: ${{ runner.os }}-build-e2e-tests-${{ hashFiles('**/go.sum') }} - restore-keys: ${{ runner.os }}-build-e2e-tests- + key: ${{ runner.os }}-build-unit-tests-${{ hashFiles('**/go.sum') }} + restore-keys: ${{ runner.os }}-build-unit-tests- - name: Cache Go Dependencies - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: .work/pkg key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-pkg- + restore-keys: ${{ runner.os }}-pkg- - name: Vendor Dependencies run: make vendor vendor.check - - name: Build Helm Chart - run: make -j2 build - env: - # We're using docker buildx, which doesn't actually load the images it - # builds by default. Specifying --load does so. - BUILD_ARGS: "--load" - - - name: Run E2E Tests - run: make e2e USE_HELM3=true + - name: Deploying locally built provider package + run: make local-deploy publish-artifacts: runs-on: ubuntu-22.04 @@ -245,11 +251,19 @@ jobs: platforms: all - name: Setup Docker Buildx - uses: docker/setup-buildx-action@v1 + uses: docker/setup-buildx-action@v2 with: version: ${{ env.DOCKER_BUILDX_VERSION }} install: true + - name: Login to Upbound + uses: docker/login-action@v2 + if: env.UPBOUND_MARKETPLACE_PUSH_ROBOT_USR != '' + with: + registry: xpkg.upbound.io + username: ${{ secrets.UPBOUND_MARKETPLACE_PUSH_ROBOT_USR }} + password: ${{ secrets.UPBOUND_MARKETPLACE_PUSH_ROBOT_PSW }} + - name: Checkout uses: actions/checkout@v2 with: @@ -265,17 +279,17 @@ jobs: - name: Find the Go Build Cache id: go - run: echo "::set-output name=cache::$(make go.cachedir)" + run: echo "cache=$(make go.cachedir)" >> $GITHUB_OUTPUT - name: Cache the Go Build Cache - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ${{ steps.go.outputs.cache }} key: ${{ runner.os }}-build-publish-artifacts-${{ hashFiles('**/go.sum') }} restore-keys: ${{ runner.os }}-build-publish-artifacts- - name: Cache Go Dependencies - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: .work/pkg key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }} @@ -291,34 +305,11 @@ jobs: # builds by default. Specifying --load does so. BUILD_ARGS: "--load" - - name: Publish Artifacts to GitHub - uses: actions/upload-artifact@v2 + - name: Upload Artifacts to GitHub + uses: actions/upload-artifact@v3 with: name: output path: _output/** - - name: Login to Docker - uses: docker/login-action@v1 - if: env.DOCKER_USR != '' - with: - username: ${{ secrets.DOCKER_USR }} - password: ${{ secrets.DOCKER_PSW }} - - - name: Publish Artifacts to S3 and Docker Hub - run: make -j2 publish BRANCH_NAME=${GITHUB_REF##*/} - if: env.AWS_USR != '' && env.DOCKER_USR != '' - env: - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_USR }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_PSW }} - GIT_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} - DOCS_GIT_USR: ${{ secrets.UPBOUND_BOT_GITHUB_USR }} - DOCS_GIT_PSW: ${{ secrets.UPBOUND_BOT_GITHUB_PSW }} - - - name: Promote Artifacts in S3 and Docker Hub - if: github.ref == 'refs/heads/main' && env.AWS_USR != '' && env.DOCKER_USR != '' - run: make -j2 promote - env: - BRANCH_NAME: main - CHANNEL: master - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_USR }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_PSW }} + - name: Publish Artifacts + run: make publish BRANCH_NAME=${GITHUB_REF##*/} \ No newline at end of file diff --git a/internal/controller/jenkinsnode/jenkinsnode.go b/internal/controller/jenkinsnode/jenkinsnode.go index c3c56b4..8a52042 100644 --- a/internal/controller/jenkinsnode/jenkinsnode.go +++ b/internal/controller/jenkinsnode/jenkinsnode.go @@ -42,8 +42,6 @@ import ( const ( errNotJenkinsNode = "managed resource is not a JenkinsNode custom resource" errTrackPCUsage = "cannot track ProviderConfig usage" - errGetPC = "cannot get ProviderConfig" - errGetCreds = "cannot get credentials" ) // Setup adds a controller that reconciles JenkinsNode managed resources. diff --git a/internal/controller/job/job.go b/internal/controller/job/job.go index edf0320..2085556 100644 --- a/internal/controller/job/job.go +++ b/internal/controller/job/job.go @@ -43,8 +43,6 @@ import ( const ( errNotJob = "managed resource is not a Job custom resource" errTrackPCUsage = "cannot track ProviderConfig usage" - errGetPC = "cannot get ProviderConfig" - errGetCreds = "cannot get credentials" ) // Setup adds a controller that reconciles Job managed resources.