From 908593c4c4bf93fa9fe45e15ce328fd65e9ceb71 Mon Sep 17 00:00:00 2001 From: Manuel Zedel Date: Tue, 10 Sep 2024 15:47:51 +0200 Subject: [PATCH 01/10] ci: made docker job reuse slightly easier + unified backend job naming Ticket: None Changelog: None Signed-off-by: Manuel Zedel --- .gitlab-ci.yml | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6fbacbdc..c9b7552c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -40,31 +40,23 @@ stages: - mkdir -p $HOME/.docker && echo $DOCKER_AUTH_CONFIG > $HOME/.docker/config.json - docker login --username $CI_REGISTRY_USER --password $CI_REGISTRY_PASSWORD $CI_REGISTRY -build:backend:docker: +.template:build:docker: stage: build needs: [] rules: - if: '$CI_COMMIT_REF_PROTECTED == "true"' when: always - - changes: - paths: ["backend/**/*"] - compare_to: "${RULES_CHANGES_COMPARE_TO_REF}" - when: always tags: - hetzner-amd-beefy - image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/docker:${DOCKER_VERSION}-cli services: - name: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/docker:${DOCKER_VERSION}-dind alias: docker - variables: DOCKER_BUILDARGS: "--push" - before_script: - apk add make bash git - *dind-login - script: # NOTE: If we're running on a PR, do not build multiplatform - test "$CI_COMMIT_REF_PROTECTED" != "true" && unset DOCKER_PLATFORM - if test -n "${DOCKER_PLATFORM}"; then @@ -73,6 +65,15 @@ build:backend:docker: export DOCKER_BUILDARGS="${DOCKER_BUILDARGS} --builder=ci-builder"; unset DOCKER_HOST; fi + +build:backend:docker: + extends: .template:build:docker + rules: + - changes: + paths: ["backend/**/*"] + compare_to: "${RULES_CHANGES_COMPARE_TO_REF}" + when: always + script: # FIXME: Only exporting deployments build stage to run unit tests # We're assuming the images have consistent GOTOOLCHAIN. # Will be fixed once we optimize to template based pipeline. @@ -185,7 +186,7 @@ test:backend:integration: reports: junit: backend/results_integration_*.xml -publish:docker:backend: +publish:backend:docker: stage: publish image: name: quay.io/skopeo/stable:${SKOPEO_VERSION} From 71b4124eca91104c1b3278afa6ba62634251c66d Mon Sep 17 00:00:00 2001 From: Manuel Zedel Date: Mon, 2 Sep 2024 10:04:48 +0200 Subject: [PATCH 02/10] ci: adapted gui jobs to changed repo setup & aligned e2e test setup Ticket: None Changelog: None Signed-off-by: Manuel Zedel --- .gitlab-ci.yml | 138 ++++- frontend/.gitlab-ci.yml | 545 ------------------ frontend/package.json | 8 +- frontend/pipeline.yml | 333 +++++++++++ .../docker-compose.e2e-tests.enterprise.yml | 53 +- .../e2e_tests/docker-compose.e2e-tests.yml | 63 +- frontend/tests/e2e_tests/run | 32 +- frontend/tests/e2e_tests/utils/commands.ts | 4 +- 8 files changed, 568 insertions(+), 608 deletions(-) delete mode 100644 frontend/.gitlab-ci.yml create mode 100644 frontend/pipeline.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c9b7552c..8407cea9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -27,19 +27,39 @@ variables: include: - project: "Northern.tech/Mender/mendertesting" - file: ".gitlab-ci-check-commits.yml" - - project: "Northern.tech/Mender/mendertesting" - file: ".gitlab-ci-github-status-updates.yml" + file: + - ".gitlab-ci-check-commits.yml" + - ".gitlab-ci-github-status-updates.yml" + - local: "/frontend/pipeline.yml" stages: - build - test - publish + - version-bump + - test-deploy .dind-login: &dind-login - mkdir -p $HOME/.docker && echo $DOCKER_AUTH_CONFIG > $HOME/.docker/config.json - docker login --username $CI_REGISTRY_USER --password $CI_REGISTRY_PASSWORD $CI_REGISTRY +test-prep:staging: + stage: pre-test + image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/docker + rules: + - if: $CI_COMMIT_BRANCH == "staging" + services: + - name: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/docker:dind + alias: docker + script: + - docker run --rm --entrypoint "/bin/sh" -v $(pwd):/extract mendersoftware/mender-stress-test-client:master -c "cp mender-stress-test-client /extract/" + artifacts: + paths: + - mender-stress-test-client + expire_in: 30 days + tags: + - hetzner-amd-beefy + .template:build:docker: stage: build needs: [] @@ -212,3 +232,115 @@ publish:backend:docker: make -C backend -j 4 docker-publish NOASK=y \ MENDER_PUBLISH_TAG=latest fi + +coveralls:done: + image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/curlimages/curl + stage: .post + script: + - curl "https://coveralls.io/webhook?repo_token=$COVERALLS_REPO_TOKEN" -d "payload[build_num]=$CI_PIPELINE_ID&payload[status]=done" + tags: + - hetzner-amd-beefy + +# +# Mender Helm Rolling release +# +.trigger:mender-helm-version-bump: + stage: version-bump + allow_failure: true + trigger: + project: Northern.tech/Mender/mender-helm + strategy: depend + resource_group: mender-helm + variables: + SYNC_CONTAINER_NAME: $CONTAINER_NAME + SYNC_IMAGE_TAG: $DOCKER_PUBLISH_COMMIT_TAG + CONTAINER: gui + DOCKER_PUBLISH_COMMIT_TAG: ${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHA} + GITHUB_HELM_REPO: "github.com/mendersoftware/mender-helm.git" + CHART_DIR: "mender" + +trigger:mender-helm-version-bump:staging: + extends: + - .trigger:mender-helm-version-bump + rules: + - if: $CI_COMMIT_BRANCH =~ /^(staging)$/ + variables: + SYNC_ENVIRONMENT: staging + HELM_PATCH_VERSION: ${CI_PIPELINE_ID}-staging # pre-release version for trigger staging only deploy + +trigger:mender-helm-version-bump:prod: + extends: + - .trigger:mender-helm-version-bump + rules: + - if: "$CI_COMMIT_TAG =~ /^saas-[a-zA-Z0-9.]+$/" + when: manual + variables: + SYNC_ENVIRONMENT: prod + HELM_PATCH_VERSION: ${CI_PIPELINE_ID} + DOCKER_PUBLISH_COMMIT_TAG: ${CI_COMMIT_REF_NAME} + +# +# Test Staging Deployment +# +.template:test:staging-deployment: + image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/mendersoftware/mender-test-containers:gui-e2e-testing + stage: test-deploy + services: + - name: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/docker:dind + alias: docker + cache: + key: + files: + - frontend/tests/e2e_tests/package-lock.json + paths: + - frontend/.npm/ + needs: + - job: trigger:mender-helm-version-bump:staging + artifacts: false + - job: test:prep + artifacts: true + variables: + CI: 1 + DEVICE_TYPE: qemux86-64 + TEST_ENVIRONMENT: staging + before_script: + - curl -fsSL https://get.docker.com | sh + - mv mender-stress-test-client frontend/tests/e2e_tests/ && cd frontend/tests/e2e_tests + - docker pull mendersoftware/mender-client-docker-addons:mender-3.6.x + - npm ci --cache .npm --prefer-offline + script: + - npm run test + after_script: + - cd $CI_PROJECT_DIR + - mkdir logs && cp /root/frontend/tests/e2e_tests/.npm/_logs/* logs/ + only: + - staging + artifacts: + expire_in: 2w + paths: + - frontend/tests/e2e_tests/test-results + - logs + when: always + tags: + - hetzner-amd-beefy-privileged + +test:staging-deployment:chrome: + extends: .template:test:staging-deployment + script: + - npm run test + when: delayed + start_in: 1 minutes + +test:staging-deployment:firefox: + extends: .template:test:staging-deployment + script: + - npm run test -- --browser=firefox + when: delayed + start_in: 25 minutes + +test:staging-deployment:webkit: + extends: .template:test:staging-deployment + script: + - npm run test -- --browser=webkit + when: delayed + start_in: 15 minutes diff --git a/frontend/.gitlab-ci.yml b/frontend/.gitlab-ci.yml deleted file mode 100644 index ab30ab06..00000000 --- a/frontend/.gitlab-ci.yml +++ /dev/null @@ -1,545 +0,0 @@ -image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/node:22-alpine - -stages: - - pre-test - - test - - build - - e2e-test - - publish - - version-bump - - test-deploy - -variables: - DOCKER_REPOSITORY: mendersoftware/gui - DOCS_VERSION: development - MULTIPLATFORM_BUILD: 'true' - MULTIPLATFORM_PLATFORMS: 'linux/amd64,linux/arm64' - -include: - - project: 'Northern.tech/Mender/mendertesting' - file: '.gitlab-ci-check-commits.yml' - - project: 'Northern.tech/Mender/mendertesting' - file: '.gitlab-ci-check-docker-build.yml' - - project: 'Northern.tech/Mender/mendertesting' - file: '.gitlab-ci-github-status-updates.yml' - - project: 'Northern.tech/Mender/mender-qa' - file: 'gitlab-pipeline/internal-variables.yml' - -.export_docker_vars: &export_docker_vars | - DOCKER_BUILD_TAG=${CI_COMMIT_REF_SLUG:-local} - DOCKER_BUILD_SERVICE_IMAGE=${DOCKER_REPOSITORY}:${DOCKER_BUILD_TAG} - DOCKER_PUBLISH_TAG=${CI_COMMIT_REF_NAME} - DOCKER_PUBLISH_COMMIT_TAG=${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHA} - -.dind-login: &dind-login - - mkdir -p $HOME/.docker && echo $DOCKER_AUTH_CONFIG > $HOME/.docker/config.json - -test:lint: - stage: test - rules: - - if: $CI_COMMIT_REF_NAME !~ /^(staging|saas-[a-zA-Z0-9.]+)$/ - needs: [] - cache: - key: - files: - - package-lock.json - paths: - - .npm/ - script: - - npm ci --cache .npm --prefer-offline - - cd tests/e2e_tests && npm ci && cd ../.. - - npm run lint - tags: - - hetzner-amd-beefy - -test:types: - stage: test - image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/python:3.11 - needs: [] - rules: - - if: $CI_PIPELINE_SOURCE == "schedule" - when: always - - when: manual - before_script: - # Prepare SSH key - - eval $(ssh-agent -s) - - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null - - mkdir -p ~/.ssh - - chmod 700 ~/.ssh - - ssh-keyscan github.com >> ~/.ssh/known_hosts - # Configure git - - git config --global user.email "mender@northern.tech" - - git config --global user.name "Mender Test Bot" - # install hub cli + deno + release tool dependency - - apt-get update && apt-get install hub -qqy - - curl -fsSL https://deno.land/x/install/install.sh | sh && export PATH="/root/.deno/bin:$PATH" - - wget https://raw.githubusercontent.com/mendersoftware/integration/master/extra/requirements.txt - - pip3 install -r requirements.txt - # get enterprise api specs from all the repos, based on mender-api-docs tooling - - export GITHUB_TOKEN=${GITHUB_BOT_TOKEN_REPO_FULL} - - cd scripts - - 'wget --header "Authorization: token $GITHUB_TOKEN" https://raw.githubusercontent.com/mendersoftware/mender-api-docs/master/versions.template.js' - - cd typeGeneration - - 'wget --header "Authorization: token $GITHUB_TOKEN" https://raw.githubusercontent.com/mendersoftware/mender-api-docs/master/specs/download.sh' - - chmod +x ./download.sh && TARGET=specs ./download.sh - script: - - deno run --allow-read --allow-write --allow-net convert.js - - deno fmt generated/models - - mkdir -p ../../src/js/api/types && mv -f generated/models/* ../../src/js/api/types - - cd ../.. - - git checkout -b update-types-$(date +%s) - - 'git add src/js/api/types && git commit --signoff -m "chore: Types update"' - - git remote add mendersoftware git@github.com:mendersoftware/gui.git - - 'hub pull-request --push --base mendersoftware:master --message "chore: Types update" --message "keeping types aligned"' - allow_failure: true - artifacts: - expire_in: 2w - paths: - - scripts/typeGeneration - - src/js/api/types - -test:licenses: - image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/denoland/deno:alpine-1.38.0 - stage: test - rules: - - if: $CI_COMMIT_REF_NAME !~ /^(staging|saas-[a-zA-Z0-9.]+)$/ - needs: [] - cache: - key: - files: - - package-lock.json - paths: - - .npm/ - before_script: - - apk add --no-cache nodejs npm - - npm ci - script: - - deno run --allow-env --allow-read --allow-sys tests/licenses/licenseCheck.ts - tags: - - hetzner-amd-beefy - -.template:test:acceptance: - stage: e2e-test - image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/tiangolo/docker-with-compose - needs: - - job: build:docker-multiplatform - artifacts: true - services: - - name: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/docker:dind - alias: docker - before_script: - - apk add --no-cache bash git jq wget - - git clone --no-tags --depth=1 --single-branch https://github.com/mendersoftware/integration.git - - docker pull ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID} - - docker tag ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID} ${DOCKER_REPOSITORY}:pr - artifacts: - expire_in: 2w - paths: - - coverage - - screenshots - - logs - - junit - reports: - junit: - - junit/results.xml - when: always - tags: - - mender-qa-worker-generic-light - -test:acceptance: - extends: .template:test:acceptance - rules: - - if: $CI_COMMIT_REF_NAME !~ /^(staging|saas-[a-zA-Z0-9.]+)$/ - script: - - GUI_REPOSITORY=$(pwd) INTEGRATION_PATH=$(pwd)/integration ./tests/e2e_tests/run - - docker rmi $DOCKER_REPOSITORY:pr - -test:acceptance:enterprise: - extends: .template:test:acceptance - rules: - - if: $CI_COMMIT_BRANCH == "master" - variables: - TEST_ENVIRONMENT: enterprise - script: - - if [ -n "$REGISTRY_MENDER_IO_USERNAME" ]; then - - docker login -u $REGISTRY_MENDER_IO_USERNAME -p $REGISTRY_MENDER_IO_PASSWORD registry.mender.io - - fi - - GUI_REPOSITORY=$(pwd) INTEGRATION_PATH=$(pwd)/integration ./tests/e2e_tests/run --enterprise - - docker rmi $DOCKER_REPOSITORY:pr - -test:acceptance:unprivileged: - extends: .template:test:acceptance - rules: - - if: $CI_COMMIT_BRANCH == "master" - before_script: - - apk add --no-cache bash git jq wget - - git clone --no-tags --depth=1 --single-branch https://github.com/mendersoftware/integration.git - - docker pull ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID}-unprivileged - - docker tag ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID}-unprivileged ${DOCKER_REPOSITORY}:pr - script: - - GUI_REPOSITORY=$(pwd) INTEGRATION_PATH=$(pwd)/integration ./tests/e2e_tests/run --unprivileged - - docker rmi $DOCKER_REPOSITORY:pr - -test:acceptance:enterprise-unprivileged: - extends: .template:test:acceptance - rules: - - if: $CI_COMMIT_BRANCH == "master" - variables: - TEST_ENVIRONMENT: enterprise - before_script: - - apk add --no-cache bash git jq wget - - git clone --no-tags --depth=1 --single-branch https://github.com/mendersoftware/integration.git - - docker pull ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID}-unprivileged - - docker tag ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID}-unprivileged ${DOCKER_REPOSITORY}:pr - script: - - if [ -n "$REGISTRY_MENDER_IO_USERNAME" ]; then - - docker login -u $REGISTRY_MENDER_IO_USERNAME -p $REGISTRY_MENDER_IO_PASSWORD registry.mender.io - - fi - - GUI_REPOSITORY=$(pwd) INTEGRATION_PATH=$(pwd)/integration ./tests/e2e_tests/run --enterprise --unprivileged - - docker rmi $DOCKER_REPOSITORY:pr - -test:unit: - stage: test - rules: - - if: $CI_COMMIT_REF_NAME !~ /^(staging|saas-[a-zA-Z0-9.]+)$/ - needs: [] - cache: - key: - files: - - package-lock.json - paths: - - .npm/ - script: - - npm i -g npm - - npm ci --cache .npm --prefer-offline - - npm run test -- --ci --maxWorkers=2 --reporters=default --reporters=jest-junit - after_script: - - mkdir logs && cp .npm/_logs/* logs/ - artifacts: - expire_in: 2w - paths: - - coverage - - logs - reports: - junit: junit.xml - when: always - tags: - - hetzner-amd-beefy - -test:docs-links: - stage: test - needs: [] - except: - - /^(staging|saas-[a-zA-Z0-9.]+)$/ - before_script: - - apk add --no-cache curl - script: - - links=$(grep -r docs.mender.io src/ | grep -v snapshots | sed -e 's,\${docsVersion},'${DOCS_VERSION}'/,g' | sed -e 's,\${path},''/,g' | egrep -o 'https?://[^ `"]+' | sort | uniq) - - error=0 - - for url in $links; do - - if ! curl --output /dev/null --silent --head --fail $url; then - - error=1 - - echo "[ko] $url" - - else - - echo "[ok] $url" - - fi - - done - - if [ $error -gt 0 ]; then - - exit 1 - - fi - tags: - - hetzner-amd-beefy - -test:docs-links:hosted: - extends: test:docs-links - only: - - /^(staging|saas-[a-zA-Z0-9.]+)$/ - except: [] - variables: - DOCS_VERSION: hosted - -test:prep: - stage: pre-test - image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/docker - rules: - - if: $CI_COMMIT_BRANCH == "staging" - services: - - name: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/docker:dind - alias: docker - script: - - docker run --rm --entrypoint "/bin/sh" -v $(pwd):/extract mendersoftware/mender-stress-test-client:master -c "cp mender-stress-test-client /extract/" - artifacts: - paths: - - mender-stress-test-client - expire_in: 30 days - tags: - - hetzner-amd-beefy - -# excludes non multiplatform build job -build:docker: - rules: - - when: never - -build:docker-multiplatform: - # by default alvaldi-gui uses the unprivileged mode - script: - - if [[ ! $CI_COMMIT_REF_NAME =~ "(main|master|staging|production|feature-.+|\d+\.\d+\..+)" ]]; then - - export MULTIPLATFORM_PLATFORMS='linux/amd64' - - fi - - echo "building ${CI_PROJECT_NAME} for ${DOCKER_BUILD_SERVICE_IMAGE}" - - docker context create builder - - docker buildx create builder --use --driver-opt network=host --buildkitd-flags '--debug --allow-insecure-entitlement network.host' - # needed for the license generation step - - docker buildx build - --tag ${DOCKER_REPOSITORY}:base - --target base - --output type=docker,dest=baseImage.tar - ${DOCKER_DIR:-.} - # build production target - - docker buildx build - --cache-to type=registry,ref=${CI_REGISTRY_IMAGE}:ci_cache,mode=max - --cache-from type=registry,ref=${CI_REGISTRY_IMAGE}:ci_cache - --tag ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID} - --file ${DOCKER_DIR:-.}/${DOCKERFILE:-Dockerfile} - --build-arg GIT_COMMIT_TAG="${DOCKER_PUBLISH_COMMIT_TAG}" - --platform $MULTIPLATFORM_PLATFORMS - --provenance false - --target production - --push - ${DOCKER_DIR:-.} - # build unprivileged target - - docker buildx build - --cache-to type=registry,ref=${CI_REGISTRY_IMAGE}:ci_cache,mode=max - --cache-from type=registry,ref=${CI_REGISTRY_IMAGE}:ci_cache - --tag ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID}-unprivileged - --file ${DOCKER_DIR:-.}/${DOCKERFILE:-Dockerfile} - --build-arg GIT_COMMIT_TAG="${DOCKER_PUBLISH_COMMIT_TAG}" - --platform $MULTIPLATFORM_PLATFORMS - --provenance false - --target unprivileged - --push - ${DOCKER_DIR:-.} - artifacts: - paths: - - baseImage.tar - -.template:test:staging-deployment: - image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/mendersoftware/mender-test-containers:gui-e2e-testing - stage: test-deploy - services: - - name: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/docker:dind - alias: docker - cache: - key: - files: - - tests/e2e_tests/package-lock.json - paths: - - .npm/ - needs: - - job: trigger:mender-helm-version-bump:staging - artifacts: false - - job: test:prep - artifacts: true - variables: - CI: 1 - DEVICE_TYPE: qemux86-64 - TEST_ENVIRONMENT: staging - before_script: - - curl -fsSL https://get.docker.com | sh - - mv mender-stress-test-client tests/e2e_tests/ && cd tests/e2e_tests - - docker pull mendersoftware/mender-client-docker-addons:mender-3.6.x - - npm ci --cache .npm --prefer-offline - script: - - npm run test - after_script: - - cd $CI_PROJECT_DIR - - mkdir logs && cp /root/.npm/_logs/* logs/ - only: - - staging - artifacts: - expire_in: 2w - paths: - - tests/e2e_tests/test-results - - logs - when: always - tags: - - hetzner-amd-beefy-privileged - -test:staging-deployment:chrome: - extends: .template:test:staging-deployment - script: - - npm run test - when: delayed - start_in: 1 minutes - -test:staging-deployment:firefox: - extends: .template:test:staging-deployment - script: - - npm run test -- --browser=firefox - when: delayed - start_in: 25 minutes - -test:staging-deployment:webkit: - extends: .template:test:staging-deployment - script: - - npm run test -- --browser=webkit - when: delayed - start_in: 15 minutes - -.template:publish:tests: - stage: publish - before_script: - - export CI_BUILD_REF=${CI_COMMIT_SHA} - - export CI_BUILD_REF_NAME=${CI_COMMIT_REF_NAME} - - export CI_MERGE_REQUEST_IID=${CI_COMMIT_BRANCH#pr_} - - export COVERALLS_PARALLEL=true - - export COVERALLS_SERVICE_JOB_ID=${CI_JOB_ID} - - export COVERALLS_SERVICE_NUMBER=${CI_PIPELINE_ID} - - apk add --no-cache git - - npm i -g coveralls - tags: - - hetzner-amd-beefy - -publish:tests: - extends: .template:publish:tests - rules: - - if: $CI_COMMIT_REF_NAME !~ /^(staging|saas-[a-zA-Z0-9.]+)$/ - needs: - - test:unit - script: - - export COVERALLS_SERVICE_JOB_NUMBER=unittests - - export COVERALLS_FLAG_NAME=unittests - - coveralls < coverage/lcov.info - -publish:e2e-tests: - extends: .template:publish:tests - rules: - - if: $CI_COMMIT_BRANCH == "master" - needs: - - test:acceptance:enterprise - script: - - export COVERALLS_SERVICE_JOB_NUMBER=e2etests - - export COVERALLS_FLAG_NAME=e2etests - - sed -i -re 's/(^[SF:]+[../]+)(.*)$/SF:\2/' coverage/lcov.info - - coveralls < coverage/lcov.info - -publish:disclaimer: - stage: publish - image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/docker:git - needs: - - job: build:docker-multiplatform - artifacts: true - services: - - name: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/docker:dind - alias: docker - variables: - DOCKER_BUILDKIT: 1 - before_script: - - *dind-login - script: - - docker load -i baseImage.tar - - docker build -t disclaimer --target disclaim . - - docker run --rm --entrypoint "/bin/sh" -v $(pwd):/extract disclaimer -c "cp disclaimer.txt /extract/" - - docker image rm disclaimer - artifacts: - expire_in: 2w - paths: - - disclaimer.txt - rules: - - if: $CI_COMMIT_REF_NAME =~ /^(master|staging|[0-9]+\.[0-9]+\.x)$/ - tags: - - hetzner-amd-beefy - -# excludes non multiplatform build job -publish:image: - rules: - - when: never - -# excludes non multiplatform job -publish:image:saas: - rules: - - when: never - -# excludes non multiplatform job -publish:image:mender: - rules: - - when: never - -publish:image-multiplatform:unprivileged: - extends: publish:image-multiplatform - variables: - GITLAB_REGISTRY_TAG: '${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID}-unprivileged' - before_script: - - !reference [publish:image:saas, before_script] - - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - - *export_docker_vars - - DOCKER_PUBLISH_COMMIT_TAG=${CI_COMMIT_REF_NAME}-unprivileged_${CI_COMMIT_SHA} - - DOCKER_PUBLISH_TAG=${CI_COMMIT_REF_NAME}-unprivileged - - SERVICE_IMAGE=${DOCKER_REPOSITORY}:${DOCKER_PUBLISH_TAG} - -publish:image-multiplatform:mender-unprivileged: - extends: publish:image-multiplatform:mender - variables: - GITLAB_REGISTRY_TAG: '${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID}-unprivileged' - script: - # Publish the image for all releases - - for version in $integration_versions; do - - regctl image copy ${GITLAB_REGISTRY_TAG} ${DOCKER_REPOSITORY}:mender-${version}-unprivileged - - regctl image copy ${GITLAB_REGISTRY_TAG} ${DOCKER_REPOSITORY}:mender-${version}-unprivileged_${CI_COMMIT_SHA} - - done - - echo "PUBLISH_IMAGE_DIGEST=${DOCKER_REPOSITORY}@$(regctl image digest ${DOCKER_REPOSITORY}:mender-${version}-unprivileged)" >> publish.env - -publish:image-multiplatform:saas-unprivileged: - extends: publish:image-multiplatform:saas - before_script: - - !reference [publish:image:saas, before_script] - - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - - *export_docker_vars - - DOCKER_PUBLISH_TAG=${CI_COMMIT_REF_NAME}-unprivileged - - SERVICE_IMAGE=${DOCKER_REPOSITORY}:${DOCKER_PUBLISH_TAG} - -coveralls:done: - image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/curlimages/curl - stage: .post - script: - - curl "https://coveralls.io/webhook?repo_token=$COVERALLS_REPO_TOKEN" -d "payload[build_num]=$CI_PIPELINE_ID&payload[status]=done" - tags: - - hetzner-amd-beefy - -# -# Mender Helm Rolling release -# -.trigger:mender-helm-version-bump: - stage: version-bump - allow_failure: true - trigger: - project: Northern.tech/Mender/mender-helm - strategy: depend - resource_group: mender-helm - variables: - SYNC_CONTAINER_NAME: $CONTAINER_NAME - SYNC_IMAGE_TAG: $DOCKER_PUBLISH_COMMIT_TAG - CONTAINER: gui - DOCKER_PUBLISH_COMMIT_TAG: ${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHA} - GITHUB_HELM_REPO: 'github.com/mendersoftware/mender-helm.git' - CHART_DIR: 'mender' - -trigger:mender-helm-version-bump:staging: - extends: - - .trigger:mender-helm-version-bump - rules: - - if: $CI_COMMIT_BRANCH =~ /^(staging)$/ - variables: - SYNC_ENVIRONMENT: staging - HELM_PATCH_VERSION: ${CI_PIPELINE_ID}-staging # pre-release version for trigger staging only deploy - -trigger:mender-helm-version-bump:prod: - extends: - - .trigger:mender-helm-version-bump - rules: - - if: '$CI_COMMIT_TAG =~ /^saas-[a-zA-Z0-9.]+$/' - when: manual - variables: - SYNC_ENVIRONMENT: prod - HELM_PATCH_VERSION: ${CI_PIPELINE_ID} - DOCKER_PUBLISH_COMMIT_TAG: ${CI_COMMIT_REF_NAME} diff --git a/frontend/package.json b/frontend/package.json index bb78abdb..fbecdf63 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -144,8 +144,12 @@ "/themes/" ], "coverageReporters": [ - "lcov", - "cobertura", + [ + "lcov", + { + "projectRoot": "../" + } + ], "text" ], "setupFiles": [ diff --git a/frontend/pipeline.yml b/frontend/pipeline.yml new file mode 100644 index 00000000..5822d95c --- /dev/null +++ b/frontend/pipeline.yml @@ -0,0 +1,333 @@ +variables: + NODE_IMAGE: + value: 'node:22-alpine' + description: 'Node version to use for building and testing' + FRONTEND_REPOSITORY: mendersoftware/gui + DOCS_VERSION: development + +test:frontend:lint: + stage: test + image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/${NODE_IMAGE} + rules: + - if: $CI_COMMIT_REF_NAME !~ /^(staging|saas-[a-zA-Z0-9.]+)$/ + - changes: + paths: ['frontend/**/*.m?[jt]sx?'] + compare_to: '${RULES_CHANGES_COMPARE_TO_REF}' + needs: [] + cache: + key: + files: + - package-lock.json + paths: + - frontend/.npm/ + script: + - cd frontend + - npm ci --cache .npm --prefer-offline + - cd tests/e2e_tests && npm ci && cd ../.. + - npm run lint + tags: + - hetzner-amd-beefy + +test:frontend:types: + stage: pre-test + image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/debian:12-slim + needs: [] + rules: + - if: $CI_PIPELINE_SOURCE == "schedule" + when: always + - when: manual + before_script: + # Prepare SSH key + - eval $(ssh-agent -s) + - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null + - mkdir -p ~/.ssh + - chmod 700 ~/.ssh + - ssh-keyscan github.com >> ~/.ssh/known_hosts + # Configure git + - git config --global user.email "mender@northern.tech" + - git config --global user.name "Mender Test Bot" + # install hub cli + deno + - apt-get update && apt-get install curl hub unzip -qqy + - curl -fsSL https://deno.land/install.sh | DENO_INSTALL=/usr/local sh + # get enterprise api specs from all the repos, based on mender-api-docs tooling + - export GITHUB_TOKEN=${GITHUB_BOT_TOKEN_REPO_FULL} + - cd scripts + - 'wget --header "Authorization: token $GITHUB_TOKEN" https://raw.githubusercontent.com/mendersoftware/mender-api-docs/master/versions.template.js' + - cd typeGeneration + script: + - deno run --allow-read --allow-write --allow-net convert.js + - deno fmt generated/models + - mkdir -p ../../src/js/api/types && mv -f generated/models/* ../../src/js/api/types + - cd ../.. + - git checkout -b update-types-$(date +%s) + - 'git add src/js/api/types && git commit --signoff -m "chore: Types update"' + - git remote add mendersoftware git@github.com:mendersoftware/mender-server.git + - 'hub pull-request --push --base mendersoftware:main --message "chore: Types update" --message "keeping types aligned"' + allow_failure: true + artifacts: + expire_in: 2w + paths: + - frontend/scripts/typeGeneration + - frontend/src/js/api/types + +test:frontend:licenses: + image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/denoland/deno:alpine-1.38.0 + stage: test + rules: + - if: $CI_COMMIT_REF_NAME !~ /^(staging|saas-[a-zA-Z0-9.]+)$/ + - changes: + paths: ['frontend/**/*'] + compare_to: '${RULES_CHANGES_COMPARE_TO_REF}' + needs: [] + cache: + key: + files: + - package-lock.json + paths: + - frontend/.npm/ + before_script: + - cd frontend + - apk add --no-cache nodejs npm + - npm ci + script: + - deno run --allow-env --allow-read --allow-sys tests/licenses/licenseCheck.ts + tags: + - hetzner-amd-beefy + +test:frontend:unit: + stage: test + image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/${NODE_IMAGE} + rules: + - if: $CI_COMMIT_REF_NAME !~ /^(staging|saas-[a-zA-Z0-9.]+)$/ + - changes: + paths: ['frontend/**/*'] + compare_to: '${RULES_CHANGES_COMPARE_TO_REF}' + needs: [] + cache: + key: + files: + - package-lock.json + paths: + - frontend/.npm/ + script: + - cd frontend + - npm ci --cache .npm --prefer-offline + - npm run test -- --ci --maxWorkers=8 --reporters=default --reporters=jest-junit + after_script: + - mkdir logs && cp .npm/_logs/* logs/ + artifacts: + expire_in: 2w + paths: + - frontend/coverage + - frontend/logs + reports: + junit: frontend/junit.xml + when: always + tags: + - hetzner-amd-beefy + +test:frontend:docs-links: + stage: test + image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/${NODE_IMAGE} + rules: + - if: $CI_COMMIT_REF_NAME !~ /^(staging|saas-[a-zA-Z0-9.]+)$/ + - changes: + paths: ['frontend/**/*'] + compare_to: '${RULES_CHANGES_COMPARE_TO_REF}' + needs: [] + before_script: + - apk add --no-cache curl + - cd frontend + script: + - links=$(grep -r docs.mender.io src/ | grep -v snapshots | sed -e 's,\${docsVersion},'${DOCS_VERSION}'/,g' | sed -e 's,\${path},''/,g' | egrep -o 'https?://[^ `"]+' | sort | uniq) + - error=0 + - | + for url in $links; do + if ! curl --output /dev/null --silent --head --fail $url; then + error=1 + echo "[ko] $url" + else + echo "[ok] $url" + fi + done + if [ $error -gt 0 ]; then + exit 1 + fi + tags: + - hetzner-amd-beefy + +test:frontend:docs-links:hosted: + extends: test:frontend:docs-links + rules: + - if: $CI_COMMIT_REF_NAME =~ /^(staging|saas-[a-zA-Z0-9.]+)$/ + variables: + DOCS_VERSION: hosted + +build:frontend:docker: + extends: .template:build:docker + rules: + - changes: + paths: ['frontend/**/*'] + compare_to: '${RULES_CHANGES_COMPARE_TO_REF}' + when: always + script: + - cd frontend + - docker context create ci; + - docker buildx create --name gui-builder --driver=docker-container ci + # needed for the license generation step + - docker build + --target base + --builder=gui-builder + --tag ${CI_REGISTRY_IMAGE}:frontend-base-${CI_PIPELINE_ID} + --push + . + # build production target + - docker build + --tag ${CI_REGISTRY_IMAGE}:frontend-${CI_PIPELINE_ID} + --builder=gui-builder + --build-arg GIT_COMMIT_TAG="${CI_COMMIT_TAG}" + --platform ${DOCKER_PLATFORM:-linux/amd64} + --provenance false + --push + . + +.template:test:frontend:acceptance: + stage: test + image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/docker:cli + rules: + - changes: + paths: ['frontend/**/*'] + compare_to: '${RULES_CHANGES_COMPARE_TO_REF}' + needs: + - job: build:frontend:docker + artifacts: true + services: + - name: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/docker:dind + alias: docker + before_script: + - !reference [.dind-login] + - apk add --no-cache bash git jq wget + - docker pull ${CI_REGISTRY_IMAGE}:frontend-${CI_PIPELINE_ID} + - docker tag ${CI_REGISTRY_IMAGE}:frontend-${CI_PIPELINE_ID} ${FRONTEND_REPOSITORY}:pr + artifacts: + expire_in: 2w + paths: + - frontend/coverage + - frontend/screenshots + - frontend/logs + - frontend/junit + reports: + junit: + - frontend/junit/results.xml + when: always + tags: + - mender-qa-worker-generic-light + +test:frontend:acceptance: + extends: .template:test:frontend:acceptance + rules: + - if: $CI_COMMIT_REF_NAME !~ /^(staging|saas-[a-zA-Z0-9.]+)$/ + script: + - GUI_REPOSITORY=$(pwd)/frontend SERVER_ROOT=$(pwd) ./frontend/tests/e2e_tests/run + +test:frontend:acceptance:enterprise: + extends: .template:test:frontend:acceptance + rules: + - if: $CI_COMMIT_BRANCH == "main" + variables: + TEST_ENVIRONMENT: enterprise + before_script: + - docker login -u $REGISTRY_MENDER_IO_USERNAME -p $REGISTRY_MENDER_IO_PASSWORD registry.mender.io + script: + - GUI_REPOSITORY=$(pwd)/frontend SERVER_ROOT=$(pwd) ./frontend/tests/e2e_tests/run --enterprise + +.template:publish:frontend:tests: + image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/${NODE_IMAGE} + stage: publish + before_script: + - export CI_BUILD_REF=${CI_COMMIT_SHA} + - export CI_BUILD_REF_NAME=${CI_COMMIT_REF_NAME} + - export CI_MERGE_REQUEST_IID=${CI_COMMIT_BRANCH#pr_} + - export COVERALLS_PARALLEL=true + - export COVERALLS_SERVICE_JOB_ID=${CI_JOB_ID} + - export COVERALLS_SERVICE_NUMBER=${CI_PIPELINE_ID} + - apk add --no-cache git + - npm i -g coveralls + tags: + - hetzner-amd-beefy + +publish:frontend:tests: + extends: .template:publish:frontend:tests + rules: + - if: $CI_COMMIT_REF_NAME !~ /^(staging|saas-[a-zA-Z0-9.]+)$/ + needs: + - job: test:frontend:unit + artifacts: true + script: + - export COVERALLS_SERVICE_JOB_NUMBER=unittests + - export COVERALLS_FLAG_NAME=unittests + - coveralls < frontend/coverage/lcov.info + +publish:frontend:e2e-tests: + extends: .template:publish:frontend:tests + rules: + - if: $CI_COMMIT_BRANCH == "main" + needs: + - test:frontend:acceptance:enterprise + script: + - export COVERALLS_SERVICE_JOB_NUMBER=frontend-e2e + - export COVERALLS_FLAG_NAME=frontend-e2e + - sed -i -re 's/(^[SF:]+[../]+)(.*)$/SF:\2/' coverage/lcov.info + - coveralls < coverage/lcov.info + +publish:frontend:licenses: + stage: publish + image: ${CI_REGISTRY_IMAGE}/frontend-base-${CI_PIPELINE_IID} + needs: + - job: build:frontend:docker + artifacts: false + script: + - npm run disclaim + artifacts: + expire_in: 2w + paths: + - disclaimer.txt + rules: + - if: $CI_COMMIT_REF_NAME =~ /^(main|staging|[0-9]+\.[0-9]+\.x)$/ + tags: + - hetzner-amd-beefy + +publish:frontend:docker: + extends: publish:backend:docker + variables: + MENDER_PUBLISH_REGISTRY: docker.io + script: + - export DOCKER_TAG=${CI_REGISTRY_IMAGE}:frontend-${CI_PIPELINE_ID} + - echo "About to publish ${DOCKER_TAG} to ${MENDER_PUBLISH_TAG}" + - skopeo copy --multi-arch all \ + docker://${DOCKER_TAG} \ + docker://${MENDER_PUBLISH_REGISTRY}/${FRONTEND_REPOSITORY}:${MENDER_PUBLISH_TAG} # covers vX.Y.Z + -fragment/ -build tags + - | + if echo -n "${MENDER_PUBLISH_TAG}" | grep -E '^v[0-9]+\.v[0-9]+\.[0-9]+$'; then + skopeo copy --multi-arch all docker://${DOCKER_TAG} docker://${MENDER_PUBLISH_REGISTRY}/gui:$(echo -n $MENDER_PUBLISH_TAG | cut -d . -f-2) + skopeo copy --multi-arch all docker://${DOCKER_TAG} docker://${MENDER_PUBLISH_REGISTRY}/gui:$(echo -n $MENDER_PUBLISH_TAG | cut -d . -f-1) + skopeo copy --multi-arch all docker://${DOCKER_TAG} docker://${MENDER_PUBLISH_REGISTRY}/gui:latest + ;; + fi + +publish:frontend:docker:enterprise: + extends: publish:frontend:docker + variables: + MENDER_PUBLISH_REGISTRY: registry.mender.io + script: + - docker login -u $REGISTRY_MENDER_IO_USERNAME -p $REGISTRY_MENDER_IO_PASSWORD registry.mender.io + - skopeo copy --multi-arch all \ + docker://${DOCKER_TAG} \ + docker://${MENDER_PUBLISH_REGISTRY}/${FRONTEND_REPOSITORY}:${MENDER_PUBLISH_TAG} # covers vX.Y.Z + -fragment/ -build tags + - | + if echo -n "${MENDER_PUBLISH_TAG}" | grep -E '^v[0-9]+\.v[0-9]+\.[0-9]+$'; then + skopeo copy --multi-arch all docker://${DOCKER_TAG} docker://${MENDER_PUBLISH_REGISTRY}/gui:$(echo -n $MENDER_PUBLISH_TAG | cut -d . -f-2) + skopeo copy --multi-arch all docker://${DOCKER_TAG} docker://${MENDER_PUBLISH_REGISTRY}/gui:$(echo -n $MENDER_PUBLISH_TAG | cut -d . -f-1) + skopeo copy --multi-arch all docker://${DOCKER_TAG} docker://${MENDER_PUBLISH_REGISTRY}/gui:latest + ;; + fi diff --git a/frontend/tests/e2e_tests/docker-compose.e2e-tests.enterprise.yml b/frontend/tests/e2e_tests/docker-compose.e2e-tests.enterprise.yml index 6101cd91..1a608f63 100644 --- a/frontend/tests/e2e_tests/docker-compose.e2e-tests.enterprise.yml +++ b/frontend/tests/e2e_tests/docker-compose.e2e-tests.enterprise.yml @@ -1,20 +1,43 @@ services: - mender-gui-tests-runner: + gui-tests-runner: depends_on: - - mender-api-gateway - - mender-auditlogs - - mender-gui - - mender-client - - mender-deployments - - mender-device-auth - - mender-inventory - - mender-useradm - - mender-mongo - - mender-workflows-server - - mender-workflows-worker - - mender-create-artifact-worker - - minio + - auditlogs + - client + - create-artifact-worker + - deployments + - deviceauth + - devicemonitor + - generate-delta-worker + - gui + - inventory + - tenantadm + - useradm + - workflows + - workflows-worker + - mongo + - nats + - s3fs + - traefik - mender-useradm: + auditlogs: + image: mendersoftware/auditlogs:main + deployments: + image: mendersoftware/deployments-enterprise:main + deviceauth: + image: mendersoftware/deviceauth-enterprise:main + devicemonitor: + image: registry.mender.io/mendersoftware/devicemonitor:main + generate-delta-worker: + image: registry.mender.io/mendersoftware/generate-delta-worker:main + inventory: + image: mendersoftware/inventory-enterprise:main + tenantadm: + image: mendersoftware/tenantadm:main + useradm: + image: mendersoftware/useradm-enterprise:main environment: USERADM_BASE_URL: "https://docker.mender.io" + workflows: + image: mendersoftware/workflows-enterprise:main + workflows-worker: + image: mendersoftware/workflows-enterprise-worker:main diff --git a/frontend/tests/e2e_tests/docker-compose.e2e-tests.yml b/frontend/tests/e2e_tests/docker-compose.e2e-tests.yml index 7a56ef0e..86594062 100644 --- a/frontend/tests/e2e_tests/docker-compose.e2e-tests.yml +++ b/frontend/tests/e2e_tests/docker-compose.e2e-tests.yml @@ -1,25 +1,27 @@ +name: gui-tests services: - mender-gui-tests-runner: + gui-tests-runner: image: mendersoftware/mender-test-containers:gui-e2e-testing command: tail -f /dev/null environment: - TEST_ENVIRONMENT - NODE_TLS_REJECT_UNAUTHORIZED=0 networks: - - mender + - default depends_on: - - mender-api-gateway - - mender-gui - - mender-client - - mender-deployments - - mender-device-auth - - mender-inventory - - mender-useradm - - mender-mongo - - mender-workflows-server - - mender-workflows-worker - - mender-create-artifact-worker - - minio + - client + - create-artifact-worker + - deployments + - deviceauth + - gui + - inventory + - useradm + - workflows + - workflows-worker + - mongo + - nats + - s3fs + - traefik volumes: - ${GUI_REPOSITORY}/coverage:/e2e/coverage - ${GUI_REPOSITORY}/junit:/e2e/junit @@ -33,18 +35,43 @@ services: - ${GUI_REPOSITORY}/tests/e2e_tests/utils:/e2e/utils - ${GUI_REPOSITORY}/videos:/e2e/videos - mender-client: - image: mendersoftware/mender-client-docker-addons:mender-3.6.x + client: + image: mendersoftware/mender-client-docker-addons:mender-master volumes: - ${GUI_REPOSITORY}/tests/e2e_tests/dockerClient/mender.json:/etc/mender/mender.conf - ${GUI_REPOSITORY}/tests/e2e_tests/dockerClient/mender-connect.json:/etc/mender/mender-connect.conf + create-artifact-worker: + image: mendersoftware/create-artifact-worker:main + deployments: + image: mendersoftware/deployments:main + deviceauth: + image: mendersoftware/deviceauth:main + deviceconfig: + image: mendersoftware/deviceconfig:main + deviceconnect: + image: mendersoftware/deviceconnect:main + inventory: + image: mendersoftware/inventory:main + iot-manager: + image: mendersoftware/iot-manager:main + useradm: + image: mendersoftware/useradm:main + workflows: + image: mendersoftware/workflows:main + workflows-worker: + image: mendersoftware/workflows:main + + traefik: + networks: + default: + aliases: [s3.localhost, docker.mender.io] + ## ## to execute or edit the tests locally: ## use playwright locally using `npm install` in the e2e_tests directory and run `npm run test` ## - - mender-gui: + gui: image: mendersoftware/gui:pr environment: - GATEWAY_IP=docker.mender.io diff --git a/frontend/tests/e2e_tests/run b/frontend/tests/e2e_tests/run index 85313bff..2a4e0dce 100755 --- a/frontend/tests/e2e_tests/run +++ b/frontend/tests/e2e_tests/run @@ -2,16 +2,10 @@ set -e # by default just add minio, with COMPOSE_CMD_BASE this creates the standard onprem ST setup -COMPOSE_CMD="docker compose -p gui-tests \ - -f ${INTEGRATION_PATH}/docker-compose.yml \ - -f ${INTEGRATION_PATH}/docker-compose.client.yml \ - -f ${INTEGRATION_PATH}/docker-compose.demo.yml \ - -f ${INTEGRATION_PATH}/docker-compose.storage.minio.yml" -ENTERPRISE_COMPOSE=" -f ${INTEGRATION_PATH}/docker-compose.enterprise.yml" +COMPOSE_CMD="docker compose -f ${SERVER_ROOT}/dev/docker-compose.yml" TEST_COMPOSE=" -f ${GUI_REPOSITORY}/tests/e2e_tests/docker-compose.e2e-tests.yml" TEST_COMPOSE_ENTERPRISE=" -f ${GUI_REPOSITORY}/tests/e2e_tests/docker-compose.e2e-tests.enterprise.yml" ENTERPRISE=0 -UNPRIVILEGED=0 COMPOSE_FILES=() @@ -26,7 +20,7 @@ usage() { echo "" echo -e "examples:" echo -e "run all GUI tests, from root of this repo, with default ST setup:" - echo -e "GUI_REPOSITORY='' INTEGRATION_PATH=. $0" + echo -e "GUI_REPOSITORY='' SERVER_ROOT=. $0" } parse_args(){ @@ -43,12 +37,7 @@ parse_args(){ SKIP_CLEANUP=1 shift ;; - --unprivileged) - UNPRIVILEGED=1 - shift - ;; --enterprise) - COMPOSE_CMD+=$ENTERPRISE_COMPOSE export TEST_ENVIRONMENT=enterprise ENTERPRISE=1 shift @@ -71,17 +60,14 @@ run_tests() { if [[ $ENTERPRISE -eq 1 ]]; then COMPOSE_CMD+=$TEST_COMPOSE_ENTERPRISE fi - if [[ $UNPRIVILEGED -eq 1 ]]; then - sed -i 's|"http://mender-gui"|"http://mender-gui:8090"|g' ${INTEGRATION_PATH}/config/traefik/traefik.yaml - fi - $COMPOSE_CMD up -d + $COMPOSE_CMD down && $COMPOSE_CMD up -d declare retries=5 if [[ $ENTERPRISE -eq 1 ]]; then # remove the client, since it won't be able to connect as it lacks a proper tenant token config - $COMPOSE_CMD rm -fsv mender-client + $COMPOSE_CMD rm -fsv client while [[ $retries -gt 0 && -z $containerid ]]; do - containerid=$(get_container_id mender-tenantadm) + containerid=$(get_container_id tenantadm) sleep 1 retries=$((retries-1)) done @@ -95,13 +81,13 @@ run_tests() { token=$(docker exec $containerid /usr/bin/tenantadm get-tenant --id $tenant | jq -r .tenant_token) jq --arg tenantToken "$token" '. + { "TenantToken": $tenantToken }' ${GUI_REPOSITORY}/tests/e2e_tests/dockerClient/mender.json > ${GUI_REPOSITORY}/tests/e2e_tests/dockerClient/mender-test.json # start a new client, using the obtained tenant token - starting it later (in the test suite) would require docker access in the test runner - docker run --name connect-client -d --network=gui-tests_mender \ + docker run --name connect-client -d --network=gui-tests_default \ -v ${GUI_REPOSITORY}/tests/e2e_tests/dockerClient/mender-test.json:/etc/mender/mender.conf \ -v ${GUI_REPOSITORY}/tests/e2e_tests/dockerClient/mender-connect.json:/etc/mender/mender-connect.conf \ - mendersoftware/mender-client-docker-addons:mender-3.6.x + mendersoftware/mender-client-docker-addons:mender-master else while [[ $retries -gt 0 && -z $containerid ]]; do - containerid=$(get_container_id mender-useradm) + containerid=$(get_container_id useradm) sleep 1 retries=$((retries-1)) done @@ -114,7 +100,7 @@ run_tests() { fi declare retries=5 while [[ $retries -gt 0 && -z $runnerid ]]; do - runnerid=$(get_container_id mender-gui-tests-runner) + runnerid=$(get_container_id gui-tests-runner) sleep 1 retries=$((retries-1)) done diff --git a/frontend/tests/e2e_tests/utils/commands.ts b/frontend/tests/e2e_tests/utils/commands.ts index 0d15b0d7..1568c8c2 100644 --- a/frontend/tests/e2e_tests/utils/commands.ts +++ b/frontend/tests/e2e_tests/utils/commands.ts @@ -169,7 +169,7 @@ export const startDockerClient = async (baseUrl, token) => { updateConfigFileWithUrl('mender-connect', srippedBaseUrl, token); // NB! to run the tests against a running local Mender backend, uncomment & adjust the following // const localNetwork = ['--network', 'menderintegration_mender']; - const localNetwork = baseUrl.includes('docker.mender.io') ? ['--network', 'gui-tests_mender'] : []; + const localNetwork = baseUrl.includes('docker.mender.io') ? ['--network', 'gui-tests_default'] : []; const args = [ 'run', '-d', @@ -180,7 +180,7 @@ export const startDockerClient = async (baseUrl, token) => { `${projectRoot}/dockerClient/mender-test.json:/etc/mender/mender.conf`, '-v', `${projectRoot}/dockerClient/mender-connect-test.json:/etc/mender/mender-connect.conf`, - 'mendersoftware/mender-client-docker-addons:mender-3.6.x' + 'mendersoftware/mender-client-docker-addons:mender-master' ]; console.log(`starting with token: ${token}`); console.log(`starting using: docker ${args.join(' ')}`); From 446d9d5fd0b3be5840f66b8051eaf695bf73deda Mon Sep 17 00:00:00 2001 From: Manuel Zedel Date: Wed, 11 Sep 2024 09:29:44 +0200 Subject: [PATCH 03/10] fix: removed unsupported required setting Ticket: None Changelog: None Signed-off-by: Manuel Zedel --- dev/docker-compose.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/dev/docker-compose.yml b/dev/docker-compose.yml index 3e88da1a..2f90b60c 100644 --- a/dev/docker-compose.yml +++ b/dev/docker-compose.yml @@ -25,10 +25,8 @@ services: depends_on: mongo: condition: service_started - required: true s3fs: condition: service_healthy - required: true environment: DEPLOYMENTS_PRESIGN_URL_HOSTNAME: "localhost" DEPLOYMENTS_PRESIGN_SECRET: "aW5zZWN1cmUgc2VjcmV0" From 7e96c094826982828204a1c3c0ade8ae0a3e3029 Mon Sep 17 00:00:00 2001 From: Manuel Zedel Date: Tue, 10 Sep 2024 10:24:41 +0200 Subject: [PATCH 04/10] ci: adjusted coveralls call to include service scoped carryforwards Ticket: None Changelog: None Signed-off-by: Manuel Zedel --- .gitlab-ci.yml | 2 +- frontend/pipeline.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8407cea9..d9971439 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -237,7 +237,7 @@ coveralls:done: image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/curlimages/curl stage: .post script: - - curl "https://coveralls.io/webhook?repo_token=$COVERALLS_REPO_TOKEN" -d "payload[build_num]=$CI_PIPELINE_ID&payload[status]=done" + - curl "https://coveralls.io/webhook?repo_token=$COVERALLS_REPO_TOKEN&carryforward=frontend-unit,frontend-e2e,create-artifact-worker-unit,deployments-unit,deployments-integration,deviceauth-unit,deviceauth-integration,deviceconfig-unit,deviceconfig-integration,deviceconnect-unit,deviceconnect-integration,inventory-unit,inventory-integration,iot-manager-unit,iot-manager-integration,useradm-unit,useradm-integration,workflows-unit,workflows-integration" -d "payload[build_num]=$CI_PIPELINE_ID&payload[status]=done" tags: - hetzner-amd-beefy diff --git a/frontend/pipeline.yml b/frontend/pipeline.yml index 5822d95c..86735426 100644 --- a/frontend/pipeline.yml +++ b/frontend/pipeline.yml @@ -264,8 +264,8 @@ publish:frontend:tests: - job: test:frontend:unit artifacts: true script: - - export COVERALLS_SERVICE_JOB_NUMBER=unittests - - export COVERALLS_FLAG_NAME=unittests + - export COVERALLS_SERVICE_JOB_NUMBER=frontend-unit + - export COVERALLS_FLAG_NAME=frontend-unit - coveralls < frontend/coverage/lcov.info publish:frontend:e2e-tests: From 9c624c4119abc24e3aeac58285098d22651f8c2e Mon Sep 17 00:00:00 2001 From: Manuel Zedel Date: Tue, 10 Sep 2024 15:48:28 +0200 Subject: [PATCH 05/10] ci: removed staging tests to rely on enterprise fork for deploy & test Ticket: None Changelog: None Signed-off-by: Manuel Zedel --- .gitlab-ci.yml | 123 ------------------------------------------------- 1 file changed, 123 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d9971439..e385be80 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -36,30 +36,11 @@ stages: - build - test - publish - - version-bump - - test-deploy .dind-login: &dind-login - mkdir -p $HOME/.docker && echo $DOCKER_AUTH_CONFIG > $HOME/.docker/config.json - docker login --username $CI_REGISTRY_USER --password $CI_REGISTRY_PASSWORD $CI_REGISTRY -test-prep:staging: - stage: pre-test - image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/docker - rules: - - if: $CI_COMMIT_BRANCH == "staging" - services: - - name: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/docker:dind - alias: docker - script: - - docker run --rm --entrypoint "/bin/sh" -v $(pwd):/extract mendersoftware/mender-stress-test-client:master -c "cp mender-stress-test-client /extract/" - artifacts: - paths: - - mender-stress-test-client - expire_in: 30 days - tags: - - hetzner-amd-beefy - .template:build:docker: stage: build needs: [] @@ -240,107 +221,3 @@ coveralls:done: - curl "https://coveralls.io/webhook?repo_token=$COVERALLS_REPO_TOKEN&carryforward=frontend-unit,frontend-e2e,create-artifact-worker-unit,deployments-unit,deployments-integration,deviceauth-unit,deviceauth-integration,deviceconfig-unit,deviceconfig-integration,deviceconnect-unit,deviceconnect-integration,inventory-unit,inventory-integration,iot-manager-unit,iot-manager-integration,useradm-unit,useradm-integration,workflows-unit,workflows-integration" -d "payload[build_num]=$CI_PIPELINE_ID&payload[status]=done" tags: - hetzner-amd-beefy - -# -# Mender Helm Rolling release -# -.trigger:mender-helm-version-bump: - stage: version-bump - allow_failure: true - trigger: - project: Northern.tech/Mender/mender-helm - strategy: depend - resource_group: mender-helm - variables: - SYNC_CONTAINER_NAME: $CONTAINER_NAME - SYNC_IMAGE_TAG: $DOCKER_PUBLISH_COMMIT_TAG - CONTAINER: gui - DOCKER_PUBLISH_COMMIT_TAG: ${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHA} - GITHUB_HELM_REPO: "github.com/mendersoftware/mender-helm.git" - CHART_DIR: "mender" - -trigger:mender-helm-version-bump:staging: - extends: - - .trigger:mender-helm-version-bump - rules: - - if: $CI_COMMIT_BRANCH =~ /^(staging)$/ - variables: - SYNC_ENVIRONMENT: staging - HELM_PATCH_VERSION: ${CI_PIPELINE_ID}-staging # pre-release version for trigger staging only deploy - -trigger:mender-helm-version-bump:prod: - extends: - - .trigger:mender-helm-version-bump - rules: - - if: "$CI_COMMIT_TAG =~ /^saas-[a-zA-Z0-9.]+$/" - when: manual - variables: - SYNC_ENVIRONMENT: prod - HELM_PATCH_VERSION: ${CI_PIPELINE_ID} - DOCKER_PUBLISH_COMMIT_TAG: ${CI_COMMIT_REF_NAME} - -# -# Test Staging Deployment -# -.template:test:staging-deployment: - image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/mendersoftware/mender-test-containers:gui-e2e-testing - stage: test-deploy - services: - - name: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/docker:dind - alias: docker - cache: - key: - files: - - frontend/tests/e2e_tests/package-lock.json - paths: - - frontend/.npm/ - needs: - - job: trigger:mender-helm-version-bump:staging - artifacts: false - - job: test:prep - artifacts: true - variables: - CI: 1 - DEVICE_TYPE: qemux86-64 - TEST_ENVIRONMENT: staging - before_script: - - curl -fsSL https://get.docker.com | sh - - mv mender-stress-test-client frontend/tests/e2e_tests/ && cd frontend/tests/e2e_tests - - docker pull mendersoftware/mender-client-docker-addons:mender-3.6.x - - npm ci --cache .npm --prefer-offline - script: - - npm run test - after_script: - - cd $CI_PROJECT_DIR - - mkdir logs && cp /root/frontend/tests/e2e_tests/.npm/_logs/* logs/ - only: - - staging - artifacts: - expire_in: 2w - paths: - - frontend/tests/e2e_tests/test-results - - logs - when: always - tags: - - hetzner-amd-beefy-privileged - -test:staging-deployment:chrome: - extends: .template:test:staging-deployment - script: - - npm run test - when: delayed - start_in: 1 minutes - -test:staging-deployment:firefox: - extends: .template:test:staging-deployment - script: - - npm run test -- --browser=firefox - when: delayed - start_in: 25 minutes - -test:staging-deployment:webkit: - extends: .template:test:staging-deployment - script: - - npm run test -- --browser=webkit - when: delayed - start_in: 15 minutes From efdd1214cc47b7a20ee6adfe7f54f6bc9f15152e Mon Sep 17 00:00:00 2001 From: Manuel Zedel Date: Tue, 10 Sep 2024 16:49:10 +0200 Subject: [PATCH 06/10] ci: removed backend type checker to rely on enterprise fork Ticket: None Changelog: None Signed-off-by: Manuel Zedel --- frontend/pipeline.yml | 42 ------------------------------------------ 1 file changed, 42 deletions(-) diff --git a/frontend/pipeline.yml b/frontend/pipeline.yml index 86735426..0c2578c8 100644 --- a/frontend/pipeline.yml +++ b/frontend/pipeline.yml @@ -28,48 +28,6 @@ test:frontend:lint: tags: - hetzner-amd-beefy -test:frontend:types: - stage: pre-test - image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/debian:12-slim - needs: [] - rules: - - if: $CI_PIPELINE_SOURCE == "schedule" - when: always - - when: manual - before_script: - # Prepare SSH key - - eval $(ssh-agent -s) - - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null - - mkdir -p ~/.ssh - - chmod 700 ~/.ssh - - ssh-keyscan github.com >> ~/.ssh/known_hosts - # Configure git - - git config --global user.email "mender@northern.tech" - - git config --global user.name "Mender Test Bot" - # install hub cli + deno - - apt-get update && apt-get install curl hub unzip -qqy - - curl -fsSL https://deno.land/install.sh | DENO_INSTALL=/usr/local sh - # get enterprise api specs from all the repos, based on mender-api-docs tooling - - export GITHUB_TOKEN=${GITHUB_BOT_TOKEN_REPO_FULL} - - cd scripts - - 'wget --header "Authorization: token $GITHUB_TOKEN" https://raw.githubusercontent.com/mendersoftware/mender-api-docs/master/versions.template.js' - - cd typeGeneration - script: - - deno run --allow-read --allow-write --allow-net convert.js - - deno fmt generated/models - - mkdir -p ../../src/js/api/types && mv -f generated/models/* ../../src/js/api/types - - cd ../.. - - git checkout -b update-types-$(date +%s) - - 'git add src/js/api/types && git commit --signoff -m "chore: Types update"' - - git remote add mendersoftware git@github.com:mendersoftware/mender-server.git - - 'hub pull-request --push --base mendersoftware:main --message "chore: Types update" --message "keeping types aligned"' - allow_failure: true - artifacts: - expire_in: 2w - paths: - - frontend/scripts/typeGeneration - - frontend/src/js/api/types - test:frontend:licenses: image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/denoland/deno:alpine-1.38.0 stage: test From 29d66984877a3dd45dac945c2542f3bfd21ec6b6 Mon Sep 17 00:00:00 2001 From: Manuel Zedel Date: Thu, 12 Sep 2024 11:40:39 +0200 Subject: [PATCH 07/10] ci: added client assumed certs to make backend work with demo client again Signed-off-by: Manuel Zedel --- frontend/tests/e2e_tests/config/traefik.cert.crt | 12 ++++++++++++ frontend/tests/e2e_tests/config/traefik.private.key | 5 +++++ frontend/tests/e2e_tests/config/traefik.tls.yaml | 9 +++++++++ .../tests/e2e_tests/docker-compose.e2e-tests.yml | 13 ++++++++++++- 4 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 frontend/tests/e2e_tests/config/traefik.cert.crt create mode 100644 frontend/tests/e2e_tests/config/traefik.private.key create mode 100644 frontend/tests/e2e_tests/config/traefik.tls.yaml diff --git a/frontend/tests/e2e_tests/config/traefik.cert.crt b/frontend/tests/e2e_tests/config/traefik.cert.crt new file mode 100644 index 00000000..b95a1843 --- /dev/null +++ b/frontend/tests/e2e_tests/config/traefik.cert.crt @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIB0jCCAXmgAwIBAgIUBFs9wGFvoR3FEF9hK5b1iOrZsL0wCgYIKoZIzj0EAwIw +GzEZMBcGA1UEAwwQZG9ja2VyLm1lbmRlci5pbzAeFw0yMTA2MDExMzExMTNaFw0z +MTA1MzAxMzExMTNaMBsxGTAXBgNVBAMMEGRvY2tlci5tZW5kZXIuaW8wWTATBgcq +hkjOPQIBBggqhkjOPQMBBwNCAAQPyND/aGLxFoMl9PVMQ0gBG74VXK4hVgOWOznX +VrzoBfETf6wXEyV7Dq217ZxtV7gsafyZ6lWtLx33qRfQd7Exo4GaMIGXMB0GA1Ud +DgQWBBSjTHcK2xcQFJLrjnAv+0Sl6pLD8zAfBgNVHSMEGDAWgBSjTHcK2xcQFJLr +jnAv+0Sl6pLD8zAPBgNVHRMBAf8EBTADAQH/MBMGA1UdJQQMMAoGCCsGAQUFBwMB +MC8GA1UdEQQoMCaCEGRvY2tlci5tZW5kZXIuaW+CEiouZG9ja2VyLm1lbmRlci5p +bzAKBggqhkjOPQQDAgNHADBEAiAvmTdg3z7GkrnNM+N5ujl4xIm6bdnVhhLXkJdn +TyWKrwIgN2asFU4swaMUobs6uXMBt5zftfLKwuQIYbBEwBemWFg= +-----END CERTIFICATE----- diff --git a/frontend/tests/e2e_tests/config/traefik.private.key b/frontend/tests/e2e_tests/config/traefik.private.key new file mode 100644 index 00000000..8296da5d --- /dev/null +++ b/frontend/tests/e2e_tests/config/traefik.private.key @@ -0,0 +1,5 @@ +-----BEGIN PRIVATE KEY----- +MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQg1l/vZtE9AH5eDFkD +7Cs814ZSv5SxbbC+1VK8m8S8npahRANCAAQPyND/aGLxFoMl9PVMQ0gBG74VXK4h +VgOWOznXVrzoBfETf6wXEyV7Dq217ZxtV7gsafyZ6lWtLx33qRfQd7Ex +-----END PRIVATE KEY----- diff --git a/frontend/tests/e2e_tests/config/traefik.tls.yaml b/frontend/tests/e2e_tests/config/traefik.tls.yaml new file mode 100644 index 00000000..ad918ff3 --- /dev/null +++ b/frontend/tests/e2e_tests/config/traefik.tls.yaml @@ -0,0 +1,9 @@ +tls: + stores: + default: + defaultCertificate: + certFile: /etc/traefik/certs/cert.crt + keyFile: /etc/traefik/certs/private.key + certificates: + - certFile: /etc/traefik/certs/cert.crt + keyFile: /etc/traefik/certs/private.key diff --git a/frontend/tests/e2e_tests/docker-compose.e2e-tests.yml b/frontend/tests/e2e_tests/docker-compose.e2e-tests.yml index 86594062..d092a037 100644 --- a/frontend/tests/e2e_tests/docker-compose.e2e-tests.yml +++ b/frontend/tests/e2e_tests/docker-compose.e2e-tests.yml @@ -38,6 +38,7 @@ services: client: image: mendersoftware/mender-client-docker-addons:mender-master volumes: + - ${GUI_REPOSITORY}/tests/e2e_tests/dockerClient/config/traefik.cert.crt:/server.crt - ${GUI_REPOSITORY}/tests/e2e_tests/dockerClient/mender.json:/etc/mender/mender.conf - ${GUI_REPOSITORY}/tests/e2e_tests/dockerClient/mender-connect.json:/etc/mender/mender-connect.conf @@ -45,6 +46,8 @@ services: image: mendersoftware/create-artifact-worker:main deployments: image: mendersoftware/deployments:main + environment: + DEPLOYMENTS_AWS_EXTERNAL_URI: "https://s3.docker.mender.io" deviceauth: image: mendersoftware/deviceauth:main deviceconfig: @@ -63,9 +66,17 @@ services: image: mendersoftware/workflows:main traefik: + volumes: + - ${GUI_REPOSITORY}/tests/e2e_tests/config/traefik.tls.yaml:/etc/traefik/config/traefik.tls.yaml:ro + - ${GUI_REPOSITORY}/tests/e2e_tests/config/traefik.cert.crt:/etc/traefik/certs/cert.crt + - ${GUI_REPOSITORY}/tests/e2e_tests/config/traefik.private.key:/etc/traefik/certs/private.key networks: default: - aliases: [s3.localhost, docker.mender.io] + aliases: [s3.docker.mender.io, docker.mender.io] + + s3fs: + labels: + traefik.http.routers.s3fs.rule: Host(`s3.docker.mender.io`) ## ## to execute or edit the tests locally: From 96315790e4fd80639d964ec728e843d9efc41019 Mon Sep 17 00:00:00 2001 From: Manuel Zedel Date: Thu, 12 Sep 2024 11:41:24 +0200 Subject: [PATCH 08/10] fix(e2e-test): aligned with increased client output Ticket: None Changelog: None Signed-off-by: Manuel Zedel --- .../tests/e2e_tests/integration/05-deviceDetails.spec.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/frontend/tests/e2e_tests/integration/05-deviceDetails.spec.ts b/frontend/tests/e2e_tests/integration/05-deviceDetails.spec.ts index a2d784c7..a2bcd0ee 100644 --- a/frontend/tests/e2e_tests/integration/05-deviceDetails.spec.ts +++ b/frontend/tests/e2e_tests/integration/05-deviceDetails.spec.ts @@ -35,9 +35,11 @@ test.describe('Device details', () => { await page.click(`.leftNav :text('Devices')`); await page.locator(`css=${selectors.deviceListItem} div:last-child`).last().click(); await page.getByText(/inventory/i).click(); - await expect(page.locator(`css=.expandedDevice >> text=Linux`)).toBeVisible(); - await expect(page.locator(`css=.expandedDevice >> text=mac`)).toBeVisible(); - await expect(page.locator(`css=.expandedDevice >> text=${demoDeviceName}`)).toBeVisible(); + const expandedDevice = await page.locator(`css=.expandedDevice`); + await expect(expandedDevice.getByText('Linux')).toBeVisible(); + await expect(expandedDevice.getByText(/mac/).first()).toBeVisible(); + await expandedDevice.getByRole('tab', { name: /software/i }).click(); + await expect(expandedDevice.getByText(demoDeviceName)).toBeVisible(); }); test('can be found', async ({ demoDeviceName, loggedInPage: page }) => { From cbf1b3ec26b9c3c8bffba829de208bc03d887bc5 Mon Sep 17 00:00:00 2001 From: Manuel Zedel Date: Thu, 12 Sep 2024 11:41:54 +0200 Subject: [PATCH 09/10] fix: post moment migration fix Ticket: None Changelog: None Signed-off-by: Manuel Zedel --- .../src/js/components/devices/troubleshoot/terminal-wrapper.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/js/components/devices/troubleshoot/terminal-wrapper.js b/frontend/src/js/components/devices/troubleshoot/terminal-wrapper.js index 6b849fd7..90d13910 100644 --- a/frontend/src/js/components/devices/troubleshoot/terminal-wrapper.js +++ b/frontend/src/js/components/devices/troubleshoot/terminal-wrapper.js @@ -72,7 +72,7 @@ const SessionInfo = ({ socketInitialized, startTime }) => { { key: 'duration', title: 'Duration', - content: startTime ? `${dayjs.duration(elapsed.diff(dayjs(startTime))).format('hh:mm:ss', { trim: false })}` : '-' + content: startTime ? `${dayjs.duration(elapsed.diff(dayjs(startTime))).format('HH:mm:ss', { trim: false })}` : '-' } ].map(({ key, title, content }) => (
From 5a13c84d0a9747f6868ebc3c8b6e73cb78c486d9 Mon Sep 17 00:00:00 2001 From: Manuel Zedel Date: Thu, 12 Sep 2024 12:15:49 +0200 Subject: [PATCH 10/10] ci: allowed overriding gui test images Ticket: None Changelog: None Signed-off-by: Manuel Zedel --- frontend/pipeline.yml | 1 + .../docker-compose.e2e-tests.enterprise.yml | 20 +++++++++---------- .../e2e_tests/docker-compose.e2e-tests.yml | 20 +++++++++---------- 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/frontend/pipeline.yml b/frontend/pipeline.yml index 0c2578c8..634c9609 100644 --- a/frontend/pipeline.yml +++ b/frontend/pipeline.yml @@ -167,6 +167,7 @@ build:frontend:docker: - apk add --no-cache bash git jq wget - docker pull ${CI_REGISTRY_IMAGE}:frontend-${CI_PIPELINE_ID} - docker tag ${CI_REGISTRY_IMAGE}:frontend-${CI_PIPELINE_ID} ${FRONTEND_REPOSITORY}:pr + - export MENDER_IMAGE_TAG=${CI_COMMIT_TAG:-main} artifacts: expire_in: 2w paths: diff --git a/frontend/tests/e2e_tests/docker-compose.e2e-tests.enterprise.yml b/frontend/tests/e2e_tests/docker-compose.e2e-tests.enterprise.yml index 1a608f63..e34889e6 100644 --- a/frontend/tests/e2e_tests/docker-compose.e2e-tests.enterprise.yml +++ b/frontend/tests/e2e_tests/docker-compose.e2e-tests.enterprise.yml @@ -20,24 +20,24 @@ services: - traefik auditlogs: - image: mendersoftware/auditlogs:main + image: mendersoftware/auditlogs:${MENDER_IMAGE_TAG:-main} deployments: - image: mendersoftware/deployments-enterprise:main + image: mendersoftware/deployments-enterprise:${MENDER_IMAGE_TAG:-main} deviceauth: - image: mendersoftware/deviceauth-enterprise:main + image: mendersoftware/deviceauth-enterprise:${MENDER_IMAGE_TAG:-main} devicemonitor: - image: registry.mender.io/mendersoftware/devicemonitor:main + image: registry.mender.io/mendersoftware/devicemonitor:${MENDER_IMAGE_TAG:-main} generate-delta-worker: - image: registry.mender.io/mendersoftware/generate-delta-worker:main + image: registry.mender.io/mendersoftware/generate-delta-worker:${MENDER_IMAGE_TAG:-main} inventory: - image: mendersoftware/inventory-enterprise:main + image: mendersoftware/inventory-enterprise:${MENDER_IMAGE_TAG:-main} tenantadm: - image: mendersoftware/tenantadm:main + image: mendersoftware/tenantadm:${MENDER_IMAGE_TAG:-main} useradm: - image: mendersoftware/useradm-enterprise:main + image: mendersoftware/useradm-enterprise:${MENDER_IMAGE_TAG:-main} environment: USERADM_BASE_URL: "https://docker.mender.io" workflows: - image: mendersoftware/workflows-enterprise:main + image: mendersoftware/workflows-enterprise:${MENDER_IMAGE_TAG:-main} workflows-worker: - image: mendersoftware/workflows-enterprise-worker:main + image: mendersoftware/workflows-enterprise-worker:${MENDER_IMAGE_TAG:-main} diff --git a/frontend/tests/e2e_tests/docker-compose.e2e-tests.yml b/frontend/tests/e2e_tests/docker-compose.e2e-tests.yml index d092a037..904fb7bf 100644 --- a/frontend/tests/e2e_tests/docker-compose.e2e-tests.yml +++ b/frontend/tests/e2e_tests/docker-compose.e2e-tests.yml @@ -43,27 +43,27 @@ services: - ${GUI_REPOSITORY}/tests/e2e_tests/dockerClient/mender-connect.json:/etc/mender/mender-connect.conf create-artifact-worker: - image: mendersoftware/create-artifact-worker:main + image: mendersoftware/create-artifact-worker:${MENDER_IMAGE_TAG:-main} deployments: - image: mendersoftware/deployments:main + image: mendersoftware/deployments:${MENDER_IMAGE_TAG:-main} environment: DEPLOYMENTS_AWS_EXTERNAL_URI: "https://s3.docker.mender.io" deviceauth: - image: mendersoftware/deviceauth:main + image: mendersoftware/deviceauth:${MENDER_IMAGE_TAG:-main} deviceconfig: - image: mendersoftware/deviceconfig:main + image: mendersoftware/deviceconfig:${MENDER_IMAGE_TAG:-main} deviceconnect: - image: mendersoftware/deviceconnect:main + image: mendersoftware/deviceconnect:${MENDER_IMAGE_TAG:-main} inventory: - image: mendersoftware/inventory:main + image: mendersoftware/inventory:${MENDER_IMAGE_TAG:-main} iot-manager: - image: mendersoftware/iot-manager:main + image: mendersoftware/iot-manager:${MENDER_IMAGE_TAG:-main} useradm: - image: mendersoftware/useradm:main + image: mendersoftware/useradm:${MENDER_IMAGE_TAG:-main} workflows: - image: mendersoftware/workflows:main + image: mendersoftware/workflows:${MENDER_IMAGE_TAG:-main} workflows-worker: - image: mendersoftware/workflows:main + image: mendersoftware/workflows:${MENDER_IMAGE_TAG:-main} traefik: volumes: