tripleo-ci/playbooks/tripleo-buildcontainers/run.yaml

64 lines
2.1 KiB
YAML

- hosts: all
name: TripleO container image building job
roles:
- role: bindep
bindep_dir: "{{ ansible_user_dir }}/{{ zuul.projects['git.openstack.org/openstack/python-tripleoclient'].src_dir }}"
tasks:
- name: Include common vars
include_vars:
file: "common.yaml"
- name: Set facts for kolla-build.conf
set_fact:
ci_branch: "{{ zuul.branch | default('master') | replace('stable/','') }}"
push_registry: "{{ push_registry | default('127.0.0.1:8787') }}"
push_tag: "{{ push_tag | default('latest') }}"
push_containers: "{{ push_containers | default(false) | bool }}"
- name: Install pip
become: true
package:
name: python-pip
state: present
- name: Install virtualenv
become: true
package:
name: python-virtualenv
state: present
- name: pip install required items
become: true
pip:
name: "{{ item }}"
state: present
virtualenv: "{{ workspace }}/venv"
with_items:
- "file://{{ openstack_git_root }}/kolla"
- "file://{{ openstack_git_root }}/tripleo-common"
- "file://{{ openstack_git_root }}/python-tripleoclient"
# TODO(aschultz): make the kolla-build branch aware
- name: Generate kolla-build.conf
template:
src: templates/kolla-build.conf.j2
dest: "{{ workspace }}/kolla-build.conf"
mode: 0644
force: yes
- name: Run image build
args:
chdir: '{{ workspace }}'
shell: |
set -x
BUILDAH=""
source {{ workspace }}/venv/bin/activate
TRIPLEO_COMMON_PATH="{{ openstack_git_root }}/tripleo-common"
if [[ "{{ use_buildah | default(False) }}" == "True" ]]; then BUILDAH="--use-buildah"; fi
openstack overcloud container image build \
--config-file $TRIPLEO_COMMON_PATH/container-images/overcloud_containers.yaml \
--kolla-config-file {{ workspace }}/kolla-build.conf $BUILDAH > {{ workspace }}/build.log 2> {{ workspace }}/build-err.log
RESULT=$?
exit $RESULT