rewrite pipeline to reflect pushing same commits to both remotes
This commit is contained in:
13
Jenkinsfile
vendored
13
Jenkinsfile
vendored
@@ -29,10 +29,15 @@ pipeline {
|
|||||||
git config user.name "Jenkins Server"
|
git config user.name "Jenkins Server"
|
||||||
git config user.email jenkins@confdroid.com
|
git config user.email jenkins@confdroid.com
|
||||||
git fetch origin
|
git fetch origin
|
||||||
# Reset the workspace to the exact branch revision that triggered the build.
|
source_branch="${gitlabSourceBranch:-${BRANCH_NAME:-${GIT_LOCAL_BRANCH:-$GIT_BRANCH}}}"
|
||||||
git checkout -B "$BRANCH_NAME" "origin/$BRANCH_NAME"
|
source_branch="${source_branch#origin/}"
|
||||||
# Create an isolated build branch from the triggering branch.
|
source_branch="${source_branch#refs/heads/}"
|
||||||
git checkout -B jenkins-build-$BUILD_NUMBER
|
if [ -z "$source_branch" ]; then
|
||||||
|
source_branch="development"
|
||||||
|
fi
|
||||||
|
echo "Using source branch: $source_branch"
|
||||||
|
# Create an isolated build branch from the triggering branch revision.
|
||||||
|
git checkout -B jenkins-build-$BUILD_NUMBER "origin/$source_branch"
|
||||||
# Merge the current master into the build branch before validation.
|
# Merge the current master into the build branch before validation.
|
||||||
git merge origin/master --no-ff || { echo "Merge conflict detected"; exit 1; }
|
git merge origin/master --no-ff || { echo "Merge conflict detected"; exit 1; }
|
||||||
'''
|
'''
|
||||||
|
|||||||
Reference in New Issue
Block a user