Add the ability to build a Gerrit plugin from a non-root directory

This update modifies the `gerrit-bazel-build-plugin-branch.sh` script
to support plugins located in non-root directories within
multi-component repositories. Changes include:
* Using `{repo}` variable as the plugin's repository path if available;
  otherwise, `{name}` is used.
* If `{sourcePath}` variable is set, it specifies the relative path to
  the plugin within the repository. This path is then linked under the
  plugin's directory for building.

Example Configuration:
* repo: gerritforge-health-service
* sourcePath: components/collectors/gerrit/ghs-upload-pack-metrics
* Resulting Link: The path
  `gerritforge-health-service/components/collectors/gerrit/
   ghs-upload-pack-metrics`
  is linked to `plugins/ghs-upload-pack-metrics` directory and used as
  the typical plugin target.

The ghs-upload-pack-metrics plugin provides example on how to use it
and also confirms that it works.

GHS-Issue: https://github.com/GerritForge/gerritforge-health-service/issues/40
Change-Id: Id26bf21cbe2eefe6d6ed02ef4aa2e56b30c724e7
2 files changed
tree: f41d8052ed2076055dc4ca09aeb218f1bd8e6dca
  1. jenkins/
  2. jenkins-docker/
  3. jenkins-internal/
  4. vars/
  5. worker/
  6. .gitignore
  7. Jenkinsfile
  8. README.md
  9. yamllint-config.yaml
README.md

Gerrit CI scripts

Providing jobs

This project uses Jenkins Jobs Builder [1] to generate jobs from yaml descriptor files.

To add new jobs reuse existing templates, defaults etc. as much as possible. E.g. adding a job to build an additional branch of a project may be as easy as adding the name of the branch to an existing project.

To ensure well readable yaml-files, use yamllint [2] to lint the yaml-files. Yamllint can be downloaded using Python Pip:

pip3 install --require-hashes yamllint

To run the linter, execute this command from the project's root directory:

yamllint -c yamllint-config.yaml jenkins/**/*.yaml

Yamllint will not fix detected issues itself.

[1] https://docs.openstack.org/infra/jenkins-job-builder/index.html [2] https://pypi.org/project/yamllint/