Add gcloud-pubsub-events plugin build
Also add the ability to use a target Gerrit branch
different than the plugin's one and make it work also
when the gerrit remote is already defined by the SCM
source.
Change-Id: I23929eecb1a23bb57842af2cd5af7bd69c74ae43
diff --git a/jenkins/gerrit-bazel-build-plugin-branch.sh b/jenkins/gerrit-bazel-build-plugin-branch.sh
index 2bdb215..042ead1 100644
--- a/jenkins/gerrit-bazel-build-plugin-branch.sh
+++ b/jenkins/gerrit-bazel-build-plugin-branch.sh
@@ -11,7 +11,7 @@
echo "Building plugin {name}/{branch} with Gerrit/{gerrit-branch}"
-git remote add gerrit https://gerrit.googlesource.com/a/gerrit
+git remote show gerrit > /dev/null 2>&1 || git remote add gerrit https://gerrit.googlesource.com/a/gerrit
git fetch gerrit {gerrit-branch}
git checkout -fb {gerrit-branch} gerrit/{gerrit-branch}
git submodule update --init
diff --git a/jenkins/gerrit-bazel-plugin-gcloud-pubsub-events.yaml b/jenkins/gerrit-bazel-plugin-gcloud-pubsub-events.yaml
new file mode 100644
index 0000000..2dfa647
--- /dev/null
+++ b/jenkins/gerrit-bazel-plugin-gcloud-pubsub-events.yaml
@@ -0,0 +1,10 @@
+- project:
+ name: gcloud-pubsub-events
+ repo: gcloud-pubsub-events
+ organization: GerritForge
+ jobs:
+ - 'plugin-{name}-gh-bazel-{branch}-{gerrit-branch}':
+ branch:
+ - master
+ gerrit-branch:
+ - stable-3.3
diff --git a/jenkins/gerrit-bazel-plugin-gh-template.yaml b/jenkins/gerrit-bazel-plugin-gh-template.yaml
index 7f6e970..14bb521 100644
--- a/jenkins/gerrit-bazel-plugin-gh-template.yaml
+++ b/jenkins/gerrit-bazel-plugin-gh-template.yaml
@@ -55,3 +55,18 @@
- archive:
artifacts: >
bazel-bin/plugins/{name}/{name}.jar*,bazel-bin/plugins/{name}/{name}.json
+
+- job-template:
+ name: 'plugin-{name}-gh-bazel-{branch}-{gerrit-branch}'
+ description: >
+ Plugin {name} {branch} branch owned by {organization}
+ and hosted on GitHub and built with Bazel for Gerrit {gerrit-branch}
+ defaults: plugin-gh-template
+ builders:
+ - set-git-credentials
+ - shell: !include-raw: gerrit-bazel-build-plugin-branch.sh
+ - shell: !include-raw: gerrit-bazel-gh-get-plugin-info.sh
+ publishers:
+ - archive:
+ artifacts: >
+ bazel-bin/plugins/{name}/{name}.jar*,bazel-bin/plugins/{name}/{name}.json