Commit e4b65f5d authored by Evan Lojewski's avatar Evan Lojewski

jenkins: Fix Merge requests with forked repositories.

This updates the jenkins configuration to match the recommendations from
https://github.com/jenkinsci/gitlab-plugin
parent adf45fa7
Pipeline #115 failed with stage
......@@ -55,26 +55,29 @@ def build(nodeName, archive = false, archive_cab = false, analyze = true, test_a
def URL = ''
def REFSPEC = env['gitlabBranch']
try {
URL = env['gitlabSourceRepoHttpUrl']
URL = env['gitlabTargetRepoHttpUrl']
}
catch (exc)
{
URL = 'http://gitlab.raptorengineering.com/kestrel-collaboration/firmware.git'
try {
URL = env['gitlabSourceRepoHttpUrl']
}
catch (exc2)
{
URL = 'http://gitlab.raptorengineering.com/kestrel-collaboration/kestrel-firmware/bare-metal-firmware.git'
}
}
def HASH = ''
try {
HASH = env['gitlabMergeRequestLastCommit']
// Merge request
HASH = 'merge-requests/' + env['gitlabMergeRequestIid']
REFSPEC = '+refs/heads/*:refs/remotes/origin/* +refs/merge-requests/*/head:refs/remotes/origin/merge-requests/*'
}
catch (exc)
{
try {
HASH = GITHUB_PR_HEAD_SHA
REFSPEC = '+refs/pull/*:refs/remotes/origin/pr/*'
}
catch (exc2)
{
HASH = '**'
}
// Push to repo
HASH = 'origin/' + env['gitlabSourceBranch}']
REFSPEC = env['gitlabBranch']
}
stage('checkout')
......@@ -86,7 +89,7 @@ def build(nodeName, archive = false, archive_cab = false, analyze = true, test_a
refspec: REFSPEC,
url: URL
]],
browser: [$class: 'GitLab', repoUrl: 'http://gitlab.raptorengineering.com/kestrel-collaboration/firmware'],
browser: [$class: 'GitLab', repoUrl: 'http://gitlab.raptorengineering.com/kestrel-collaboration/kestrel-firmware/bare-metal-firmware'],
doGenerateSubmoduleConfigurations: false,
extensions: [
[$class: 'SubmoduleOption',
......@@ -95,7 +98,7 @@ def build(nodeName, archive = false, archive_cab = false, analyze = true, test_a
recursiveSubmodules: false,
reference: '',
trackingSubmodules: false
]
],
],
submoduleCfg: []
])
......
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