imfreedom/teamcity-ansible

Add a coverity role and playbook
draft
2021-06-02, Gary Kramlich
93fd8350e586
Parents 1f4dfbb121c1
Children f6928f977ec5
Add a coverity role and playbook
--- a/README.md Wed Jun 02 02:03:15 2021 -0500
+++ b/README.md Wed Jun 02 16:11:25 2021 -0500
@@ -5,10 +5,15 @@
# Running
-There are currently 2 playbooks you can run. One for simple build agents that
-build directly on the host named `teamcity_simple_agents.yaml` and the other
-uses convey and docker to build for many platforms from a single host, named
-`teamcity_convey_agents.yaml`.
+There are currently 3 playbooks you can run.
+
+`teamcity_convey_agents.yaml` will setup the agent to use convey and docker
+to build for many platforms all in containers.
+
+`teamcity_coverity_agents.yaml` will setup the agent to run coverity builds
+directly on the agent.
+
+`teamcity_simple_agents.yaml` will setup the agent to run directly on the agent.
To run one of these playbooks you just need to run
--- a/inventories/pidgin/hosts.yaml Wed Jun 02 02:03:15 2021 -0500
+++ b/inventories/pidgin/hosts.yaml Wed Jun 02 16:11:25 2021 -0500
@@ -5,12 +5,37 @@
grim-reaper01:
ansible_host: reaper01
teamcity_agent_name: grim-reaper01
+ teamcity_properties:
+ - "system.convey=True"
+ - "system.buildImages=True"
+ - "system.qemuUserStatic=True"
+ teamcity_groups:
+ - "docker"
grim-reaper02:
ansible_host: reaper02
teamcity_agent_name: grim-reaper02
+ teamcity_properties:
+ - "system.convey=True"
+ - "system.buildImages=True"
+ - "system.qemuUserStatic=True"
+ teamcity_groups:
+ - "docker"
grim-reaper03:
ansible_host: reaper03
teamcity_agent_name: grim-reaper03
+ teamcity_properties:
+ - "system.convey=True"
+ - "system.qemuUserStatic=True"
+ teamcity_groups:
+ - "docker"
+ teamcity_coverity_agents:
+ hosts:
+ grim-coverity:
+ ansible_host: coverity
+ teamcity_agent_name: grim-coverity
+ teamcity_properties:
+ - "system.coverity=True"
+ - "system.coverity_tool={{ coverity_directory }}"
teamcity_simple_agents:
hosts:
grim-beastie:
--- a/inventories/pidgin/vault.yaml Wed Jun 02 02:03:15 2021 -0500
+++ b/inventories/pidgin/vault.yaml Wed Jun 02 16:11:25 2021 -0500
@@ -1,6 +1,8 @@
$ANSIBLE_VAULT;1.1;AES256
-36353664326438366133626532373837316233386564326362643066343765353532396233636639
-6363323237623164643239386666613736396138336138300a333739373864613038613339643663
-61663465346535376664323130316432366330643634393264636564623433373930363061663364
-3936356635313865330a363739616162323537656666303938303437376634313137323664626263
-3636
+39623663646338323462306138633632316337396532616265346438626138353066383766326662
+3062353265653631666133346531626333346166636661390a316236323632666139656663643030
+63623063626665396330326636316639396465306464663466373561356531346331326438376266
+3134626139356433380a393139333938356663313830613734353336316235663431633933323830
+66383737656533356430326131343436633330376362323734623533366163346538353466386130
+39623362343533393063306561343266343231616538626563353461666133613539316132383461
+623764626661326230303462623638663462
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/roles/coverity/meta/main.yaml Wed Jun 02 16:11:25 2021 -0500
@@ -0,0 +1,3 @@
+dependencies:
+ - curl
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/roles/coverity/tasks/main.yaml Wed Jun 02 16:11:25 2021 -0500
@@ -0,0 +1,29 @@
+- name: "set coverity bool tool archive name"
+ set_fact:
+ coverity_archive: "/usr/src/coverity_tool.tgz"
+ coverity_directory: "/usr/src/coverity_tool"
+- name: "download coverity build tool"
+ uri:
+ url: "https://scan.coverity.com/download/linux64"
+ method: "POST"
+ body:
+ token: "{{ coverity_token }}"
+ project: "Pidgin"
+ body_format: "form-urlencoded"
+ dest: "{{ coverity_archive }}"
+ when: "false"
+- name: "create coverity build tool directory"
+ file:
+ name: "{{ coverity_directory }}"
+ state: "directory"
+ owner: "root"
+ group: "root"
+- name: "extract coverity build tool"
+ unarchive:
+ src: "{{ coverity_archive }}"
+ dest: "{{ coverity_directory }}"
+ extra_opts:
+ - "--strip-components=1"
+ remote_src: "yes"
+ when: "false"
+
--- a/roles/teamcity/tasks/main.yml Wed Jun 02 02:03:15 2021 -0500
+++ b/roles/teamcity/tasks/main.yml Wed Jun 02 16:11:25 2021 -0500
@@ -4,8 +4,6 @@
fail: msg="ERROR - required variable 'teamcity_server' missing"
when: teamcity_server is not defined
-- include_tasks: known_hosts.yml
-
- include_tasks: dependencies.yml
- include_tasks: vars.yml
@@ -13,6 +11,8 @@
- include_tasks: user.yml
when: ansible_system != "Darwin"
+- include_tasks: known_hosts.yml
+
- include_tasks: agent.yml
- include_tasks: systemd.yml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/teamcity_coverity_agents.yaml Wed Jun 02 16:11:25 2021 -0500
@@ -0,0 +1,9 @@
+---
+- hosts: teamcity_coverity_agents
+ roles:
+ - role: update
+ - role: cron-apt
+ - role: coverity
+ - role: teamcity
+ teamcity_server: https://ci.imfreedom.org/
+