Helm-test #21
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Helm-test | |
on: | |
schedule: | |
- cron: '0 3 * * 1' # run tests at 1 AM (UTC), every monday (1) | |
workflow_dispatch: | |
env: | |
GO_VERSION: "~1.20" | |
# renovate: datasource=github-releases depName=kubernetes-sigs/controller-tools | |
CONTROLLER_TOOLS_VERSION: "v0.12.0" | |
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 }} | |
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" | |
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: "lifecycle-operator" | |
folder: "operator/" | |
- name: "metrics-operator" | |
folder: "metrics-operator/" | |
- name: "scheduler" | |
folder: "scheduler/" | |
- name: "functions-runtime" | |
folder: "functions-runtime/" | |
- name: "python-runtime" | |
folder: "python-runtime/" | |
- name: "certificate-operator" | |
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@v4 | |
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: Upload image as artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.config.name }}-image.tar | |
path: /tmp/${{ matrix.config.name }}-image.tar | |
build_helm_chart: | |
name: Build Helm Chart | |
needs: [prepare_ci_run, build_image] | |
runs-on: ubuntu-22.04 | |
env: | |
RELEASE_REGISTRY: "localhost:5000/keptn" | |
DATETIME: ${{ needs.prepare_ci_run.outputs.DATETIME }} | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Generate helm charts | |
run: | | |
make helm-package RELEASE_REGISTRY=${{ env.RELEASE_REGISTRY }} CHART_APPVERSION=dev-${{ env.DATETIME }} | |
for file in $(find ./helm/chart/templates -type f -name "*.yaml"); | |
do | |
sed -i 's/{{ include "chart.fullname" . }}-//g' "$file" | |
done | |
- name: Upload KLT helm charts archive | |
uses: actions/upload-artifact@v3 | |
with: | |
name: keptn-lifecycle-toolkit.tgz | |
path: ./helm/chart/* | |
- name: Upload generated helm yaml | |
uses: actions/upload-artifact@v3 | |
with: | |
name: helmchart.yaml | |
path: ./helmchart.yaml | |
integration_tests: | |
name: Integration Tests | |
needs: [prepare_ci_run, build_helm_chart] | |
with: | |
runtime_tag: dev-${{ needs.prepare_ci_run.outputs.DATETIME }} | |
helm-install: true | |
uses: ./.github/workflows/integration-test.yml |