mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-27 10:44:33 +00:00
tests: functional: Add jobs for bullseye-backports
- Added an additional build job called 'build-backports' - Added a separate stage for functional tests in order to avoid depending on multiple jobs - Improved readability of long commands in YAML files - Depending on GitLab username 'weblate' instead of a RE2 regexp (untested) - Increased job timeout to 2h 30m Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
parent
de292d0dcd
commit
629ca17ac2
@ -2,15 +2,18 @@
|
|||||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
|
||||||
.app-server:
|
.app-server:
|
||||||
needs:
|
stage: functional-tests
|
||||||
- job: build
|
dependencies: []
|
||||||
except:
|
except:
|
||||||
- '$CI_COMMIT_TITLE =~ /^Weblate.*/'
|
- $GITLAB_USER_LOGIN == "weblate"
|
||||||
script:
|
script:
|
||||||
- BUILD_JOB_ID=$(curl -s "https://salsa.debian.org/api/v4/projects/$CI_PROJECT_ID/pipelines/$CI_PIPELINE_ID/jobs" | jq -r '.[] | select(.name=="build") | .id')
|
- BUILD_JOB_ID=$(curl -s "https://salsa.debian.org/api/v4/projects/$CI_PROJECT_ID/pipelines/$CI_PIPELINE_ID/jobs?scope[]=success" | jq -r '.[] | select(.name==env.BUILD_JOB_NAME) | .id')
|
||||||
- export AWS_DEFAULT_REGION=us-east-1
|
- export AWS_DEFAULT_REGION=us-east-1
|
||||||
- LAUNCH_TEMPLATE_ID=$(aws ec2 describe-launch-templates --launch-template-names $LAUNCH_TEMPLATE_NAME | jq -r ".LaunchTemplates[0].LaunchTemplateId")
|
- LAUNCH_TEMPLATE_ID=$(aws ec2 describe-launch-templates --launch-template-names $LAUNCH_TEMPLATE_NAME | jq -r ".LaunchTemplates[0].LaunchTemplateId")
|
||||||
- INSTANCE_ID=$(aws ec2 run-instances --launch-template LaunchTemplateId="$LAUNCH_TEMPLATE_ID" --associate-public-ip-address --tag-specifications "ResourceType=instance, Tags=[{Key=salsa:project-id,Value=$CI_PROJECT_ID},{Key=salsa:build-job-id,Value=$BUILD_JOB_ID},{Key=Name,Value=$INSTANCE_NAME}]" | jq -r ".Instances[0].InstanceId")
|
- |
|
||||||
|
INSTANCE_ID=$(aws ec2 run-instances --launch-template LaunchTemplateId="$LAUNCH_TEMPLATE_ID" --associate-public-ip-address \
|
||||||
|
--tag-specifications "ResourceType=instance, Tags=[{Key=salsa:project-id,Value=$CI_PROJECT_ID},{Key=salsa:build-job-id,Value=$BUILD_JOB_ID},{Key=Name,Value=$INSTANCE_NAME}]" | \
|
||||||
|
jq -r ".Instances[0].InstanceId")
|
||||||
- APP_SERVER_IP=$(aws ec2 describe-instances --instance-ids $INSTANCE_ID | jq -r ".Reservations[0].Instances[0].PublicIpAddress")
|
- APP_SERVER_IP=$(aws ec2 describe-instances --instance-ids $INSTANCE_ID | jq -r ".Reservations[0].Instances[0].PublicIpAddress")
|
||||||
- echo "APP_SERVER_IP=$APP_SERVER_IP" >> app-servers.env
|
- echo "APP_SERVER_IP=$APP_SERVER_IP" >> app-servers.env
|
||||||
- echo "INSTANCE_ID=$INSTANCE_ID" >> app-servers.env
|
- echo "INSTANCE_ID=$INSTANCE_ID" >> app-servers.env
|
||||||
@ -21,10 +24,8 @@
|
|||||||
dotenv: app-servers.env
|
dotenv: app-servers.env
|
||||||
|
|
||||||
.run-functional-tests:
|
.run-functional-tests:
|
||||||
needs:
|
stage: functional-tests
|
||||||
- job: app-server-unstable
|
timeout: 150m
|
||||||
artifacts: true
|
|
||||||
timeout: 2h
|
|
||||||
# Need to find a way of running the cleanup step even on failure
|
# Need to find a way of running the cleanup step even on failure
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
when: delayed
|
when: delayed
|
||||||
@ -38,7 +39,9 @@
|
|||||||
script:
|
script:
|
||||||
- cp -r . /home/tester/freedombox && chown -R tester:tester /home/tester/freedombox
|
- cp -r . /home/tester/freedombox && chown -R tester:tester /home/tester/freedombox
|
||||||
- sudo -u tester bash -c 'pip3 install --user splinter pytest-splinter pytest-reporter-html1'
|
- sudo -u tester bash -c 'pip3 install --user splinter pytest-splinter pytest-reporter-html1'
|
||||||
- sudo FREEDOMBOX_URL="https://$APP_SERVER_IP" -u tester bash -c 'cd /home/tester/freedombox && py.test-3 -v --durations=10 --include-functional --splinter-headless --template=html1/index.html --report=functional-tests.html'
|
- |
|
||||||
|
sudo FREEDOMBOX_URL="https://$APP_SERVER_IP" -u tester bash -c \
|
||||||
|
'cd /home/tester/freedombox && py.test-3 -v --durations=10 --include-functional --splinter-headless --template=html1/index.html --report=functional-tests.html'
|
||||||
after_script:
|
after_script:
|
||||||
- echo "INSTANCE_ID=$INSTANCE_ID" >> app-servers.env
|
- echo "INSTANCE_ID=$INSTANCE_ID" >> app-servers.env
|
||||||
- cp /home/tester/freedombox/functional-tests.html .
|
- cp /home/tester/freedombox/functional-tests.html .
|
||||||
@ -53,6 +56,7 @@
|
|||||||
|
|
||||||
# Does not run if the previous job times out or is cancelled
|
# Does not run if the previous job times out or is cancelled
|
||||||
.terminate-app-server:
|
.terminate-app-server:
|
||||||
|
stage: functional-tests
|
||||||
script:
|
script:
|
||||||
- aws ec2 --region us-east-1 terminate-instances --instance-ids $INSTANCE_ID > /dev/null
|
- aws ec2 --region us-east-1 terminate-instances --instance-ids $INSTANCE_ID > /dev/null
|
||||||
tags:
|
tags:
|
||||||
|
|||||||
@ -8,6 +8,7 @@ image: registry.salsa.debian.org/freedombox-team/freedombox:gitlabci
|
|||||||
stages:
|
stages:
|
||||||
- provisioning
|
- provisioning
|
||||||
- build
|
- build
|
||||||
|
- functional-tests
|
||||||
- publish
|
- publish
|
||||||
- test
|
- test
|
||||||
|
|
||||||
@ -43,10 +44,30 @@ doc-tests:
|
|||||||
script:
|
script:
|
||||||
- doc/scripts/wikiparser.py
|
- doc/scripts/wikiparser.py
|
||||||
|
|
||||||
|
app-server-stable:
|
||||||
|
variables:
|
||||||
|
LAUNCH_TEMPLATE_NAME: functional-tests-stable
|
||||||
|
INSTANCE_NAME: app-server-stable
|
||||||
|
BUILD_JOB_NAME: build-backports
|
||||||
|
extends: .app-server
|
||||||
|
|
||||||
|
run-functional-tests-stable:
|
||||||
|
needs:
|
||||||
|
- job: app-server-stable
|
||||||
|
artifacts: true
|
||||||
|
extends: .run-functional-tests
|
||||||
|
|
||||||
|
terminate-app-server-stable:
|
||||||
|
needs:
|
||||||
|
- job: run-functional-tests-stable
|
||||||
|
artifacts: true
|
||||||
|
extends: .terminate-app-server
|
||||||
|
|
||||||
app-server-testing:
|
app-server-testing:
|
||||||
variables:
|
variables:
|
||||||
LAUNCH_TEMPLATE_NAME: functional-tests-testing
|
LAUNCH_TEMPLATE_NAME: functional-tests-testing
|
||||||
INSTANCE_NAME: app-server-testing
|
INSTANCE_NAME: app-server-testing
|
||||||
|
BUILD_JOB_NAME: build
|
||||||
extends: .app-server
|
extends: .app-server
|
||||||
|
|
||||||
run-functional-tests-testing:
|
run-functional-tests-testing:
|
||||||
@ -65,6 +86,7 @@ app-server-unstable:
|
|||||||
variables:
|
variables:
|
||||||
LAUNCH_TEMPLATE_NAME: functional-tests-unstable
|
LAUNCH_TEMPLATE_NAME: functional-tests-unstable
|
||||||
INSTANCE_NAME: app-server-unstable
|
INSTANCE_NAME: app-server-unstable
|
||||||
|
BUILD_JOB_NAME: build
|
||||||
extends: .app-server
|
extends: .app-server
|
||||||
|
|
||||||
run-functional-tests-unstable:
|
run-functional-tests-unstable:
|
||||||
@ -85,6 +107,11 @@ extract-source:
|
|||||||
build:
|
build:
|
||||||
extends: .build-package
|
extends: .build-package
|
||||||
|
|
||||||
|
build-backports:
|
||||||
|
extends: .build-package
|
||||||
|
variables:
|
||||||
|
RELEASE: bullseye-backports
|
||||||
|
|
||||||
build i386:
|
build i386:
|
||||||
extends: .build-package-i386
|
extends: .build-package-i386
|
||||||
|
|
||||||
@ -123,3 +150,4 @@ rc-bugs:
|
|||||||
|
|
||||||
aptly:
|
aptly:
|
||||||
extends: .publish-aptly
|
extends: .publish-aptly
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user