system-config/playbooks/roles/zuul-executor/tasks/main.yaml

123 lines
3.0 KiB
YAML

- name: Install PPAs
apt_repository:
repo: '{{ item }}'
become: yes
loop:
# For bubblewrap
- ppa:openstack-ci-core/bubblewrap
# Temporary PPA needed for bpo-27945 while waiting for SRU to be published
- ppa:openstack-ci-core/python-bpo-27945-backport
# We use later HWE kernels for better memory managment, requiring an
# updated AFS version which we install from our custom ppa.
- ppa:openstack-ci-core/openafs-amd64-hwe
# For skopeo
- ppa:projectatomic/ppa
- name: Install bindep
pip:
name: bindep
state: present
executable: pip3
become: yes
- name: Install extra packages
package:
name: '{{ item }}'
state: present
loop:
- jemalloc1
- bubblewrap
- skopeo
- socat
- name: Clone zuul repo
git:
repo: https://opendev.org/zuul/zuul
dest: /opt/zuul
force: yes
register: zuul_repo
- name: Install zuul bindep packages
shell:
cmd: apt-get install -y $(bindep -b compile)
chdir: /opt/zuul
when: zuul_repo is changed
- name: Install zuul
shell:
cmd: pip install .
chdir: /opt/zuul
when: zuul_repo is changed
- name: Run zuul-manage-ansible
shell:
cmd: zuul-manage-ansible
environment:
ANSIBLE_EXTRA_PACKAGES: gear
when: zuul_repo is changed
- name: Install kubectl
include_role:
name: install-kubectl
# This checks the current installed ara version with pip list and the
# latest version of ara on pypi with pip search and if they are different
# then we know we need to upgrade to reconcile the local version with
# the upstream version.
#
# We do this using this check here rather than a pip package resource so
# that ara's deps don't inadverdently update zuuls deps (specifically
# ansible).
- name: Install ARA safely
shell: |
if test $(pip3 list --format columns | sed -ne 's/^ara\s\+\([.0-9]\+\)\s\+$/\1/p') != $(pip3 search 'ara$' | sed -ne 's/^ara (\(.*\)).*$/\1/p') ; then
pip3 install --upgrade --upgrade-strategy=only-if-needed "ara<1.0.0"
fi
- name: Create Zuul Executor directories
file:
state: directory
path: '{{ item }}'
owner: zuul
group: zuul
loop:
- /var/lib/zuul/builds
- /var/lib/zuul/git
- name: Set up cron job to pack git refs
cron:
name: pack-git-refs
state: present
job: 'find /var/lib/zuul/git/ -maxdepth 3 -type d -name ".git" -exec git --git-dir="{}" pack-refs --all \;'
minute: 7
hour: 4
- name: Install logging config
copy:
src: logging.conf
dest: /etc/zuul/executor-logging.conf
- name: Rotate executor logs
include_role:
name: logrotate
vars:
logrotate_file_name: /var/log/zuul/executor.log
- name: Rotate executor debug logs
include_role:
name: logrotate
vars:
logrotate_file_name: /var/log/zuul/executor-debug.log
- name: Install init script
copy:
src: zuul-executor.init
dest: /etc/init.d/zuul-executor
mode: 0555
register: install_init_script
- name: Register script with systemd
shell:
cmd: /bin/systemctl daemon-reload
when: install_init_script is changed