Rebase master before building

Closes: GRADE-2046

Test plan:
- tests pass
- EDU Shared/canvas-image-wip build passes

Change-Id: I7b1cfb3227a1afd9eb705b690c400a7ae1cf1e75
Reviewed-on: https://gerrit.instructure.com/183701
Tested-by: Jenkins
Reviewed-by: Robert Lamb <rlamb@instructure.com>
QA-Review: Robert Lamb <rlamb@instructure.com>
Product-Review: Robert Lamb <rlamb@instructure.com>
This commit is contained in:
Derek Bender 2019-03-04 15:09:25 -06:00
parent 7c87638a1f
commit 751028701e
1 changed files with 13 additions and 2 deletions

15
Jenkinsfile vendored
View File

@ -26,12 +26,12 @@ def withGerritCredentials = { Closure command ->
]) { command() }
}
def fetchFromGerrit = { String repo, String path, String customRepoDestination = null, String sourcePath = '' ->
def fetchFromGerrit = { String repo, String path, String customRepoDestination = null, String sourcePath = null ->
withGerritCredentials({ ->
sh """
mkdir -p ${path}/${customRepoDestination ?: repo}
GIT_SSH_COMMAND='ssh -i \"$SSH_KEY_PATH\" -l \"$SSH_USERNAME\"' \
git archive --remote=ssh://$GERRIT_URL/${repo} master ${sourcePath} | tar -x -C ${path}/${customRepoDestination ?: repo}
git archive --remote=ssh://$GERRIT_URL/${repo} master ${sourcePath == null ? '' : sourcePath} | tar -x -C ${path}/${customRepoDestination ?: repo}
"""
})
}
@ -101,6 +101,17 @@ pipeline {
}
}
stage('Rebase') {
when { expression { env.GERRIT_EVENT_TYPE == 'patchset-created' } }
steps {
sh '''
git config user.name $GERRIT_EVENT_ACCOUNT_NAME
git config user.email $GERRIT_EVENT_ACCOUNT_EMAIL
git rebase --preserve-merges origin/$GERRIT_BRANCH
'''
}
}
stage('Build Image') {
steps {
timeout(time: 20, unit: 'MINUTES') {