diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bfdd9538651e44334be1ffddaa5ddcbec92c4605..bd9e0893738ce3bce5aa43919d4201a5f4150811 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -30,7 +30,7 @@ check-pipeline-status: when: always script: - | - curl --header --form "token=$CI_JOB_TOKEN" \ + curl --header "token=$CI_JOB_TOKEN" \ "https://git.iws.uni-stuttgart.de/api/v4/projects/31/pipelines/?status=success" \ > pipeline_status.json - | diff --git a/.gitlab-ci/default.yml b/.gitlab-ci/default.yml index 3783d27951d1125c2e8a85a7bc3b1f32cf1368c1..71ddf0f1d38f5ac5e96c625ec6750fa6a5a9d84f 100644 --- a/.gitlab-ci/default.yml +++ b/.gitlab-ci/default.yml @@ -21,6 +21,13 @@ select tests: script: - dunecontrol --opts=$DUNE_OPTS_FILE --current all - | + getLastSuccesful() { + python3 .gitlab-ci/getpipelineinfo.py \ + --status-file $1 \ + --look-for latest \ + --print-format commit-sha + } + if [[ "$TRIGGER_SOURCE" == "merge_request_event" ]]; then echo "Detecting changes w.r.t to target branch '$MR_TARGET_BRANCH_NAME'" python3 bin/testing/getchangedfiles.py --outfile changedfiles.txt \ @@ -36,19 +43,15 @@ select tests: elif [ -n $TEST_AGAINST_LAST_SUCCESSFUL ]; then echo "Determining sha of the last successful pipeline to test against" - curl --header --form "token=$CI_JOB_TOKEN" \ + curl --header "token=$CI_JOB_TOKEN" \ "https://git.iws.uni-stuttgart.de/api/v4/projects/31/pipelines/?status=success" \ > pipeline_status.json - if ! python3 .gitlab-ci/getpipelineinfo.py --status-file pipeline_status.json \ - --look-for latest \ - --print-format commit-sha; then + if ! getLastSuccesful pipeline_status.json; then echo "Could not find a successful pipeline, will build/run all tests" touch affectedtests.json else - export COMMIT_SHA=$(python3 .gitlab-ci/getpipelineinfo.py --status-file pipeline_status.json \ - --look-for latest \ - --print-format commit-sha) + COMMIT_SHA=$(getLastSuccesful pipeline_status.json) echo "Comparing against sha $COMMIT_SHA" python3 bin/testing/getchangedfiles.py --outfile changedfiles.txt \ --source-tree HEAD \