name: 'Deploy Konflux CI on kind cluster and run Konflux UI E2E tests' description: 'Reusable action for running konflux-ui E2E test against konflux-ci instance deployed on kind cluster' inputs: job-type: description: '"on-pr" or "periodic-local" or "periodic-stage"' required: true runs: using: "composite" steps: - name: Free Disk Space (Ubuntu) uses: jlumbroso/free-disk-space@3f13feab2962a87273d379ebc36ea159527e6cc9 # v1.3.2 with: # this might remove tools that are actually needed, # if set to "true" but frees about 6 GB tool-cache: false docker-images: false - name: Get latest konflux-ci release tag id: get-konflux-release run: | LATEST_TAG=$(gh release list --repo konflux-ci/konflux-ci \ --exclude-pre-releases --limit 50 --json tagName -q '.[].tagName' \ | sort -V | tail -1) echo "tag=${LATEST_TAG}" >> "$GITHUB_OUTPUT" echo "Latest konflux-ci release: ${LATEST_TAG}" shell: bash env: GH_TOKEN: ${{ github.token }} # konflux-ci is cloned to /home/runner/work/konflux-ui/konflux-ui # as it have to be at home folder to use helm/kind-action@v1 action - name: Checkout Repository uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: repository: 'konflux-ci/konflux-ci' path: 'konflux-ci' ref: ${{ steps.get-konflux-release.outputs.tag }} - name: Disable AppArmor # works around a change in ubuntu 24.04 that restricts Linux namespace access # for unprivileged users run: sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 shell: bash - name: Install Kind uses: helm/kind-action@ea822c7bf1874f08e5a491df991c228edffc3376 # v1.15.2 with: install_only: true - name: Show version information run: | : Show version information kubectl version --client kind version shell: bash - name: Deploy Konflux env: GITHUB_APP_ID: ${{ env.GH_APP_ID }} GITHUB_PRIVATE_KEY: ${{ env.GH_APP_PRIVATE_KEY }} WEBHOOK_SECRET: ${{ env.GH_APP_WEBHOOK_SECRET }} QUAY_TOKEN: ${{ env.QUAY_TOKEN_TEST }} QUAY_ORGANIZATION: ${{ env.QUAY_TEST_ORG }} SMEE_CHANNEL: ${{ env.SMEE_URL }} OPERATOR_INSTALL_METHOD: release SET_SKIP_CHECKS: 'true' run: | : Deploy Konflux using operator-based deployment cd konflux-ci ./scripts/deploy-local.sh shell: bash - name: Patch konflux-public-info with image controller integration run: | kubectl get configmap konflux-public-info -n konflux-info -o json \ | jq '.data["info.json"] = (.data["info.json"] | fromjson | .integrations.image_controller.enabled = true | tojson)' \ | kubectl apply -f - shell: bash - name: List namespaces run: | : List namespaces kubectl get namespace shell: bash # can't delete the application after tests without admin role - name: Grant admin permissions to test user in default-tenant run: | TEST_USER="${CYPRESS_USERNAME:-user2@konflux.dev}" kubectl create rolebinding user2-konflux-admin \ --clusterrole=konflux-admin-user-actions \ --user="$TEST_USER" \ -n default-tenant shell: bash - name: Build konflux-ui image env: CYPRESS_GH_TOKEN: ${{ env.HAC_TEST_GH_TOKEN }} TARGET_BRANCH: ${{ env.TARGET_BRANCH }} SOURCE_BRANCH: ${{ env.SOURCE_BRANCH }} PR_NUMBER: ${{ env.PR_NUMBER }} HEAD_SHA: ${{ env.HEAD_SHA }} FORKED_REPO_URL: ${{ env.FORKED_REPO_URL }} BASE_REPO_URL: ${{ env.BASE_REPO_URL }} JOB_TYPE: ${{ inputs.job-type }} run: | : Build konflux-ui image ./pr_check.sh build shell: bash - name: Inject custom UI image into proxy deployment run: | : Replace default UI image with instrumented build for e2e coverage kubectl scale deployment/konflux-operator-controller-manager \ -n konflux-operator --replicas=0 kubectl wait --for=delete pod -l control-plane=controller-manager \ -n konflux-operator --timeout=2m kubectl patch deployment proxy -n konflux-ui --type='strategic' -p='{ "spec": { "template": { "spec": { "initContainers": [ { "name": "copy-static-content", "image": "localhost/test/test:konflux-ui", "imagePullPolicy": "IfNotPresent" } ] } } } }' if ! kubectl rollout status deployment/proxy -n konflux-ui --timeout=5m; then echo "::error::Proxy deployment rollout failed" kubectl describe deployment proxy -n konflux-ui kubectl get pods -n konflux-ui -l app=proxy -o wide for pod in $(kubectl get pods -n konflux-ui -l app=proxy -o name); do echo "=== $pod ===" kubectl describe "$pod" -n konflux-ui kubectl logs "$pod" -n konflux-ui --all-containers --previous 2>/dev/null || true done exit 1 fi shell: bash