commit | 9e5276c49f1a70c3ea78a505b4eeb25ae1719d2a | [log] [tgz] |
---|---|---|
author | David Ostrovsky <david@ostrovsky.org> | Thu May 21 13:43:59 2020 +0200 |
committer | Luca Milanesio <luca.milanesio@gmail.com> | Fri May 22 10:46:04 2020 +0000 |
tree | ac5cc82f2c0fdb5bd67a837ed3010e6b62fc9986 | |
parent | 7a701f41769a55fe8288f4f8e55d2a025bb6642b [diff] |
Revisit plugin test target detection The way it is currently implemented to detect test targets is error prone. In case of find-owners plugin there are two test targets: $ grep -2 junit_tests BUILD | grep -o 'name = "[^"]*"' | cut -d '"' -f 2 findowners_junit_tests findowners_IT_tests But the code assumes that there are only one single target: if [ "$TEST_TARGET" != "" ] then bazelisk test --test_env DOCKER_HOST=$DOCKER_HOST plugins/{name}:$TEST_TARGET fi And this is why the second target findowners_IT_tests gets orphaned and is not prefixed with "plugins/{name}" prefix and thus not found. Moreover, this approach to grep for targets can also lead to false negative results, because the test rules might be located in nested plugin packages but not in the root package, like it is the case for checks plugin. For such plugins no test are executed at all. To rectify, avoid grep and just use Bazel's native wildcard "/..." target feature, that should work in all three possible cases: 1. no test rule exist 2. one single test rule exsits in plugin's root package 3. many test rules exist in root and/or nested packages This approach has problem with exit code of bazel in case that there are no tests even thoufg test run was requested. As documented in the user guide: [1], it is expected that Bazel unconditionally returns exit code 4 in this situation. Check for that exit code explicitly and warn CI users to contact plugin maintainers if there were no tests found. Let's face it: the code is inherently broken if there are no tests at all. Still we would like to avoid the boilerplate to be needed and wrote this feature request: [2]. [1] https://docs.bazel.build/versions/master/guide.html#what-exit-code-will-i-get [2] https://github.com/bazelbuild/bazel/issues/11465 Bug: Issue 12512 Change-Id: Id641cfd2300939d3eac5adb4cdc4a14b12d5f7c2
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 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/