Cache zanata cli tools

Cache zanata cli tools during build, and up the prep-zanata role to
look for the cached version in preference to dowloading.

Change-Id: If70f3386d0350c94dd1548e7f3c60a1d02914824
This commit is contained in:
Ian Wienand 2017-12-04 16:06:18 +11:00
parent 0cab082b0f
commit 3466674297
5 changed files with 43 additions and 2 deletions

View File

@ -1 +1,17 @@
Pre-cache all of the things devstack might need
cache-devstack
==============
Pre-cache a range of things into CI images. This element uses the
``source-repositories`` element to acquire files to be cached. The
standard cache location is ``/opt/cache/files``.
A number of strategies are used to get the files to be cached.
We have a number of ``source-repository-*`` files for each package
package that should be cached into images.
``extra-data.d/55-cache-devstack-repos`` goes through each devstack
branch and runs the ``tools/image_list.sh`` script to dynamically
build a list of files to cache as requested by devstack. This is
mostly virtual machine images, but also some other peripheral packages.

View File

@ -0,0 +1 @@
zanata-cli file /opt/cache/files/zanata-cli-3.8.1-dist.tar.gz https://search.maven.org/remotecontent?filepath=org/zanata/zanata-cli/3.8.1/zanata-cli-3.8.1-dist.tar.gz

View File

@ -27,3 +27,8 @@ Prepare zanata client use
:default: 3.8.1
The version of zanata client to install
.. zuul:rolevar:: zanata_client_checksum
:default: cc4ecfa2d530ff314076bd0173bdf829824737d48d4f4a2f4ca18d263e9da7c3
The expected SHA256 checksum of the zanata client

View File

@ -1,2 +1,3 @@
---
zanata_client_version: 3.8.1
zanata_client_checksum: cc4ecfa2d530ff314076bd0173bdf829824737d48d4f4a2f4ca18d263e9da7c3

View File

@ -14,12 +14,30 @@
state: directory
become: true
- name: extract zanata client tarball
- name: Look for cached zanata client
stat:
path: "/opt/cache/files/zanata-cli-{{ zanata_client_version }}-dist.tar.gz"
checksum_algorithm: sha256
register: cached_client
- name: Ensure correct checksum of cached client
assert: cached_client.checksum == "{{ zanata_client_checksum }}"
when: cached_client.exists
- name: Extract cached client tarball
unarchive:
src: "/opt/cache/files/zanata-cli-{{ zanata_client_version }}-dist.tar.gz"
dest: "/opt/zanata"
creates: "/opt/zanata/zanata-cli-{{ zanata_client_version }}/bin/zanata-cli"
when: cached_client.exists
- name: Download and extract zanata client tarball
unarchive:
src: "https://search.maven.org/remotecontent?filepath=org/zanata/zanata-cli/{{ zanata_client_version }}/zanata-cli-{{ zanata_client_version }}-dist.tar.gz"
remote_src: yes
dest: "/opt/zanata/"
creates: "/opt/zanata/zanata-cli-{{ zanata_client_version }}/bin/zanata-cli"
when: not cached_client.exists
- name: ensure zanata-cli perms
file: