diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cfb71aee..e0e495fc 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -129,8 +129,9 @@ variables: options: - "yes" - "no" - TESTS_PROJECT_URL: - description: "URL of the E2E-test Gitlab project API with project ID." + TESTS_BRANCH: + description: "Branch of E2E-tests on which the test pipeline is triggered" + value: "main" # please use the following set of variables with normalized names: DOMAIN: "${NAMESPACE}.${CLUSTER}.${BASE_DOMAIN}" ISTIO_DOMAIN: "${NAMESPACE}.istio.${CLUSTER}.${BASE_DOMAIN}" @@ -408,51 +409,50 @@ run-tests: when: "always" script: - | - COMPONENTS="login or portal or profile or navigation" - if [ "${DEPLOY_ALL_COMPONENTS}" != "no" ]; then - COMPONENTS="${COMPONENTS} or collabora or ics or jitsi or keycloak or nextcloud or openproject or ox or ucs \ - or xwiki" - else - [ "${DEPLOY_COLLABORA}" != "no" ] && COMPONENTS="${COMPONENTS} or collabora" - [ "${DEPLOY_ICS}" != "no" ] && COMPONENTS="${COMPONENTS} or ics" - [ "${DEPLOY_JITSI}" != "no" ] && COMPONENTS="${COMPONENTS} or jitsi" - [ "${DEPLOY_KEYCLOAK}" != "no" ] && COMPONENTS="${COMPONENTS} or keycloak" - [ "${DEPLOY_NEXTCLOUD}" != "no" ] && COMPONENTS="${COMPONENTS} or nextcloud" - [ "${DEPLOY_OPENPROJECT}" != "no" ] && COMPONENTS="${COMPONENTS} or openproject" - [ "${DEPLOY_OX}" != "no" ] && COMPONENTS="${COMPONENTS} or ox" - [ "${DEPLOY_UCS}" != "no" ] && COMPONENTS="${COMPONENTS} or ucs" - [ "${DEPLOY_XWIKI}" != "no" ] && COMPONENTS="${COMPONENTS} or xwiki" - fi - - echo "Gathering passwords from UCS container ..." UCS_CONTAINER_NAME=$( \ - kubectl -n ${NAMESPACE} get pods --no-headers \ - --selector 'app.kubernetes.io/instance=univention-corporate-container' \ - | awk '{print $1}' \ + kubectl -n ${NAMESPACE} get pods --no-headers --selector \ + 'app.kubernetes.io/instance=univention-corporate-container' \ + | grep Running \ + | awk '{print $1}' \ ) - echo "UCS_CONTAINER_NAME: ${UCS_CONTAINER_NAME}" DEFAULT_USER_PASSWORD=$( \ kubectl -n ${NAMESPACE} describe pod ${UCS_CONTAINER_NAME} \ | grep DEFAULT_ACCOUNT_USER_PASSWORD \ | awk '{print $2}' \ ) - DEFAULT_ADMIN_PASSWORD=$( \ + DEFAULT_ADMIN_PASSWORD=$( kubectl -n ${NAMESPACE} describe pod ${UCS_CONTAINER_NAME} \ | grep DEFAULT_ACCOUNT_ADMIN_PASSWORD \ | awk '{print $2}' \ ) - echo "triggering test pipeline ..." - curl -X POST \ - -F "ref=main" \ - -F "token=${CI_JOB_TOKEN}" \ - -F "variables[url]=https://portal.${DOMAIN}" \ - -F "variables[user_name]=${DEFAULT_USER_NAME}" \ - -F "variables[user_password]=${DEFAULT_USER_PASSWORD}" \ - -F "variables[admin_name]=${DEFAULT_ADMIN_NAME}" \ - -F "variables[admin_password]=${DEFAULT_ADMIN_PASSWORD}" \ - -F "variables[components]=\"${COMPONENTS}\"" \ - https://${TESTS_PROJECT_URL}/trigger/pipeline + curl --request POST \ + --header "Content-Type: application/json" \ + --data "{ \ + \"ref\": \"${TESTS_BRANCH}\", \ + \"token\": \"${CI_JOB_TOKEN}\", \ + \"variables\": { \ + \"url\": \"https://portal.${DOMAIN}\", \ + \"user_name\": \"${DEFAULT_USER_NAME}\", \ + \"user_password\": \"${DEFAULT_USER_PASSWORD}\", \ + \"admin_name\": \"${DEFAULT_ADMIN_NAME}\", \ + \"admin_password\": \"${DEFAULT_ADMIN_PASSWORD}\", \ + \"DEPLOY_ALL_COMPONENTS\": \"${DEPLOY_ALL_COMPONENTS}\", \ + \"DEPLOY_COLLABORA\": \"${DEPLOY_COLLABORA}\", \ + \"DEPLOY_ELEMENT\": \"${DEPLOY_ELEMENT}\", \ + \"DEPLOY_ICS\": \"${DEPLOY_ICS}\", \ + \"DEPLOY_JITSI\": \"${DEPLOY_JITSI}\", \ + \"DEPLOY_KEYCLOAK\": \"${DEPLOY_KEYCLOAK}\", \ + \"DEPLOY_NEXTCLOUD\": \"${DEPLOY_NEXTCLOUD}\", \ + \"DEPLOY_OPENPROJECT\": \"${DEPLOY_OPENPROJECT}\", \ + \"DEPLOY_OX\": \"${DEPLOY_OX}\", \ + \"DEPLOY_SERVICES\": \"${DEPLOY_SERVICES}\", \ + \"DEPLOY_UCS\": \"${DEPLOY_UCS}\", \ + \"DEPLOY_XWIKI\": \"${DEPLOY_XWIKI}\", \ + \"DEPLOY_PROVISIONING\": \"${DEPLOY_PROVISIONING}\" \ + } \ + }" \ + "https://${TESTS_PROJECT_URL}/trigger/pipeline" generate-release-assets: stage: "generate-release-assets" diff --git a/README.md b/README.md index c395c091..497eee9c 100644 --- a/README.md +++ b/README.md @@ -460,17 +460,14 @@ components we are going to cover various aspects: ## Tests -There is a frontend end-to-end test suite that can get triggered if the -deployment is performed via a Gitlab pipeline. +The gitlab-ci pipeline contains a job named `run-tests` that can trigger a test suite pipeline on another gitlab project. +The `DEPLOY_`-variables are used to determine which components should be tested. +In order for the trigger to work, the variable `TESTS_PROJECT_URL` has to be set on this gitlab project's CI variables +that can be found at `Settings` -> `CI/CD` -> `Variables`. The variable should have this format: +`/api/v4/projects/`. -Currently, the test suite is in progress to be published, so right now it is -only usable by project members. But that will change soon, and it could be used -to create custom tests and perform them after deployment. - -The deployment pipeline provides a variable named `TESTS_PROJECT_URL` that -points to the test pipeline residing in another Gitlab repository. At the end of -the deployment the test pipeline is triggered. Tests are just performed for -components that have been deployed prior. +If the branch of the test pipeline is not `main` this can be set with the .gitlab-ci.yml variable +`TESTS_BRANCH` while creating a new pipeline. # Footnotes