Skip to content
Snippets Groups Projects
Commit 73fd9e02 authored by Daniel Hornung's avatar Daniel Hornung
Browse files

MAINT: Switching CI pipeline triggering to the "trigger" keyword.

parent 4f9a1222
No related branches found
No related tags found
1 merge request!14Use "trigger" keyword for pipeline.
Pipeline #24372 passed
Pipeline: CaosDB Julia Integration Tests

#24373

    ......@@ -16,7 +16,7 @@
    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_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 +25,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,13 +155,14 @@ test_pages:
    refs:
    - main
    # trigger the integration tests
    trigger_inttest:
    trigger_prepare:
    # Calculate the branch name
    tags: [ docker ]
    stage: deploy
    script:
    ## Determine the juliainttest branch...
    # ... use an f-branch if posible...
    - F_BRANCH=dev
    - if echo "$CI_COMMIT_REF_NAME" | grep -c "^f-" ; then
    if curl -o /dev/null -s -w "%{http_code}" $JULIAINTTEST_BRANCHES/$CI_COMMIT_REF_NAME | grep "404"; then
    JULIAINT_REF=dev ;
    ......@@ -175,22 +178,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}"
    - 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