From 1170204ffe032720bae290a3d30eb3d7cf48c395 Mon Sep 17 00:00:00 2001 From: Daniel Skinstad Drabitzius Date: Mon, 3 Feb 2025 15:13:06 +0100 Subject: [PATCH] chore: trigger integration tests * Trigger integration tests * Install requirements for release_tool.py from the checked out branch instead of getting it from master Ticket: QA-828 Signed-off-by: Daniel Skinstad Drabitzius --- gitlab-pipeline/stage/build.yml | 3 +- gitlab-pipeline/stage/init.yml | 6 +- gitlab-pipeline/stage/trigger-integration.yml | 57 ++++++++++++++++--- 3 files changed, 51 insertions(+), 15 deletions(-) diff --git a/gitlab-pipeline/stage/build.yml b/gitlab-pipeline/stage/build.yml index e9616580..72c5844b 100644 --- a/gitlab-pipeline/stage/build.yml +++ b/gitlab-pipeline/stage/build.yml @@ -28,8 +28,6 @@ build:client:docker: - echo "failure" > /JOB_RESULT.txt # Dependencies - apk --update add python3 py-pip curl jq bash git xz - - wget https://raw.githubusercontent.com/mendersoftware/integration/master/extra/requirements.txt - - pip3 install --break-system-packages -r requirements.txt # Post job status - ${CI_PROJECT_DIR}/scripts/github_pull_request_status pending "Gitlab ${CI_JOB_NAME} started" "${CI_JOB_URL}" "${CI_JOB_NAME}/${INTEGRATION_REV}" # Prepare workspace @@ -41,6 +39,7 @@ build:client:docker: - xz -d /tmp/workspace.tar.xz - tar -xf /tmp/workspace.tar script: + - pip3 install --break-system-packages -r ${WORKSPACE}/integration/extra/requirements.txt - echo ${CI_REGISTRY_PASSWORD} | docker login --username ${CI_REGISTRY_USER} --password-stdin ${CI_REGISTRY} # First build mender's repo Docker image - docker_url=$($WORKSPACE/integration/extra/release_tool.py --map-name docker mender-client-docker docker_url) diff --git a/gitlab-pipeline/stage/init.yml b/gitlab-pipeline/stage/init.yml index 049b9ad5..56032119 100644 --- a/gitlab-pipeline/stage/init.yml +++ b/gitlab-pipeline/stage/init.yml @@ -19,10 +19,6 @@ init:workspace: - export WORKSPACE=$(realpath ${CI_PROJECT_DIR}/..) - apk --update add git openssh bash python3 curl py3-pip jq xz - # release_tool.py dependencies - - wget https://raw.githubusercontent.com/mendersoftware/integration/master/extra/requirements.txt - - pip3 install -r requirements.txt - # Post job status - ${CI_PROJECT_DIR}/scripts/github_pull_request_status pending "Gitlab ${CI_JOB_NAME} started" "${CI_JOB_URL}" "${CI_JOB_NAME}/${INTEGRATION_REV}" @@ -115,6 +111,8 @@ init:workspace: # should not need it. - ( - cd integration + # release_tool.py dependencies + - pip3 install -r extra/requirements.txt # Rename the branch we're on, so that it's not in the way for the # subsequent fetch. It's ok if this fails, it just means we're not on any # branch. diff --git a/gitlab-pipeline/stage/trigger-integration.yml b/gitlab-pipeline/stage/trigger-integration.yml index d45c0459..387a03a0 100644 --- a/gitlab-pipeline/stage/trigger-integration.yml +++ b/gitlab-pipeline/stage/trigger-integration.yml @@ -3,19 +3,58 @@ inherit: variables: false variables: - MENDER_CLIENT_TAG: mender-$INTEGRATION_REV - MENDER_GATEWAY_QEMU_TAG: mender-$INTEGRATION_REV - MENDER_GATEWAY_TAG: $MENDER_GATEWAY_REV + MENDER_REGISTRY: registry.gitlab.com + MENDER_DOCKER_REGISTRY: registry.gitlab.com + MENDER_CLIENT_REPOSITORY: northern.tech/mender + + MENDER_CLIENT_DOCKER_IMAGE: mender-qa + MENDER_CLIENT_DOCKER_TAG: ${CI_PIPELINE_ID}-mender-client-docker + + MENDER_CLIENT_DOCKER_ADDONS_IMAGE: mender-qa + MENDER_CLIENT_DOCKER_ADDONS_TAG: ${CI_PIPELINE_ID}-mender-client-docker-addons + + MENDER_CLIENT_QEMU_IMAGE: mender-qa + MENDER_CLIENT_QEMU_TAG: ${CI_PIPELINE_ID}-mender-client-qemu + + MENDER_CLIENT_QEMU_ROFS_IMAGE: mender-qa + MENDER_CLIENT_QEMU_ROFS_TAG: ${CI_PIPELINE_ID}-mender-client-qemu-rofs + + MENDER_GATEWAY_QEMU_COMMERCIAL_IMAGE: mender-qa + MENDER_GATEWAY_QEMU_COMMERCIAL_TAG: ${CI_PIPELINE_ID}-mender-qemu-rofs-commercial + + MENDER_MONITOR_QEMU_COMMERCIAL_IMAGE: mender-qa + MENDER_MONITOR_QEMU_COMMERCIAL_TAG: ${CI_PIPELINE_ID}-mender-monitor-qemu-commercial + + MENDER_QEMU_ROFS_COMMERCIAL_IMAGE: mender-qa + MENDER_QEMU_ROFS_COMMERCIAL_TAG: ${CI_PIPELINE_ID}-mender-qemu-rofs-commercial + + MENDER_GATEWAY_TAG: ${MENDER_GATEWAY_REV} + RUN_TESTS_FULL_INTEGRATION: "true" # TODO: remove these parallel 1 overrides whenever tests are stable CI_JOBS_IN_PARALLEL_INTEGRATION: 1 XDIST_JOBS_IN_PARALLEL_INTEGRATION: 1 + +trigger:generate-gitlab-integration-rev: + stage: trigger:integration + script: + # Convert INTEGRATION_REV on format `pull/0000/head` to `pr_0000` to specify which gitlab branch to trigger + - | + if [ "$INTEGRATION_REV" != "master" ]; then + GITLAB_INTEGRATION_REV=$(echo $INTEGRATION_REV | awk '{split($0, array, "/"); printf "pr_%s", array[2]}') + else + GITLAB_INTEGRATION_REV=master + fi + - echo "GITLAB_INTEGRATION_REV=$GITLAB_INTEGRATION_REV" >> gitlab_integration_rev.env + artifacts: + reports: + dotenv: gitlab_integration_rev.env + +trigger:integration-tests: + extends: .template:trigger:integration-tests + needs: ["trigger:generate-gitlab-integration-rev", "build:client:qemu"] + when: always trigger: project: Northern.tech/Mender/integration - branch: $INTEGRATION_REV + branch: $GITLAB_INTEGRATION_REV strategy: depend - -trigger:integration-tests:manual: - needs: [] - when: manual - extends: .template:trigger:integration-tests