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:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
when: manual
variables:
TRIGGER_SOURCE: $CI_PIPELINE_SOURCE
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_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:
extends: .default-trigger
......
......@@ -12,35 +12,56 @@ workflow:
# variables that may be overwritten by the trigger
variables:
TRIGGER_SOURCE: "unknown"
MR_TARGET_BRANCH_NAME: "master"
DUMUX_PIPELINE_SOURCE: "unknown"
DUMUX_MR_SOURCE_BRANCH: "unknown"
DUMUX_MR_TARGET_BRANCH: "unknown"
DUMUX_REPO: "https://git.iws.uni-stuttgart.de/dumux-repositories/dumux.git"
MR_TARGET_BRANCH_NAME: ""
DUMUX_MR_SOURCE_BRANCH: ""
DUMUX_MR_TARGET_BRANCH: ""
DUMUX_TRIGGER_COMMIT_SHA: ""
DUMUX_TRIGGER_REF_SHA: ""
select tests:
stage: configure
before_script:
- |
if [[ "$DUMUX_PIPELINE_SOURCE" == "merge_request_event" ]]; then
echo "Cloning upstream merge request source/target branches ${DUMUX_MR_SOURCE_BRANCH}/${DUMUX_MR_TARGET_BRANCH}"
git clone -b ${DUMUX_MR_SOURCE_BRANCH} --depth=1 https://git.iws.uni-stuttgart.de/dumux-repositories/dumux.git
if [[ -n "$DUMUX_MR_SOURCE_BRANCH" ]]; then
echo "Fetching upstream branches related to merge request."
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
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
else
echo "Cloning into Dumux master"
git clone -b master --depth 1 https://git.iws.uni-stuttgart.de/dumux-repositories/dumux.git
git clone -b master --depth 1 $DUMUX_REPO
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
- dunecontrol --opts=$DUNE_OPTS_FILE --only=dumux all
script:
- 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"
SOURCE_TREE=$DUMUX_MR_SOURCE_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="."
SOURCE_TREE="HEAD"
TARGET_TREE=origin/$MR_TARGET_BRANCH_NAME
......@@ -57,7 +78,6 @@ select tests:
--file-list changedfiles.txt \
--build-dir build-cmake
else
echo "Received trigger source / dumux pipeline source: $TRIGGER_SOURCE / $DUMUX_PIPELINE_SOURCE"
echo "Skipping test selection, build/test stages will consider all tests!"
touch affectedtests.json
fi
......
Markdown is supported
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