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
No related branches found
No related tags found
1 merge request!14Use "trigger" keyword for pipeline.
Pipeline #25691 passed
Pipeline: CaosDB Julia Integration Tests

#25695

    #
    # 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: # Taken an adapted from gitlab's example repos:
    # https://gitlab.com/gitlab-examples/julia # https://gitlab.com/gitlab-examples/julia
    ...@@ -16,7 +36,6 @@ ...@@ -16,7 +36,6 @@
    variables: variables:
    JULIALIB_REGISTRY_IMAGE: $CI_REGISTRY/caosdb/src/caosdb-julialib/testenv:$CI_COMMIT_REF_NAME 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 JULIAINTTEST_BRANCHES: https://gitlab.indiscale.com/api/v4/projects/120/repository/branches
    GIT_SUBMODULE_STRATEGY: normal GIT_SUBMODULE_STRATEGY: normal
    ...@@ -25,9 +44,11 @@ variables: ...@@ -25,9 +44,11 @@ variables:
    TRIGGERED_BY_HASH: $CI_COMMIT_SHORT_SHA TRIGGERED_BY_HASH: $CI_COMMIT_SHORT_SHA
    # The defalt branch to use with caosdb-cpplib # The defalt branch to use with caosdb-cpplib
    # TODO: Change back to dev once f-consolidate-c has been merged.
    CPP_DEFAULT_BRANCH: dev CPP_DEFAULT_BRANCH: dev
    # For storing cross-job values
    DOTENV: custom.env
    image: $JULIALIB_REGISTRY_IMAGE image: $JULIALIB_REGISTRY_IMAGE
    stages: stages:
    ...@@ -153,8 +174,8 @@ test_pages: ...@@ -153,8 +174,8 @@ test_pages:
    refs: refs:
    - main - main
    # trigger the integration tests trigger_prepare:
    trigger_inttest: # Calculate the branch name
    tags: [ docker ] tags: [ docker ]
    stage: deploy stage: deploy
    script: script:
    ...@@ -175,22 +196,40 @@ trigger_inttest: ...@@ -175,22 +196,40 @@ trigger_inttest:
    - JULIAINT_REF=${JULIAINT_REF:-dev} - JULIAINT_REF=${JULIAINT_REF:-dev}
    - F_BRANCH=$CI_COMMIT_REF_NAME - F_BRANCH=$CI_COMMIT_REF_NAME
    - echo "Triggering caosdb-juliainttest@${JULIAINT_REF} (F_BRANCH=$F_BRANCH)" # Write to dotenv
    - curl -w "%{stderr}HTTPCODE=%{http_code}" -X POST - echo "JULIAINT_REF=${JULIAINT_REF}" >> "$DOTENV"
    -F token=$CI_JOB_TOKEN - echo "F_BRANCH=${F_BRANCH}" >> "$DOTENV"
    -F "variables[TRIGGERED_BY_REPO]=$TRIGGERED_BY_REPO" - echo "CPPLIB_REF=${CPP_DEFAULT_BRANCH}" >> "$DOTENV"
    -F "variables[TRIGGERED_BY_REF]=$TRIGGERED_BY_REF" - cat "$DOTENV"
    -F "variables[TRIGGERED_BY_HASH]=$TRIGGERED_BY_HASH" artifacts:
    -F "variables[JULIALIB_REGISTRY_IMAGE]=$JULIALIB_REGISTRY_IMAGE" reports:
    -F "variables[CPPLIB_REF]=${CPP_DEFAULT_BRANCH}" dotenv: "$DOTENV"
    -F "variables[F_BRANCH]=${F_BRANCH}" expire_in: 1 day
    -F ref=${JULIAINT_REF} $JULIAINTTEST_PIPELINE 2>HTTPCODE
    # fail if the request failed
    - grep -c "HTTPCODE=2" HTTPCODE
    # 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 # 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 # found in the same place. However, care must be taken to correctly
    # locate the binary file (`/opt/julia/bin/julia` above), which is # 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