From 416eccd5dc0a2139a33393836c055e915f40956f Mon Sep 17 00:00:00 2001 From: Valeriy Svydenko Date: Thu, 28 Sep 2023 13:55:07 +0300 Subject: [PATCH] update github workflow Signed-off-by: Valeriy Svydenko --- .github/workflows/smoke-test-pr-check.yaml | 188 ++++++++------------- 1 file changed, 71 insertions(+), 117 deletions(-) diff --git a/.github/workflows/smoke-test-pr-check.yaml b/.github/workflows/smoke-test-pr-check.yaml index ed1143c9ac..893781fc74 100644 --- a/.github/workflows/smoke-test-pr-check.yaml +++ b/.github/workflows/smoke-test-pr-check.yaml @@ -10,131 +10,85 @@ # Red Hat, Inc. - initial API and implementation # -name: Smoke Test - -# Trigger the workflow on pull request +name: Empty workspace smoke test on: pull_request: paths-ignore: - '**/*.md' - - devfile.yaml + - .devfile.yaml + - LICENSE - '.ci/*' + env: - LOCAL_TEST_DIR: /tmp + USERSTORY: CloneGitRepoAPI + TS_API_TEST_KUBERNETES_COMMAND_LINE_TOOL: kubectl + DEPLOYMENT_TIMEOUT: 90s + PULL_POLICY: IfNotPresent + jobs: - smoke-test: + workspace-api-tests-on-minikube: runs-on: ubuntu-22.04 steps: - - name: Checkout source code - uses: actions/checkout@v3 - - - name: Build Plugin Registry image - run: | - BUILDER=docker SKIP_FORMAT=true SKIP_LINT=true SKIP_TEST=true ./build.sh --tag next - docker save -o /tmp/che-plugin-registry-next.tar quay.io/eclipse/che-plugin-registry:next - - - name: Display docker images - run: | - docker images - - - name: Cleanup docker images - run: | - docker system prune -af - - - name: Disk free - run: | - df -h - - - name: Start minikube - id: run-minikube - uses: che-incubator/setup-minikube-action@next - with: - minikube-version: v1.23.2 - - - name: Install chectl - run: bash <(curl -sL https://www.eclipse.org/che/chectl/) --channel=next - - - name: Deploy Che - run: | - # - # load che-plugin-registry image from /tmp/che-plugin-registry-next.tar - # - eval $(minikube docker-env) && docker load -i /tmp/che-plugin-registry-next.tar && rm /tmp/che-plugin-registry-next.tar - - # - # deploy Che - # - chectl server:deploy \ - --batch \ - --platform minikube \ - --k8spodwaittimeout=120000 \ - --k8spodreadytimeout=120000 \ - --che-operator-cr-patch-yaml "${GITHUB_WORKSPACE}/build/dev/github-minikube-checluster-patch.yaml" - - # - # apply patch - # - kubectl patch devworkspaceoperatorconfigs \ - -n eclipse-che devworkspace-config \ - --patch '{"config": {"workspace": {"imagePullPolicy": "IfNotPresent"}}}' \ - --type merge - - - name: Pull Universal Base Image - run: | - minikube image pull quay.io/devfile/universal-developer-image:ubi8-latest - - - name: Run Smoke test - run: | - docker run \ - --shm-size=2048m \ - -p 5920:5920 \ - --network="host" \ - -e TS_SELENIUM_LOAD_PAGE_TIMEOUT=60000 \ - -e TS_SELENIUM_USERNAME=che@eclipse.org \ - -e TS_SELENIUM_PASSWORD=admin \ - -e TS_SELENIUM_BASE_URL=https://$(kubectl get ingress che -n eclipse-che -o jsonpath='{.spec.rules[0].host}') \ - -e DELETE_WORKSPACE_ON_FAILED_TEST=true \ - -e TS_SELENIUM_START_WORKSPACE_TIMEOUT=120000 \ - -e NODE_TLS_REJECT_UNAUTHORIZED=0 \ - -e VIDEO_RECORDING=true \ - -e TS_SELENIUM_LOG_LEVEL=TRACE \ - -e TS_WAIT_LOADER_PRESENCE_TIMEOUT=120000 \ - -e TS_COMMON_DASHBOARD_WAIT_TIMEOUT=30000 \ - -v ${LOCAL_TEST_DIR}/tests/e2e/report:/tmp/e2e/report:Z \ - -v ${LOCAL_TEST_DIR}/tests/e2e/video:/tmp/ffmpeg_report:Z \ - -e USERSTORY=SmokeTest \ - -e TS_SELENIUM_VALUE_OPENSHIFT_OAUTH=false \ - -e TEST_REPO=https://github.com/che-incubator/quarkus-api-example?df=smoke-test.devfile.yaml \ - quay.io/mmusiien/che-e2e:smoke-test - - - name: Bump logs - if: always() - run: | - NS=admin-che - TARGET_DIR="/tmp/devworkspace-happy-path-artifacts/${NS}-info" - mkdir -p "$TARGET_DIR" - for POD in $(kubectl get pods -o name -n ${NS}); do - for CONTAINER in $(kubectl get -n ${NS} ${POD} -o jsonpath="{.spec.containers[*].name}"); do - echo "[INFO] Downloading logs $POD/$CONTAINER in $NS" - # container name includes `pod/` prefix. remove it - LOGS_FILE=$TARGET_DIR/$(echo ${POD}-${CONTAINER}.log | sed 's|pod/||g') - kubectl logs ${POD} -c ${CONTAINER} -n ${NS} > $LOGS_FILE || true - done - done - echo "[INFO] Bumping events in namespace ${NS}" - kubectl get events -n $NS > $TARGET_DIR/events.log || true + - name: Checkout + uses: actions/checkout@master + + - name: Cleanup build-in images + run: | + # remove build-in images from the VM because it is not used + docker rmi -f $(docker images -aq) + + - name: Start minikube cluster + id: run-minikube + uses: che-incubator/setup-minikube-action@next + with: + minikube-version: v1.31.0 + + - name: Install NodeJs + uses: actions/setup-node@v3 + + - name: Build image + run: | + eval $(minikube docker-env) + build.sh -t quay.io/eclipse/che-plugin-registry:next . + + - name: Checkout DWO + uses: actions/checkout@master + with: + repository: devfile/devworkspace-operator + path: devworkspace-operator + + - name: Setup cert manager + run: | + cd devworkspace-operator + make install_cert_manager + kubectl wait deployment -n cert-manager cert-manager --for condition=Available=True --timeout=$DEPLOYMENT_TIMEOUT + kubectl wait deployment -n cert-manager cert-manager-cainjector --for condition=Available=True --timeout=$DEPLOYMENT_TIMEOUT + kubectl wait deployment -n cert-manager cert-manager-webhook --for condition=Available=True --timeout=$DEPLOYMENT_TIMEOUT + + - name: Setup DWO + run: | + cd devworkspace-operator + make install + kubectl rollout status deployment -n devworkspace-controller devworkspace-controller-manager --timeout=$DEPLOYMENT_TIMEOUT + kubectl rollout status deployment -n devworkspace-controller devworkspace-webhook-server --timeout=$DEPLOYMENT_TIMEOUT + kubectl wait deployment -n devworkspace-controller devworkspace-webhook-server --for condition=Available=True --timeout=$DEPLOYMENT_TIMEOUT + kubectl wait deployment -n devworkspace-controller devworkspace-controller-manager --for condition=Available=True --timeout=$DEPLOYMENT_TIMEOUT + + - name: Check that plugin registry image is present in the image list + run: | + minikube image list --format table + + - name: Checkout tests codebase + uses: actions/checkout@master + with: + ref: api-test-with-clone-project-without-generating + repository: eclipse/che + path: che + + - name: Run Empty workspace smoke test + run: | + cd che/tests/e2e + npm i + npm run driver-less-test - - name: Store e2e artifacts - if: always() - uses: actions/upload-artifact@v3 - with: - name: e2e-artifacts - path: /tmp/tests - - - name: Store k8s logs - if: always() - uses: actions/upload-artifact@v3 - with: - name: k8s-logs - path: /tmp/devworkspace-happy-path-artifacts/admin-che-info