Commit 8167b7ba authored by Dennis Gläser's avatar Dennis Gläser
Browse files

[ci] receive upstream reference commit

parent 93c8acf5
Pipeline #4900 passed with stage
...@@ -19,11 +19,11 @@ variables: ...@@ -19,11 +19,11 @@ variables:
- if: $CI_PIPELINE_SOURCE == "merge_request_event" - if: $CI_PIPELINE_SOURCE == "merge_request_event"
when: manual when: manual
variables: variables:
TRIGGER_SOURCE: $CI_PIPELINE_SOURCE
MR_TARGET_BRANCH_NAME: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME MR_TARGET_BRANCH_NAME: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME
DUMUX_PIPELINE_SOURCE: $DUMUX_PIPELINE_SOURCE
DUMUX_MR_SOURCE_BRANCH: $DUMUX_MERGE_REQUEST_SOURCE_BRANCH DUMUX_MR_SOURCE_BRANCH: $DUMUX_MERGE_REQUEST_SOURCE_BRANCH
DUMUX_MR_TARGET_BRANCH: $DUMUX_MERGE_REQUEST_TARGET_BRANCH DUMUX_MR_TARGET_BRANCH: $DUMUX_MERGE_REQUEST_TARGET_BRANCH
DUMUX_TRIGGER_COMMIT_SHA: $DUMUX_COMMIT_SHA
DUMUX_TRIGGER_REF_SHA: $DUMUX_REFERENCE_SHA
full-dune-2.7-gcc: full-dune-2.7-gcc:
extends: .default-trigger extends: .default-trigger
......
...@@ -12,35 +12,56 @@ workflow: ...@@ -12,35 +12,56 @@ workflow:
# variables that may be overwritten by the trigger # variables that may be overwritten by the trigger
variables: variables:
TRIGGER_SOURCE: "unknown" DUMUX_REPO: "https://git.iws.uni-stuttgart.de/dumux-repositories/dumux.git"
MR_TARGET_BRANCH_NAME: "master" MR_TARGET_BRANCH_NAME: ""
DUMUX_PIPELINE_SOURCE: "unknown" DUMUX_MR_SOURCE_BRANCH: ""
DUMUX_MR_SOURCE_BRANCH: "unknown" DUMUX_MR_TARGET_BRANCH: ""
DUMUX_MR_TARGET_BRANCH: "unknown" DUMUX_TRIGGER_COMMIT_SHA: ""
DUMUX_TRIGGER_REF_SHA: ""
select tests: select tests:
stage: configure stage: configure
before_script: before_script:
- | - |
if [[ "$DUMUX_PIPELINE_SOURCE" == "merge_request_event" ]]; then if [[ -n "$DUMUX_MR_SOURCE_BRANCH" ]]; then
echo "Cloning upstream merge request source/target branches ${DUMUX_MR_SOURCE_BRANCH}/${DUMUX_MR_TARGET_BRANCH}" echo "Fetching upstream branches related to merge request."
git clone -b ${DUMUX_MR_SOURCE_BRANCH} --depth=1 https://git.iws.uni-stuttgart.de/dumux-repositories/dumux.git echo "Source branch: $DUMUX_MR_SOURCE_BRANCH"
echo "Target branch: $DUMUX_MR_TARGET_BRANCH"
git clone -b ${DUMUX_MR_TARGET_BRANCH} --depth 1 $DUMUX_REPO
pushd dumux pushd dumux
git fetch --depth=1 origin ${DUMUX_MR_TARGET_BRANCH}:${DUMUX_MR_TARGET_BRANCH} git fetch --depth=1 origin ${DUMUX_MR_SOURCE_BRANCH}:${DUMUX_MR_SOURCE_BRANCH}
popd popd
else else
echo "Cloning into Dumux master" git clone -b master --depth 1 $DUMUX_REPO
git clone -b master --depth 1 https://git.iws.uni-stuttgart.de/dumux-repositories/dumux.git
pushd dumux
if [[ -n "$DUMUX_TRIGGER_COMMIT_SHA" ]]; then
echo "Fetching upstream commit $DUMUX_TRIGGER_COMMIT_SHA"
git fetch --depth=1 origin ${DUMUX_TRIGGER_COMMIT_SHA}
git checkout ${DUMUX_TRIGGER_COMMIT_SHA}
fi
if [[ -n "$DUMUX_TRIGGER_REF_SHA" ]]; then
echo "Fetching upstream reference commit $DUMUX_TRIGGER_REF_SHA"
git fetch --depth=1 origin ${DUMUX_TRIGGER_REF_SHA}
fi
popd
fi fi
- dunecontrol --opts=$DUNE_OPTS_FILE --only=dumux all - dunecontrol --opts=$DUNE_OPTS_FILE --only=dumux all
script: script:
- dunecontrol --opts=$DUNE_OPTS_FILE --current all - dunecontrol --opts=$DUNE_OPTS_FILE --current all
- | - |
if [[ "$DUMUX_PIPELINE_SOURCE" == "merge_request_event" ]]; then if [[ -n "$DUMUX_MR_SOURCE_BRANCH" ]]; then
CHECK_FOLDER="dumux" CHECK_FOLDER="dumux"
SOURCE_TREE=$DUMUX_MR_SOURCE_BRANCH SOURCE_TREE=$DUMUX_MR_SOURCE_BRANCH
TARGET_TREE=$DUMUX_MR_TARGET_BRANCH TARGET_TREE=$DUMUX_MR_TARGET_BRANCH
elif [[ "$TRIGGER_SOURCE" == "merge_request_event" ]]; then elif [[ -n "$DUMUX_TRIGGER_REF_SHA" ]]; then
CHECK_FOLDER="dumux"
SOURCE_TREE=$DUMUX_TRIGGER_COMMIT_SHA
TARGET_TREE=$DUMUX_TRIGGER_REF_SHA
elif [[ -n "$MR_TARGET_BRANCH_NAME" ]]; then
CHECK_FOLDER="." CHECK_FOLDER="."
SOURCE_TREE="HEAD" SOURCE_TREE="HEAD"
TARGET_TREE=origin/$MR_TARGET_BRANCH_NAME TARGET_TREE=origin/$MR_TARGET_BRANCH_NAME
...@@ -57,7 +78,6 @@ select tests: ...@@ -57,7 +78,6 @@ select tests:
--file-list changedfiles.txt \ --file-list changedfiles.txt \
--build-dir build-cmake --build-dir build-cmake
else else
echo "Received trigger source / dumux pipeline source: $TRIGGER_SOURCE / $DUMUX_PIPELINE_SOURCE"
echo "Skipping test selection, build/test stages will consider all tests!" echo "Skipping test selection, build/test stages will consider all tests!"
touch affectedtests.json touch affectedtests.json
fi fi
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment