diff --git a/.github/workflows/check-manifest-diffs.yaml b/.github/workflows/check-manifest-diffs.yaml new file mode 100644 index 00000000000..d6c5e4f7432 --- /dev/null +++ b/.github/workflows/check-manifest-diffs.yaml @@ -0,0 +1,77 @@ +name: "Check for diff in manifests" + +on: + pull_request: + branches: [ "main" ] + types: + - "opened" + - "synchronize" + - "reopened" + - "labeled" + - "unlabeled" + +jobs: + create-pr-manifests: + if: ${{ contains(github.event.pull_request.labels.*.name, 'confirm/helm-update') == false }} + name: Create PR manifests + runs-on: ubuntu-latest + outputs: + manifests: ${{ steps.make-pr-manifests.outputs.manifests }} + steps: + - name: Checkout lifecycle-manager + uses: actions/checkout@v4 + - name: Run 'make dry-run' + id: make-pr-manifests + run: | + make dry-run + { + echo 'manifests<> "$GITHUB_OUTPUT" + create-main-manifests: + if: ${{ contains(github.event.pull_request.labels.*.name, 'confirm/helm-update') == false }} + name: Create 'main' manifests + runs-on: ubuntu-latest + outputs: + manifests: ${{ steps.make-main-manifests.outputs.manifests }} + steps: + - name: Checkout lifecycle-manager + uses: actions/checkout@v4 + with: + ref: main + - name: Run 'make dry-run' + id: make-main-manifests + run: | + make dry-run + { + echo 'manifests<> "$GITHUB_OUTPUT" + diff-manifests: + needs: + - create-pr-manifests + - create-main-manifests + name: Diff manifests + runs-on: ubuntu-latest + steps: + - name: Diff + env: + PR_MANIFESTS: ${{needs.create-pr-manifests.outputs.manifests}} + MAIN_MANIFESTS: ${{needs.create-main-manifests.outputs.manifests}} + run: | + echo "$PR_MANIFESTS" >> ./prManifests.yaml + echo "$MAIN_MANIFESTS" >> ./mainManifests.yaml + + set +e + SCRIPT_OUTPUT=$(diff ./prManifests.yaml ./mainManifests.yaml) + SCRIPT_EXIT_CODE=$? + if [[ $SCRIPT_EXIT_CODE != 0 ]]; then + echo "Detected diff in manifests. Make sure to update Helm charts accordingly and add the'confirm/helm-update' label to the PR when okay." + echo "$SCRIPT_OUTPUT" + exit $SCRIPT_EXIT_CODE + fi + set -e + + echo "No diff in manifests, all good." diff --git a/config/default/kustomization.yaml b/config/default/kustomization.yaml index 42101926e34..ca1ad45e6e9 100644 --- a/config/default/kustomization.yaml +++ b/config/default/kustomization.yaml @@ -2,7 +2,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization # Adds namespace to all resources. -namespace: kcp-system +namespace: foobar # Value of this field is prepended to the # names of all resources, e.g. a deployment named diff --git a/config/manager/kustomization.yaml b/config/manager/kustomization.yaml index b086b114783..6f2470caef2 100644 --- a/config/manager/kustomization.yaml +++ b/config/manager/kustomization.yaml @@ -15,5 +15,4 @@ configMapGenerator: images: - name: controller - newName: europe-docker.pkg.dev/kyma-project/prod/lifecycle-manager - newTag: latest + newName: /lifecycle-manager