From 2c2301f5e3c84c627e6d1568faf277f7d9a661ed Mon Sep 17 00:00:00 2001 From: David Moreau-Simard Date: Sun, 30 Jul 2017 18:13:41 -0400 Subject: [PATCH] Add third-party CI on tripleo-common to test container builds This adds a job that will run DLRN-rpmbuild on new tripleo-common reviews and then run a container build with the new package to ensure that new images or overrides do not break container builds. This doesn't test the containers themselves but at least we'll know if they can build, we'll eventually add further testing coverage. Additionally, for the sake of simplicty, we'll also be building all container images on ansible-role-rdo-kolla-build code reviews which is not so much of a problem now that builds are relatively fast. Change-Id: Ib80dfb10573255321f20132d76e42c53d58c6c0a --- jobs/rdoinfra.yaml | 121 ++++++++++++++++++++++++++++++--------------- zuul/projects.yaml | 4 -- zuul/upstream.yaml | 7 +++ 3 files changed, 88 insertions(+), 44 deletions(-) diff --git a/jobs/rdoinfra.yaml b/jobs/rdoinfra.yaml index eb037b8323..17206b677d 100644 --- a/jobs/rdoinfra.yaml +++ b/jobs/rdoinfra.yaml @@ -64,60 +64,101 @@ - zuul node: rdo-centos-7 +- builder: + name: checkout-rdo-kolla-build + builders: + shell: | + if [[ "${ZUUL_PROJECT}" != "rdo-infra/ansible-role-rdo-kolla-build" ]]; then + mkdir -p $WORKSPACE/rdo-infra/ansible-role-rdo-kolla-build + git clone https://github.com/rdo-infra/ansible-role-rdo-kolla-build + fi + +- builder: + name: rdo-kolla-build-images + builders: + shell: | + mkdir -p $WORKSPACE/roles + ln -s $WORKSPACE/rdo-infra/ansible-role-rdo-kolla-build $WORKSPACE/roles/kolla-build + + sudo yum -y install libselinux-python + # Need to inherit system-site-packages for libselinux-python and python-yum + virtualenv --system-site-packages $WORKSPACE/ansible + source $WORKSPACE/ansible/bin/activate + pip install ansible==2.3.1.0 ara + + export ara_location=$(python -c "import os,ara; print(os.path.dirname(ara.__file__))") + export ANSIBLE_CALLBACK_PLUGINS=$ara_location/plugins/callbacks + export ANSIBLE_ACTION_PLUGINS=$ara_location/plugins/actions + export ANSIBLE_LIBRARY=$ara_location/plugins/modules + export ANSIBLE_ROLES_PATH=$WORKSPACE/roles + + export ARA_DATABASE="sqlite:///$WORKSPACE/ara.sqlite" + + cat << EOF > ${WORKSPACE}/playbook.yml + --- + - name: Build Kolla images + hosts: localhost + become: yes + become_user: root + roles: + - kolla-build + EOF + ansible-playbook -i localhost $WORKSPACE/playbook.yml --tags "setup,build" + - job: - name: gate-rdo-kolla-build-containers + name: 'rdo-kolla-build-integration' defaults: global builders: - prepare-workspace - rdo-log-setup - - shell: | - set -e - mkdir $WORKSPACE/roles - ln -s $WORKSPACE/$ZUUL_PROJECT/ $WORKSPACE/roles/kolla-build - - sudo yum -y install libselinux-python - # Need to inherit system-site-packages for libselinux-python and python-yum - virtualenv --system-site-packages $WORKSPACE/ansible - source $WORKSPACE/ansible/bin/activate - pip install ansible==2.3.1.0 ara - - export ara_location=$(python -c "import os,ara; print(os.path.dirname(ara.__file__))") - export ANSIBLE_CALLBACK_PLUGINS=$ara_location/plugins/callbacks - export ANSIBLE_ACTION_PLUGINS=$ara_location/plugins/actions - export ANSIBLE_LIBRARY=$ara_location/plugins/modules - export ANSIBLE_ROLES_PATH=$WORKSPACE/roles + - dlrn-gate-repository + - checkout-rdo-kolla-build + - rdo-kolla-build-images + triggers: + - zuul + publishers: + - postbuildscript: + builders: + - shell: | + mkdir $WORKSPACE/logs + cp -a /tmp/kolla $WORKSPACE/logs/ + export ARA_DATABASE="sqlite:///$WORKSPACE/ara.sqlite" + sudo -E $WORKSPACE/ansible/bin/ara generate html $WORKSPACE/logs/ara - export ARA_DATABASE="sqlite:///$WORKSPACE/ara.sqlite" + # Ensure permissions allow artifact uploading + sudo chown -R "$(id -u).$(id -g)" $WORKSPACE/logs + script-only-if-succeeded: False + script-only-if-failed: False + - rdo-rsync-logs + node: rdo-centos-7 + wrappers: + - timestamps + - credentials-binding: + - file: + credential-id: 4b4632bd-f44b-446d-a8ca-b57eabef0a7c + variable: LOG_SSH_KEY - cat << EOF > ${WORKSPACE}/playbook.yml - --- - - name: Build Kolla images - hosts: localhost - become: yes - become_user: root - vars: - kolla_rdo_images: - - openstack-base - - keystone - kolla_force_build: true - tasks: - - include_role: - name: "kolla-build" - EOF - ansible-playbook -i localhost $WORKSPACE/playbook.yml --tags "setup,build" +- job: + name: gate-rdo-kolla-build-containers + defaults: global + builders: + - prepare-workspace + - rdo-log-setup + - checkout-rdo-kolla-build + - rdo-kolla-build-images triggers: - zuul publishers: - postbuildscript: builders: - shell: | - mkdir $WORKSPACE/logs - cp -a /tmp/kolla $WORKSPACE/logs/ - export ARA_DATABASE="sqlite:///$WORKSPACE/ara.sqlite" - sudo -E $WORKSPACE/ansible/bin/ara generate html $WORKSPACE/logs/ara + mkdir $WORKSPACE/logs + cp -a /tmp/kolla $WORKSPACE/logs/ + export ARA_DATABASE="sqlite:///$WORKSPACE/ara.sqlite" + sudo -E $WORKSPACE/ansible/bin/ara generate html $WORKSPACE/logs/ara - # Ensure permissions allow artifact uploading - sudo chown -R "$(id -u).$(id -g)" $WORKSPACE/logs + # Ensure permissions allow artifact uploading + sudo chown -R "$(id -u).$(id -g)" $WORKSPACE/logs script-only-if-succeeded: False script-only-if-failed: False - rdo-rsync-logs diff --git a/zuul/projects.yaml b/zuul/projects.yaml index 7daa7c081a..d44c285d16 100644 --- a/zuul/projects.yaml +++ b/zuul/projects.yaml @@ -1428,10 +1428,6 @@ projects: template: - name: package-distgit-check-jobs - - name: openstack/tripleo-common - template: - - name: package-check-jobs - - name: openstack/tripleo-common-distgit template: - name: package-distgit-check-jobs diff --git a/zuul/upstream.yaml b/zuul/upstream.yaml index 88e491e693..9ee5af9642 100644 --- a/zuul/upstream.yaml +++ b/zuul/upstream.yaml @@ -149,6 +149,13 @@ pipelines: subject: '[Zuul] Job failed in openstack-post pipeline: {change.project}' projects: + - name: openstack/tripleo-common + template: + - name: package-check-jobs + openstack-check: + - DLRN-rpmbuild: + - rdo-kolla-build-integration + - name: openstack/python-openstackclient openstack-check-verified: - DLRN-rpmbuild