Merge "Ansiblify the wheel build a little more"

This commit is contained in:
Jenkins 2017-09-07 20:11:53 +00:00 committed by Gerrit Code Review
commit be03d367f9
3 changed files with 41 additions and 77 deletions
jenkins/scripts
playbooks/wheel
roles/build-wheels/tasks

@ -1,45 +0,0 @@
#!/bin/bash -xe
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
# This script generates a descriptor slug to use with AFS, composed of the
# operating system, its version, and the processor architecture.
# Pull in the os release.
# ID is 'fedora', 'centos', 'ubuntu'
# VERSION_ID is '23', '7', '14.04'
# Nothing else is useful and/or reliable across distros
source /etc/os-release
################################################################################
# Generate an OS Release Name
OS_TYPE=$ID
################################################################################
# Generate a version string.
OS_VERSION=$VERSION_ID
if [ "$OS_TYPE" != "ubuntu" ]; then
OS_VERSION=$(echo $OS_VERSION | cut -d'.' -f1)
fi
################################################################################
# Get the processor architecture.
# x86_64, i386, armv7l, armv6l
OS_ARCH=$(uname -m)
################################################################################
# Build the name
AFS_SLUG="$OS_TYPE-$OS_VERSION-$OS_ARCH"
AFS_SLUG=$(echo "$AFS_SLUG" | tr '[:upper:]' '[:lower:]')
export AFS_SLUG

@ -9,39 +9,22 @@
fileserver: "{{ wheel_mirror_ubuntu_xenial_key }}"
- hosts: "wheel-mirror-*"
gather_facts: False
tasks:
- name: Build the wheel mirror
with-items:
- python2
- python3
shell: |
# Generate the AFS Slug from the host system.
source scripts/afs-slug.sh
AFS_DIR=/afs/.openstack.org/mirror/wheel/$AFS_SLUG/
WHEEL_DIR=/opt/wheel/workspace
pre_tasks:
- name: Generate AFS slug
set_fact:
afs_slug: "{{ ansible_distribution|lower }}-{{ ansible_distribution_version }}-{{ ansible_architecture }}"
# Delete any previous build directory
rm -rf $WHEEL_DIR
mkdir $WHEEL_DIR
- name: Set fact for AFS dir
set_fact:
afs_dir: "/afs/.openstack.org/mirror/wheel/{{ afs_slug }}/"
# Build the wheels into staging directory
echo "Building wheels"
bash -x scripts/wheel-build.sh $WHEEL_DIR {{ item }}
- name: Set fact for wheel dir
set_fact:
wheel_dir: /opt/wheel/workspace
# Get an afs token and copy the wheels to AFS
echo "Obtaining token and copying wheels to AFS"
k5start -t -f /etc/wheel.keytab \
service/wheel \
-- timeout -k 2m 30m \
scripts/wheel-copy.sh $WHEEL_DIR $AFS_DIR
# Get an afs token and rebuild the mirror index.html
echo "Obtaining token and rebuilding mirror index."
k5start -t -f /etc/wheel.keytab \
service/wheel \
-- timeout -k 2m 30m \
scripts/wheel-index.sh $AFS_DIR
echo "Done."
roles:
- role: build-wheels
wheel_python: python2
- role: build-wheels
wheel_python: python3

@ -0,0 +1,26 @@
- name: Ensure old version of wheel dir is gone
file:
path: "{{ wheel_dir }}"
state: absent
- name: Ensure wheel dir exists
file:
path: "{{ wheel_dir }}"
state: directory
- name: Build the wheel mirror
shell: bash -x scripts/wheel-build.sh {{ wheel_dir }} {{ wheel_python }}
- name: Get an afs token and copy the wheels to AFS
command: <
k5start -t -f /etc/wheel.keytab
service/wheel
-- timeout -k 2m 30m
scripts/wheel-copy.sh {{ wheel_dir }} {{ afs_dir }}
- name: Obtaining token and rebuilding mirror index
command: <
k5start -t -f /etc/wheel.keytab
service/wheel
-- timeout -k 2m 30m
scripts/wheel-index.sh {{ afs_dir }}