summaryrefslogtreecommitdiffstats
path: root/jjb
diff options
context:
space:
mode:
authoragardner <agardner@linuxfoundation.org>2018-02-05 16:12:11 -0500
committeragardner <agardner@linuxfoundation.org>2018-02-08 14:10:56 -0500
commit0215f34ba5867f3a5f0a77e6a9fec25a36853445 (patch)
tree399005cf5597bcbbeeffad67e8d4870b1b6f2ae2 /jjb
parent96ac89af9b65921a6914022de29efa0e4d6d79d8 (diff)
Job for ansible to setup build servers.
set noop for now. -C, --check don't make any changes; instead, try to predict some of the changes that may occur -D, --diff when changing (small) files and templates, show the differences in those files; works great with --check Change-Id: I723fcf1b068b8ef73a0994be90271cb1cdd51ecb Signed-off-by: agardner <agardner@linuxfoundation.org>
Diffstat (limited to 'jjb')
-rw-r--r--jjb/releng/opnfv-utils.yml62
1 files changed, 60 insertions, 2 deletions
diff --git a/jjb/releng/opnfv-utils.yml b/jjb/releng/opnfv-utils.yml
index 6f77cd250..48590089d 100644
--- a/jjb/releng/opnfv-utils.yml
+++ b/jjb/releng/opnfv-utils.yml
@@ -7,6 +7,7 @@
- 'prune-docker-images'
- 'archive-repositories'
- 'check-status-of-slaves'
+ - 'ansible-build-server'
########################
# job templates
@@ -33,12 +34,14 @@
builders:
- description-setter:
description: "Built on $NODE_NAME"
+ # yamllint disable rule:line-length
- shell: |
#!/bin/bash
-
(docker ps -q; docker ps -aq) | sort | uniq -u | xargs --no-run-if-empty docker rm
docker images -f dangling=true -q | xargs --no-run-if-empty docker rmi
+
+ # yamllint enable rule:line-length
triggers:
- timed: '@midnight'
@@ -88,7 +91,7 @@
parameters:
- node:
name: SLAVE_NAME
- description: We don't want workspace wiped. so I just threw the script on the master
+ description: 'script lives on master node'
default-slaves:
- master
allowed-multiselect: false
@@ -101,3 +104,58 @@
- shell: |
cd /opt/jenkins-ci/slavemonitor
bash slave-monitor-0.1.sh | sort
+
+- job-template:
+ name: 'ansible-build-server'
+
+ project-type: freestyle
+
+ disabled: false
+ concurrent: true
+
+ parameters:
+ - label:
+ name: SLAVE_LABEL
+ description: 'Slave label on Jenkins'
+ default: 'test-ansible-build'
+ allowed-multiselect: true
+ ignore-offline-nodes: true
+ - project-parameter:
+ project: releng
+ branch: master
+
+ scm:
+ - git-scm
+
+ triggers:
+ - timed: '@midnight'
+
+ builders:
+ - install-ansible
+ - run-ansible-build-server-playbook
+
+
+- builder:
+ name: install-ansible
+ builders:
+ - shell: |
+ # Install ansible here
+ if [ -f /etc/centos-release ] \
+ || [ -f /etc/redhat-release ] \
+ || [ -f /etc/system-release ]; then
+ sudo yum install ansible
+ fi
+ if [ -f /etc/debian_version ] \
+ || grep -qi ubuntu /etc/lsb-release \
+ || grep -qi ubuntu /etc/os-release; then
+ apt-get install ansible
+ fi
+
+- builder:
+ name: run-ansible-build-server-playbook
+ builders:
+ - shell: |
+ # run playbook
+ ansible-playbook -C -D -i \
+ $WORKSPACE/utils/build-server-ansible/inventory.ini \
+ $WORKSPACE/utils/build-server-ansible/main.yml