Revert "Remove account plugin"
This reverts commit 9c58fcdc73d62b73df5f6b56c4383e06771a8834.
Reason for revert: Gerrit delete account functionality isn't a
replacement of the account plugin as it leaves the changes in an
inconsistent state. The plugin is therefore still needed,
at least for now.
Change-Id: I626d739fc026eaa3ebfcb747a4d2af1cde51fea9
diff --git a/jenkins/gerrit-bazel-build-account-plugin.sh b/jenkins/gerrit-bazel-build-account-plugin.sh
new file mode 100644
index 0000000..1a06316
--- /dev/null
+++ b/jenkins/gerrit-bazel-build-account-plugin.sh
@@ -0,0 +1,46 @@
+#!/bin/bash -e
+
+case {branch} in
+ master|stable-3.9|stable-3.10)
+ . set-java.sh 17
+ ;;
+
+ *)
+ . set-java.sh 11
+ ;;
+esac
+
+git checkout -f -b gerrit-{branch} gerrit/{branch}
+git submodule update --init
+rm -rf plugins/account
+git read-tree -u --prefix=plugins/account origin/{branch}
+
+for file in external_plugin_deps.bzl external_package.json
+do
+ if [ -f plugins/account/$file ]
+ then
+ cp -f plugins/account/$file plugins/
+ fi
+done
+
+TARGETS=$(echo "plugins/account:account" | sed -e 's/account/account/g')
+
+# install packages from package.json and copy deps into src tree
+pushd plugins/account
+./copy_deps.sh
+popd
+
+java -fullversion
+bazelisk version
+bazelisk build $BAZEL_OPTS $TARGETS
+bazelisk test $BAZEL_OPTS --test_env DOCKER_HOST=$DOCKER_HOST //tools/bzl:always_pass_test plugins/account/...
+
+for JAR in $(find bazel-bin/plugins/account -name account*.jar)
+do
+ PLUGIN_VERSION=$(git describe --always origin/{branch})
+ echo -e "Implementation-Version: $PLUGIN_VERSION" > MANIFEST.MF
+ jar ufm $JAR MANIFEST.MF && rm MANIFEST.MF
+ DEST_JAR=bazel-bin/plugins/account/$(basename $JAR)
+ [ "$JAR" -ef "$DEST_JAR" ] || mv $JAR $DEST_JAR
+ echo "$PLUGIN_VERSION" > bazel-bin/plugins/account/$(basename $JAR-version)
+done
diff --git a/jenkins/gerrit-bazel-plugin-account.yaml b/jenkins/gerrit-bazel-plugin-account.yaml
new file mode 100644
index 0000000..7671fc1
--- /dev/null
+++ b/jenkins/gerrit-bazel-plugin-account.yaml
@@ -0,0 +1,45 @@
+- job-template:
+ name: 'plugin-account-bazel-{branch}'
+ description: 'Plugin account {branch} branch build with Bazel'
+ defaults: plugin-template-bazel
+ node: bazel-debian
+ class: plugins
+ project-name: plugins%2Faccount
+ scm:
+ - git:
+ remotes:
+ - origin:
+ url: https://gerrit.googlesource.com/a/plugins/{name}
+ credentials-id: gerrit.googlesource.com
+ - gerrit:
+ url: https://gerrit.googlesource.com/a/gerrit
+ credentials-id: gerrit.googlesource.com
+ branches:
+ - origin/{branch}
+ submodule:
+ recursive: true
+ parent-credentials: true
+ skip-tag: true
+ wrappers:
+ - credentials-binding:
+ - username-password-separated:
+ credential-id: gerrit.googlesource.com
+ username: GS_GIT_USER
+ password: GS_GIT_PASS
+ builders:
+ - set-git-credentials
+ - shell: !include-raw: gerrit-bazel-build-account-plugin.sh
+ - shell: !include-raw: gerrit-bazel-get-project-info.sh
+ publishers:
+ - archive:
+ artifacts: >
+ bazel-bin/plugins/account/account.jar*,bazel-bin/plugins/account/account.json
+ follow-symlinks: true
+
+- project:
+ name: account
+ jobs:
+ - 'plugin-account-bazel-{branch}':
+ branch:
+ - master
+ - stable-3.8