Skip to content

Commit 0de4096

Browse files
committed
ansible: automate installation of Coverity build tool
1 parent dee50b9 commit 0de4096

File tree

2 files changed

+47
-6
lines changed

2 files changed

+47
-6
lines changed

ansible/MANUAL_STEPS.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -658,15 +658,16 @@ Test the connection to the target machine with `ansible HOST -m win_ping -vvvv`.
658658

659659
## jenkins-workspace
660660

661-
The hosts labelled jenkins-workspace are used to "execute" the coordination of Jenkins jobs. Jenkins uses them to do the initial Git work to figure out what needs to be done before farming off to the actual test machines. These machines are lower powered but have large disks so they can waste space with the numerous Git repositories Jenkins will create in this process. The use of these hosts takes a load off the Jenkins master and prevents the Jenkins master from filling up its disk with Git repositories.
661+
The hosts labelled [jenkins-workspace] are used to "execute" the coordination of Jenkins jobs. Jenkins uses them to do the initial Git work to figure out what needs to be done before farming off to the actual test machines. These machines are lower powered but have large disks so they can waste space with the numerous Git repositories Jenkins will create in this process. The use of these hosts takes a load off the Jenkins master and prevents the Jenkins master from filling up its disk with Git repositories.
662662

663-
Note that not all jobs can use jenkins-workspace servers for execution, some are tied to other hosts.
663+
Note that not all jobs can use [jenkins-workspace] servers for execution, some are tied to other hosts.
664664

665-
The jenkins-workspace hosts are setup as standard Node.js nodes but are only given the `jenkins-workspace` label. After setup, they require the following manual steps:
665+
The [jenkins-workspace] hosts are setup as standard Node.js nodes but are only given the [jenkins-workspace] label.
666666

667-
* Download the Coverity Build Tool for Linux x64 at <https://scan.coverity.com/download> (requires a Coverity login)
668-
* Extract to `/var`, e.g. so the resulting directory looks like `/var/cov-analysis-linux64-2017.07/` or similar
669-
* Ensure that the [node-coverity-daily](https://ci.nodejs.org/job/node-daily-coverity/configure) job matches the path used in its explicit `PATH` setting
667+
The playbook should download and install the Coverity build tool needed for static analysis into `/var/`. The extracted build tool should end up in a directory similar to `/var/cov-analysis-linux64-2023.6.2`. This directory must match the `PATH` setting in the [node-coverity-daily][] job. According to Synopsis the tool is usually updated twice yearly -- if it is updated the directory will change and the following steps should be done:
668+
669+
* Run the playbook on all [jenkins-workspace][] machines so that they have the same version of the Coverity build tool installed.
670+
* Update the [node-coverity-daily][] job so that the set `PATH` contains the new directory name.
670671

671672
## Docker hosts
672673

@@ -777,5 +778,7 @@ pax -rf /u/unix1/SDK8_64bit_SR6_FP10.PAX.Z -ppx
777778

778779

779780
[Setting up a Windows Host]: https://docs.ansible.com/ansible/latest/user_guide/windows_setup.html
781+
[jenkins-workspace]: https://ci.nodejs.org/label/jenkins-workspace/
780782
[newer Ansible configuration]: https://github.com/nodejs/build/tree/main/ansible
783+
[node-coverity-daily]: https://ci.nodejs.org/job/node-daily-coverity/configure
781784
[stand-alone]: https://github.com/nodejs/build/tree/main/setup/windows

ansible/roles/jenkins-workspace/tasks/main.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,3 +158,41 @@
158158
name: jq
159159
state: latest
160160
update_cache: yes
161+
162+
# Coverity build tool. See MANUAL_STEPS.md.
163+
- name: Get md5sum for Coverity build tool
164+
ansible.builtin.uri:
165+
body:
166+
md5: 1
167+
token: "{{ secrets.coverity_token }}"
168+
project: Node.js
169+
body_format: form-urlencoded
170+
method: POST
171+
url: https://scan.coverity.com/download/linux64
172+
return_content: true
173+
register: coverity_build_tool_meta
174+
175+
- name: Download Coverity build tool
176+
ansible.builtin.uri:
177+
body:
178+
token: "{{ secrets.coverity_token }}"
179+
project: Node.js
180+
body_format: form-urlencoded
181+
dest: /tmp/
182+
method: POST
183+
url: https://scan.coverity.com/download/linux64
184+
register: coverity_build_tool
185+
186+
- name: Validate checksum of downloaded Coverity build tool
187+
ansible.builtin.stat:
188+
checksum_algorithm: md5
189+
path: "{{ coverity_build_tool.path }}"
190+
failed_when: coverity_build_tool_file.stat.checksum != coverity_build_tool_meta.content
191+
register: coverity_build_tool_file
192+
193+
- name: Unpack Coverity build tool
194+
ansible.builtin.unarchive:
195+
creates: "/var/{{ coverity_build_tool.path|regex_search('/tmp/(.+)\\.tar\\.gz', '\\1')|first }}"
196+
dest: /var/
197+
remote_src: true
198+
src: "{{ coverity_build_tool.path }}"

0 commit comments

Comments
 (0)