From f056788f8f7a281dbeda01cd8a1617e41a1c26ff Mon Sep 17 00:00:00 2001 From: realanna Date: Wed, 1 Feb 2023 11:32:07 +0100 Subject: [PATCH 1/5] ci: add helm to install action Signed-off-by: realanna ci: add helm to install action Signed-off-by: realanna ci: add helm to install action Signed-off-by: realanna ci: add helm to install action Signed-off-by: realanna ci: add helm to install action Signed-off-by: realanna ci: add helm to install action Signed-off-by: realanna ci: add helm to install action Signed-off-by: realanna --- .../actions/deploy-klt-on-cluster/action.yml | 19 ++- .github/workflows/helm-checks.yaml | 142 ++++++++++++++++++ .github/workflows/integration-test.yml | 5 + 3 files changed, 164 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/helm-checks.yaml diff --git a/.github/actions/deploy-klt-on-cluster/action.yml b/.github/actions/deploy-klt-on-cluster/action.yml index 3114fd88d3..6ea75e28d7 100644 --- a/.github/actions/deploy-klt-on-cluster/action.yml +++ b/.github/actions/deploy-klt-on-cluster/action.yml @@ -18,7 +18,12 @@ inputs: required: false description: "Name of the kind cluster" default: "test-cluster" - + helm-install: + required: false + type: boolean + description: "Install KLT via helm instead of manifest if true" + # renovate: datasource=github-releases depName=kubernetes-sigs/kind + default: false runs: using: "composite" steps: @@ -52,9 +57,11 @@ runs: kind load image-archive $image/$image -n ${{ inputs.cluster-name }} done - - name: Install lifecycle-toolkit + - name: Install lifecycle-toolkit with manifests + if: ${{ inputs.helm-install == 'false' }} shell: bash run: | + echo "Installing KLT using manifests" sed -i 's/imagePullPolicy: Always/imagePullPolicy: Never/g' ~/download/artifacts/keptn-lifecycle-operator-manifest-test/release.yaml sed -i 's/ghcr.keptn.sh\/keptn\/functions-runtime:.*/localhost:5000\/keptn\/functions-runtime:${{ inputs.functions_runtime_tag }}/g' ~/download/artifacts/keptn-lifecycle-operator-manifest-test/release.yaml kubectl create namespace keptn-lifecycle-toolkit-system @@ -64,3 +71,11 @@ runs: kubectl apply -f ~/download/artifacts/scheduler-manifest-test kubectl rollout status deployment keptn-scheduler -n keptn-lifecycle-toolkit-system -w kubectl rollout status deployment klc-controller-manager -n keptn-lifecycle-toolkit-system -w + + - name: Install lifecycle-toolkit with helm + if: ${{ inputs.helm-install == 'true' }} + shell: bash + run: | + echo "Installing KLT using helm" + kubectl create namespace keptn-lifecycle-toolkit-system + helm install -n keptn-lifecycle-toolkit-system toolkit ~/download/artifacts/keptn-lifecycle-toolkit.tgz --wait --timeout 14m diff --git a/.github/workflows/helm-checks.yaml b/.github/workflows/helm-checks.yaml new file mode 100644 index 0000000000..41d9439291 --- /dev/null +++ b/.github/workflows/helm-checks.yaml @@ -0,0 +1,142 @@ +name: Helm-test +on: + schedule: + - cron: '0 3 * * 1' # run tests at 1 AM (UTC), every monday (1) + workflow_dispatch: + inputs: + branch: + description: 'Take CI build artifacts from branch (e.g., master, release-x.y.z)' + required: true + default: 'main' +env: + GO_VERSION: "~1.19" + # renovate: datasource=github-releases depName=kubernetes-sigs/controller-tools + CONTROLLER_TOOLS_VERSION: "v0.9.2" + ENVTEST_K8S_VERSION: "1.24.2" + SCHEDULER_COMPATIBLE_K8S_VERSION: "v0.24.3" +defaults: + run: + shell: bash + +jobs: + prepare_ci_run: + name: Prepare CI Run + runs-on: ubuntu-22.04 + outputs: + GIT_SHA: ${{ steps.extract_branch.outputs.GIT_SHA }} + BRANCH: ${{ steps.extract_branch.outputs.BRANCH }} + BRANCH_SLUG: ${{ steps.extract_branch.outputs.BRANCH_SLUG }} + DATETIME: ${{ steps.get_datetime.outputs.DATETIME }} + BUILD_TIME: ${{ steps.get_datetime.outputs.BUILD_TIME }} + NON_FORKED_AND_NON_ROBOT_RUN: ${{ steps.get_run_type.outputs.NON_FORKED_AND_NON_ROBOT_RUN }} + + steps: + - name: Check out code + uses: actions/checkout@v3 + + - name: Extract branch name + id: extract_branch + uses: keptn/gh-action-extract-branch-name@main + + - name: Get current date and time + id: get_datetime + run: | + DATETIME=$(date +'%Y%m%d%H%M') + BUILD_TIME=$(date -u "+%F_%T") + echo "DATETIME=$DATETIME" >> "$GITHUB_OUTPUT" + echo "BUILD_TIME=$BUILD_TIME" >> "$GITHUB_OUTPUT" + + - name: Get workflow run type + id: get_run_type + run: | + NON_FORKED_AND_NON_ROBOT_RUN=${{ ( github.actor != 'renovate[bot]' && github.actor != 'dependabot[bot]' ) && ( github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository ) }} + echo "github.actor != 'renovate[bot]' = ${{ github.actor != 'renovate[bot]' }}" + echo "github.actor != 'dependabot[bot]' = ${{ github.actor != 'dependabot[bot]' }}" + echo "github.event_name == 'push' = ${{ github.event_name == 'push' }}" + echo "github.event.pull_request.head.repo.full_name == github.repository = ${{ github.event.pull_request.head.repo.full_name == github.repository }}" + echo "NON_FORKED_AND_NON_ROBOT_RUN = $NON_FORKED_AND_NON_ROBOT_RUN" + echo "NON_FORKED_AND_NON_ROBOT_RUN=$NON_FORKED_AND_NON_ROBOT_RUN" >> "$GITHUB_OUTPUT" + + build_image: + name: Build Docker Image + needs: prepare_ci_run + runs-on: ubuntu-22.04 + env: + BRANCH: ${{ needs.prepare_ci_run.outputs.BRANCH }} + DATETIME: ${{ needs.prepare_ci_run.outputs.DATETIME }} + BUILD_TIME: ${{ needs.prepare_ci_run.outputs.BUILD_TIME }} + GIT_SHA: ${{ needs.prepare_ci_run.outputs.GIT_SHA }} + RELEASE_REGISTRY: "localhost:5000/keptn" + strategy: + matrix: + config: + - name: "keptn-lifecycle-operator" + folder: "operator/" + - name: "scheduler" + folder: "scheduler/" + - name: "klt-cert-manager" + folder: "klt-cert-manager/" + steps: + - name: Check out code + uses: actions/checkout@v3 + + - name: Cache build tools + id: cache-build-tools + uses: actions/cache@v3 + with: + path: ./${{ matrix.config.folder }}bin + key: build-tools-${{ github.ref_name }} + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v2 + + - name: Build Docker Image + uses: docker/build-push-action@v3 + with: + context: ${{ matrix.config.folder }} + platforms: linux/amd64 + target: production + tags: | + ${{ env.RELEASE_REGISTRY }}/${{ matrix.config.name }}:dev-${{ env.DATETIME }} + build-args: | + GIT_HASH=${{ env.GIT_SHA }} + RELEASE_VERSION=dev-${{ env.DATETIME }} + BUILD_TIME=${{ env.BUILD_TIME }} + CONTROLLER_TOOLS_VERSION=${{ env.CONTROLLER_TOOLS_VERSION }} + SCHEDULER_COMPATIBLE_K8S_VERSION=${{ env.SCHEDULER_COMPATIBLE_K8S_VERSION }} + builder: ${{ steps.buildx.outputs.name }} + push: false + cache-from: type=gha,scope=${{ github.ref_name }}-${{ matrix.config.name }} + cache-to: type=gha,scope=${{ github.ref_name }}-${{ matrix.config.name }} + outputs: type=docker,dest=/tmp/${{ matrix.config.name }}-image.tar + + - name: Generate helm charts + run: make helm-package + + - name: Upload KLT helm charts archive + uses: actions/upload-artifact@v3 + with: + name: kepn-lifecycle-toolkit + path: ./helm/chart/charts/*.tgz + + - name: Upload image as artifact + uses: actions/upload-artifact@v3 + with: + name: ${{ matrix.config.name }}-image.tar + path: /tmp/${{ matrix.config.name }}-image.tar + + - name: Upload release.yaml for tests + if: matrix.config.name != 'functions-runtime' + uses: actions/upload-artifact@v3 + with: + name: ${{ matrix.config.name }}-manifest-test + path: ${{ matrix.config.folder }}/config/rendered/release.yaml + + integration_tests: + name: Integration Tests + needs: [ prepare_ci_run, build_image ] + with: + functions_runtime_tag: dev-${{ needs.prepare_ci_run.outputs.DATETIME }} + helm-install: true + uses: ./.github/workflows/integration-test.yml \ No newline at end of file diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index bfbbbc7d1a..709ea0c5d9 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -6,6 +6,10 @@ on: description: "Tag for the functions runner image" type: "string" required: true + helm-install: + description: "Decides wheter to install via helm" + type: "boolean" + default: false env: GO_VERSION: "~1.19" # renovate: datasource=github-tags depName=kudobuilder/kuttl @@ -26,6 +30,7 @@ jobs: uses: ./.github/actions/deploy-klt-on-cluster with: functions_runtime_tag: ${{ inputs.functions_runtime_tag }} + helm-install: ${{ inputs.helm-install }} - name: Download KUTTL run: | From a0c9bbc993975e910e28aec987a0c0a1619dbb86 Mon Sep 17 00:00:00 2001 From: realanna Date: Wed, 1 Feb 2023 13:29:30 +0100 Subject: [PATCH 2/5] clean up Signed-off-by: realanna fixed helm checks Signed-off-by: realanna fixed helm checks Signed-off-by: realanna fixed helm checks Signed-off-by: realanna fixed helm checks Signed-off-by: realanna fixed helm checks Signed-off-by: realanna fixed helm checks Signed-off-by: realanna fixed helm checks Signed-off-by: realanna fixed helm checks Signed-off-by: realanna fixed helm checks Signed-off-by: realanna fixed helm checks Signed-off-by: realanna fixed helm checks Signed-off-by: realanna fixed helm checks Signed-off-by: realanna fixed helm checks Signed-off-by: realanna fixed helm checks Signed-off-by: realanna fixed helm checks Signed-off-by: realanna fixed helm checks Signed-off-by: realanna fixed helm checks Signed-off-by: realanna fixed helm checks Signed-off-by: realanna fixed helm checks Signed-off-by: realanna fixed helm checks Signed-off-by: realanna fixed helm checks Signed-off-by: realanna fixed helm checks Signed-off-by: realanna fixed helm checks Signed-off-by: realanna fixed helm checks Signed-off-by: realanna fixed helm checks Signed-off-by: realanna test Signed-off-by: realanna test Signed-off-by: realanna test Signed-off-by: realanna --- .../actions/deploy-klt-on-cluster/action.yml | 3 +- .github/workflows/CI.yaml | 185 ++---------------- .github/workflows/helm-checks.yaml | 54 ++--- .../config/manager/kustomization.yaml | 4 +- operator/config/manager/kustomization.yaml | 4 +- operator/config/manager/manager.yaml | 8 +- .../manifests/install/kustomization.yaml | 4 +- 7 files changed, 55 insertions(+), 207 deletions(-) diff --git a/.github/actions/deploy-klt-on-cluster/action.yml b/.github/actions/deploy-klt-on-cluster/action.yml index 6ea75e28d7..5cf00280fb 100644 --- a/.github/actions/deploy-klt-on-cluster/action.yml +++ b/.github/actions/deploy-klt-on-cluster/action.yml @@ -77,5 +77,4 @@ runs: shell: bash run: | echo "Installing KLT using helm" - kubectl create namespace keptn-lifecycle-toolkit-system - helm install -n keptn-lifecycle-toolkit-system toolkit ~/download/artifacts/keptn-lifecycle-toolkit.tgz --wait --timeout 14m + helm upgrade --install -n keptn-lifecycle-toolkit-system --create-namespace toolkit ~/download/artifacts/keptn-lifecycle-toolkit.tgz --debug --wait --timeout 1m diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index 15f78cb6a0..9ab274f148 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -57,39 +57,6 @@ jobs: echo "NON_FORKED_AND_NON_ROBOT_RUN = $NON_FORKED_AND_NON_ROBOT_RUN" echo "NON_FORKED_AND_NON_ROBOT_RUN=$NON_FORKED_AND_NON_ROBOT_RUN" >> "$GITHUB_OUTPUT" - test: - name: Unit Tests - needs: prepare_ci_run - runs-on: ubuntu-22.04 - strategy: - matrix: - config: - - name: "keptn-lifecycle-operator" - folder: "operator/" - - name: "scheduler" - folder: "scheduler/" - - name: "klt-cert-manager" - folder: "klt-cert-manager/" - steps: - - name: Check out code - uses: actions/checkout@v3 - - - name: Set up Go 1.x - uses: actions/setup-go@v3 - with: - go-version: ${{ env.GO_VERSION }} - cache: true - cache-dependency-path: '${{ matrix.config.folder }}go.sum' - - - name: Unit Test ${{ matrix.config.name }} - working-directory: ./${{ matrix.config.folder }} - run: make test - - - name: Report code coverage - uses: codecov/codecov-action@v3 - with: - flags: ${{ matrix.config.name }} - build_image: name: Build Docker Image needs: prepare_ci_run @@ -107,8 +74,6 @@ jobs: folder: "operator/" - name: "scheduler" folder: "scheduler/" - - name: "functions-runtime" - folder: "functions-runtime/" - name: "klt-cert-manager" folder: "klt-cert-manager/" steps: @@ -152,146 +117,34 @@ jobs: name: ${{ matrix.config.name }}-image.tar path: /tmp/${{ matrix.config.name }}-image.tar - - name: Install controller-gen - if: matrix.config.name == 'keptn-lifecycle-operator' - working-directory: ./${{ matrix.config.folder }} - run: make controller-gen - - - name: Generate release.yaml - if: matrix.config.name != 'functions-runtime' - working-directory: ./${{ matrix.config.folder }} - env: - TAG: dev-${{ env.DATETIME }} - run: make release-manifests - - name: Upload release.yaml for tests - if: matrix.config.name != 'functions-runtime' - uses: actions/upload-artifact@v3 - with: - name: ${{ matrix.config.name }}-manifest-test - path: ${{ matrix.config.folder }}/config/rendered/release.yaml - - component_tests: - name: Component Tests - needs: prepare_ci_run - uses: ./.github/workflows/component-test.yml - - integration_tests: - name: Integration Tests - needs: [ prepare_ci_run, build_image ] - with: - functions_runtime_tag: dev-${{ needs.prepare_ci_run.outputs.DATETIME }} - uses: ./.github/workflows/integration-test.yml - - e2e_tests: - name: End to End Tests - needs: [ prepare_ci_run, build_image ] - with: - functions_runtime_tag: dev-${{ needs.prepare_ci_run.outputs.DATETIME }} - uses: ./.github/workflows/e2e-test.yml - - performance_tests: - name: Performance Tests + build_helm_chart: + name: Build Helm Chart needs: [ prepare_ci_run, build_image ] - with: - functions_runtime_tag: dev-${{ needs.prepare_ci_run.outputs.DATETIME }} - uses: ./.github/workflows/performance-test.yml - - upload_images: - name: Upload images to ghcr registry - needs: [ prepare_ci_run, test, component_tests, integration_tests, e2e_tests, performance_tests ] - if: github.event_name == 'push' && needs.prepare_ci_run.outputs.NON_FORKED_AND_NON_ROBOT_RUN == 'true' # only run on push to main/maintenance branches runs-on: ubuntu-22.04 env: - DATETIME: ${{ needs.prepare_ci_run.outputs.DATETIME }} - BUILD_TIME: ${{ needs.prepare_ci_run.outputs.BUILD_TIME }} - GIT_SHA: ${{ needs.prepare_ci_run.outputs.GIT_SHA }} - strategy: - matrix: - config: - - name: "keptn-lifecycle-operator" - folder: "operator/" - - name: "scheduler" - folder: "scheduler/" - - name: "functions-runtime" - folder: "functions-runtime/" - - name: "klt-cert-manager" - folder: "klt-cert-manager/" - permissions: - packages: write # Needed for pushing images to the registry + RELEASE_REGISTRY: "localhost:5000/keptn" steps: - name: Check out code uses: actions/checkout@v3 - - name: Cache build tools - id: cache-build-tools - uses: actions/cache@v3 - with: - path: ./${{ matrix.config.folder }}bin - key: build-tools-${{ github.ref_name }} - - - name: Login to GitHub Container Registry - uses: docker/login-action@v2 - with: - registry: "ghcr.io" - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Set up Docker Buildx - id: buildx - uses: docker/setup-buildx-action@v2 - - - name: Build Docker Image - uses: docker/build-push-action@v3 - with: - context: ${{ matrix.config.folder }} - platforms: linux/amd64,linux/arm64 - target: production - tags: | - ghcr.io/keptn/${{ matrix.config.name }}:dev-${{ env.DATETIME }} - build-args: | - GIT_HASH=${{ env.GIT_SHA }} - RELEASE_VERSION=dev-${{ env.DATETIME }} - BUILD_TIME=${{ env.BUILD_TIME }} - CONTROLLER_TOOLS_VERSION=${{ env.CONTROLLER_TOOLS_VERSION }} - SCHEDULER_COMPATIBLE_K8S_VERSION=${{ env.SCHEDULER_COMPATIBLE_K8S_VERSION }} - builder: ${{ steps.buildx.outputs.name }} - push: true - cache-from: type=gha,scope=${{ github.ref_name }}-${{ matrix.config.name }} - cache-to: type=gha,scope=${{ github.ref_name }}-${{ matrix.config.name }} - - - name: Install controller-gen - if: matrix.config.name == 'keptn-lifecycle-operator' || matrix.config.name == 'klt-cert-manager' - working-directory: ./${{ matrix.config.folder }} - run: make controller-gen - - - name: Generate release.yaml - if: matrix.config.name != 'functions-runtime' - working-directory: ./${{ matrix.config.folder }} - env: - TAG: dev-${{ env.DATETIME }} - run: make release-manifests + - name: Generate helm charts + run: | + make helm-package RELEASE_REGISTRY=${{ env.RELEASE_REGISTRY }} TAG=dev-${{ needs.prepare_ci_run.outputs.DATETIME }} + sed -i 's/imagePullPolicy: Always/imagePullPolicy: Never/g' ./helm/chart/templates/rendered.yaml + sed -i 's/ghcr.keptn.sh\/keptn\/functions-runtime:.*/localhost:5000\/keptn\/functions-runtime dev-${{ needs.prepare_ci_run.outputs.DATETIME }}/g' ./helm/chart/templates/rendered.yaml + rm -r ./helm/chart/charts - - name: Upload release.yaml - if: matrix.config.name != 'functions-runtime' + - name: Upload KLT helm charts archive uses: actions/upload-artifact@v3 with: - name: ${{ matrix.config.name }}-manifest - path: ${{ matrix.config.folder }}/config/rendered/release.yaml + name: keptn-lifecycle-toolkit.tgz + path: ./helm/chart/* - update-docs: - name: Update Documentation - needs: - - prepare_ci_run - if: github.event_name == 'push' && needs.prepare_ci_run.outputs.NON_FORKED_AND_NON_ROBOT_RUN == 'true' - runs-on: ubuntu-22.04 - steps: - - name: Check out code - uses: actions/checkout@v3 - - - name: Update Documentation - uses: ./.github/actions/update-documentation - with: - version: "dev" - klt-repo: ${{ github.workspace }} - token: ${{ secrets.KEPTN_SANDBOX_BOT_TOKEN }} + integration_tests: + name: Integration Tests + needs: [ build_helm_chart ] + with: + functions_runtime_tag: dev-${{ needs.prepare_ci_run.outputs.DATETIME }} + helm-install: true + uses: ./.github/workflows/integration-test.yml \ No newline at end of file diff --git a/.github/workflows/helm-checks.yaml b/.github/workflows/helm-checks.yaml index 41d9439291..edc6845b08 100644 --- a/.github/workflows/helm-checks.yaml +++ b/.github/workflows/helm-checks.yaml @@ -3,11 +3,7 @@ on: schedule: - cron: '0 3 * * 1' # run tests at 1 AM (UTC), every monday (1) workflow_dispatch: - inputs: - branch: - description: 'Take CI build artifacts from branch (e.g., master, release-x.y.z)' - required: true - default: 'main' + env: GO_VERSION: "~1.19" # renovate: datasource=github-releases depName=kubernetes-sigs/controller-tools @@ -111,32 +107,38 @@ jobs: cache-to: type=gha,scope=${{ github.ref_name }}-${{ matrix.config.name }} outputs: type=docker,dest=/tmp/${{ matrix.config.name }}-image.tar - - name: Generate helm charts - run: make helm-package - - - name: Upload KLT helm charts archive - uses: actions/upload-artifact@v3 - with: - name: kepn-lifecycle-toolkit - path: ./helm/chart/charts/*.tgz - - name: Upload image as artifact uses: actions/upload-artifact@v3 with: name: ${{ matrix.config.name }}-image.tar path: /tmp/${{ matrix.config.name }}-image.tar - - name: Upload release.yaml for tests - if: matrix.config.name != 'functions-runtime' + + build_helm_chart: + name: Build Helm Chart + needs: [ prepare_ci_run, build_image ] + runs-on: ubuntu-22.04 + env: + RELEASE_REGISTRY: "localhost:5000/keptn" + steps: + - name: Check out code + uses: actions/checkout@v3 + + - name: Generate helm charts + run: | + make helm-package RELEASE_REGISTRY=${{ env.RELEASE_REGISTRY }} TAG=dev-${{ needs.prepare_ci_run.outputs.DATETIME }} + rm -r ./helm/chart/charts + + - name: Upload KLT helm charts archive uses: actions/upload-artifact@v3 with: - name: ${{ matrix.config.name }}-manifest-test - path: ${{ matrix.config.folder }}/config/rendered/release.yaml - - integration_tests: - name: Integration Tests - needs: [ prepare_ci_run, build_image ] - with: - functions_runtime_tag: dev-${{ needs.prepare_ci_run.outputs.DATETIME }} - helm-install: true - uses: ./.github/workflows/integration-test.yml \ No newline at end of file + name: keptn-lifecycle-toolkit.tgz + path: ./helm/chart/* + + integration_tests: + name: Integration Tests + needs: [ build_helm_chart ] + with: + functions_runtime_tag: dev-${{ needs.prepare_ci_run.outputs.DATETIME }} + helm-install: true + uses: ./.github/workflows/integration-test.yml diff --git a/klt-cert-manager/config/manager/kustomization.yaml b/klt-cert-manager/config/manager/kustomization.yaml index a82a896cb3..e417d62d23 100644 --- a/klt-cert-manager/config/manager/kustomization.yaml +++ b/klt-cert-manager/config/manager/kustomization.yaml @@ -4,5 +4,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization images: - name: controller - newName: ghcr.keptn.sh/keptn/keptn-cert-manager - newTag: "202301111673450920" + newName: ghcr.io/keptn/klt-cert-manager + newTag: "202302021675335649" diff --git a/operator/config/manager/kustomization.yaml b/operator/config/manager/kustomization.yaml index 2452067f0f..24422e9680 100644 --- a/operator/config/manager/kustomization.yaml +++ b/operator/config/manager/kustomization.yaml @@ -10,5 +10,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization images: - name: controller - newName: ghcr.keptn.sh/keptn/keptn-lifecycle-operator - newTag: "202301111673423054" + newName: ghcr.io/keptn/keptn-lifecycle-operator + newTag: "202302021675335649" diff --git a/operator/config/manager/manager.yaml b/operator/config/manager/manager.yaml index eaac7df43c..9593687dc4 100644 --- a/operator/config/manager/manager.yaml +++ b/operator/config/manager/manager.yaml @@ -1,10 +1,4 @@ -apiVersion: v1 -kind: Namespace -metadata: - labels: - control-plane: controller-manager - name: system ---- + apiVersion: apps/v1 kind: Deployment metadata: diff --git a/scheduler/manifests/install/kustomization.yaml b/scheduler/manifests/install/kustomization.yaml index 10b8820106..86aca98e5d 100644 --- a/scheduler/manifests/install/kustomization.yaml +++ b/scheduler/manifests/install/kustomization.yaml @@ -13,5 +13,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization images: - name: scheduler - newName: ghcr.keptn.sh/keptn/scheduler - newTag: 0.5.0-next.13 + newName: ghcr.io/keptn/scheduler + newTag: "202302021675335649" From 466badaae5e6c809f2f3b74cbd91175ad63e7444 Mon Sep 17 00:00:00 2001 From: realanna Date: Thu, 2 Feb 2023 12:57:53 +0100 Subject: [PATCH 3/5] clean up Signed-off-by: realanna --- .github/workflows/CI.yaml | 185 ++++++++++++++++++++++++++--- .github/workflows/helm-checks.yaml | 2 + 2 files changed, 168 insertions(+), 19 deletions(-) diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index 9ab274f148..15f78cb6a0 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -57,6 +57,39 @@ jobs: echo "NON_FORKED_AND_NON_ROBOT_RUN = $NON_FORKED_AND_NON_ROBOT_RUN" echo "NON_FORKED_AND_NON_ROBOT_RUN=$NON_FORKED_AND_NON_ROBOT_RUN" >> "$GITHUB_OUTPUT" + test: + name: Unit Tests + needs: prepare_ci_run + runs-on: ubuntu-22.04 + strategy: + matrix: + config: + - name: "keptn-lifecycle-operator" + folder: "operator/" + - name: "scheduler" + folder: "scheduler/" + - name: "klt-cert-manager" + folder: "klt-cert-manager/" + steps: + - name: Check out code + uses: actions/checkout@v3 + + - name: Set up Go 1.x + uses: actions/setup-go@v3 + with: + go-version: ${{ env.GO_VERSION }} + cache: true + cache-dependency-path: '${{ matrix.config.folder }}go.sum' + + - name: Unit Test ${{ matrix.config.name }} + working-directory: ./${{ matrix.config.folder }} + run: make test + + - name: Report code coverage + uses: codecov/codecov-action@v3 + with: + flags: ${{ matrix.config.name }} + build_image: name: Build Docker Image needs: prepare_ci_run @@ -74,6 +107,8 @@ jobs: folder: "operator/" - name: "scheduler" folder: "scheduler/" + - name: "functions-runtime" + folder: "functions-runtime/" - name: "klt-cert-manager" folder: "klt-cert-manager/" steps: @@ -117,34 +152,146 @@ jobs: name: ${{ matrix.config.name }}-image.tar path: /tmp/${{ matrix.config.name }}-image.tar + - name: Install controller-gen + if: matrix.config.name == 'keptn-lifecycle-operator' + working-directory: ./${{ matrix.config.folder }} + run: make controller-gen + + - name: Generate release.yaml + if: matrix.config.name != 'functions-runtime' + working-directory: ./${{ matrix.config.folder }} + env: + TAG: dev-${{ env.DATETIME }} + run: make release-manifests - build_helm_chart: - name: Build Helm Chart + - name: Upload release.yaml for tests + if: matrix.config.name != 'functions-runtime' + uses: actions/upload-artifact@v3 + with: + name: ${{ matrix.config.name }}-manifest-test + path: ${{ matrix.config.folder }}/config/rendered/release.yaml + + component_tests: + name: Component Tests + needs: prepare_ci_run + uses: ./.github/workflows/component-test.yml + + integration_tests: + name: Integration Tests + needs: [ prepare_ci_run, build_image ] + with: + functions_runtime_tag: dev-${{ needs.prepare_ci_run.outputs.DATETIME }} + uses: ./.github/workflows/integration-test.yml + + e2e_tests: + name: End to End Tests + needs: [ prepare_ci_run, build_image ] + with: + functions_runtime_tag: dev-${{ needs.prepare_ci_run.outputs.DATETIME }} + uses: ./.github/workflows/e2e-test.yml + + performance_tests: + name: Performance Tests needs: [ prepare_ci_run, build_image ] + with: + functions_runtime_tag: dev-${{ needs.prepare_ci_run.outputs.DATETIME }} + uses: ./.github/workflows/performance-test.yml + + upload_images: + name: Upload images to ghcr registry + needs: [ prepare_ci_run, test, component_tests, integration_tests, e2e_tests, performance_tests ] + if: github.event_name == 'push' && needs.prepare_ci_run.outputs.NON_FORKED_AND_NON_ROBOT_RUN == 'true' # only run on push to main/maintenance branches runs-on: ubuntu-22.04 env: - RELEASE_REGISTRY: "localhost:5000/keptn" + DATETIME: ${{ needs.prepare_ci_run.outputs.DATETIME }} + BUILD_TIME: ${{ needs.prepare_ci_run.outputs.BUILD_TIME }} + GIT_SHA: ${{ needs.prepare_ci_run.outputs.GIT_SHA }} + strategy: + matrix: + config: + - name: "keptn-lifecycle-operator" + folder: "operator/" + - name: "scheduler" + folder: "scheduler/" + - name: "functions-runtime" + folder: "functions-runtime/" + - name: "klt-cert-manager" + folder: "klt-cert-manager/" + permissions: + packages: write # Needed for pushing images to the registry steps: - name: Check out code uses: actions/checkout@v3 - - name: Generate helm charts - run: | - make helm-package RELEASE_REGISTRY=${{ env.RELEASE_REGISTRY }} TAG=dev-${{ needs.prepare_ci_run.outputs.DATETIME }} - sed -i 's/imagePullPolicy: Always/imagePullPolicy: Never/g' ./helm/chart/templates/rendered.yaml - sed -i 's/ghcr.keptn.sh\/keptn\/functions-runtime:.*/localhost:5000\/keptn\/functions-runtime dev-${{ needs.prepare_ci_run.outputs.DATETIME }}/g' ./helm/chart/templates/rendered.yaml - rm -r ./helm/chart/charts + - name: Cache build tools + id: cache-build-tools + uses: actions/cache@v3 + with: + path: ./${{ matrix.config.folder }}bin + key: build-tools-${{ github.ref_name }} + + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: "ghcr.io" + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v2 + + - name: Build Docker Image + uses: docker/build-push-action@v3 + with: + context: ${{ matrix.config.folder }} + platforms: linux/amd64,linux/arm64 + target: production + tags: | + ghcr.io/keptn/${{ matrix.config.name }}:dev-${{ env.DATETIME }} + build-args: | + GIT_HASH=${{ env.GIT_SHA }} + RELEASE_VERSION=dev-${{ env.DATETIME }} + BUILD_TIME=${{ env.BUILD_TIME }} + CONTROLLER_TOOLS_VERSION=${{ env.CONTROLLER_TOOLS_VERSION }} + SCHEDULER_COMPATIBLE_K8S_VERSION=${{ env.SCHEDULER_COMPATIBLE_K8S_VERSION }} + builder: ${{ steps.buildx.outputs.name }} + push: true + cache-from: type=gha,scope=${{ github.ref_name }}-${{ matrix.config.name }} + cache-to: type=gha,scope=${{ github.ref_name }}-${{ matrix.config.name }} - - name: Upload KLT helm charts archive + - name: Install controller-gen + if: matrix.config.name == 'keptn-lifecycle-operator' || matrix.config.name == 'klt-cert-manager' + working-directory: ./${{ matrix.config.folder }} + run: make controller-gen + + - name: Generate release.yaml + if: matrix.config.name != 'functions-runtime' + working-directory: ./${{ matrix.config.folder }} + env: + TAG: dev-${{ env.DATETIME }} + run: make release-manifests + + - name: Upload release.yaml + if: matrix.config.name != 'functions-runtime' uses: actions/upload-artifact@v3 with: - name: keptn-lifecycle-toolkit.tgz - path: ./helm/chart/* + name: ${{ matrix.config.name }}-manifest + path: ${{ matrix.config.folder }}/config/rendered/release.yaml - integration_tests: - name: Integration Tests - needs: [ build_helm_chart ] - with: - functions_runtime_tag: dev-${{ needs.prepare_ci_run.outputs.DATETIME }} - helm-install: true - uses: ./.github/workflows/integration-test.yml \ No newline at end of file + update-docs: + name: Update Documentation + needs: + - prepare_ci_run + if: github.event_name == 'push' && needs.prepare_ci_run.outputs.NON_FORKED_AND_NON_ROBOT_RUN == 'true' + runs-on: ubuntu-22.04 + steps: + - name: Check out code + uses: actions/checkout@v3 + + - name: Update Documentation + uses: ./.github/actions/update-documentation + with: + version: "dev" + klt-repo: ${{ github.workspace }} + token: ${{ secrets.KEPTN_SANDBOX_BOT_TOKEN }} diff --git a/.github/workflows/helm-checks.yaml b/.github/workflows/helm-checks.yaml index edc6845b08..1044782c1d 100644 --- a/.github/workflows/helm-checks.yaml +++ b/.github/workflows/helm-checks.yaml @@ -127,6 +127,8 @@ jobs: - name: Generate helm charts run: | make helm-package RELEASE_REGISTRY=${{ env.RELEASE_REGISTRY }} TAG=dev-${{ needs.prepare_ci_run.outputs.DATETIME }} + sed -i 's/imagePullPolicy: Always/imagePullPolicy: Never/g' ./helm/chart/templates/rendered.yaml + sed -i 's/ghcr.keptn.sh\/keptn\/functions-runtime:.*/localhost:5000\/keptn\/functions-runtime dev-${{ needs.prepare_ci_run.outputs.DATETIME }}/g' ./helm/chart/templates/rendered.yaml rm -r ./helm/chart/charts - name: Upload KLT helm charts archive From 218b727362ddd4c8161071aa953f68bbd70efa81 Mon Sep 17 00:00:00 2001 From: realanna Date: Thu, 2 Feb 2023 13:06:28 +0100 Subject: [PATCH 4/5] clean up Signed-off-by: realanna --- .github/workflows/helm-checks.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/helm-checks.yaml b/.github/workflows/helm-checks.yaml index 1044782c1d..1db6dd2585 100644 --- a/.github/workflows/helm-checks.yaml +++ b/.github/workflows/helm-checks.yaml @@ -70,6 +70,8 @@ jobs: folder: "operator/" - name: "scheduler" folder: "scheduler/" + - name: "functions-runtime" + folder: "functions-runtime/" - name: "klt-cert-manager" folder: "klt-cert-manager/" steps: From 985f0a42ac0fd3beec47c8b9d606744dbab13fc7 Mon Sep 17 00:00:00 2001 From: realanna Date: Thu, 2 Feb 2023 13:10:25 +0100 Subject: [PATCH 5/5] clean up Signed-off-by: realanna --- klt-cert-manager/config/manager/kustomization.yaml | 4 ++-- operator/config/manager/kustomization.yaml | 4 ++-- scheduler/manifests/install/kustomization.yaml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/klt-cert-manager/config/manager/kustomization.yaml b/klt-cert-manager/config/manager/kustomization.yaml index e417d62d23..a82a896cb3 100644 --- a/klt-cert-manager/config/manager/kustomization.yaml +++ b/klt-cert-manager/config/manager/kustomization.yaml @@ -4,5 +4,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization images: - name: controller - newName: ghcr.io/keptn/klt-cert-manager - newTag: "202302021675335649" + newName: ghcr.keptn.sh/keptn/keptn-cert-manager + newTag: "202301111673450920" diff --git a/operator/config/manager/kustomization.yaml b/operator/config/manager/kustomization.yaml index 24422e9680..2452067f0f 100644 --- a/operator/config/manager/kustomization.yaml +++ b/operator/config/manager/kustomization.yaml @@ -10,5 +10,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization images: - name: controller - newName: ghcr.io/keptn/keptn-lifecycle-operator - newTag: "202302021675335649" + newName: ghcr.keptn.sh/keptn/keptn-lifecycle-operator + newTag: "202301111673423054" diff --git a/scheduler/manifests/install/kustomization.yaml b/scheduler/manifests/install/kustomization.yaml index 86aca98e5d..10b8820106 100644 --- a/scheduler/manifests/install/kustomization.yaml +++ b/scheduler/manifests/install/kustomization.yaml @@ -13,5 +13,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization images: - name: scheduler - newName: ghcr.io/keptn/scheduler - newTag: "202302021675335649" + newName: ghcr.keptn.sh/keptn/scheduler + newTag: 0.5.0-next.13