Skip to content
Snippets Groups Projects
Commit cf0298ef authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

Merge branch 'f-trigger' into 'dev'

Use "trigger" keyword for pipeline.

See merge request !14
parents 4f9a1222 614ef5d2
Branches f-overview
No related tags found
1 merge request!14Use "trigger" keyword for pipeline.
Checking pipeline status
#
# This file is a part of the CaosDB Project.
#
# Copyright (C) 2021-2022 IndiScale GmbH (info@indiscale.com)
# Copyright (C) 2021 Florian Spreckelsen <f.spreckelsen@indiscale.com>
# Copyright (C) 2022 Daniel Hornung <d.hornung@indiscale.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# Taken an adapted from gitlab's example repos:
# https://gitlab.com/gitlab-examples/julia
......@@ -16,7 +36,6 @@
variables:
JULIALIB_REGISTRY_IMAGE: $CI_REGISTRY/caosdb/src/caosdb-julialib/testenv:$CI_COMMIT_REF_NAME
JULIAINTTEST_PIPELINE: https://gitlab.indiscale.com/api/v4/projects/120/trigger/pipeline
JULIAINTTEST_BRANCHES: https://gitlab.indiscale.com/api/v4/projects/120/repository/branches
GIT_SUBMODULE_STRATEGY: normal
......@@ -25,9 +44,11 @@ variables:
TRIGGERED_BY_HASH: $CI_COMMIT_SHORT_SHA
# The defalt branch to use with caosdb-cpplib
# TODO: Change back to dev once f-consolidate-c has been merged.
CPP_DEFAULT_BRANCH: dev
# For storing cross-job values
DOTENV: custom.env
image: $JULIALIB_REGISTRY_IMAGE
stages:
......@@ -153,8 +174,8 @@ test_pages:
refs:
- main
# trigger the integration tests
trigger_inttest:
trigger_prepare:
# Calculate the branch name
tags: [ docker ]
stage: deploy
script:
......@@ -175,22 +196,40 @@ trigger_inttest:
- JULIAINT_REF=${JULIAINT_REF:-dev}
- F_BRANCH=$CI_COMMIT_REF_NAME
- echo "Triggering caosdb-juliainttest@${JULIAINT_REF} (F_BRANCH=$F_BRANCH)"
- curl -w "%{stderr}HTTPCODE=%{http_code}" -X POST
-F token=$CI_JOB_TOKEN
-F "variables[TRIGGERED_BY_REPO]=$TRIGGERED_BY_REPO"
-F "variables[TRIGGERED_BY_REF]=$TRIGGERED_BY_REF"
-F "variables[TRIGGERED_BY_HASH]=$TRIGGERED_BY_HASH"
-F "variables[JULIALIB_REGISTRY_IMAGE]=$JULIALIB_REGISTRY_IMAGE"
-F "variables[CPPLIB_REF]=${CPP_DEFAULT_BRANCH}"
-F "variables[F_BRANCH]=${F_BRANCH}"
-F ref=${JULIAINT_REF} $JULIAINTTEST_PIPELINE 2>HTTPCODE
# fail if the request failed
- grep -c "HTTPCODE=2" HTTPCODE
# Write to dotenv
- echo "JULIAINT_REF=${JULIAINT_REF}" >> "$DOTENV"
- echo "F_BRANCH=${F_BRANCH}" >> "$DOTENV"
- echo "CPPLIB_REF=${CPP_DEFAULT_BRANCH}" >> "$DOTENV"
- cat "$DOTENV"
artifacts:
reports:
dotenv: "$DOTENV"
expire_in: 1 day
# WARNING: This template is using the `julia` images from [Docker
# trigger the integration tests
trigger_inttest:
stage: deploy
needs: [ trigger_prepare ]
inherit:
variables:
# List the variables that shall be inherited, which also means they will override any equally
# named varibles in child pipelines.
- TRIGGERED_BY_REPO
- TRIGGERED_BY_REF
- TRIGGERED_BY_HASH
- JULIALIB_REGISTRY_IMAGE
variables:
# dotenv variables must be set again here.
F_BRANCH: $F_BRANCH
CPPLIB_REF: $CPPLIB_REF
trigger:
project: caosdb/src/caosdb-juliainttest
branch: $JULIAINT_REF
strategy: depend
# WARNING: This template uses the `julia` images from [Docker
# Hub][3]. One can use custom Julia images and/or the official ones
# found in the same place. However, care must be taken to correctly
# locate the binary file (`/opt/julia/bin/julia` above), which is
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment