Skip to content

Commit 45f781a

Browse files
committed
Allow including repos from Github
Added extra-gh-repos variables to add dependencies hosted on github. Change-Id: Ic91ecdff09feb48c43718efca665d1ff41051afc
1 parent bb663a9 commit 45f781a

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

jenkins/gerrit-bazel-build-plugin-branch.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,17 @@ do
5050
popd
5151
done
5252

53+
GH_PLUGIN_SCM_BASE_URL="https://github.com/{organization}"
54+
for extraGhRepo in {extra-gh-repos}
55+
do
56+
pushd ..
57+
git clone -b {branch} $GH_PLUGIN_SCM_BASE_URL/$extraGhRepo.git
58+
popd
59+
pushd plugins
60+
ln -s ../../$extraGhRepo .
61+
popd
62+
done
63+
5364
TARGETS=$(echo "{targets}" | sed -e 's/{{name}}/{name}/g')
5465
java -fullversion
5566

jenkins/gerrit-bazel-build-plugin.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,17 @@ do
4949
popd
5050
done
5151

52+
GH_PLUGIN_SCM_BASE_URL="https://github.com/{organization}"
53+
for extraGhRepo in {extra-gh-repos}
54+
do
55+
pushd ..
56+
git clone -b {branch} $GH_PLUGIN_SCM_BASE_URL/$extraGhRepo.git
57+
popd
58+
pushd plugins
59+
ln -s ../../$extraGhRepo .
60+
popd
61+
done
62+
5263
TARGETS=$(echo "{targets}" | sed -e 's/{{name}}/{name}/g')
5364

5465
java -fullversion

vars/pluginPipeline.groovy

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ def call(Map parm = [:]) {
3636
def buildCheck = parm.buildCheckId
3737
def extraPlugins = parm.extraPlugins ?: []
3838
def extraModules = parm.extraModules ?: []
39+
def extraGhRepos = parm.extraGhRepos ?: []
3940
def gerritReviewBaseUrl = "https://gerrit.googlesource.com/a"
4041
def gerritReviewHostname = "gerrit.googlesource.com"
4142
def gjfVersion = parm.gjfVersion ?: '1.24.0'
@@ -54,10 +55,11 @@ def call(Map parm = [:]) {
5455
stage('Checkout') {
5556
steps {
5657
checkout scm
58+
def scmUrl = sh(returnStdout: true, script: 'git config remote.origin.url').trim()
59+
def githubBaseUrl = s.substring(0, scmUrl.lastIndexOf("/"))
5760

5861
withCredentials([usernamePassword(usernameVariable: "GS_GIT_USER", passwordVariable: "GS_GIT_PASS", credentialsId: env.GERRIT_CREDENTIALS_ID)]) {
5962
script {
60-
def scmUrl = sh(returnStdout: true, script: 'git config remote.origin.url').trim()
6163
def pluginScmHostname = new java.net.URI(scmUrl).getHost()
6264

6365
sh 'echo "machine ' + pluginScmHostname + ' login $GS_GIT_USER password $GS_GIT_PASS">> ~/.netrc'
@@ -72,6 +74,7 @@ def call(Map parm = [:]) {
7274
script {
7375
extraPlugins.each { plugin -> sh "git clone -b ${GERRIT_BRANCH} ${gerritReviewBaseUrl}/plugins/${plugin}" }
7476
extraModules.each { module -> sh "git clone -b ${GERRIT_BRANCH} ${gerritReviewBaseUrl}/modules/${module}" }
77+
extraGhRepos.each { repo -> sh "git clone -b ${GERRIT_BRANCH} ${githubBaseUrl}/${repo}.git" }
7578
}
7679
}
7780
}
@@ -114,7 +117,7 @@ def call(Map parm = [:]) {
114117
sh "if [ -f ../${pluginName}/external_plugin_deps.bzl ]; then cd plugins && ln -sf ../../${pluginName}/external_plugin_deps.bzl .; fi"
115118
sh "if [ -f ../${pluginName}/external_package.json ]; then cd plugins && ln -sf ../../${pluginName}/external_package.json package.json; fi"
116119
script {
117-
(extraPlugins + extraModules).each { plugin -> sh "cd plugins && ln -s ../../${plugin} ." }
120+
(extraPlugins + extraModules + extraGhRepos).each { plugin -> sh "cd plugins && ln -s ../../${plugin} ." }
118121
}
119122
sh "${bazeliskCmd} build ${bazeliskOptions} plugins/${pluginName}/..."
120123
sh "${bazeliskCmd} test ${bazeliskOptions} --test_env DOCKER_HOST=" + '$DOCKER_HOST' + " plugins/${pluginName}/..."

0 commit comments

Comments
 (0)