From 6bd2502a91abf715d2b6f82aa4409b5b6b7faa0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Fri, 5 Apr 2024 13:51:56 +0200 Subject: [PATCH 01/55] chore: Introduce shared GitHub Actions --- .../actions/hello-world-action/action.yaml | 35 +++++++++++++++++++ .github/actions/hello-world-action/goodbye.sh | 1 + 2 files changed, 36 insertions(+) create mode 100644 .github/actions/hello-world-action/action.yaml create mode 100755 .github/actions/hello-world-action/goodbye.sh diff --git a/.github/actions/hello-world-action/action.yaml b/.github/actions/hello-world-action/action.yaml new file mode 100644 index 0000000000..0f4b8037a4 --- /dev/null +++ b/.github/actions/hello-world-action/action.yaml @@ -0,0 +1,35 @@ +name: 'Hello World' +description: 'Greet someone' +inputs: + who-to-greet: # id of input + description: 'Who to greet' + required: true + default: 'World' +outputs: + random-number: + description: "Random number" + value: ${{ steps.random-number-generator.outputs.random-number }} +runs: + using: "composite" + steps: + - name: Set Greeting + run: echo "Hello $INPUT_WHO_TO_GREET." + shell: bash + env: + INPUT_WHO_TO_GREET: ${{ inputs.who-to-greet }} + + - name: Random Number Generator + id: random-number-generator + run: echo "random-number=$(echo $RANDOM)" >> $GITHUB_OUTPUT + shell: bash + + - name: Set GitHub Path + run: echo "$GITHUB_ACTION_PATH" >> $GITHUB_PATH + shell: bash + env: + GITHUB_ACTION_PATH: ${{ github.action_path }} + + - name: Run goodbye.sh + run: goodbye.sh + shell: bash + diff --git a/.github/actions/hello-world-action/goodbye.sh b/.github/actions/hello-world-action/goodbye.sh new file mode 100755 index 0000000000..cafe4a89be --- /dev/null +++ b/.github/actions/hello-world-action/goodbye.sh @@ -0,0 +1 @@ +echo "echo Goodbye" From 4add18da7175c688d8f00f35cd5cc0c0d07ff5ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Fri, 5 Apr 2024 13:53:51 +0200 Subject: [PATCH 02/55] added workflow --- .github/workflows/test-e2e-junk.yaml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/test-e2e-junk.yaml diff --git a/.github/workflows/test-e2e-junk.yaml b/.github/workflows/test-e2e-junk.yaml new file mode 100644 index 0000000000..cb9b4a1462 --- /dev/null +++ b/.github/workflows/test-e2e-junk.yaml @@ -0,0 +1,18 @@ +on: + pull_request: + branches: [ "main" ] + +jobs: + hello_world_job: + runs-on: ubuntu-latest + name: A job to say hello + steps: + - uses: actions/checkout@v4 + - id: foo + uses: actions/hello-world-action@v1 + with: + who-to-greet: 'Mona the Octocat' + - run: echo random-number "$RANDOM_NUMBER" + shell: bash + env: + RANDOM_NUMBER: ${{ steps.foo.outputs.random-number }} From 0fbb9d97c05ceefdcc589210e2ccc8e3e0e1a080 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Fri, 5 Apr 2024 14:06:45 +0200 Subject: [PATCH 03/55] fix path --- .github/actions/hello-world-action/action.yaml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/actions/hello-world-action/action.yaml b/.github/actions/hello-world-action/action.yaml index 0f4b8037a4..c794e621fa 100644 --- a/.github/actions/hello-world-action/action.yaml +++ b/.github/actions/hello-world-action/action.yaml @@ -23,13 +23,6 @@ runs: run: echo "random-number=$(echo $RANDOM)" >> $GITHUB_OUTPUT shell: bash - - name: Set GitHub Path - run: echo "$GITHUB_ACTION_PATH" >> $GITHUB_PATH - shell: bash - env: - GITHUB_ACTION_PATH: ${{ github.action_path }} - - name: Run goodbye.sh - run: goodbye.sh + run: ./github/actions/hello-world-action/goodbye.sh shell: bash - From 9be041d55df4844dc479300a4c0f219e9859849f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Fri, 5 Apr 2024 14:08:58 +0200 Subject: [PATCH 04/55] clean test --- .github/actions/hello-world-action/action.yaml | 13 ------------- .github/workflows/test-e2e-junk.yaml | 4 ---- 2 files changed, 17 deletions(-) diff --git a/.github/actions/hello-world-action/action.yaml b/.github/actions/hello-world-action/action.yaml index c794e621fa..67fac85e6b 100644 --- a/.github/actions/hello-world-action/action.yaml +++ b/.github/actions/hello-world-action/action.yaml @@ -5,10 +5,6 @@ inputs: description: 'Who to greet' required: true default: 'World' -outputs: - random-number: - description: "Random number" - value: ${{ steps.random-number-generator.outputs.random-number }} runs: using: "composite" steps: @@ -17,12 +13,3 @@ runs: shell: bash env: INPUT_WHO_TO_GREET: ${{ inputs.who-to-greet }} - - - name: Random Number Generator - id: random-number-generator - run: echo "random-number=$(echo $RANDOM)" >> $GITHUB_OUTPUT - shell: bash - - - name: Run goodbye.sh - run: ./github/actions/hello-world-action/goodbye.sh - shell: bash diff --git a/.github/workflows/test-e2e-junk.yaml b/.github/workflows/test-e2e-junk.yaml index cb9b4a1462..f73e2111c2 100644 --- a/.github/workflows/test-e2e-junk.yaml +++ b/.github/workflows/test-e2e-junk.yaml @@ -12,7 +12,3 @@ jobs: uses: actions/hello-world-action@v1 with: who-to-greet: 'Mona the Octocat' - - run: echo random-number "$RANDOM_NUMBER" - shell: bash - env: - RANDOM_NUMBER: ${{ steps.foo.outputs.random-number }} From 20a4976dfdcec6bc951907ce516b36b176722cf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Fri, 5 Apr 2024 15:02:40 +0200 Subject: [PATCH 05/55] wait-for-image-build action --- .../actions/wait-for-image-build/action.yaml | 34 +++++++++++++++++++ .github/workflows/test-e2e-junk.yaml | 10 +++++- 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 .github/actions/wait-for-image-build/action.yaml diff --git a/.github/actions/wait-for-image-build/action.yaml b/.github/actions/wait-for-image-build/action.yaml new file mode 100644 index 0000000000..8f706ba411 --- /dev/null +++ b/.github/actions/wait-for-image-build/action.yaml @@ -0,0 +1,34 @@ +name: Wait for image build +description: Waits for the image to be built. Exits with error if not built within the given timeout. +inputs: + token: + description: The GitHub token to use for making API requests. + required: true + statusName: + description: The name of the GitHub status check to wait for. For example, `build` or `deploy`. + required: true + timeoutSeconds: + description: The number of seconds to wait for the status check to complete. + required: false + default: "900" + intervalSeconds: + description: The number of seconds to wait before each poll of the GitHub API. + required: false + default: "10" +runs: + using: "composite" + steps: + - name: Wait for image build + id: wait-for-build + with: + token: ${{ inputs.token }} + statusName: ${{ inputs.statusName }} + timeoutSeconds: ${{ inputs.timeoutSeconds }} + intervalSeconds: ${{ inputs.intervalSeconds }} + uses: autotelic/action-wait-for-status-check@v1 + - name: Exit if build failed + if: steps.wait-for-build.outputs.state != 'success' + shell: bash + run: | + echo "Image build did not succeed!" + exit 1 diff --git a/.github/workflows/test-e2e-junk.yaml b/.github/workflows/test-e2e-junk.yaml index f73e2111c2..09cc7dd129 100644 --- a/.github/workflows/test-e2e-junk.yaml +++ b/.github/workflows/test-e2e-junk.yaml @@ -3,12 +3,20 @@ on: branches: [ "main" ] jobs: + wait-for-image-build: + runs-on: ubuntu-latest + steps: + - uses: actions/wait-for-image-build + with: + token: ${{ secrets.GITHUB_TOKEN }} + statusName: ${{ (github.event_name == 'pull_request') && 'pull-lifecycle-mgr-build' || 'main-lifecycle-mgr-build' }} hello_world_job: + needs: wait-for-image-build runs-on: ubuntu-latest name: A job to say hello steps: - uses: actions/checkout@v4 - id: foo - uses: actions/hello-world-action@v1 + uses: actions/hello-world-action with: who-to-greet: 'Mona the Octocat' From 0d2f2b60b924f8e46897f1bfd39b1da02ec4a9df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Fri, 5 Apr 2024 15:05:23 +0200 Subject: [PATCH 06/55] local path --- .github/workflows/test-e2e-junk.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-e2e-junk.yaml b/.github/workflows/test-e2e-junk.yaml index 09cc7dd129..90efd436e4 100644 --- a/.github/workflows/test-e2e-junk.yaml +++ b/.github/workflows/test-e2e-junk.yaml @@ -6,7 +6,7 @@ jobs: wait-for-image-build: runs-on: ubuntu-latest steps: - - uses: actions/wait-for-image-build + - uses: ./.github/actions/wait-for-image-build with: token: ${{ secrets.GITHUB_TOKEN }} statusName: ${{ (github.event_name == 'pull_request') && 'pull-lifecycle-mgr-build' || 'main-lifecycle-mgr-build' }} @@ -17,6 +17,6 @@ jobs: steps: - uses: actions/checkout@v4 - id: foo - uses: actions/hello-world-action + uses: ./.github/actions/hello-world-action with: who-to-greet: 'Mona the Octocat' From 1712390c9734d76bce1d16b200a60d48ff32e5a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Fri, 5 Apr 2024 15:08:42 +0200 Subject: [PATCH 07/55] checkout --- .github/workflows/test-e2e-junk.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-e2e-junk.yaml b/.github/workflows/test-e2e-junk.yaml index 90efd436e4..565a9d8a63 100644 --- a/.github/workflows/test-e2e-junk.yaml +++ b/.github/workflows/test-e2e-junk.yaml @@ -6,6 +6,7 @@ jobs: wait-for-image-build: runs-on: ubuntu-latest steps: + - uses: actions/checkout@v4 - uses: ./.github/actions/wait-for-image-build with: token: ${{ secrets.GITHUB_TOKEN }} From 4ec638a25eb68668e738b3fd7359c65a9a5e6242 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Mon, 8 Apr 2024 15:45:36 +0200 Subject: [PATCH 08/55] introduce install kubectl --- .github/actions/install-kubectl/action.yaml | 18 ++++++++++++++++++ .github/actions/setup-tools/action.yaml | 6 ++++++ .github/workflows/test-e2e-junk.yaml | 8 ++------ 3 files changed, 26 insertions(+), 6 deletions(-) create mode 100644 .github/actions/install-kubectl/action.yaml create mode 100644 .github/actions/setup-tools/action.yaml diff --git a/.github/actions/install-kubectl/action.yaml b/.github/actions/install-kubectl/action.yaml new file mode 100644 index 0000000000..c4215446ed --- /dev/null +++ b/.github/actions/install-kubectl/action.yaml @@ -0,0 +1,18 @@ +name: Install kubectl +description: Downloads kubectl and installs it locally. Follows the instructions for Debian-based distributions at https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/#install-using-native-package-management. +runs: + using: "composite" + steps: + - name: Download the public signing key for the Kubernetes package repositories + shell: bash + run: | + curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.28.7/deb/Release.key | sudo gpg --batch --yes --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg + - name: Add the appropriate Kubernetes apt repository + shell: bash + run: | + echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.28.7/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list + - name: Install kubectl + shell: bash + run: | + sudo apt-get update + sudo apt-get install -y kubectl diff --git a/.github/actions/setup-tools/action.yaml b/.github/actions/setup-tools/action.yaml new file mode 100644 index 0000000000..13cdf47a03 --- /dev/null +++ b/.github/actions/setup-tools/action.yaml @@ -0,0 +1,6 @@ +name: Setup tools +description: Downloads, installs and configures all the tools needed to setup and run the tests. +runs: + using: "composite" + steps: + - uses: ./.github/actions/install-kubectl diff --git a/.github/workflows/test-e2e-junk.yaml b/.github/workflows/test-e2e-junk.yaml index 565a9d8a63..eff30f9e5b 100644 --- a/.github/workflows/test-e2e-junk.yaml +++ b/.github/workflows/test-e2e-junk.yaml @@ -11,13 +11,9 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} statusName: ${{ (github.event_name == 'pull_request') && 'pull-lifecycle-mgr-build' || 'main-lifecycle-mgr-build' }} - hello_world_job: + e2e-integration: needs: wait-for-image-build runs-on: ubuntu-latest - name: A job to say hello steps: - uses: actions/checkout@v4 - - id: foo - uses: ./.github/actions/hello-world-action - with: - who-to-greet: 'Mona the Octocat' + - uses: ./.github/actions/setup-tools From 73c3dcffcc8d5cf85a9e54a8ecfdcaf1015a7d5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Mon, 8 Apr 2024 15:46:00 +0200 Subject: [PATCH 09/55] delete hello world --- .github/actions/hello-world-action/action.yaml | 15 --------------- .github/actions/hello-world-action/goodbye.sh | 1 - 2 files changed, 16 deletions(-) delete mode 100644 .github/actions/hello-world-action/action.yaml delete mode 100755 .github/actions/hello-world-action/goodbye.sh diff --git a/.github/actions/hello-world-action/action.yaml b/.github/actions/hello-world-action/action.yaml deleted file mode 100644 index 67fac85e6b..0000000000 --- a/.github/actions/hello-world-action/action.yaml +++ /dev/null @@ -1,15 +0,0 @@ -name: 'Hello World' -description: 'Greet someone' -inputs: - who-to-greet: # id of input - description: 'Who to greet' - required: true - default: 'World' -runs: - using: "composite" - steps: - - name: Set Greeting - run: echo "Hello $INPUT_WHO_TO_GREET." - shell: bash - env: - INPUT_WHO_TO_GREET: ${{ inputs.who-to-greet }} diff --git a/.github/actions/hello-world-action/goodbye.sh b/.github/actions/hello-world-action/goodbye.sh deleted file mode 100755 index cafe4a89be..0000000000 --- a/.github/actions/hello-world-action/goodbye.sh +++ /dev/null @@ -1 +0,0 @@ -echo "echo Goodbye" From 9b3d2d1a9f880722000032dce4f4c09cf0bf37bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Mon, 8 Apr 2024 15:51:07 +0200 Subject: [PATCH 10/55] use minor k8s version --- .github/actions/install-kubectl/action.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/install-kubectl/action.yaml b/.github/actions/install-kubectl/action.yaml index c4215446ed..ca426e9f9c 100644 --- a/.github/actions/install-kubectl/action.yaml +++ b/.github/actions/install-kubectl/action.yaml @@ -6,11 +6,11 @@ runs: - name: Download the public signing key for the Kubernetes package repositories shell: bash run: | - curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.28.7/deb/Release.key | sudo gpg --batch --yes --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg + curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.28/deb/Release.key | sudo gpg --batch --yes --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg - name: Add the appropriate Kubernetes apt repository shell: bash run: | - echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.28.7/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list + echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.28/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list - name: Install kubectl shell: bash run: | From ab8cfdb4f7ba17345c1f937f3fffa4c93afaff72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Mon, 8 Apr 2024 15:53:02 +0200 Subject: [PATCH 11/55] temp speedup image build --- .github/workflows/test-e2e-junk.yaml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test-e2e-junk.yaml b/.github/workflows/test-e2e-junk.yaml index eff30f9e5b..497c015100 100644 --- a/.github/workflows/test-e2e-junk.yaml +++ b/.github/workflows/test-e2e-junk.yaml @@ -6,11 +6,13 @@ jobs: wait-for-image-build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/wait-for-image-build - with: - token: ${{ secrets.GITHUB_TOKEN }} - statusName: ${{ (github.event_name == 'pull_request') && 'pull-lifecycle-mgr-build' || 'main-lifecycle-mgr-build' }} + - run: | + echo Done... + # - uses: actions/checkout@v4 + # - uses: ./.github/actions/wait-for-image-build + # with: + # token: ${{ secrets.GITHUB_TOKEN }} + # statusName: ${{ (github.event_name == 'pull_request') && 'pull-lifecycle-mgr-build' || 'main-lifecycle-mgr-build' }} e2e-integration: needs: wait-for-image-build runs-on: ubuntu-latest From ee46675d26f897a98de2ec89165ad93955926a06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Mon, 8 Apr 2024 16:00:53 +0200 Subject: [PATCH 12/55] parsing k8s version --- .github/actions/install-kubectl/action.yaml | 18 ++++++++++++++++-- .github/actions/setup-tools/action.yaml | 6 ++++++ .github/workflows/test-e2e-junk.yaml | 4 ++++ 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/.github/actions/install-kubectl/action.yaml b/.github/actions/install-kubectl/action.yaml index ca426e9f9c..44eec6d5c9 100644 --- a/.github/actions/install-kubectl/action.yaml +++ b/.github/actions/install-kubectl/action.yaml @@ -1,16 +1,30 @@ name: Install kubectl description: Downloads kubectl and installs it locally. Follows the instructions for Debian-based distributions at https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/#install-using-native-package-management. +inputs: + k8s_version: + description: 'The version of Kubernetes to install. For example, 1.28.7.' + required: true runs: using: "composite" steps: + - name: Parse K8s minor version + id: parse_k8s_minor_version + shell: bash + run: | + full_version=${{ inputs.k8s_version }} + split=( ${full_version//./ } ) + k8s_minor_version=${split[0]}.${split[1]} + + echo Using K8s minor version ${k8s_minor_version} + echo "k8s_minor_version=${k8s_minor_version}" >> $GITHUB_OUTPUT - name: Download the public signing key for the Kubernetes package repositories shell: bash run: | - curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.28/deb/Release.key | sudo gpg --batch --yes --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg + curl -fsSL https://pkgs.k8s.io/core:/stable:/v${{ steps.parse_k8s_minor_version.outputs.k8s_minor_version }}/deb/Release.key | sudo gpg --batch --yes --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg - name: Add the appropriate Kubernetes apt repository shell: bash run: | - echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.28/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list + echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v${{ steps.parse_k8s_minor_version.outputs.k8s_minor_version }}/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list - name: Install kubectl shell: bash run: | diff --git a/.github/actions/setup-tools/action.yaml b/.github/actions/setup-tools/action.yaml index 13cdf47a03..62a90c7027 100644 --- a/.github/actions/setup-tools/action.yaml +++ b/.github/actions/setup-tools/action.yaml @@ -1,6 +1,12 @@ name: Setup tools description: Downloads, installs and configures all the tools needed to setup and run the tests. +inputs: + k8s_version: + description: 'The version of Kubernetes to install. For example, 1.28.7.' + required: true runs: using: "composite" steps: - uses: ./.github/actions/install-kubectl + with: + k8s_version: ${{ inputs.k8s_version }} diff --git a/.github/workflows/test-e2e-junk.yaml b/.github/workflows/test-e2e-junk.yaml index 497c015100..06a21ff9d8 100644 --- a/.github/workflows/test-e2e-junk.yaml +++ b/.github/workflows/test-e2e-junk.yaml @@ -16,6 +16,10 @@ jobs: e2e-integration: needs: wait-for-image-build runs-on: ubuntu-latest + env: + K8S_VERSION: 1.28.7 steps: - uses: actions/checkout@v4 - uses: ./.github/actions/setup-tools + with: + k8s_version: ${{ env.K8S_VERSION }} From b86d13de4d54d3ef11730088aabd66dfdb927add Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Mon, 8 Apr 2024 16:46:14 +0200 Subject: [PATCH 13/55] introduce install istioctl --- .github/actions/install-istioctl/action.yaml | 15 +++++++++++++++ .github/actions/setup-tools/action.yaml | 6 ++++++ .github/workflows/test-e2e-junk.yaml | 2 ++ 3 files changed, 23 insertions(+) create mode 100644 .github/actions/install-istioctl/action.yaml diff --git a/.github/actions/install-istioctl/action.yaml b/.github/actions/install-istioctl/action.yaml new file mode 100644 index 0000000000..37805a7f0e --- /dev/null +++ b/.github/actions/install-istioctl/action.yaml @@ -0,0 +1,15 @@ +name: Install istioctl +description: Downloads istioctl and installs it locally. +inputs: + istio_version: + description: 'The version of istioctl to install. For example, 1.20.3.' + required: true +runs: + using: "composite" + steps: + - name: Install istioctl + shell: bash + run: | + curl -L https://istio.io/downloadIstio | TARGET_ARCH=x86_64 sh - + chmod +x istio-${{ inputs.istio_version }}/bin/istioctl + mv istio-${{ inputs.istio_version }}/bin/istioctl /usr/local/bin diff --git a/.github/actions/setup-tools/action.yaml b/.github/actions/setup-tools/action.yaml index 62a90c7027..ad105511d4 100644 --- a/.github/actions/setup-tools/action.yaml +++ b/.github/actions/setup-tools/action.yaml @@ -4,9 +4,15 @@ inputs: k8s_version: description: 'The version of Kubernetes to install. For example, 1.28.7.' required: true + istio_version: + description: 'The version of Istio to install. For example, 1.20.3.' + required: true runs: using: "composite" steps: - uses: ./.github/actions/install-kubectl with: k8s_version: ${{ inputs.k8s_version }} + - uses: ./.github/actions/install-istioctl + with: + istio_version: ${{ inputs.istio_version }} diff --git a/.github/workflows/test-e2e-junk.yaml b/.github/workflows/test-e2e-junk.yaml index 06a21ff9d8..38a8efc9f9 100644 --- a/.github/workflows/test-e2e-junk.yaml +++ b/.github/workflows/test-e2e-junk.yaml @@ -18,8 +18,10 @@ jobs: runs-on: ubuntu-latest env: K8S_VERSION: 1.28.7 + ISTIO_VERSION: 1.20.3 steps: - uses: actions/checkout@v4 - uses: ./.github/actions/setup-tools with: k8s_version: ${{ env.K8S_VERSION }} + istio_version: ${{ env.ISTIO_VERSION }} From 131e05e4432265a61705ba669d8ecb0f607c3633 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Mon, 8 Apr 2024 16:53:29 +0200 Subject: [PATCH 14/55] introduce install kyma-cli --- .github/actions/install-kyma-cli/action.yaml | 12 ++++++++++++ .github/actions/setup-tools/action.yaml | 1 + 2 files changed, 13 insertions(+) create mode 100644 .github/actions/install-kyma-cli/action.yaml diff --git a/.github/actions/install-kyma-cli/action.yaml b/.github/actions/install-kyma-cli/action.yaml new file mode 100644 index 0000000000..9a6abfe6a4 --- /dev/null +++ b/.github/actions/install-kyma-cli/action.yaml @@ -0,0 +1,12 @@ +name: Install kyma-cli +description: Downloads kyma-cli and installs it locally. +runs: + using: "composite" + steps: + - name: Install kyma-cli + shell: bash + run: | + wget https://storage.googleapis.com/kyma-cli-unstable/kyma-linux + chmod +x kyma-linux && mv kyma-linux /usr/local/bin/kyma-unstable + echo "PATH=/usr/local/bin/kyma-unstable" >> $GITHUB_OUTPUT + ln -s /usr/local/bin/kyma-unstable /usr/local/bin/kyma diff --git a/.github/actions/setup-tools/action.yaml b/.github/actions/setup-tools/action.yaml index ad105511d4..15f40a6f15 100644 --- a/.github/actions/setup-tools/action.yaml +++ b/.github/actions/setup-tools/action.yaml @@ -16,3 +16,4 @@ runs: - uses: ./.github/actions/install-istioctl with: istio_version: ${{ inputs.istio_version }} + - uses: ./.github/actions/install-kyma-cli From 2f814ba29a32827e7b09daf507cd3503f4b1b444 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Mon, 8 Apr 2024 17:05:14 +0200 Subject: [PATCH 15/55] introduce install cmctl --- .github/actions/install-cmctl/action.yaml | 14 ++++++++++++++ .github/actions/setup-tools/action.yaml | 1 + 2 files changed, 15 insertions(+) create mode 100644 .github/actions/install-cmctl/action.yaml diff --git a/.github/actions/install-cmctl/action.yaml b/.github/actions/install-cmctl/action.yaml new file mode 100644 index 0000000000..2c45cc2fab --- /dev/null +++ b/.github/actions/install-cmctl/action.yaml @@ -0,0 +1,14 @@ +name: Install cmctl +description: Downloads cmctl (cert-manager Command Line Tool) and installs it locally. +runs: + using: "composite" + steps: + - name: Install cmctl + shell: bash + run: | + OS=$(go env GOOS) + ARCH=$(go env GOARCH) + + curl -fsSL -o cmctl.tar.gz https://github.com/cert-manager/cert-manager/releases/latest/download/cmctl-$OS-$ARCH.tar.gz + tar xzf cmctl.tar.gz + sudo mv cmctl /usr/local/bin diff --git a/.github/actions/setup-tools/action.yaml b/.github/actions/setup-tools/action.yaml index 15f40a6f15..d41a9ef606 100644 --- a/.github/actions/setup-tools/action.yaml +++ b/.github/actions/setup-tools/action.yaml @@ -17,3 +17,4 @@ runs: with: istio_version: ${{ inputs.istio_version }} - uses: ./.github/actions/install-kyma-cli + - uses: ./.github/actions/install-cmctl From 1abc38ae98aff66293e9b46da3f5704daa480ba2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Mon, 8 Apr 2024 17:15:31 +0200 Subject: [PATCH 16/55] introduce install k3d --- .github/actions/install-k3d/action.yaml | 13 +++++++++++++ .github/actions/setup-tools/action.yaml | 20 +++++++++++++------- .github/workflows/test-e2e-junk.yaml | 2 ++ 3 files changed, 28 insertions(+), 7 deletions(-) create mode 100644 .github/actions/install-k3d/action.yaml diff --git a/.github/actions/install-k3d/action.yaml b/.github/actions/install-k3d/action.yaml new file mode 100644 index 0000000000..8d18220c90 --- /dev/null +++ b/.github/actions/install-k3d/action.yaml @@ -0,0 +1,13 @@ +name: Install k3d +description: Downloads k3d and installs it locally. +inputs: + k3d_version: + description: 'The version of k3d to install. For example, 5.6.0.' + required: true +runs: + using: "composite" + steps: + - name: Install k3d + shell: bash + run: | + wget -qO - https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | TAG=v${{ inputs.k3d_version }} bash diff --git a/.github/actions/setup-tools/action.yaml b/.github/actions/setup-tools/action.yaml index d41a9ef606..d128e49b8d 100644 --- a/.github/actions/setup-tools/action.yaml +++ b/.github/actions/setup-tools/action.yaml @@ -7,14 +7,20 @@ inputs: istio_version: description: 'The version of Istio to install. For example, 1.20.3.' required: true + k3d_version: + description: 'The version of k3d to install. For example, 5.6.0.' + required: true runs: using: "composite" steps: - - uses: ./.github/actions/install-kubectl - with: - k8s_version: ${{ inputs.k8s_version }} - - uses: ./.github/actions/install-istioctl + # - uses: ./.github/actions/install-kubectl + # with: + # k8s_version: ${{ inputs.k8s_version }} + # - uses: ./.github/actions/install-istioctl + # with: + # istio_version: ${{ inputs.istio_version }} + # - uses: ./.github/actions/install-kyma-cli + # - uses: ./.github/actions/install-cmctl + - uses: ./.github/actions/install-k3d with: - istio_version: ${{ inputs.istio_version }} - - uses: ./.github/actions/install-kyma-cli - - uses: ./.github/actions/install-cmctl + k3d_version: ${{ inputs.k3d_version }} diff --git a/.github/workflows/test-e2e-junk.yaml b/.github/workflows/test-e2e-junk.yaml index 38a8efc9f9..06a0643c58 100644 --- a/.github/workflows/test-e2e-junk.yaml +++ b/.github/workflows/test-e2e-junk.yaml @@ -19,9 +19,11 @@ jobs: env: K8S_VERSION: 1.28.7 ISTIO_VERSION: 1.20.3 + K3D_VERSION: 5.6.0 steps: - uses: actions/checkout@v4 - uses: ./.github/actions/setup-tools with: k8s_version: ${{ env.K8S_VERSION }} istio_version: ${{ env.ISTIO_VERSION }} + k3d_version: ${{ env.K3D_VERSION }} From ce3aaa6d5f3222c4971f251a7d677c8371400a41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Mon, 8 Apr 2024 17:27:32 +0200 Subject: [PATCH 17/55] use setup-go --- .github/actions/setup-tools/action.yaml | 14 ++++++++++++-- .github/workflows/test-e2e-junk.yaml | 4 ++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/actions/setup-tools/action.yaml b/.github/actions/setup-tools/action.yaml index d128e49b8d..1283d0c151 100644 --- a/.github/actions/setup-tools/action.yaml +++ b/.github/actions/setup-tools/action.yaml @@ -10,6 +10,12 @@ inputs: k3d_version: description: 'The version of k3d to install. For example, 5.6.0.' required: true + go-version-file: + description: The path to the Go version file. + required: true + cache-dependency-path: + description: The path to the Go dependency file. + required: true runs: using: "composite" steps: @@ -21,6 +27,10 @@ runs: # istio_version: ${{ inputs.istio_version }} # - uses: ./.github/actions/install-kyma-cli # - uses: ./.github/actions/install-cmctl - - uses: ./.github/actions/install-k3d + # - uses: ./.github/actions/install-k3d + # with: + # k3d_version: ${{ inputs.k3d_version }} + - uses: actions/setup-go@v4 with: - k3d_version: ${{ inputs.k3d_version }} + go-version-file: ${{ inputs.go-version-file }} + cache-dependency-path: ${{ inputs.cache-dependency-path }} diff --git a/.github/workflows/test-e2e-junk.yaml b/.github/workflows/test-e2e-junk.yaml index 06a0643c58..bf9902de58 100644 --- a/.github/workflows/test-e2e-junk.yaml +++ b/.github/workflows/test-e2e-junk.yaml @@ -20,6 +20,8 @@ jobs: K8S_VERSION: 1.28.7 ISTIO_VERSION: 1.20.3 K3D_VERSION: 5.6.0 + GO_VERSION_FILE_PATH: lifecycle-manager/go.mod + CACHE_DEPENDENCY_PATH: lifecycle-manager/go.sum steps: - uses: actions/checkout@v4 - uses: ./.github/actions/setup-tools @@ -27,3 +29,5 @@ jobs: k8s_version: ${{ env.K8S_VERSION }} istio_version: ${{ env.ISTIO_VERSION }} k3d_version: ${{ env.K3D_VERSION }} + go-version-file: ${{ env.GO_VERSION_FILE_PATH }} + cache-dependency-path: ${{ env.CACHE_DEPENDENCY_PATH }} From 25e635e9ab9b3e63fa34c1b0f6245dd541b65c5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Mon, 8 Apr 2024 17:29:47 +0200 Subject: [PATCH 18/55] checkout lifecycle-manager to path --- .github/workflows/test-e2e-junk.yaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-e2e-junk.yaml b/.github/workflows/test-e2e-junk.yaml index bf9902de58..fa89715d5e 100644 --- a/.github/workflows/test-e2e-junk.yaml +++ b/.github/workflows/test-e2e-junk.yaml @@ -23,8 +23,11 @@ jobs: GO_VERSION_FILE_PATH: lifecycle-manager/go.mod CACHE_DEPENDENCY_PATH: lifecycle-manager/go.sum steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-tools + - name: Checkout lifecycle-manager + uses: actions/checkout@v4 + with: + path: lifecycle-manager + - uses: ./lifecycle-manager/.github/actions/setup-tools with: k8s_version: ${{ env.K8S_VERSION }} istio_version: ${{ env.ISTIO_VERSION }} From 2681c6b121ebea78558077b3eb9fab2d1db268ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Mon, 8 Apr 2024 17:32:04 +0200 Subject: [PATCH 19/55] complete setup-tools --- .github/actions/setup-tools/action.yaml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/actions/setup-tools/action.yaml b/.github/actions/setup-tools/action.yaml index 1283d0c151..8e108d1cfa 100644 --- a/.github/actions/setup-tools/action.yaml +++ b/.github/actions/setup-tools/action.yaml @@ -19,17 +19,17 @@ inputs: runs: using: "composite" steps: - # - uses: ./.github/actions/install-kubectl - # with: - # k8s_version: ${{ inputs.k8s_version }} - # - uses: ./.github/actions/install-istioctl - # with: - # istio_version: ${{ inputs.istio_version }} - # - uses: ./.github/actions/install-kyma-cli - # - uses: ./.github/actions/install-cmctl - # - uses: ./.github/actions/install-k3d - # with: - # k3d_version: ${{ inputs.k3d_version }} + - uses: ./lifecycle-manager/.github/actions/install-kubectl + with: + k8s_version: ${{ inputs.k8s_version }} + - uses: ./lifecycle-manager/.github/actions/install-istioctl + with: + istio_version: ${{ inputs.istio_version }} + - uses: ./lifecycle-manager/.github/actions/install-kyma-cli + - uses: ./lifecycle-manager/.github/actions/install-cmctl + - uses: ./lifecycle-manager/.github/actions/install-k3d + with: + k3d_version: ${{ inputs.k3d_version }} - uses: actions/setup-go@v4 with: go-version-file: ${{ inputs.go-version-file }} From e3c49438120749c31cd6e3cdeb970c752685a5e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Mon, 8 Apr 2024 17:40:42 +0200 Subject: [PATCH 20/55] introduce configure-hosts and setup-test-clusters --- .github/actions/configure-hosts/action.yaml | 16 ++++++++++++++++ .github/actions/setup-test-clusters/action.yaml | 6 ++++++ .github/workflows/test-e2e-junk.yaml | 1 + 3 files changed, 23 insertions(+) create mode 100644 .github/actions/configure-hosts/action.yaml create mode 100644 .github/actions/setup-test-clusters/action.yaml diff --git a/.github/actions/configure-hosts/action.yaml b/.github/actions/configure-hosts/action.yaml new file mode 100644 index 0000000000..c6cacda829 --- /dev/null +++ b/.github/actions/configure-hosts/action.yaml @@ -0,0 +1,16 @@ +name: Configure hosts +description: Introduces an entry to the /etc/hosts file resolving k3d-kcp-registry to localhost. +runs: + using: "composite" + steps: + - name: Configure hosts + shell: bash + run: | + FILE=/etc/hosts + if [ -f "$FILE" ]; then + sudo echo "127.0.0.1 k3d-kcp-registry" | sudo tee -a $FILE + else + echo "$FILE does not exist." + exit 1 + fi + echo "/etc/hosts file patched" diff --git a/.github/actions/setup-test-clusters/action.yaml b/.github/actions/setup-test-clusters/action.yaml new file mode 100644 index 0000000000..e3250b9695 --- /dev/null +++ b/.github/actions/setup-test-clusters/action.yaml @@ -0,0 +1,6 @@ +name: Setup test clusters +description: Creates and configures the KCP and SKR clusters. +runs: + using: "composite" + steps: + - uses: ./lifecycle-manager/.github/actions/configure-hosts diff --git a/.github/workflows/test-e2e-junk.yaml b/.github/workflows/test-e2e-junk.yaml index fa89715d5e..94e68c2de7 100644 --- a/.github/workflows/test-e2e-junk.yaml +++ b/.github/workflows/test-e2e-junk.yaml @@ -34,3 +34,4 @@ jobs: k3d_version: ${{ env.K3D_VERSION }} go-version-file: ${{ env.GO_VERSION_FILE_PATH }} cache-dependency-path: ${{ env.CACHE_DEPENDENCY_PATH }} + - uses: ./lifecycle-manager/.github/actions/setup-test-clusters From c5c6e4ba301c0161fe5e68391c8c06f41fde34f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Mon, 8 Apr 2024 18:04:15 +0200 Subject: [PATCH 21/55] introduce create-k3d-cluster --- .../actions/create-k3d-cluster/action.yaml | 29 +++++++++++++++++++ .../actions/setup-test-clusters/action.yaml | 4 +++ 2 files changed, 33 insertions(+) create mode 100644 .github/actions/create-k3d-cluster/action.yaml diff --git a/.github/actions/create-k3d-cluster/action.yaml b/.github/actions/create-k3d-cluster/action.yaml new file mode 100644 index 0000000000..e8e1b92941 --- /dev/null +++ b/.github/actions/create-k3d-cluster/action.yaml @@ -0,0 +1,29 @@ +name: Create k3d cluster +description: Creates a k3d cluster. +inputs: + cluster_name: + description: The name of the cluster to create. + required: true + args: + description: Additional arguments to pass to the k3d cluster create command separated by semicolon (;). + required: false +runs: + using: "composite" + steps: + - name: Create k3d cluster + shell: bash + run: | + IFS=';' read -ra splitted_args <<< "${{ inputs.args }}" + + install_command="k3d cluster create kcp " + + for arg in "${splitted_args[@]}"; + do + install_command+="$arg " + done + + install_command+="--image rancher/k3s:v$K8S_VERSION-k3s1 " + install_command+="--k3s-arg '--disable=traefik@server:*' " + install_command+="--k3s-arg '--tls-san=host.k3d.internal@server:*'" + + echo "$install_command" diff --git a/.github/actions/setup-test-clusters/action.yaml b/.github/actions/setup-test-clusters/action.yaml index e3250b9695..b2c84e0862 100644 --- a/.github/actions/setup-test-clusters/action.yaml +++ b/.github/actions/setup-test-clusters/action.yaml @@ -4,3 +4,7 @@ runs: using: "composite" steps: - uses: ./lifecycle-manager/.github/actions/configure-hosts + - uses: ./lifecycle-manager/.github/actions/create-k3d-cluster + with: + cluster_name: kcp + args: "-p 10080:80@loadbalancer;-p 10443:443@loadbalancer" From c949d05e870400e986c19f0351dd5bb50eb3e68c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Tue, 9 Apr 2024 11:41:39 +0200 Subject: [PATCH 22/55] introduce create kcp cluster --- .github/actions/create-k3d-cluster/action.yaml | 2 +- .github/actions/setup-test-clusters/action.yaml | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/actions/create-k3d-cluster/action.yaml b/.github/actions/create-k3d-cluster/action.yaml index e8e1b92941..70dc23a126 100644 --- a/.github/actions/create-k3d-cluster/action.yaml +++ b/.github/actions/create-k3d-cluster/action.yaml @@ -15,7 +15,7 @@ runs: run: | IFS=';' read -ra splitted_args <<< "${{ inputs.args }}" - install_command="k3d cluster create kcp " + install_command="k3d cluster create ${{ inputs.cluster_name }} " for arg in "${splitted_args[@]}"; do diff --git a/.github/actions/setup-test-clusters/action.yaml b/.github/actions/setup-test-clusters/action.yaml index b2c84e0862..099dc87cf9 100644 --- a/.github/actions/setup-test-clusters/action.yaml +++ b/.github/actions/setup-test-clusters/action.yaml @@ -6,5 +6,9 @@ runs: - uses: ./lifecycle-manager/.github/actions/configure-hosts - uses: ./lifecycle-manager/.github/actions/create-k3d-cluster with: - cluster_name: kcp + cluster_name: skr args: "-p 10080:80@loadbalancer;-p 10443:443@loadbalancer" + - uses: ./lifecycle-manager/.github/actions/create-k3d-cluster + with: + cluster_name: kcp + args: "-p 9443:443@loadbalancer;-p 9080:80@loadbalancer;-p 9081:8080@loadbalancer;--registry-create k3d-kcp-registry:5111" From a02f9ab6671e5dabf032328211d0bd3277bbd776 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Tue, 9 Apr 2024 12:58:12 +0200 Subject: [PATCH 23/55] use explicit k8s version input --- .github/actions/create-k3d-cluster/action.yaml | 5 ++++- .github/actions/setup-test-clusters/action.yaml | 6 ++++++ .github/workflows/test-e2e-junk.yaml | 2 ++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/actions/create-k3d-cluster/action.yaml b/.github/actions/create-k3d-cluster/action.yaml index 70dc23a126..2263ae4e6d 100644 --- a/.github/actions/create-k3d-cluster/action.yaml +++ b/.github/actions/create-k3d-cluster/action.yaml @@ -4,6 +4,9 @@ inputs: cluster_name: description: The name of the cluster to create. required: true + k8s_version: + description: The version of k8s to use. + required: true args: description: Additional arguments to pass to the k3d cluster create command separated by semicolon (;). required: false @@ -22,7 +25,7 @@ runs: install_command+="$arg " done - install_command+="--image rancher/k3s:v$K8S_VERSION-k3s1 " + install_command+="--image rancher/k3s:v${{ inputs.k8s_version }}-k3s1 " install_command+="--k3s-arg '--disable=traefik@server:*' " install_command+="--k3s-arg '--tls-san=host.k3d.internal@server:*'" diff --git a/.github/actions/setup-test-clusters/action.yaml b/.github/actions/setup-test-clusters/action.yaml index 099dc87cf9..4d20aa491a 100644 --- a/.github/actions/setup-test-clusters/action.yaml +++ b/.github/actions/setup-test-clusters/action.yaml @@ -1,5 +1,9 @@ name: Setup test clusters description: Creates and configures the KCP and SKR clusters. +inputs: + k8s_version: + description: The version of k8s to use. + required: true runs: using: "composite" steps: @@ -7,8 +11,10 @@ runs: - uses: ./lifecycle-manager/.github/actions/create-k3d-cluster with: cluster_name: skr + k8s_version: ${{ inputs.k8s_version }} args: "-p 10080:80@loadbalancer;-p 10443:443@loadbalancer" - uses: ./lifecycle-manager/.github/actions/create-k3d-cluster with: cluster_name: kcp + k8s_version: ${{ inputs.k8s_version }} args: "-p 9443:443@loadbalancer;-p 9080:80@loadbalancer;-p 9081:8080@loadbalancer;--registry-create k3d-kcp-registry:5111" diff --git a/.github/workflows/test-e2e-junk.yaml b/.github/workflows/test-e2e-junk.yaml index 94e68c2de7..0fa0e63a67 100644 --- a/.github/workflows/test-e2e-junk.yaml +++ b/.github/workflows/test-e2e-junk.yaml @@ -35,3 +35,5 @@ jobs: go-version-file: ${{ env.GO_VERSION_FILE_PATH }} cache-dependency-path: ${{ env.CACHE_DEPENDENCY_PATH }} - uses: ./lifecycle-manager/.github/actions/setup-test-clusters + with: + k8s_version: ${{ env.K8S_VERSION }} From d1bd7eebec9da42dfb4a9227904026b1014c06b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Tue, 9 Apr 2024 14:41:36 +0200 Subject: [PATCH 24/55] introduce configure kubectl --- .github/actions/export-kubeconfigs/action.yaml | 15 +++++++++++++++ .github/actions/setup-test-clusters/action.yaml | 4 ++++ .../actions/switch-kubectl-context/action.yaml | 13 +++++++++++++ .github/workflows/test-e2e-junk.yaml | 1 + 4 files changed, 33 insertions(+) create mode 100644 .github/actions/export-kubeconfigs/action.yaml create mode 100644 .github/actions/switch-kubectl-context/action.yaml diff --git a/.github/actions/export-kubeconfigs/action.yaml b/.github/actions/export-kubeconfigs/action.yaml new file mode 100644 index 0000000000..36573f835f --- /dev/null +++ b/.github/actions/export-kubeconfigs/action.yaml @@ -0,0 +1,15 @@ +name: Export kubeconfigs +description: Merges the configs from KCP and SKR k3d clusters into the default kubeconfig and exports the same as environment variables KCP_KUBECONFIG and SKR_KUBECONFIG. +inputs: + context_name: + description: The name of the context to use. + required: true +runs: + using: "composite" + steps: + - name: Export kubeconfigs + shell: bash + run: | + k3d kubeconfig merge -a -d + echo "KCP_KUBECONFIG=$(k3d kubeconfig write kcp)" >> $GITHUB_ENV + echo "SKR_KUBECONFIG=$(k3d kubeconfig write skr)" >> $GITHUB_ENV diff --git a/.github/actions/setup-test-clusters/action.yaml b/.github/actions/setup-test-clusters/action.yaml index 4d20aa491a..a442338d90 100644 --- a/.github/actions/setup-test-clusters/action.yaml +++ b/.github/actions/setup-test-clusters/action.yaml @@ -18,3 +18,7 @@ runs: cluster_name: kcp k8s_version: ${{ inputs.k8s_version }} args: "-p 9443:443@loadbalancer;-p 9080:80@loadbalancer;-p 9081:8080@loadbalancer;--registry-create k3d-kcp-registry:5111" + - uses: ./lifecycle-manager/.github/actions/export-kubeconfigs + - uses: ./lifecycle-manager/.github/actions/switch-kubectl-context + with: + context_name: k3d-kcp diff --git a/.github/actions/switch-kubectl-context/action.yaml b/.github/actions/switch-kubectl-context/action.yaml new file mode 100644 index 0000000000..71a9d0271f --- /dev/null +++ b/.github/actions/switch-kubectl-context/action.yaml @@ -0,0 +1,13 @@ +name: Switch kubectl context +description: Switches kubectl to use the context with the provided name. +inputs: + context_name: + description: The name of the context to use. + required: true +runs: + using: "composite" + steps: + - name: Configure kubectl + shell: bash + run: | + kubectl config use-context ${{ inputs.context_name }} diff --git a/.github/workflows/test-e2e-junk.yaml b/.github/workflows/test-e2e-junk.yaml index 0fa0e63a67..128baf38f3 100644 --- a/.github/workflows/test-e2e-junk.yaml +++ b/.github/workflows/test-e2e-junk.yaml @@ -37,3 +37,4 @@ jobs: - uses: ./lifecycle-manager/.github/actions/setup-test-clusters with: k8s_version: ${{ env.K8S_VERSION }} + \ No newline at end of file From 210129c3c2beb729574fb4b1758d58bf36f68d0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Tue, 9 Apr 2024 14:56:38 +0200 Subject: [PATCH 25/55] add debugging comment --- .github/actions/create-k3d-cluster/action.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/actions/create-k3d-cluster/action.yaml b/.github/actions/create-k3d-cluster/action.yaml index 2263ae4e6d..309c68e877 100644 --- a/.github/actions/create-k3d-cluster/action.yaml +++ b/.github/actions/create-k3d-cluster/action.yaml @@ -30,3 +30,7 @@ runs: install_command+="--k3s-arg '--tls-san=host.k3d.internal@server:*'" echo "$install_command" + - name: Test + shell: bash + run: | + k3d cluster list From 9de88fbe2e04fa43b0467019d0361ff1174fc35b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Tue, 9 Apr 2024 15:02:02 +0200 Subject: [PATCH 26/55] remove quotes --- .github/actions/create-k3d-cluster/action.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/create-k3d-cluster/action.yaml b/.github/actions/create-k3d-cluster/action.yaml index 309c68e877..5123a91aa2 100644 --- a/.github/actions/create-k3d-cluster/action.yaml +++ b/.github/actions/create-k3d-cluster/action.yaml @@ -26,8 +26,8 @@ runs: done install_command+="--image rancher/k3s:v${{ inputs.k8s_version }}-k3s1 " - install_command+="--k3s-arg '--disable=traefik@server:*' " - install_command+="--k3s-arg '--tls-san=host.k3d.internal@server:*'" + install_command+="--k3s-arg --disable=traefik@server:* " + install_command+="--k3s-arg --tls-san=host.k3d.internal@server:* " echo "$install_command" - name: Test From ccb562c39beed2da51b84a3faf494ad5eeb7e37d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Tue, 9 Apr 2024 15:05:49 +0200 Subject: [PATCH 27/55] fix k3d install command --- .github/actions/create-k3d-cluster/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/create-k3d-cluster/action.yaml b/.github/actions/create-k3d-cluster/action.yaml index 5123a91aa2..fc237e8713 100644 --- a/.github/actions/create-k3d-cluster/action.yaml +++ b/.github/actions/create-k3d-cluster/action.yaml @@ -29,7 +29,7 @@ runs: install_command+="--k3s-arg --disable=traefik@server:* " install_command+="--k3s-arg --tls-san=host.k3d.internal@server:* " - echo "$install_command" + eval ${install_command} - name: Test shell: bash run: | From f577dd4924da5f9e87a72d2b06e8591f6e374824 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Tue, 9 Apr 2024 15:10:32 +0200 Subject: [PATCH 28/55] rename command --- .github/actions/create-k3d-cluster/action.yaml | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/.github/actions/create-k3d-cluster/action.yaml b/.github/actions/create-k3d-cluster/action.yaml index fc237e8713..d5c2f3d6ca 100644 --- a/.github/actions/create-k3d-cluster/action.yaml +++ b/.github/actions/create-k3d-cluster/action.yaml @@ -18,19 +18,15 @@ runs: run: | IFS=';' read -ra splitted_args <<< "${{ inputs.args }}" - install_command="k3d cluster create ${{ inputs.cluster_name }} " + create_command="k3d cluster create ${{ inputs.cluster_name }} " for arg in "${splitted_args[@]}"; do - install_command+="$arg " + create_command+="$arg " done - install_command+="--image rancher/k3s:v${{ inputs.k8s_version }}-k3s1 " - install_command+="--k3s-arg --disable=traefik@server:* " - install_command+="--k3s-arg --tls-san=host.k3d.internal@server:* " + create_command+="--image rancher/k3s:v${{ inputs.k8s_version }}-k3s1 " + create_command+="--k3s-arg --disable=traefik@server:* " + create_command+="--k3s-arg --tls-san=host.k3d.internal@server:* " - eval ${install_command} - - name: Test - shell: bash - run: | - k3d cluster list + eval ${create_command} From 8dc5a6dc7ad589ab627188640565d7fe48f7fb7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Tue, 9 Apr 2024 15:22:18 +0200 Subject: [PATCH 29/55] introduce deploy istio --- .github/actions/deploy-istio/action.yaml | 9 +++++++++ .github/actions/setup-test-clusters/action.yaml | 1 + 2 files changed, 10 insertions(+) create mode 100644 .github/actions/deploy-istio/action.yaml diff --git a/.github/actions/deploy-istio/action.yaml b/.github/actions/deploy-istio/action.yaml new file mode 100644 index 0000000000..d62fe2f41c --- /dev/null +++ b/.github/actions/deploy-istio/action.yaml @@ -0,0 +1,9 @@ +name: Deploy istio +description: Deploys istio in the currently configured context. +runs: + using: "composite" + steps: + - name: Deploy istio + shell: bash + run: | + istioctl install --set profile=demo -y diff --git a/.github/actions/setup-test-clusters/action.yaml b/.github/actions/setup-test-clusters/action.yaml index a442338d90..be41ef336a 100644 --- a/.github/actions/setup-test-clusters/action.yaml +++ b/.github/actions/setup-test-clusters/action.yaml @@ -22,3 +22,4 @@ runs: - uses: ./lifecycle-manager/.github/actions/switch-kubectl-context with: context_name: k3d-kcp + - uses: ./lifecycle-manager/.github/actions/deploy-istio From 48f1ebe3de44f2f1099053ab680d72932e79b10e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Tue, 9 Apr 2024 15:28:01 +0200 Subject: [PATCH 30/55] introduce deploy cert manager --- .github/actions/deploy-cert-manager/action.yaml | 14 ++++++++++++++ .github/actions/setup-test-clusters/action.yaml | 8 +++++++- .github/workflows/test-e2e-junk.yaml | 3 +++ 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 .github/actions/deploy-cert-manager/action.yaml diff --git a/.github/actions/deploy-cert-manager/action.yaml b/.github/actions/deploy-cert-manager/action.yaml new file mode 100644 index 0000000000..171d051fff --- /dev/null +++ b/.github/actions/deploy-cert-manager/action.yaml @@ -0,0 +1,14 @@ +name: Deploy cert-manager +description: Deploys cert-manager in the currently configured context. +inputs: + cert_manager_version: + description: 'The version of cert-manager to depoy. For example, 1.13.3.' + required: true +runs: + using: "composite" + steps: + - name: Deploy cert-manager + shell: bash + run: | + kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v${{ inputs.cert_manager_version }}/cert-manager.yaml + cmctl check api --wait=2m diff --git a/.github/actions/setup-test-clusters/action.yaml b/.github/actions/setup-test-clusters/action.yaml index be41ef336a..08093e0666 100644 --- a/.github/actions/setup-test-clusters/action.yaml +++ b/.github/actions/setup-test-clusters/action.yaml @@ -2,7 +2,10 @@ name: Setup test clusters description: Creates and configures the KCP and SKR clusters. inputs: k8s_version: - description: The version of k8s to use. + description: The version of k8s to use. For example, 1.28.7 + required: true + cert_manager_version: + description: The version of cert-manager to depoy. For example, 1.13.3. required: true runs: using: "composite" @@ -23,3 +26,6 @@ runs: with: context_name: k3d-kcp - uses: ./lifecycle-manager/.github/actions/deploy-istio + - uses: ./lifecycle-manager/.github/actions/deploy-cert-manager + with: + cert_manager_version: ${{ inputs.cert_manager_version }} diff --git a/.github/workflows/test-e2e-junk.yaml b/.github/workflows/test-e2e-junk.yaml index 128baf38f3..f43666ea6c 100644 --- a/.github/workflows/test-e2e-junk.yaml +++ b/.github/workflows/test-e2e-junk.yaml @@ -20,6 +20,7 @@ jobs: K8S_VERSION: 1.28.7 ISTIO_VERSION: 1.20.3 K3D_VERSION: 5.6.0 + CERT_MANAGER_VERSION: 1.13.3 GO_VERSION_FILE_PATH: lifecycle-manager/go.mod CACHE_DEPENDENCY_PATH: lifecycle-manager/go.sum steps: @@ -37,4 +38,6 @@ jobs: - uses: ./lifecycle-manager/.github/actions/setup-test-clusters with: k8s_version: ${{ env.K8S_VERSION }} + cert_manager_version: ${{ env.CERT_MANAGER_VERSION }} + \ No newline at end of file From 8c584625d4b8c63dbd76e86b99be48cce264c3da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Tue, 9 Apr 2024 15:53:20 +0200 Subject: [PATCH 31/55] test shared configuration --- .../actions/configure-variables/action.yaml | 18 ++++++++++++++++++ .github/workflows/test-e2e-junk.yaml | 8 ++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 .github/actions/configure-variables/action.yaml diff --git a/.github/actions/configure-variables/action.yaml b/.github/actions/configure-variables/action.yaml new file mode 100644 index 0000000000..1a605c4e93 --- /dev/null +++ b/.github/actions/configure-variables/action.yaml @@ -0,0 +1,18 @@ +name: Define (env) variables +description: Defines variables such as versions and file paths. Where needed, those are also exported as environment variables. +outputs: + k8s_version: + description: The version of k8s to use. For example, 1.28.7. + value: ${{ steps.define-variables.outputs.k8s_version }} +runs: + using: "composite" + steps: + - name: Define variables + id: define-variables + shell: bash + run: | + echo "k8s_version=1.28.7" >> $GITHUB_OUTPUT + - name: Export env variables + shell: bash + run: | + echo "KLM_VERSION_TAG=latest" >> $GITHUB_ENV diff --git a/.github/workflows/test-e2e-junk.yaml b/.github/workflows/test-e2e-junk.yaml index f43666ea6c..def6e909eb 100644 --- a/.github/workflows/test-e2e-junk.yaml +++ b/.github/workflows/test-e2e-junk.yaml @@ -28,9 +28,11 @@ jobs: uses: actions/checkout@v4 with: path: lifecycle-manager + - uses: ./lifecycle-manager/.github/actions/configure-variables + id: configuration - uses: ./lifecycle-manager/.github/actions/setup-tools with: - k8s_version: ${{ env.K8S_VERSION }} + k8s_version: ${{ steps.configuration.outputs.k8s_version }} istio_version: ${{ env.ISTIO_VERSION }} k3d_version: ${{ env.K3D_VERSION }} go-version-file: ${{ env.GO_VERSION_FILE_PATH }} @@ -39,5 +41,7 @@ jobs: with: k8s_version: ${{ env.K8S_VERSION }} cert_manager_version: ${{ env.CERT_MANAGER_VERSION }} - + - shell: bash + run: | + echo "TODO: ${KLM_VERSION_TAG}" \ No newline at end of file From e18dfcf3ec6989505778af38109fd3ecc7772916 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Tue, 9 Apr 2024 16:18:19 +0200 Subject: [PATCH 32/55] define variables in step --- .../actions/configure-variables/action.yaml | 18 ------------- .github/actions/get-configuration/action.yaml | 26 +++++++++++++++++++ .github/workflows/test-e2e-junk.yaml | 24 +++++------------ 3 files changed, 33 insertions(+), 35 deletions(-) delete mode 100644 .github/actions/configure-variables/action.yaml create mode 100644 .github/actions/get-configuration/action.yaml diff --git a/.github/actions/configure-variables/action.yaml b/.github/actions/configure-variables/action.yaml deleted file mode 100644 index 1a605c4e93..0000000000 --- a/.github/actions/configure-variables/action.yaml +++ /dev/null @@ -1,18 +0,0 @@ -name: Define (env) variables -description: Defines variables such as versions and file paths. Where needed, those are also exported as environment variables. -outputs: - k8s_version: - description: The version of k8s to use. For example, 1.28.7. - value: ${{ steps.define-variables.outputs.k8s_version }} -runs: - using: "composite" - steps: - - name: Define variables - id: define-variables - shell: bash - run: | - echo "k8s_version=1.28.7" >> $GITHUB_OUTPUT - - name: Export env variables - shell: bash - run: | - echo "KLM_VERSION_TAG=latest" >> $GITHUB_ENV diff --git a/.github/actions/get-configuration/action.yaml b/.github/actions/get-configuration/action.yaml new file mode 100644 index 0000000000..8038be8f41 --- /dev/null +++ b/.github/actions/get-configuration/action.yaml @@ -0,0 +1,26 @@ +name: Define (env) variables +description: Defines variables such as versions and file paths. Where needed, those are also exported as environment variables. +outputs: + k8s_version: + description: The version of k8s to use. For example, 1.28.7. + value: ${{ steps.define-variables.outputs.k8s_version }} + istio_version: + description: The version of Istio to install. For example, 1.20.3. + value: ${{ steps.define-variables.outputs.istio_version }} + k3d_version: + description: The version of k3d to install. For example, 5.6.0. + value: ${{ steps.define-variables.outputs.k3d_version }} + cert_manager_version: + description: The version of cert-manager to deploy. For example, 1.13.3. + value: ${{ steps.define-variables.outputs.cert_manager_version }} +runs: + using: "composite" + steps: + - name: Define variables + id: define-variables + shell: bash + run: | + echo "k8s_version=1.28.7" >> $GITHUB_OUTPUT + echo "istio_version=1.20.3" >> $GITHUB_OUTPUT + echo "k3d_version=5.6.0" >> $GITHUB_OUTPUT + echo "cert_manager_version=1.13.3" >> $GITHUB_OUTPUT diff --git a/.github/workflows/test-e2e-junk.yaml b/.github/workflows/test-e2e-junk.yaml index def6e909eb..59b92605d6 100644 --- a/.github/workflows/test-e2e-junk.yaml +++ b/.github/workflows/test-e2e-junk.yaml @@ -16,32 +16,22 @@ jobs: e2e-integration: needs: wait-for-image-build runs-on: ubuntu-latest - env: - K8S_VERSION: 1.28.7 - ISTIO_VERSION: 1.20.3 - K3D_VERSION: 5.6.0 - CERT_MANAGER_VERSION: 1.13.3 - GO_VERSION_FILE_PATH: lifecycle-manager/go.mod - CACHE_DEPENDENCY_PATH: lifecycle-manager/go.sum steps: - name: Checkout lifecycle-manager uses: actions/checkout@v4 with: path: lifecycle-manager - - uses: ./lifecycle-manager/.github/actions/configure-variables + - uses: ./lifecycle-manager/.github/actions/get-configuration id: configuration - uses: ./lifecycle-manager/.github/actions/setup-tools with: k8s_version: ${{ steps.configuration.outputs.k8s_version }} - istio_version: ${{ env.ISTIO_VERSION }} - k3d_version: ${{ env.K3D_VERSION }} - go-version-file: ${{ env.GO_VERSION_FILE_PATH }} - cache-dependency-path: ${{ env.CACHE_DEPENDENCY_PATH }} + istio_version: ${{ steps.configuration.outputs.istio_version }} + k3d_version: ${{ steps.configuration.outputs.k3d_version }} + go-version-file: lifecycle-manager/go.mod + cache-dependency-path: lifecycle-manager/go.sum - uses: ./lifecycle-manager/.github/actions/setup-test-clusters with: - k8s_version: ${{ env.K8S_VERSION }} - cert_manager_version: ${{ env.CERT_MANAGER_VERSION }} - - shell: bash - run: | - echo "TODO: ${KLM_VERSION_TAG}" + k8s_version: ${{ steps.configuration.outputs.k8s_version }} + cert_manager_version: ${{ steps.configuration.outputs.cert_manager_version }} \ No newline at end of file From becbdec65596a096732e26fb8b03d7f13286baf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Tue, 9 Apr 2024 16:25:21 +0200 Subject: [PATCH 33/55] try fixing istio version --- .github/actions/get-configuration/action.yaml | 4 ++-- .github/actions/install-istioctl/action.yaml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/actions/get-configuration/action.yaml b/.github/actions/get-configuration/action.yaml index 8038be8f41..eb824aa9ad 100644 --- a/.github/actions/get-configuration/action.yaml +++ b/.github/actions/get-configuration/action.yaml @@ -1,5 +1,5 @@ -name: Define (env) variables -description: Defines variables such as versions and file paths. Where needed, those are also exported as environment variables. +name: Get configuration +description: Defines configuration variables such as versions. outputs: k8s_version: description: The version of k8s to use. For example, 1.28.7. diff --git a/.github/actions/install-istioctl/action.yaml b/.github/actions/install-istioctl/action.yaml index 37805a7f0e..328f2c70fb 100644 --- a/.github/actions/install-istioctl/action.yaml +++ b/.github/actions/install-istioctl/action.yaml @@ -10,6 +10,6 @@ runs: - name: Install istioctl shell: bash run: | - curl -L https://istio.io/downloadIstio | TARGET_ARCH=x86_64 sh - + curl -L https://istio.io/downloadIstio | ISTIO_VERSION=${{ inputs.istio_version }} TARGET_ARCH=x86_64 sh - chmod +x istio-${{ inputs.istio_version }}/bin/istioctl mv istio-${{ inputs.istio_version }}/bin/istioctl /usr/local/bin From c6a4b6d7515e326a39aaabe66e1f1e6f51045589 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Tue, 9 Apr 2024 16:38:56 +0200 Subject: [PATCH 34/55] add klm veresion tag in image repo configuration --- .github/actions/get-configuration/action.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/actions/get-configuration/action.yaml b/.github/actions/get-configuration/action.yaml index eb824aa9ad..7e7b668f6d 100644 --- a/.github/actions/get-configuration/action.yaml +++ b/.github/actions/get-configuration/action.yaml @@ -13,6 +13,12 @@ outputs: cert_manager_version: description: The version of cert-manager to deploy. For example, 1.13.3. value: ${{ steps.define-variables.outputs.cert_manager_version }} + klm_version_tag: + description: The version tag for the KLM image. For example, PR-123. + value: ${{ steps.define-variables.outputs.klm_version_tag }} + klm_image_repo: + description: The repository for the KLM image. For example, dev. + value: ${{ steps.define-variables.outputs.klm_image_repo }} runs: using: "composite" steps: @@ -24,3 +30,5 @@ runs: echo "istio_version=1.20.3" >> $GITHUB_OUTPUT echo "k3d_version=5.6.0" >> $GITHUB_OUTPUT echo "cert_manager_version=1.13.3" >> $GITHUB_OUTPUT + echo "klm_version_tag=PR-${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT + echo "klm_image_repo=dev" >> $GITHUB_OUTPUT From 04367c8056f014930090244f2908e473f96025e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Tue, 9 Apr 2024 16:42:18 +0200 Subject: [PATCH 35/55] make k8s version configurable --- .github/actions/get-configuration/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/get-configuration/action.yaml b/.github/actions/get-configuration/action.yaml index 7e7b668f6d..24d6b587e2 100644 --- a/.github/actions/get-configuration/action.yaml +++ b/.github/actions/get-configuration/action.yaml @@ -26,7 +26,7 @@ runs: id: define-variables shell: bash run: | - echo "k8s_version=1.28.7" >> $GITHUB_OUTPUT + echo "k8s_version=${{ github.event.inputs.k8s_version || '1.28.7' }}" >> $GITHUB_OUTPUT echo "istio_version=1.20.3" >> $GITHUB_OUTPUT echo "k3d_version=5.6.0" >> $GITHUB_OUTPUT echo "cert_manager_version=1.13.3" >> $GITHUB_OUTPUT From 4d6ea9a44343cd45e33cfcfd18441a231a29c653 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Tue, 9 Apr 2024 16:50:29 +0200 Subject: [PATCH 36/55] add matrix --- .github/workflows/test-e2e-junk.yaml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.github/workflows/test-e2e-junk.yaml b/.github/workflows/test-e2e-junk.yaml index 59b92605d6..5663d00bf0 100644 --- a/.github/workflows/test-e2e-junk.yaml +++ b/.github/workflows/test-e2e-junk.yaml @@ -14,8 +14,32 @@ jobs: # token: ${{ secrets.GITHUB_TOKEN }} # statusName: ${{ (github.event_name == 'pull_request') && 'pull-lifecycle-mgr-build' || 'main-lifecycle-mgr-build' }} e2e-integration: + name: "E2E Tests" needs: wait-for-image-build + strategy: + matrix: + e2e-test: + - "watcher-enqueue" + - "kyma-deprovision-with-foreground-propagation" + - "kyma-deprovision-with-background-propagation" + - "module-status-propagation" + - "kyma-metrics" + - "module-without-default-cr" + - "module-consistency" + - "non-blocking-deletion" + - "upgrade-under-deletion" + - "purge-controller" + - "purge-metrics" + - "module-upgrade-channel-switch" + - "module-upgrade-new-version" + - "skip-manifest-reconciliation" + - "ca-certificate-rotation" + - "self-signed-certificate-rotation" + - "mandatory-module" + - "mandatory-module-metrics" + - "misconfigured-kyma-secret" runs-on: ubuntu-latest + timeout-minutes: 20 steps: - name: Checkout lifecycle-manager uses: actions/checkout@v4 From 3a38e3ea595f8301e557fc67c38bf6752ad4d948 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Tue, 9 Apr 2024 17:04:32 +0200 Subject: [PATCH 37/55] add patch purge finalizer flags --- .../apply-test-specific-patches/action.yaml | 25 +++++++++++++++++++ .github/workflows/test-e2e-junk.yaml | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 .github/actions/apply-test-specific-patches/action.yaml diff --git a/.github/actions/apply-test-specific-patches/action.yaml b/.github/actions/apply-test-specific-patches/action.yaml new file mode 100644 index 0000000000..7e6e7b40f3 --- /dev/null +++ b/.github/actions/apply-test-specific-patches/action.yaml @@ -0,0 +1,25 @@ +name: Apply test-specific patches +description: Applies test-specific patches to kustomize. +inputs: + k8s_version: + description: 'The version of Kubernetes to install. For example, 1.28.7.' + required: true +runs: + using: "composite" + steps: + - name: Patch purge finalizer flags + if: ${{ matrix.e2e-test == 'purge-controller' || matrix.e2e-test == 'purge-metrics'}} + working-directory: lifecycle-manager + shell: bash + run: | + pushd config/watcher_local_test + echo \ + "- op: add + path: /spec/template/spec/containers/0/args/- + value: --enable-purge-finalizer=true + - op: add + path: /spec/template/spec/containers/0/args/- + value: --purge-finalizer-timeout=5s" >> purge_finalizer.yaml + cat purge_finalizer.yaml + kustomize edit add patch --path purge_finalizer.yaml --kind Deployment + popd diff --git a/.github/workflows/test-e2e-junk.yaml b/.github/workflows/test-e2e-junk.yaml index 5663d00bf0..0994e0ffe8 100644 --- a/.github/workflows/test-e2e-junk.yaml +++ b/.github/workflows/test-e2e-junk.yaml @@ -58,4 +58,4 @@ jobs: with: k8s_version: ${{ steps.configuration.outputs.k8s_version }} cert_manager_version: ${{ steps.configuration.outputs.cert_manager_version }} - \ No newline at end of file + - uses: ./lifecycle-manager/.github/actions/apply-test-specific-patches From 0f3b62c4a86574802ed2a08225dfe40e7fc2a268 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Tue, 9 Apr 2024 17:21:35 +0200 Subject: [PATCH 38/55] complete patches --- .../apply-test-specific-patches/action.yaml | 74 ++++++++++++++++++- .github/workflows/test-e2e-junk.yaml | 3 + 2 files changed, 75 insertions(+), 2 deletions(-) diff --git a/.github/actions/apply-test-specific-patches/action.yaml b/.github/actions/apply-test-specific-patches/action.yaml index 7e6e7b40f3..f2a0e642d3 100644 --- a/.github/actions/apply-test-specific-patches/action.yaml +++ b/.github/actions/apply-test-specific-patches/action.yaml @@ -1,8 +1,11 @@ name: Apply test-specific patches description: Applies test-specific patches to kustomize. inputs: - k8s_version: - description: 'The version of Kubernetes to install. For example, 1.28.7.' + klm_version_tag: + description: The version tag for the KLM image. For example, PR-123. + required: true + klm_image_repo: + description: The repository for the KLM image. For example, dev. required: true runs: using: "composite" @@ -23,3 +26,70 @@ runs: cat purge_finalizer.yaml kustomize edit add patch --path purge_finalizer.yaml --kind Deployment popd + - name: Patch metrics cleanup interval + if : ${{ matrix.e2e-test == 'kyma-metrics' }} + working-directory: lifecycle-manager + shell: bash + run: | + pushd config/watcher_local_test + echo \ + "- op: add + path: /spec/template/spec/containers/0/args/- + value: --metrics-cleanup-interval=1" >> metrics_cleanup.yaml + cat metrics_cleanup.yaml + kustomize edit add patch --path metrics_cleanup.yaml --kind Deployment + popd + - name: Patch self signed certificate lifetime + if: ${{matrix.e2e-test == 'self-signed-certificate-rotation'}} + working-directory: lifecycle-manager + shell: bash + run: | + pushd config/watcher_local_test + echo \ + "- op: add + path: /spec/template/spec/containers/0/args/- + value: --self-signed-cert-duration=1h + - op: add + path: /spec/template/spec/containers/0/args/- + value: --self-signed-cert-renew-before=59m + - op: add + path: /spec/template/spec/containers/0/args/- + value: --self-signed-cert-renew-buffer=1m" >> self-signed-cert.yaml + cat self-signed-cert.yaml + kustomize edit add patch --path self-signed-cert.yaml --kind Deployment + popd + - name: Patch CA certificate renewBefore + if: ${{matrix.e2e-test == 'ca-certificate-rotation'}} + working-directory: lifecycle-manager + shell: bash + run: | + pushd config/watcher_local_test + echo \ + "- op: replace + path: /spec/renewBefore + value: 59m + - op: replace + path: /spec/duration + value: 1h">> certificate_renewal.yaml + cat certificate_renewal.yaml + kustomize edit add patch --path certificate_renewal.yaml --kind Certificate --group cert-manager.io --version v1 --name watcher-serving-cert + popd + - name: Deploy LM local testing kustomize + working-directory: lifecycle-manager + shell: bash + run: | + maxRetry=5 + for retry in $(seq 1 $maxRetry) + do + if make local-deploy-with-watcher IMG=europe-docker.pkg.dev/kyma-project/${{ inputs.klm_image_repo }}/lifecycle-manager:${{ inputs.klm_version_tag }}; then + kubectl wait pods -n kcp-system -l app.kubernetes.io/name=lifecycle-manager --for condition=Ready --timeout=90s + echo "KLM deployed successfully" + exit 0 + elif [[ $retry -lt $maxRetry ]]; then + echo "Deploy encountered some error, will retry after 20 seconds" + sleep 20 + else + echo "KLM deployment failed" + exit 1 + fi + done \ No newline at end of file diff --git a/.github/workflows/test-e2e-junk.yaml b/.github/workflows/test-e2e-junk.yaml index 0994e0ffe8..7170b95190 100644 --- a/.github/workflows/test-e2e-junk.yaml +++ b/.github/workflows/test-e2e-junk.yaml @@ -59,3 +59,6 @@ jobs: k8s_version: ${{ steps.configuration.outputs.k8s_version }} cert_manager_version: ${{ steps.configuration.outputs.cert_manager_version }} - uses: ./lifecycle-manager/.github/actions/apply-test-specific-patches + with: + klm_version_tag: ${{ steps.configuration.outputs.klm_version_tag }} + klm_image_repo: ${{ steps.configuration.outputs.klm_image_repo }} From 9e3c4dfcf711f19be7eb5e78d19b10bd985c279e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Tue, 9 Apr 2024 17:27:29 +0200 Subject: [PATCH 39/55] rename step --- .../action.yaml | 6 +++--- .github/workflows/test-e2e-junk.yaml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) rename .github/actions/{apply-test-specific-patches => deploy-lifecycle-manager}/action.yaml (96%) diff --git a/.github/actions/apply-test-specific-patches/action.yaml b/.github/actions/deploy-lifecycle-manager/action.yaml similarity index 96% rename from .github/actions/apply-test-specific-patches/action.yaml rename to .github/actions/deploy-lifecycle-manager/action.yaml index f2a0e642d3..031a538145 100644 --- a/.github/actions/apply-test-specific-patches/action.yaml +++ b/.github/actions/deploy-lifecycle-manager/action.yaml @@ -1,5 +1,5 @@ -name: Apply test-specific patches -description: Applies test-specific patches to kustomize. +name: Deploy lifecycle-manager +description: Applies test-specific patches to the lifecycle-manager kustomize and deploys it. inputs: klm_version_tag: description: The version tag for the KLM image. For example, PR-123. @@ -92,4 +92,4 @@ runs: echo "KLM deployment failed" exit 1 fi - done \ No newline at end of file + done diff --git a/.github/workflows/test-e2e-junk.yaml b/.github/workflows/test-e2e-junk.yaml index 7170b95190..9e190c2eb0 100644 --- a/.github/workflows/test-e2e-junk.yaml +++ b/.github/workflows/test-e2e-junk.yaml @@ -58,7 +58,7 @@ jobs: with: k8s_version: ${{ steps.configuration.outputs.k8s_version }} cert_manager_version: ${{ steps.configuration.outputs.cert_manager_version }} - - uses: ./lifecycle-manager/.github/actions/apply-test-specific-patches + - uses: ./lifecycle-manager/.github/actions/deploy-lifecycle-manager with: klm_version_tag: ${{ steps.configuration.outputs.klm_version_tag }} klm_image_repo: ${{ steps.configuration.outputs.klm_image_repo }} From 66b18d88cf2c925dd3df3ef2bc8c8623ea86567d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Tue, 9 Apr 2024 17:28:00 +0200 Subject: [PATCH 40/55] add checkout template-operator --- .github/workflows/test-e2e-junk.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/test-e2e-junk.yaml b/.github/workflows/test-e2e-junk.yaml index 9e190c2eb0..c9d459d9cf 100644 --- a/.github/workflows/test-e2e-junk.yaml +++ b/.github/workflows/test-e2e-junk.yaml @@ -45,6 +45,11 @@ jobs: uses: actions/checkout@v4 with: path: lifecycle-manager + - name: Checkout template-operator + uses: actions/checkout@v4 + with: + repository: kyma-project/template-operator + path: template-operator - uses: ./lifecycle-manager/.github/actions/get-configuration id: configuration - uses: ./lifecycle-manager/.github/actions/setup-tools From 90ac58ac7bfa37f2e4091404aba63a9b14dcf5cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Tue, 9 Apr 2024 17:34:58 +0200 Subject: [PATCH 41/55] add deploy template operator --- .../deploy-template-operator/action.yaml | 93 +++++++++++++++++++ .github/workflows/test-e2e-junk.yaml | 1 + 2 files changed, 94 insertions(+) create mode 100644 .github/actions/deploy-template-operator/action.yaml diff --git a/.github/actions/deploy-template-operator/action.yaml b/.github/actions/deploy-template-operator/action.yaml new file mode 100644 index 0000000000..2ed12e1733 --- /dev/null +++ b/.github/actions/deploy-template-operator/action.yaml @@ -0,0 +1,93 @@ +name: Deploy template-operator +description: Deploys a test-specific template-operator. +runs: + using: "composite" + steps: + - name: Create Template Operator Module and apply + working-directory: template-operator + if: ${{ matrix.e2e-test == 'kyma-metrics' || + matrix.e2e-test == 'non-blocking-deletion' || + matrix.e2e-test == 'purge-controller' || + matrix.e2e-test == 'purge-metrics' || + matrix.e2e-test == 'kyma-deprovision-with-foreground-propagation' || + matrix.e2e-test == 'kyma-deprovision-with-background-propagation' || + matrix.e2e-test == 'module-consistency' || + matrix.e2e-test == 'skip-manifest-reconciliation' || + matrix.e2e-test == 'misconfigured-kyma-secret' + }} + shell: bash + run: | + make build-manifests + kyma alpha create module --module-config-file ./module-config.yaml --path . --registry k3d-kcp-registry:5111 --insecure + sed -i 's/k3d-kcp-registry:5111/k3d-kcp-registry:5000/g' ./template.yaml + kubectl config use-context k3d-kcp + kubectl get crds + kubectl apply -f template.yaml + - name: Create Template Operator Module for regular and fast channels + working-directory: lifecycle-manager + if: ${{ matrix.e2e-test == 'module-upgrade-channel-switch' || + matrix.e2e-test == 'module-upgrade-new-version' || + matrix.e2e-test == 'upgrade-under-deletion' + }} + shell: bash + run: | + kubectl apply -f tests/moduletemplates/moduletemplate_template_operator_v2_fast.yaml + kubectl apply -f tests/moduletemplates/moduletemplate_template_operator_v1_regular.yaml + - name: Create Template Operator Module as Mandatory Module + working-directory: lifecycle-manager + if: ${{ matrix.e2e-test == 'mandatory-module' || + matrix.e2e-test == 'mandatory-module-metrics' + }} + shell: bash + run: | + kubectl apply -f tests/moduletemplates/mandatory_moduletemplate_template_operator_v1.yaml + - name: Apply Template Operator Module V2, fast channel + working-directory: ./lifecycle-manager + if: ${{ matrix.e2e-test == 'non-blocking-deletion' }} + shell: bash + run: | + kubectl apply -f tests/moduletemplates/moduletemplate_template_operator_v2_fast.yaml + - name: Create Template Operator Module with final state and final deletion state as `Warning` and apply + working-directory: template-operator + if: ${{ matrix.e2e-test == 'module-status-propagation'}} + shell: bash + run: | + pushd config/default + echo \ + "- op: replace + path: /spec/template/spec/containers/0/args/1 + value: --final-state=Warning + - op: replace + path: /spec/template/spec/containers/0/args/2 + value: --final-deletion-state=Warning" >> warning_patch.yaml + cat warning_patch.yaml + kustomize edit add patch --path warning_patch.yaml --kind Deployment + popd + kyma alpha create module --kubebuilder-project --channel=regular --name kyma.project.io/module/template-operator --version 1.1.1 --path . --registry k3d-kcp-registry:5111 --insecure --module-archive-version-overwrite / + sed -i 's/k3d-kcp-registry:5111/k3d-kcp-registry:5000/g' ./template.yaml + kubectl config use-context k3d-kcp + kubectl get crds + kubectl apply -f template.yaml + - name: Create Template Operator Module without default CR and apply + working-directory: template-operator + if: ${{ matrix.e2e-test == 'module-without-default-cr' }} + shell: bash + run: | + make build-manifests + echo "name: kyma-project.io/module/template-operator + channel: regular + version: v1.0.0 + manifest: template-operator.yaml + security: sec-scanners-config.yaml + annotations: + operator.kyma-project.io/doc-url: https://kyma-project.io" >> module-config-no-cr.yaml + kyma alpha create module \ + --module-config-file ./module-config-no-cr.yaml \ + --path . \ + --registry k3d-kcp-registry:5111 \ + --insecure + sed -i 's/k3d-kcp-registry:5111/k3d-kcp-registry:5000/g' ./template.yaml + kubectl config use-context k3d-kcp + kubectl get crds + kubectl apply -f template.yaml + diff --git a/.github/workflows/test-e2e-junk.yaml b/.github/workflows/test-e2e-junk.yaml index c9d459d9cf..74ba71f5ea 100644 --- a/.github/workflows/test-e2e-junk.yaml +++ b/.github/workflows/test-e2e-junk.yaml @@ -67,3 +67,4 @@ jobs: with: klm_version_tag: ${{ steps.configuration.outputs.klm_version_tag }} klm_image_repo: ${{ steps.configuration.outputs.klm_image_repo }} + - uses: ./lifecycle-manager/.github/actions/deploy-template-operator From 6547373062c79eb3c7aad05254dff1f538ece046 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Tue, 9 Apr 2024 17:39:57 +0200 Subject: [PATCH 42/55] add expose metrics endpiont --- .github/actions/deploy-lifecycle-manager/action.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/actions/deploy-lifecycle-manager/action.yaml b/.github/actions/deploy-lifecycle-manager/action.yaml index 031a538145..f35617ed82 100644 --- a/.github/actions/deploy-lifecycle-manager/action.yaml +++ b/.github/actions/deploy-lifecycle-manager/action.yaml @@ -93,3 +93,13 @@ runs: exit 1 fi done + - name: Expose Metrics Endpoint + working-directory: lifecycle-manager + if: ${{ matrix.e2e-test == 'kyma-metrics' || + matrix.e2e-test == 'purge-metrics' || + matrix.e2e-test == 'self-signed-certificate-rotation' || + matrix.e2e-test == 'mandatory-module-metrics' + }} + shell: bash + run: | + kubectl patch svc klm-metrics-service -p '{"spec": {"type": "LoadBalancer"}}' -n kcp-system From 1e9f894f0c24bd5aee597e41680476aaf1272d6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Tue, 9 Apr 2024 17:45:13 +0200 Subject: [PATCH 43/55] re-enable image build; add execution of e2e tests --- .github/workflows/test-e2e-junk.yaml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test-e2e-junk.yaml b/.github/workflows/test-e2e-junk.yaml index 74ba71f5ea..48d593f91e 100644 --- a/.github/workflows/test-e2e-junk.yaml +++ b/.github/workflows/test-e2e-junk.yaml @@ -6,13 +6,11 @@ jobs: wait-for-image-build: runs-on: ubuntu-latest steps: - - run: | - echo Done... - # - uses: actions/checkout@v4 - # - uses: ./.github/actions/wait-for-image-build - # with: - # token: ${{ secrets.GITHUB_TOKEN }} - # statusName: ${{ (github.event_name == 'pull_request') && 'pull-lifecycle-mgr-build' || 'main-lifecycle-mgr-build' }} + - uses: actions/checkout@v4 + - uses: ./.github/actions/wait-for-image-build + with: + token: ${{ secrets.GITHUB_TOKEN }} + statusName: ${{ (github.event_name == 'pull_request') && 'pull-lifecycle-mgr-build' || 'main-lifecycle-mgr-build' }} e2e-integration: name: "E2E Tests" needs: wait-for-image-build @@ -40,6 +38,8 @@ jobs: - "misconfigured-kyma-secret" runs-on: ubuntu-latest timeout-minutes: 20 + env: + GOSUMDB: off steps: - name: Checkout lifecycle-manager uses: actions/checkout@v4 @@ -68,3 +68,7 @@ jobs: klm_version_tag: ${{ steps.configuration.outputs.klm_version_tag }} klm_image_repo: ${{ steps.configuration.outputs.klm_image_repo }} - uses: ./lifecycle-manager/.github/actions/deploy-template-operator + - name: Run ${{ matrix.e2e-test }} + working-directory: lifecycle-manager + run: | + make -C tests/e2e ${{ matrix.e2e-test }} From d28e1008a3796a19ad6d876e47e26ea17a04fa4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Tue, 9 Apr 2024 17:59:49 +0200 Subject: [PATCH 44/55] add names --- .github/workflows/test-e2e-junk.yaml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-e2e-junk.yaml b/.github/workflows/test-e2e-junk.yaml index 48d593f91e..8c1b4ef4dc 100644 --- a/.github/workflows/test-e2e-junk.yaml +++ b/.github/workflows/test-e2e-junk.yaml @@ -1,9 +1,12 @@ +name: TestSuite E2E Junk + on: pull_request: branches: [ "main" ] jobs: wait-for-image-build: + name: "Wait for image build" runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -51,8 +54,10 @@ jobs: repository: kyma-project/template-operator path: template-operator - uses: ./lifecycle-manager/.github/actions/get-configuration + name: Get configuration id: configuration - uses: ./lifecycle-manager/.github/actions/setup-tools + name: Setup tools with: k8s_version: ${{ steps.configuration.outputs.k8s_version }} istio_version: ${{ steps.configuration.outputs.istio_version }} @@ -60,15 +65,17 @@ jobs: go-version-file: lifecycle-manager/go.mod cache-dependency-path: lifecycle-manager/go.sum - uses: ./lifecycle-manager/.github/actions/setup-test-clusters + name: Setup test clusters with: k8s_version: ${{ steps.configuration.outputs.k8s_version }} cert_manager_version: ${{ steps.configuration.outputs.cert_manager_version }} - uses: ./lifecycle-manager/.github/actions/deploy-lifecycle-manager + name: Deploy lifecycle-manager with: klm_version_tag: ${{ steps.configuration.outputs.klm_version_tag }} klm_image_repo: ${{ steps.configuration.outputs.klm_image_repo }} - uses: ./lifecycle-manager/.github/actions/deploy-template-operator - - name: Run ${{ matrix.e2e-test }} + - name: Run '${{ matrix.e2e-test }}' test working-directory: lifecycle-manager run: | make -C tests/e2e ${{ matrix.e2e-test }} From 5b662dbd144bbb22979471f9e19eb97dde9a426d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Tue, 9 Apr 2024 18:00:50 +0200 Subject: [PATCH 45/55] remove obsolete image build status name --- .github/workflows/test-e2e-junk.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-e2e-junk.yaml b/.github/workflows/test-e2e-junk.yaml index 8c1b4ef4dc..9e0d42172f 100644 --- a/.github/workflows/test-e2e-junk.yaml +++ b/.github/workflows/test-e2e-junk.yaml @@ -13,7 +13,7 @@ jobs: - uses: ./.github/actions/wait-for-image-build with: token: ${{ secrets.GITHUB_TOKEN }} - statusName: ${{ (github.event_name == 'pull_request') && 'pull-lifecycle-mgr-build' || 'main-lifecycle-mgr-build' }} + statusName: pull-lifecycle-mgr-build e2e-integration: name: "E2E Tests" needs: wait-for-image-build From 11a37d20da3f7431cc90b577b9e6acba68abab09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Tue, 9 Apr 2024 18:02:46 +0200 Subject: [PATCH 46/55] pretifying --- .github/workflows/test-e2e-junk.yaml | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test-e2e-junk.yaml b/.github/workflows/test-e2e-junk.yaml index 9e0d42172f..d3b0ef26b7 100644 --- a/.github/workflows/test-e2e-junk.yaml +++ b/.github/workflows/test-e2e-junk.yaml @@ -48,33 +48,41 @@ jobs: uses: actions/checkout@v4 with: path: lifecycle-manager + - name: Checkout template-operator uses: actions/checkout@v4 with: repository: kyma-project/template-operator path: template-operator - - uses: ./lifecycle-manager/.github/actions/get-configuration - name: Get configuration + + - name: Get configuration + uses: ./lifecycle-manager/.github/actions/get-configuration id: configuration - - uses: ./lifecycle-manager/.github/actions/setup-tools - name: Setup tools + + - name: Setup tools + uses: ./lifecycle-manager/.github/actions/setup-tools with: k8s_version: ${{ steps.configuration.outputs.k8s_version }} istio_version: ${{ steps.configuration.outputs.istio_version }} k3d_version: ${{ steps.configuration.outputs.k3d_version }} go-version-file: lifecycle-manager/go.mod cache-dependency-path: lifecycle-manager/go.sum - - uses: ./lifecycle-manager/.github/actions/setup-test-clusters - name: Setup test clusters + + - name: Setup test clusters + uses: ./lifecycle-manager/.github/actions/setup-test-clusters with: k8s_version: ${{ steps.configuration.outputs.k8s_version }} cert_manager_version: ${{ steps.configuration.outputs.cert_manager_version }} - - uses: ./lifecycle-manager/.github/actions/deploy-lifecycle-manager - name: Deploy lifecycle-manager + + - name: Deploy lifecycle-manager + uses: ./lifecycle-manager/.github/actions/deploy-lifecycle-manager with: klm_version_tag: ${{ steps.configuration.outputs.klm_version_tag }} klm_image_repo: ${{ steps.configuration.outputs.klm_image_repo }} - - uses: ./lifecycle-manager/.github/actions/deploy-template-operator + + - name: Deploy template-operator + uses: ./lifecycle-manager/.github/actions/deploy-template-operator + - name: Run '${{ matrix.e2e-test }}' test working-directory: lifecycle-manager run: | From 2a0c3c773d3c2facb35ccfb13e6002ad557690a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Tue, 9 Apr 2024 18:04:08 +0200 Subject: [PATCH 47/55] re-add workflow dispatch trigger --- .github/workflows/test-e2e-junk.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/test-e2e-junk.yaml b/.github/workflows/test-e2e-junk.yaml index d3b0ef26b7..e74f65d6d1 100644 --- a/.github/workflows/test-e2e-junk.yaml +++ b/.github/workflows/test-e2e-junk.yaml @@ -3,6 +3,11 @@ name: TestSuite E2E Junk on: pull_request: branches: [ "main" ] + workflow_dispatch: + inputs: + k8s_version: + description: "With Kubernetes version" + required: false jobs: wait-for-image-build: From 700df8ffa7ec31c6cae56a3d5666ba42d4a09999 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Tue, 9 Apr 2024 18:22:04 +0200 Subject: [PATCH 48/55] outsorce gosumdb to get configuratin --- .github/actions/get-configuration/action.yaml | 6 +++++- .github/workflows/test-e2e-junk.yaml | 2 -- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/actions/get-configuration/action.yaml b/.github/actions/get-configuration/action.yaml index 24d6b587e2..4fefcc1aec 100644 --- a/.github/actions/get-configuration/action.yaml +++ b/.github/actions/get-configuration/action.yaml @@ -1,5 +1,5 @@ name: Get configuration -description: Defines configuration variables such as versions. +description: Defines configuration variables such as versions. Exposes globally needed environment variables. outputs: k8s_version: description: The version of k8s to use. For example, 1.28.7. @@ -32,3 +32,7 @@ runs: echo "cert_manager_version=1.13.3" >> $GITHUB_OUTPUT echo "klm_version_tag=PR-${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT echo "klm_image_repo=dev" >> $GITHUB_OUTPUT + - name: Expose environment variables + shell: bash + run: | + echo "GOSUMDB=off" >> $GITHUB_ENV diff --git a/.github/workflows/test-e2e-junk.yaml b/.github/workflows/test-e2e-junk.yaml index e74f65d6d1..67f243b472 100644 --- a/.github/workflows/test-e2e-junk.yaml +++ b/.github/workflows/test-e2e-junk.yaml @@ -46,8 +46,6 @@ jobs: - "misconfigured-kyma-secret" runs-on: ubuntu-latest timeout-minutes: 20 - env: - GOSUMDB: off steps: - name: Checkout lifecycle-manager uses: actions/checkout@v4 From c2b38b60d7f1e1f8d918082130ede581b0b85d5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Tue, 9 Apr 2024 18:31:45 +0200 Subject: [PATCH 49/55] split deploy lifecycle-manager --- .../deploy-lifecycle-manager-e2e/action.yaml | 91 +++++++++++++++++++ .../deploy-lifecycle-manager/action.yaml | 76 +--------------- .github/workflows/test-e2e-junk.yaml | 2 +- 3 files changed, 93 insertions(+), 76 deletions(-) create mode 100644 .github/actions/deploy-lifecycle-manager-e2e/action.yaml diff --git a/.github/actions/deploy-lifecycle-manager-e2e/action.yaml b/.github/actions/deploy-lifecycle-manager-e2e/action.yaml new file mode 100644 index 0000000000..1fff090ba6 --- /dev/null +++ b/.github/actions/deploy-lifecycle-manager-e2e/action.yaml @@ -0,0 +1,91 @@ +name: Deploy lifecycle-manager E2E +description: Applies E2E test-specific patches to the lifecycle-manager kustomize and deploys it. +inputs: + klm_version_tag: + description: The version tag for the KLM image. For example, PR-123. + required: true + klm_image_repo: + description: The repository for the KLM image. For example, dev. + required: true +runs: + using: "composite" + steps: + - name: Patch purge finalizer flags + if: ${{ matrix.e2e-test == 'purge-controller' || matrix.e2e-test == 'purge-metrics'}} + working-directory: lifecycle-manager + shell: bash + run: | + pushd config/watcher_local_test + echo \ + "- op: add + path: /spec/template/spec/containers/0/args/- + value: --enable-purge-finalizer=true + - op: add + path: /spec/template/spec/containers/0/args/- + value: --purge-finalizer-timeout=5s" >> purge_finalizer.yaml + cat purge_finalizer.yaml + kustomize edit add patch --path purge_finalizer.yaml --kind Deployment + popd + - name: Patch metrics cleanup interval + if : ${{ matrix.e2e-test == 'kyma-metrics' }} + working-directory: lifecycle-manager + shell: bash + run: | + pushd config/watcher_local_test + echo \ + "- op: add + path: /spec/template/spec/containers/0/args/- + value: --metrics-cleanup-interval=1" >> metrics_cleanup.yaml + cat metrics_cleanup.yaml + kustomize edit add patch --path metrics_cleanup.yaml --kind Deployment + popd + - name: Patch self signed certificate lifetime + if: ${{matrix.e2e-test == 'self-signed-certificate-rotation'}} + working-directory: lifecycle-manager + shell: bash + run: | + pushd config/watcher_local_test + echo \ + "- op: add + path: /spec/template/spec/containers/0/args/- + value: --self-signed-cert-duration=1h + - op: add + path: /spec/template/spec/containers/0/args/- + value: --self-signed-cert-renew-before=59m + - op: add + path: /spec/template/spec/containers/0/args/- + value: --self-signed-cert-renew-buffer=1m" >> self-signed-cert.yaml + cat self-signed-cert.yaml + kustomize edit add patch --path self-signed-cert.yaml --kind Deployment + popd + - name: Patch CA certificate renewBefore + if: ${{matrix.e2e-test == 'ca-certificate-rotation'}} + working-directory: lifecycle-manager + shell: bash + run: | + pushd config/watcher_local_test + echo \ + "- op: replace + path: /spec/renewBefore + value: 59m + - op: replace + path: /spec/duration + value: 1h">> certificate_renewal.yaml + cat certificate_renewal.yaml + kustomize edit add patch --path certificate_renewal.yaml --kind Certificate --group cert-manager.io --version v1 --name watcher-serving-cert + popd + - name: Deploy LM local testing kustomize + uses: ./lifecycle-manager/.github/actions/deploy-lifecycle-manager + with: + klm_version_tag: ${{ inputs.klm_version_tag }} + klm_image_repo: ${{ inputs.klm_image_repo }} + - name: Expose Metrics Endpoint + working-directory: lifecycle-manager + if: ${{ matrix.e2e-test == 'kyma-metrics' || + matrix.e2e-test == 'purge-metrics' || + matrix.e2e-test == 'self-signed-certificate-rotation' || + matrix.e2e-test == 'mandatory-module-metrics' + }} + shell: bash + run: | + kubectl patch svc klm-metrics-service -p '{"spec": {"type": "LoadBalancer"}}' -n kcp-system diff --git a/.github/actions/deploy-lifecycle-manager/action.yaml b/.github/actions/deploy-lifecycle-manager/action.yaml index f35617ed82..81300dfc56 100644 --- a/.github/actions/deploy-lifecycle-manager/action.yaml +++ b/.github/actions/deploy-lifecycle-manager/action.yaml @@ -1,5 +1,5 @@ name: Deploy lifecycle-manager -description: Applies test-specific patches to the lifecycle-manager kustomize and deploys it. +description: Deploys lifecycle-manager. inputs: klm_version_tag: description: The version tag for the KLM image. For example, PR-123. @@ -10,70 +10,6 @@ inputs: runs: using: "composite" steps: - - name: Patch purge finalizer flags - if: ${{ matrix.e2e-test == 'purge-controller' || matrix.e2e-test == 'purge-metrics'}} - working-directory: lifecycle-manager - shell: bash - run: | - pushd config/watcher_local_test - echo \ - "- op: add - path: /spec/template/spec/containers/0/args/- - value: --enable-purge-finalizer=true - - op: add - path: /spec/template/spec/containers/0/args/- - value: --purge-finalizer-timeout=5s" >> purge_finalizer.yaml - cat purge_finalizer.yaml - kustomize edit add patch --path purge_finalizer.yaml --kind Deployment - popd - - name: Patch metrics cleanup interval - if : ${{ matrix.e2e-test == 'kyma-metrics' }} - working-directory: lifecycle-manager - shell: bash - run: | - pushd config/watcher_local_test - echo \ - "- op: add - path: /spec/template/spec/containers/0/args/- - value: --metrics-cleanup-interval=1" >> metrics_cleanup.yaml - cat metrics_cleanup.yaml - kustomize edit add patch --path metrics_cleanup.yaml --kind Deployment - popd - - name: Patch self signed certificate lifetime - if: ${{matrix.e2e-test == 'self-signed-certificate-rotation'}} - working-directory: lifecycle-manager - shell: bash - run: | - pushd config/watcher_local_test - echo \ - "- op: add - path: /spec/template/spec/containers/0/args/- - value: --self-signed-cert-duration=1h - - op: add - path: /spec/template/spec/containers/0/args/- - value: --self-signed-cert-renew-before=59m - - op: add - path: /spec/template/spec/containers/0/args/- - value: --self-signed-cert-renew-buffer=1m" >> self-signed-cert.yaml - cat self-signed-cert.yaml - kustomize edit add patch --path self-signed-cert.yaml --kind Deployment - popd - - name: Patch CA certificate renewBefore - if: ${{matrix.e2e-test == 'ca-certificate-rotation'}} - working-directory: lifecycle-manager - shell: bash - run: | - pushd config/watcher_local_test - echo \ - "- op: replace - path: /spec/renewBefore - value: 59m - - op: replace - path: /spec/duration - value: 1h">> certificate_renewal.yaml - cat certificate_renewal.yaml - kustomize edit add patch --path certificate_renewal.yaml --kind Certificate --group cert-manager.io --version v1 --name watcher-serving-cert - popd - name: Deploy LM local testing kustomize working-directory: lifecycle-manager shell: bash @@ -93,13 +29,3 @@ runs: exit 1 fi done - - name: Expose Metrics Endpoint - working-directory: lifecycle-manager - if: ${{ matrix.e2e-test == 'kyma-metrics' || - matrix.e2e-test == 'purge-metrics' || - matrix.e2e-test == 'self-signed-certificate-rotation' || - matrix.e2e-test == 'mandatory-module-metrics' - }} - shell: bash - run: | - kubectl patch svc klm-metrics-service -p '{"spec": {"type": "LoadBalancer"}}' -n kcp-system diff --git a/.github/workflows/test-e2e-junk.yaml b/.github/workflows/test-e2e-junk.yaml index 67f243b472..764c7c873b 100644 --- a/.github/workflows/test-e2e-junk.yaml +++ b/.github/workflows/test-e2e-junk.yaml @@ -78,7 +78,7 @@ jobs: cert_manager_version: ${{ steps.configuration.outputs.cert_manager_version }} - name: Deploy lifecycle-manager - uses: ./lifecycle-manager/.github/actions/deploy-lifecycle-manager + uses: ./lifecycle-manager/.github/actions/deploy-lifecycle-manager-e2e with: klm_version_tag: ${{ steps.configuration.outputs.klm_version_tag }} klm_image_repo: ${{ steps.configuration.outputs.klm_image_repo }} From 66be3bd7c3873a466b4a9d01b94918240967275a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Wed, 10 Apr 2024 08:38:56 +0200 Subject: [PATCH 50/55] pretifying --- .github/actions/configure-hosts/action.yaml | 2 +- .github/actions/create-k3d-cluster/action.yaml | 2 +- .github/actions/deploy-cert-manager/action.yaml | 4 ++-- .github/actions/deploy-istio/action.yaml | 2 +- .github/actions/deploy-lifecycle-manager-e2e/action.yaml | 2 +- .github/actions/deploy-lifecycle-manager/action.yaml | 2 +- .github/actions/deploy-template-operator/action.yaml | 2 +- .github/actions/export-kubeconfigs/action.yaml | 2 +- .github/actions/get-configuration/action.yaml | 2 +- .github/actions/install-cmctl/action.yaml | 2 +- .github/actions/install-istioctl/action.yaml | 4 ++-- .github/actions/install-k3d/action.yaml | 4 ++-- .github/actions/install-kubectl/action.yaml | 4 ++-- .github/actions/install-kyma-cli/action.yaml | 2 +- .github/actions/setup-test-clusters/action.yaml | 2 +- .github/actions/setup-tools/action.yaml | 8 ++++---- .github/actions/switch-kubectl-context/action.yaml | 2 +- .github/actions/wait-for-image-build/action.yaml | 2 +- 18 files changed, 25 insertions(+), 25 deletions(-) diff --git a/.github/actions/configure-hosts/action.yaml b/.github/actions/configure-hosts/action.yaml index c6cacda829..c7f478a94c 100644 --- a/.github/actions/configure-hosts/action.yaml +++ b/.github/actions/configure-hosts/action.yaml @@ -1,7 +1,7 @@ name: Configure hosts description: Introduces an entry to the /etc/hosts file resolving k3d-kcp-registry to localhost. runs: - using: "composite" + using: composite steps: - name: Configure hosts shell: bash diff --git a/.github/actions/create-k3d-cluster/action.yaml b/.github/actions/create-k3d-cluster/action.yaml index d5c2f3d6ca..58e814e8c8 100644 --- a/.github/actions/create-k3d-cluster/action.yaml +++ b/.github/actions/create-k3d-cluster/action.yaml @@ -11,7 +11,7 @@ inputs: description: Additional arguments to pass to the k3d cluster create command separated by semicolon (;). required: false runs: - using: "composite" + using: composite steps: - name: Create k3d cluster shell: bash diff --git a/.github/actions/deploy-cert-manager/action.yaml b/.github/actions/deploy-cert-manager/action.yaml index 171d051fff..41c4447a84 100644 --- a/.github/actions/deploy-cert-manager/action.yaml +++ b/.github/actions/deploy-cert-manager/action.yaml @@ -2,10 +2,10 @@ name: Deploy cert-manager description: Deploys cert-manager in the currently configured context. inputs: cert_manager_version: - description: 'The version of cert-manager to depoy. For example, 1.13.3.' + description: The version of cert-manager to depoy. For example, 1.13.3. required: true runs: - using: "composite" + using: composite steps: - name: Deploy cert-manager shell: bash diff --git a/.github/actions/deploy-istio/action.yaml b/.github/actions/deploy-istio/action.yaml index d62fe2f41c..c1359f8c89 100644 --- a/.github/actions/deploy-istio/action.yaml +++ b/.github/actions/deploy-istio/action.yaml @@ -1,7 +1,7 @@ name: Deploy istio description: Deploys istio in the currently configured context. runs: - using: "composite" + using: composite steps: - name: Deploy istio shell: bash diff --git a/.github/actions/deploy-lifecycle-manager-e2e/action.yaml b/.github/actions/deploy-lifecycle-manager-e2e/action.yaml index 1fff090ba6..8e65400435 100644 --- a/.github/actions/deploy-lifecycle-manager-e2e/action.yaml +++ b/.github/actions/deploy-lifecycle-manager-e2e/action.yaml @@ -8,7 +8,7 @@ inputs: description: The repository for the KLM image. For example, dev. required: true runs: - using: "composite" + using: composite steps: - name: Patch purge finalizer flags if: ${{ matrix.e2e-test == 'purge-controller' || matrix.e2e-test == 'purge-metrics'}} diff --git a/.github/actions/deploy-lifecycle-manager/action.yaml b/.github/actions/deploy-lifecycle-manager/action.yaml index 81300dfc56..2587d68d5b 100644 --- a/.github/actions/deploy-lifecycle-manager/action.yaml +++ b/.github/actions/deploy-lifecycle-manager/action.yaml @@ -8,7 +8,7 @@ inputs: description: The repository for the KLM image. For example, dev. required: true runs: - using: "composite" + using: composite steps: - name: Deploy LM local testing kustomize working-directory: lifecycle-manager diff --git a/.github/actions/deploy-template-operator/action.yaml b/.github/actions/deploy-template-operator/action.yaml index 2ed12e1733..d7330980fb 100644 --- a/.github/actions/deploy-template-operator/action.yaml +++ b/.github/actions/deploy-template-operator/action.yaml @@ -1,7 +1,7 @@ name: Deploy template-operator description: Deploys a test-specific template-operator. runs: - using: "composite" + using: composite steps: - name: Create Template Operator Module and apply working-directory: template-operator diff --git a/.github/actions/export-kubeconfigs/action.yaml b/.github/actions/export-kubeconfigs/action.yaml index 36573f835f..d5a598cfc5 100644 --- a/.github/actions/export-kubeconfigs/action.yaml +++ b/.github/actions/export-kubeconfigs/action.yaml @@ -5,7 +5,7 @@ inputs: description: The name of the context to use. required: true runs: - using: "composite" + using: composite steps: - name: Export kubeconfigs shell: bash diff --git a/.github/actions/get-configuration/action.yaml b/.github/actions/get-configuration/action.yaml index 4fefcc1aec..f91d5db4ed 100644 --- a/.github/actions/get-configuration/action.yaml +++ b/.github/actions/get-configuration/action.yaml @@ -20,7 +20,7 @@ outputs: description: The repository for the KLM image. For example, dev. value: ${{ steps.define-variables.outputs.klm_image_repo }} runs: - using: "composite" + using: composite steps: - name: Define variables id: define-variables diff --git a/.github/actions/install-cmctl/action.yaml b/.github/actions/install-cmctl/action.yaml index 2c45cc2fab..1c83e91bb8 100644 --- a/.github/actions/install-cmctl/action.yaml +++ b/.github/actions/install-cmctl/action.yaml @@ -1,7 +1,7 @@ name: Install cmctl description: Downloads cmctl (cert-manager Command Line Tool) and installs it locally. runs: - using: "composite" + using: composite steps: - name: Install cmctl shell: bash diff --git a/.github/actions/install-istioctl/action.yaml b/.github/actions/install-istioctl/action.yaml index 328f2c70fb..24dbd52971 100644 --- a/.github/actions/install-istioctl/action.yaml +++ b/.github/actions/install-istioctl/action.yaml @@ -2,10 +2,10 @@ name: Install istioctl description: Downloads istioctl and installs it locally. inputs: istio_version: - description: 'The version of istioctl to install. For example, 1.20.3.' + description: The version of istioctl to install. For example, 1.20.3. required: true runs: - using: "composite" + using: composite steps: - name: Install istioctl shell: bash diff --git a/.github/actions/install-k3d/action.yaml b/.github/actions/install-k3d/action.yaml index 8d18220c90..b7aacf6df2 100644 --- a/.github/actions/install-k3d/action.yaml +++ b/.github/actions/install-k3d/action.yaml @@ -2,10 +2,10 @@ name: Install k3d description: Downloads k3d and installs it locally. inputs: k3d_version: - description: 'The version of k3d to install. For example, 5.6.0.' + description: The version of k3d to install. For example, 5.6.0. required: true runs: - using: "composite" + using: composite steps: - name: Install k3d shell: bash diff --git a/.github/actions/install-kubectl/action.yaml b/.github/actions/install-kubectl/action.yaml index 44eec6d5c9..b74b463cfb 100644 --- a/.github/actions/install-kubectl/action.yaml +++ b/.github/actions/install-kubectl/action.yaml @@ -2,10 +2,10 @@ name: Install kubectl description: Downloads kubectl and installs it locally. Follows the instructions for Debian-based distributions at https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/#install-using-native-package-management. inputs: k8s_version: - description: 'The version of Kubernetes to install. For example, 1.28.7.' + description: The version of Kubernetes to install. For example, 1.28.7. required: true runs: - using: "composite" + using: composite steps: - name: Parse K8s minor version id: parse_k8s_minor_version diff --git a/.github/actions/install-kyma-cli/action.yaml b/.github/actions/install-kyma-cli/action.yaml index 9a6abfe6a4..1e2e347155 100644 --- a/.github/actions/install-kyma-cli/action.yaml +++ b/.github/actions/install-kyma-cli/action.yaml @@ -1,7 +1,7 @@ name: Install kyma-cli description: Downloads kyma-cli and installs it locally. runs: - using: "composite" + using: composite steps: - name: Install kyma-cli shell: bash diff --git a/.github/actions/setup-test-clusters/action.yaml b/.github/actions/setup-test-clusters/action.yaml index 08093e0666..47c8106bd9 100644 --- a/.github/actions/setup-test-clusters/action.yaml +++ b/.github/actions/setup-test-clusters/action.yaml @@ -8,7 +8,7 @@ inputs: description: The version of cert-manager to depoy. For example, 1.13.3. required: true runs: - using: "composite" + using: composite steps: - uses: ./lifecycle-manager/.github/actions/configure-hosts - uses: ./lifecycle-manager/.github/actions/create-k3d-cluster diff --git a/.github/actions/setup-tools/action.yaml b/.github/actions/setup-tools/action.yaml index 8e108d1cfa..f9ed2a9a2c 100644 --- a/.github/actions/setup-tools/action.yaml +++ b/.github/actions/setup-tools/action.yaml @@ -2,13 +2,13 @@ name: Setup tools description: Downloads, installs and configures all the tools needed to setup and run the tests. inputs: k8s_version: - description: 'The version of Kubernetes to install. For example, 1.28.7.' + description: The version of Kubernetes to install. For example, 1.28.7. required: true istio_version: - description: 'The version of Istio to install. For example, 1.20.3.' + description: The version of Istio to install. For example, 1.20.3. required: true k3d_version: - description: 'The version of k3d to install. For example, 5.6.0.' + description: The version of k3d to install. For example, 5.6.0. required: true go-version-file: description: The path to the Go version file. @@ -17,7 +17,7 @@ inputs: description: The path to the Go dependency file. required: true runs: - using: "composite" + using: composite steps: - uses: ./lifecycle-manager/.github/actions/install-kubectl with: diff --git a/.github/actions/switch-kubectl-context/action.yaml b/.github/actions/switch-kubectl-context/action.yaml index 71a9d0271f..c173dd74e8 100644 --- a/.github/actions/switch-kubectl-context/action.yaml +++ b/.github/actions/switch-kubectl-context/action.yaml @@ -5,7 +5,7 @@ inputs: description: The name of the context to use. required: true runs: - using: "composite" + using: composite steps: - name: Configure kubectl shell: bash diff --git a/.github/actions/wait-for-image-build/action.yaml b/.github/actions/wait-for-image-build/action.yaml index 8f706ba411..74005f6803 100644 --- a/.github/actions/wait-for-image-build/action.yaml +++ b/.github/actions/wait-for-image-build/action.yaml @@ -16,7 +16,7 @@ inputs: required: false default: "10" runs: - using: "composite" + using: composite steps: - name: Wait for image build id: wait-for-build From 2445fb09cdb4c91b986d1c08f4845f06ad69ac27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Wed, 10 Apr 2024 08:44:57 +0200 Subject: [PATCH 51/55] remove unnecessary kubectl context setting --- .github/actions/deploy-template-operator/action.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/actions/deploy-template-operator/action.yaml b/.github/actions/deploy-template-operator/action.yaml index d7330980fb..a411232416 100644 --- a/.github/actions/deploy-template-operator/action.yaml +++ b/.github/actions/deploy-template-operator/action.yaml @@ -20,7 +20,6 @@ runs: make build-manifests kyma alpha create module --module-config-file ./module-config.yaml --path . --registry k3d-kcp-registry:5111 --insecure sed -i 's/k3d-kcp-registry:5111/k3d-kcp-registry:5000/g' ./template.yaml - kubectl config use-context k3d-kcp kubectl get crds kubectl apply -f template.yaml - name: Create Template Operator Module for regular and fast channels @@ -65,7 +64,6 @@ runs: popd kyma alpha create module --kubebuilder-project --channel=regular --name kyma.project.io/module/template-operator --version 1.1.1 --path . --registry k3d-kcp-registry:5111 --insecure --module-archive-version-overwrite / sed -i 's/k3d-kcp-registry:5111/k3d-kcp-registry:5000/g' ./template.yaml - kubectl config use-context k3d-kcp kubectl get crds kubectl apply -f template.yaml - name: Create Template Operator Module without default CR and apply @@ -87,7 +85,6 @@ runs: --registry k3d-kcp-registry:5111 \ --insecure sed -i 's/k3d-kcp-registry:5111/k3d-kcp-registry:5000/g' ./template.yaml - kubectl config use-context k3d-kcp kubectl get crds kubectl apply -f template.yaml From 1bd1178235a462716ab20f7303805597b4223448 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Wed, 10 Apr 2024 09:08:36 +0200 Subject: [PATCH 52/55] add new rbac-privileges test --- .github/workflows/test-e2e-junk.yaml | 48 +++++++++++++++------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/.github/workflows/test-e2e-junk.yaml b/.github/workflows/test-e2e-junk.yaml index 764c7c873b..80fbea5283 100644 --- a/.github/workflows/test-e2e-junk.yaml +++ b/.github/workflows/test-e2e-junk.yaml @@ -2,16 +2,17 @@ name: TestSuite E2E Junk on: pull_request: - branches: [ "main" ] + branches: + - main workflow_dispatch: inputs: k8s_version: - description: "With Kubernetes version" + description: With Kubernetes version required: false jobs: wait-for-image-build: - name: "Wait for image build" + name: Wait for image build runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -20,30 +21,31 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} statusName: pull-lifecycle-mgr-build e2e-integration: - name: "E2E Tests" + name: E2E Tests needs: wait-for-image-build strategy: matrix: e2e-test: - - "watcher-enqueue" - - "kyma-deprovision-with-foreground-propagation" - - "kyma-deprovision-with-background-propagation" - - "module-status-propagation" - - "kyma-metrics" - - "module-without-default-cr" - - "module-consistency" - - "non-blocking-deletion" - - "upgrade-under-deletion" - - "purge-controller" - - "purge-metrics" - - "module-upgrade-channel-switch" - - "module-upgrade-new-version" - - "skip-manifest-reconciliation" - - "ca-certificate-rotation" - - "self-signed-certificate-rotation" - - "mandatory-module" - - "mandatory-module-metrics" - - "misconfigured-kyma-secret" + - watcher-enqueue + - kyma-deprovision-with-foreground-propagation + - kyma-deprovision-with-background-propagation + - module-status-propagation + - kyma-metrics + - module-without-default-cr + - module-consistency + - non-blocking-deletion + - upgrade-under-deletion + - purge-controller + - purge-metrics + - module-upgrade-channel-switch + - module-upgrade-new-version + - skip-manifest-reconciliation + - ca-certificate-rotation + - self-signed-certificate-rotation + - mandatory-module + - mandatory-module-metrics + - misconfigured-kyma-secret + - rbac-privileges runs-on: ubuntu-latest timeout-minutes: 20 steps: From fe1fce6f66cdf67f94f213dcb992e713140d7240 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Wed, 10 Apr 2024 11:21:14 +0200 Subject: [PATCH 53/55] fix typo --- .github/actions/deploy-cert-manager/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/deploy-cert-manager/action.yaml b/.github/actions/deploy-cert-manager/action.yaml index 41c4447a84..aa1cb7be1d 100644 --- a/.github/actions/deploy-cert-manager/action.yaml +++ b/.github/actions/deploy-cert-manager/action.yaml @@ -2,7 +2,7 @@ name: Deploy cert-manager description: Deploys cert-manager in the currently configured context. inputs: cert_manager_version: - description: The version of cert-manager to depoy. For example, 1.13.3. + description: The version of cert-manager to deploy. For example, 1.13.3. required: true runs: using: composite From a3a9cec6d7d9eef86b5de09c4f0cb2d144a61d35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Wed, 10 Apr 2024 17:25:01 +0200 Subject: [PATCH 54/55] merged new test file into old one --- .../{test-e2e-junk.yaml => test-e2e.yaml} | 2 +- .github/workflows/test-e2e.yml | 324 ------------------ 2 files changed, 1 insertion(+), 325 deletions(-) rename .github/workflows/{test-e2e-junk.yaml => test-e2e.yaml} (99%) delete mode 100644 .github/workflows/test-e2e.yml diff --git a/.github/workflows/test-e2e-junk.yaml b/.github/workflows/test-e2e.yaml similarity index 99% rename from .github/workflows/test-e2e-junk.yaml rename to .github/workflows/test-e2e.yaml index 80fbea5283..de07f41656 100644 --- a/.github/workflows/test-e2e-junk.yaml +++ b/.github/workflows/test-e2e.yaml @@ -1,4 +1,4 @@ -name: TestSuite E2E Junk +name: TestSuite E2E on: pull_request: diff --git a/.github/workflows/test-e2e.yml b/.github/workflows/test-e2e.yml deleted file mode 100644 index a8e8b0c10a..0000000000 --- a/.github/workflows/test-e2e.yml +++ /dev/null @@ -1,324 +0,0 @@ -name: TestSuite E2E - -on: - pull_request: - branches: [ "main" ] - workflow_dispatch: - inputs: - k8s_version: - description: "With Kubernetes version" - required: false -jobs: - wait-for-img: - name: "Wait for Image Build" - runs-on: ubuntu-latest - steps: - - uses: autotelic/action-wait-for-status-check@v1 - id: wait-for-build - with: - token: ${{ secrets.GITHUB_TOKEN }} - # Context for which we should look for the matching status - statusName: ${{ (github.event_name == 'pull_request') && 'pull-lifecycle-mgr-build' || 'main-lifecycle-mgr-build' }} - timeoutSeconds: 900 - intervalSeconds: 10 - - name: Exit If Failing Build Requirement - if: steps.wait-for-build.outputs.state != 'success' - run: | - echo "Image build did not succeed, skipping E2E Test!" - exit 1 - - e2e-integration: - strategy: - matrix: - e2e-test: [ "watcher-enqueue", - "kyma-deprovision-with-foreground-propagation", - "kyma-deprovision-with-background-propagation", - "module-status-propagation", - "kyma-metrics", - "module-without-default-cr", - "module-consistency", - "non-blocking-deletion", - "upgrade-under-deletion", - "purge-controller", - "purge-metrics", - "module-upgrade-channel-switch", - "module-upgrade-new-version", - "skip-manifest-reconciliation", - "ca-certificate-rotation", - "self-signed-certificate-rotation", - "mandatory-module", - "mandatory-module-metrics", - "misconfigured-kyma-secret", - "rbac-privileges" - ] - name: "E2E" - needs: [wait-for-img] - runs-on: ubuntu-latest - timeout-minutes: 20 - env: - K3D_VERSION: v5.6.0 - K8S_VERSION: ${{ github.event.inputs.k8s_version || '1.28.7' }} - ISTIO_VERSION: 1.20.3 - CM_VERSION: v1.13.3 - KLM_VERSION_TAG: latest - KLM_IMAGE_REPO: prod - GOSUMDB: off - steps: - - name: Install prerequisites - run: | - curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.28/deb/Release.key | sudo gpg --batch --yes --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg - echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.28/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list - sudo apt update -y - sudo apt install kubectl -y - - name: Checkout lifecycle-manager - uses: actions/checkout@v4 - with: - path: lifecycle-manager - - name: Set up Go - uses: actions/setup-go@v4 - with: - go-version-file: 'lifecycle-manager/go.mod' - cache-dependency-path: 'lifecycle-manager/go.sum' - - name: Install Istio CLI - run: | - curl -L https://istio.io/downloadIstio | TARGET_ARCH=x86_64 sh - - chmod +x istio-$ISTIO_VERSION/bin/istioctl - mv istio-$ISTIO_VERSION/bin/istioctl /usr/local/bin - - name: Install Kyma CLI - run: | - wget https://storage.googleapis.com/kyma-cli-unstable/kyma-linux - chmod +x kyma-linux && mv kyma-linux /usr/local/bin/kyma-unstable - echo "PATH=/usr/local/bin/kyma-unstable" >> $GITHUB_OUTPUT - - run: ln -s /usr/local/bin/kyma-unstable /usr/local/bin/kyma - - name: Install Cert Manager Command Line Tool - run: | - OS=$(go env GOOS); ARCH=$(go env GOARCH); curl -fsSL -o cmctl.tar.gz https://github.com/cert-manager/cert-manager/releases/latest/download/cmctl-$OS-$ARCH.tar.gz - tar xzf cmctl.tar.gz - sudo mv cmctl /usr/local/bin - - name: Install k3d - run: wget -qO - https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | TAG=$K3D_VERSION bash - - name: Provision SKR cluster - run: | - k3d cluster create skr \ - -p 10080:80@loadbalancer \ - -p 10443:443@loadbalancer \ - --image rancher/k3s:v$K8S_VERSION-k3s1 \ - --k3s-arg '--disable=traefik@server:*' \ - --k3s-arg '--tls-san=host.k3d.internal@server:*' - - name: Provision KCP cluster - run: | - k3d cluster create kcp \ - -p 9443:443@loadbalancer \ - -p 9080:80@loadbalancer \ - -p 9081:8080@loadbalancer \ - --image rancher/k3s:v$K8S_VERSION-k3s1 \ - --registry-create k3d-kcp-registry:5111 \ - --k3s-arg '--disable=traefik@server:*' \ - --k3s-arg '--tls-san=host.k3d.internal@server:*' - - name: Update Kubeconfigs - run: k3d kubeconfig merge -a -d - - name: Export required Kubeconfig Env vars - run: | - echo "KCP_KUBECONFIG=$(k3d kubeconfig write kcp)" >> $GITHUB_ENV - echo "SKR_KUBECONFIG=$(k3d kubeconfig write skr)" >> $GITHUB_ENV - - name: Patch /etc/hosts - run: | - FILE=/etc/hosts - if [ -f "$FILE" ]; then - sudo echo "127.0.0.1 k3d-kcp-registry" | sudo tee -a $FILE - else - echo "$FILE does not exist." - exit 1 - fi - echo "/etc/hosts file patched" - - name: Switch kubeconfig context to KCP cluster - run: kubectl config use-context k3d-kcp - - name: Deploy Istio on KCP Cluster - run: | - istioctl install --set profile=demo -y - - name: Deploy Cert Manager on KCP Cluster - run: | - kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/$CM_VERSION/cert-manager.yaml - cmctl check api --wait=2m - - name: Override Kustomize Controller Image TAG and Image repository environment variables in Pull Request to PR Image - if: ${{ github.event_name == 'pull_request' }} - run: | - echo "KLM_VERSION_TAG=PR-${{ github.event.pull_request.number }}" >> $GITHUB_ENV - echo "KLM_IMAGE_REPO=dev" >> $GITHUB_ENV - - name: Patch purge finalizer flags - if: ${{ matrix.e2e-test == 'purge-controller' || matrix.e2e-test == 'purge-metrics'}} - working-directory: lifecycle-manager - run: | - pushd config/watcher_local_test - echo \ - "- op: add - path: /spec/template/spec/containers/0/args/- - value: --enable-purge-finalizer=true - - op: add - path: /spec/template/spec/containers/0/args/- - value: --purge-finalizer-timeout=5s" >> purge_finalizer.yaml - cat purge_finalizer.yaml - kustomize edit add patch --path purge_finalizer.yaml --kind Deployment - popd - - name: Patch metrics cleanup interval - if : ${{ matrix.e2e-test == 'kyma-metrics' }} - working-directory: lifecycle-manager - run: | - pushd config/watcher_local_test - echo \ - "- op: add - path: /spec/template/spec/containers/0/args/- - value: --metrics-cleanup-interval=1" >> metrics_cleanup.yaml - cat metrics_cleanup.yaml - kustomize edit add patch --path metrics_cleanup.yaml --kind Deployment - popd - - name: Patch self signed certificate lifetime - if: ${{matrix.e2e-test == 'self-signed-certificate-rotation'}} - working-directory: lifecycle-manager - run: | - pushd config/watcher_local_test - echo \ - "- op: add - path: /spec/template/spec/containers/0/args/- - value: --self-signed-cert-duration=1h - - op: add - path: /spec/template/spec/containers/0/args/- - value: --self-signed-cert-renew-before=59m - - op: add - path: /spec/template/spec/containers/0/args/- - value: --self-signed-cert-renew-buffer=1m" >> self-signed-cert.yaml - cat self-signed-cert.yaml - kustomize edit add patch --path self-signed-cert.yaml --kind Deployment - popd - - name: Patch CA certificate renewBefore - if: ${{matrix.e2e-test == 'ca-certificate-rotation'}} - working-directory: lifecycle-manager - run: | - pushd config/watcher_local_test - echo \ - "- op: replace - path: /spec/renewBefore - value: 59m - - op: replace - path: /spec/duration - value: 1h">> certificate_renewal.yaml - cat certificate_renewal.yaml - kustomize edit add patch --path certificate_renewal.yaml --kind Certificate --group cert-manager.io --version v1 --name watcher-serving-cert - popd - - name: Deploy LM local testing kustomize - working-directory: lifecycle-manager - run: | - maxRetry=5 - for retry in $(seq 1 $maxRetry) - do - if make local-deploy-with-watcher IMG=europe-docker.pkg.dev/kyma-project/$KLM_IMAGE_REPO/lifecycle-manager:$KLM_VERSION_TAG; then - kubectl wait pods -n kcp-system -l app.kubernetes.io/name=lifecycle-manager --for condition=Ready --timeout=90s - echo "KLM deployed successfully" - exit 0 - elif [[ $retry -lt $maxRetry ]]; then - echo "Deploy encountered some error, will retry after 20 seconds" - sleep 20 - else - echo "KLM deployment failed" - exit 1 - fi - done - - name: Checkout template-operator - uses: actions/checkout@v4 - with: - repository: kyma-project/template-operator - path: template-operator - - name: Create Template Operator Module and apply - working-directory: template-operator - if: ${{ matrix.e2e-test == 'kyma-metrics' || - matrix.e2e-test == 'non-blocking-deletion' || - matrix.e2e-test == 'purge-controller' || - matrix.e2e-test == 'purge-metrics' || - matrix.e2e-test == 'kyma-deprovision-with-foreground-propagation' || - matrix.e2e-test == 'kyma-deprovision-with-background-propagation' || - matrix.e2e-test == 'module-consistency' || - matrix.e2e-test == 'skip-manifest-reconciliation' || - matrix.e2e-test == 'misconfigured-kyma-secret' - }} - run: | - make build-manifests - kyma alpha create module --module-config-file ./module-config.yaml --path . --registry k3d-kcp-registry:5111 --insecure - sed -i 's/k3d-kcp-registry:5111/k3d-kcp-registry:5000/g' ./template.yaml - kubectl config use-context k3d-kcp - kubectl get crds - kubectl apply -f template.yaml - - name: Create Template Operator Module for regular and fast channels - working-directory: lifecycle-manager - if: ${{ matrix.e2e-test == 'module-upgrade-channel-switch' || - matrix.e2e-test == 'module-upgrade-new-version' || - matrix.e2e-test == 'upgrade-under-deletion' - }} - run: | - kubectl apply -f tests/moduletemplates/moduletemplate_template_operator_v2_fast.yaml - kubectl apply -f tests/moduletemplates/moduletemplate_template_operator_v1_regular.yaml - - name: Create Template Operator Module as Mandatory Module - working-directory: lifecycle-manager - if: ${{ matrix.e2e-test == 'mandatory-module' || - matrix.e2e-test == 'mandatory-module-metrics' - }} - run: | - kubectl apply -f tests/moduletemplates/mandatory_moduletemplate_template_operator_v1.yaml - - name: Apply Template Operator Module V2, fast channel - working-directory: ./lifecycle-manager - if: ${{ matrix.e2e-test == 'non-blocking-deletion' }} - run: | - kubectl apply -f tests/moduletemplates/moduletemplate_template_operator_v2_fast.yaml - - name: Create Template Operator Module with final state and final deletion state as `Warning` and apply - working-directory: template-operator - if: ${{ matrix.e2e-test == 'module-status-propagation'}} - run: | - pushd config/default - echo \ - "- op: replace - path: /spec/template/spec/containers/0/args/1 - value: --final-state=Warning - - op: replace - path: /spec/template/spec/containers/0/args/2 - value: --final-deletion-state=Warning" >> warning_patch.yaml - cat warning_patch.yaml - kustomize edit add patch --path warning_patch.yaml --kind Deployment - popd - kyma alpha create module --kubebuilder-project --channel=regular --name kyma.project.io/module/template-operator --version 1.1.1 --path . --registry k3d-kcp-registry:5111 --insecure --module-archive-version-overwrite / - sed -i 's/k3d-kcp-registry:5111/k3d-kcp-registry:5000/g' ./template.yaml - kubectl config use-context k3d-kcp - kubectl get crds - kubectl apply -f template.yaml - - name: Create Template Operator Module without default CR and apply - working-directory: template-operator - if: ${{ matrix.e2e-test == 'module-without-default-cr' }} - run: | - make build-manifests - echo "name: kyma-project.io/module/template-operator - channel: regular - version: v1.0.0 - manifest: template-operator.yaml - security: sec-scanners-config.yaml - annotations: - operator.kyma-project.io/doc-url: https://kyma-project.io" >> module-config-no-cr.yaml - kyma alpha create module \ - --module-config-file ./module-config-no-cr.yaml \ - --path . \ - --registry k3d-kcp-registry:5111 \ - --insecure - sed -i 's/k3d-kcp-registry:5111/k3d-kcp-registry:5000/g' ./template.yaml - kubectl config use-context k3d-kcp - kubectl get crds - kubectl apply -f template.yaml - - name: Expose Metrics Endpoint - working-directory: lifecycle-manager - if: ${{ matrix.e2e-test == 'kyma-metrics' || - matrix.e2e-test == 'purge-metrics' || - matrix.e2e-test == 'self-signed-certificate-rotation' || - matrix.e2e-test == 'mandatory-module-metrics' - }} - run: | - kubectl patch svc klm-metrics-service -p '{"spec": {"type": "LoadBalancer"}}' -n kcp-system - - name: Run ${{ matrix.e2e-test }} - working-directory: lifecycle-manager - run: | - make -C tests/e2e ${{ matrix.e2e-test }} From 0512e0b020359a483371eff8780ad7524a4e24c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Schw=C3=A4gerl?= Date: Wed, 10 Apr 2024 17:42:36 +0200 Subject: [PATCH 55/55] reset name --- .github/workflows/test-e2e.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-e2e.yaml b/.github/workflows/test-e2e.yaml index de07f41656..85d38c5a02 100644 --- a/.github/workflows/test-e2e.yaml +++ b/.github/workflows/test-e2e.yaml @@ -21,7 +21,7 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} statusName: pull-lifecycle-mgr-build e2e-integration: - name: E2E Tests + name: E2E needs: wait-for-image-build strategy: matrix: