Skip to content

Commit

Permalink
ci: removed frontend parts relying on docker image being built for now
Browse files Browse the repository at this point in the history
Ticket: None
Changelog: None
Signed-off-by: Manuel Zedel <[email protected]>
  • Loading branch information
mzedel committed Sep 5, 2024
1 parent 5d069ad commit 4b021f9
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 285 deletions.
107 changes: 0 additions & 107 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@ stages:
- pre-test
- build
- test
- e2e-test
- publish
- version-bump
- test-deploy

.dind-login: &dind-login
- mkdir -p $HOME/.docker && echo $DOCKER_AUTH_CONFIG > $HOME/.docker/config.json
Expand Down Expand Up @@ -158,107 +155,3 @@ coveralls:done:
- 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
178 changes: 0 additions & 178 deletions frontend/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,7 @@ variables:
NODE_IMAGE:
value: 'node:22-alpine'
description: 'Node version to use for building and testing'
DOCKER_REPOSITORY: mendersoftware/gui
DOCS_VERSION: development
MULTIPLATFORM_BUILD: 'true'
MULTIPLATFORM_PLATFORMS: 'linux/amd64,linux/arm64'

.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}

test:lint:frontend:
stage: pre-test
Expand Down Expand Up @@ -172,93 +163,6 @@ test:docs-links:hosted:frontend:
variables:
DOCS_VERSION: hosted

# excludes non multiplatform build job
build:docker:
rules:
- when: never

build:docker-multiplatform:frontend:
# 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
--push
${DOCKER_DIR:-.}
artifacts:
paths:
- baseImage.tar

.template:test:acceptance:frontend:
stage: e2e-test
image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/tiangolo/docker-with-compose
rules:
- changes:
paths: ['frontend/**/*']
compare_to: '${RULES_CHANGES_COMPARE_TO_REF}'
needs:
- job: build:docker-multiplatform:frontend
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
- 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:frontend:
extends: .template:test:acceptance:frontend
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
- docker rmi $DOCKER_REPOSITORY:pr

test:acceptance:enterprise:frontend:
extends: .template:test:acceptance:frontend
rules:
- if: $CI_COMMIT_BRANCH == "main"
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 ./frontend/tests/e2e_tests/run --enterprise
- docker rmi $DOCKER_REPOSITORY:pr

.template:publish:tests:frontend:
image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/${NODE_IMAGE}
stage: publish
Expand All @@ -284,85 +188,3 @@ publish:tests:frontend:
- export COVERALLS_SERVICE_JOB_NUMBER=unittests
- export COVERALLS_FLAG_NAME=unittests
- coveralls < coverage/lcov.info

publish:e2e-tests:frontend:
extends: .template:publish:tests:frontend
rules:
- if: $CI_COMMIT_BRANCH == "main"
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:licenses:frontend:
stage: publish
image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/docker:git
needs:
- job: build:docker-multiplatform:frontend
artifacts: true
services:
- name: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/docker:dind
alias: docker
script:
- docker load -i baseImage.tar
- docker run --rm --entrypoint "/bin/sh" -v $(pwd):/extract ${DOCKER_REPOSITORY}:base -c "npm run disclaim && cp disclaimer.txt /extract/"
- docker image rm disclaimer
artifacts:
expire_in: 2w
paths:
- disclaimer.txt
rules:
- if: $CI_COMMIT_REF_NAME =~ /^(main|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}

0 comments on commit 4b021f9

Please sign in to comment.