diff --git a/.github/workflows/chart-test.yaml b/.github/workflows/chart-test.yaml index 1e775c49d..4d2b4a850 100644 --- a/.github/workflows/chart-test.yaml +++ b/.github/workflows/chart-test.yaml @@ -87,7 +87,7 @@ jobs: version: "v3.19.2" - name: Install helm unittest plugin - run: helm plugin install https://github.com/helm-unittest/helm-unittest.git --version v1.0.0 + run: helm plugin install https://github.com/helm-unittest/helm-unittest.git --version v1.1.0 - name: Run chart unit tests id: unittest @@ -137,8 +137,21 @@ jobs: if: steps.unittest.outcome == 'failure' run: exit 1 + detect-fork: + runs-on: ubuntu-latest + permissions: {} + outputs: + is-fork: ${{ steps.check.outputs.is-fork }} + steps: + - name: Check fork status + id: check + env: + IS_FORK: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository }} + run: echo "is-fork=$IS_FORK" >> "$GITHUB_OUTPUT" + install: runs-on: ubuntu-latest-4x + needs: [detect-fork] steps: - name: Checkout uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -178,6 +191,7 @@ jobs: run: kubectl create namespace posit-test - name: Create License File Secrets + if: needs.detect-fork.outputs.is-fork != 'true' env: PWB_LICENSE: ${{ secrets.PWB_LICENSE_FILE }} PCT_LICENSE: ${{ secrets.PCT_LICENSE_FILE }} @@ -201,16 +215,32 @@ jobs: # no allow-failure until https://github.com/actions/toolkit/issues/399 - name: Run chart-testing (install changed) id: ct-install - if: ${{ github.ref != 'refs/heads/main' && steps.list-changed.outputs.changed == 'true' }} + if: ${{ github.ref != 'refs/heads/main' && steps.list-changed.outputs.changed == 'true' && needs.detect-fork.outputs.is-fork != 'true' }} run: ct install --target-branch main --chart-dirs charts --chart-dirs other-charts --excluded-charts rstudio-library,rstudio-library-test --namespace posit-test continue-on-error: true # no allow-failure until https://github.com/actions/toolkit/issues/399 - name: Run chart-testing (install all) id: ct-install-all + if: needs.detect-fork.outputs.is-fork != 'true' run: ct install --target-branch main --all --chart-dirs charts --chart-dirs other-charts --excluded-charts rstudio-library,rstudio-library-test --namespace posit-test continue-on-error: true + # Fork PRs have no access to license secrets. replicas=0 causes Kubernetes to + # create all non-pod resources (Services, RBAC, ConfigMaps, PVCs) and consider + # the Deployment immediately rolled out — no pod is scheduled that needs the license. + - name: Run chart-testing (install changed, fork) + id: ct-install-fork + if: ${{ github.ref != 'refs/heads/main' && steps.list-changed.outputs.changed == 'true' && needs.detect-fork.outputs.is-fork == 'true' }} + run: ct install --target-branch main --chart-dirs charts --chart-dirs other-charts --excluded-charts rstudio-library,rstudio-library-test --namespace posit-test --helm-extra-set-args "--set=replicas=0" + continue-on-error: true + + - name: Run chart-testing (install all, fork) + id: ct-install-all-fork + if: needs.detect-fork.outputs.is-fork == 'true' + run: ct install --target-branch main --all --chart-dirs charts --chart-dirs other-charts --excluded-charts rstudio-library,rstudio-library-test --namespace posit-test --helm-extra-set-args "--set=replicas=0" + continue-on-error: true + - name: Notify Slack of chart install failure if on main if: github.ref == 'refs/heads/main' && (steps.ct-install.outcome == 'failure' || steps.ct-install-all.outcome == 'failure') uses: slackapi/slack-github-action@45a88b9581bfab2566dc881e2cd66d334e621e2c # v3.0.3 @@ -233,7 +263,7 @@ jobs: SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK - name: Fail the workflow if failed installs - if: steps.ct-install.outcome == 'failure' || steps.ct-install-all.outcome == 'failure' + if: steps.ct-install.outcome == 'failure' || steps.ct-install-all.outcome == 'failure' || steps.ct-install-fork.outcome == 'failure' || steps.ct-install-all-fork.outcome == 'failure' run: exit 1 check-versions-connect: diff --git a/charts/posit-chronicle/tests/configmap_fail_test.yaml b/charts/posit-chronicle/tests/configmap_fail_test.yaml index 402dc91f3..78c4ed244 100644 --- a/charts/posit-chronicle/tests/configmap_fail_test.yaml +++ b/charts/posit-chronicle/tests/configmap_fail_test.yaml @@ -27,7 +27,7 @@ tests: ServiceLogLevel: INVALID asserts: - failedTemplate: - errorPattern: ".*ServiceLogLevel: Does not match pattern.*" + errorPattern: "(?i).*ServiceLogLevel.*does not match pattern.*" - it: should fail for invalid log level values set: config: @@ -35,7 +35,7 @@ tests: ServiceLogFormat: INVALID asserts: - failedTemplate: - errorPattern: ".*ServiceLogFormat: Does not match pattern.*" + errorPattern: "(?i).*ServiceLogFormat.*does not match pattern.*" - it: should fail if S3 is enabled but no bucket is specified set: config: