Skip to content
Snippets Groups Projects
Commit 534d19b2 authored by Dennis Gläser's avatar Dennis Gläser
Browse files

[ci] simplify commit sha detection

parent 2d50a481
No related branches found
No related tags found
1 merge request!2644Feature/continuous master pipeline status
...@@ -30,7 +30,7 @@ check-pipeline-status: ...@@ -30,7 +30,7 @@ check-pipeline-status:
when: always when: always
script: 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" \ "https://git.iws.uni-stuttgart.de/api/v4/projects/31/pipelines/?status=success" \
> pipeline_status.json > pipeline_status.json
- | - |
......
...@@ -21,6 +21,13 @@ select tests: ...@@ -21,6 +21,13 @@ select tests:
script: script:
- dunecontrol --opts=$DUNE_OPTS_FILE --current all - 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 if [[ "$TRIGGER_SOURCE" == "merge_request_event" ]]; then
echo "Detecting changes w.r.t to target branch '$MR_TARGET_BRANCH_NAME'" echo "Detecting changes w.r.t to target branch '$MR_TARGET_BRANCH_NAME'"
python3 bin/testing/getchangedfiles.py --outfile changedfiles.txt \ python3 bin/testing/getchangedfiles.py --outfile changedfiles.txt \
...@@ -36,19 +43,15 @@ select tests: ...@@ -36,19 +43,15 @@ select tests:
elif [ -n $TEST_AGAINST_LAST_SUCCESSFUL ]; then elif [ -n $TEST_AGAINST_LAST_SUCCESSFUL ]; then
echo "Determining sha of the last successful pipeline to test against" 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" \ "https://git.iws.uni-stuttgart.de/api/v4/projects/31/pipelines/?status=success" \
> pipeline_status.json > pipeline_status.json
if ! python3 .gitlab-ci/getpipelineinfo.py --status-file pipeline_status.json \ if ! getLastSuccesful pipeline_status.json; then
--look-for latest \
--print-format commit-sha; then
echo "Could not find a successful pipeline, will build/run all tests" echo "Could not find a successful pipeline, will build/run all tests"
touch affectedtests.json touch affectedtests.json
else else
export COMMIT_SHA=$(python3 .gitlab-ci/getpipelineinfo.py --status-file pipeline_status.json \ COMMIT_SHA=$(getLastSuccesful pipeline_status.json)
--look-for latest \
--print-format commit-sha)
echo "Comparing against sha $COMMIT_SHA" echo "Comparing against sha $COMMIT_SHA"
python3 bin/testing/getchangedfiles.py --outfile changedfiles.txt \ python3 bin/testing/getchangedfiles.py --outfile changedfiles.txt \
--source-tree HEAD \ --source-tree HEAD \
......
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