diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ff1db6df2ede12b6254e3c9ad1841fe1a3603061..5e279c27b7fc1536ce70dd41e69781e09bbe8072 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -23,7 +23,6 @@ variables: CPPLIB_REGISTRY_IMAGE: $CI_REGISTRY/caosdb/src/caosdb-cpplib/testenv:$CI_COMMIT_REF_NAME - CPPINTTEST_PIPELINE: https://gitlab.indiscale.com/api/v4/projects/111/trigger/pipeline CPPINTTEST_BRANCHES: https://gitlab.indiscale.com/api/v4/projects/111/repository/branches GIT_SUBMODULE_STRATEGY: normal @@ -32,6 +31,9 @@ variables: TRIGGERED_BY_REF: $CI_COMMIT_REF_NAME TRIGGERED_BY_HASH: $CI_COMMIT_SHORT_SHA + # For storing cross-job values + DOTENV: custom.env + image: $CPPLIB_REGISTRY_IMAGE @@ -91,12 +93,11 @@ test: - cmake --build . -j --target cxxcaosdbcli # - cmake --build . -j --target ccaosdbcli # Disabled until it compiles again. -# trigger the integration tests -trigger_inttest: +trigger_prepare: + # Calculate the branch name tags: [ docker ] stage: deploy script: - ## Determine the cppinttest branch... # ... use an f-branch if posible... - F_BRANCH=dev @@ -121,18 +122,35 @@ trigger_inttest: # ... and fall-back to dev - CPPINT_REF=${CPPINT_REF:-dev} - - echo "Triggering caosdb-cppinttest@${CPPINT_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[CPPLIB_REGISTRY_IMAGE]=$CPPLIB_REGISTRY_IMAGE" - -F "variables[F_BRANCH]=${F_BRANCH}" - -F ref=${CPPINT_REF} $CPPINTTEST_PIPELINE 2>HTTPCODE - - # fail if the request failed - - grep -c "HTTPCODE=2" HTTPCODE + # Write to dotenv + - echo "CPPINT_REF=${CPPINT_REF}" >> "$DOTENV" + - echo "F_BRANCH=${F_BRANCH}" >> "$DOTENV" + - cat "$DOTENV" + artifacts: + reports: + dotenv: "$DOTENV" + expire_in: 1 day + + +# 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 + - CPPLIB_REGISTRY_IMAGE + variables: + # dotenv variables must be set again here. + F_BRANCH: $F_BRANCH + trigger: + project: caosdb/src/caosdb-cppinttest + branch: $CPPINT_REF + strategy: depend # Build the sphinx documentation and make it ready for deployment by Gitlab Pages # Special job for serving a static website. See https://docs.gitlab.com/ee/ci/yaml/README.html#pages