Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Tests included in the pipeline. Still 2 falling.

Michal Rutka525dc66980b7
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index cb2d15ef6..7f6087f87 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -9,6 +9,7 @@ stages:
- build
- build_fail
- test
+ - tests_fail
- deploy
- dast
- cleanup
@@ -69,9 +70,7 @@ build-master:
only:
- master
-# This step is executed when build fails. The purpose is to e-mail a git commiter about the problem.
-email failed pipeline:
- stage: build_fail
+.email_template: &email_definition
image: docker:latest
script:
- docker pull registry.gitlab.com/openremote/openremote:master
@@ -81,6 +80,7 @@ email failed pipeline:
- export REPO=$(docker run --rm -v $(pwd):/or registry.gitlab.com/openremote/openremote:master git remote get-url origin|xargs basename)
- echo $REPO
- docker run -v $(pwd):/usr/src/myapp -w /usr/src/myapp
+ -e "STAGE=$STAGE"
-e "WHO=$WHO"
-e "WHAT=$WHAT"
-e "WHEN=$WHEN"
@@ -92,6 +92,13 @@ email failed pipeline:
only:
- master
+# This step is executed when build fails. The purpose is to e-mail a git commiter about the problem.
+email failed build:
+ stage: build_fail
+ before_script:
+ - export STAGE='docker images build'
+ <<: *email_definition
+
test-master:
before_script:
- docker run -v $(pwd):/or
@@ -103,11 +110,16 @@ test-master:
script:
- docker run --network host -v $(pwd):/or "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
/bin/sh -c "./gradlew clean build installDist"
- # Still has 3 errors, therefore allow it to fail
- allow_failure: true
rules:
- if: $CI_COMMIT_BRANCH == "master"
- when: manual
+ if: $CI_COMMIT_MESSAGE !~ /skip-tests/
+ when: on_success
+
+email failed tests:
+ stage: tests_fail
+ before_script:
+ - export STAGE='tests'
+ <<: *email_definition
deploy-master:
image: registry.gitlab.com/gitlab-org/cloud-deploy/aws-base:latest
@@ -122,7 +134,7 @@ deploy-master:
only:
- master
-auto delete aws cloudformation stack:
+auto delete aws cloudformation stack after 8 hours:
image: registry.gitlab.com/gitlab-org/cloud-deploy/aws-base:latest
stage: cleanup
script:
diff --git a/gitlab-ci/aws-mail.py b/gitlab-ci/aws-mail.py
index 1c1adc746..20f4650d3 100644
--- a/gitlab-ci/aws-mail.py
+++ b/gitlab-ci/aws-mail.py
@@ -5,7 +5,7 @@ import os
sender = '[email protected]'
receivers = [os.environ['WHO']]
-subject = 'Gitlab pipeline FAILED: '+os.environ['WHAT']
+subject = 'Gitlab pipeline FAILED on ' + os.environ['STAGE'] + ': ' + os.environ['WHAT']
print(sender,receivers, subject)
message = '\r\n'.join(['From: %s' % sender,
@@ -14,6 +14,9 @@ message = '\r\n'.join(['From: %s' % sender,
"""
The GitLab CI/CD pipeline FAILED for {repo}
+To skip testing and run complete pipeline without errors please include
+'skip-tests' in the git commit message.
+
{what}
{when}
{who}.