blob: f19491fde8b87dbea47bbecc5cc3eda6fcf49ce9 [file] [log] [blame]
eprasad81108dc2020-12-29 11:49:10 +00001---
2# ============LICENSE_START=======================================================
3# Copyright (C) 2020 The Nordix Foundation. All rights reserved.
4# ================================================================================
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#
17# SPDX-License-Identifier: Apache-2.0
18# ============LICENSE_END=========================================================
19
20- name: Create directory to store container images
21 file:
22 path: "{{ containers_folder }}"
23 state: "{{ item }}"
24 with_items:
25 - absent
26 - directory
27
28
29# NOTE (eprasad): docker_image module doesn't seem to respect become so falling back to command module
30- name: Pull test stack container images
Akash Rajgurua5e57642021-06-02 14:40:39 +010031 command: "docker pull {{ xtesting_image_repo }}/{{ item.value.image_name }}@sha256:{{ item.value.image_version }}"
eprasad81108dc2020-12-29 11:49:10 +000032 with_dict: "{{ framework[testfw] }}"
33 become: true
34 changed_when: false
35
36- name: Add tag to the stack images
37 command: |-
Akash Rajgurua5e57642021-06-02 14:40:39 +010038 docker tag "{{ xtesting_image_repo }}/{{ item.value.image_name }}@sha256:{{ item.value.image_version }}"
eprasad81108dc2020-12-29 11:49:10 +000039 "onap/{{ item.value.image_name }}:{{ test_stack_version }}"
40 with_dict: "{{ framework[testfw] }}"
41 become: true
42 changed_when: false
43
44# save container images
45- name: Save test stack container images
46 command: |-
47 docker save "onap/{{ item.value.image_name }}:{{ test_stack_version }}"
48 -o {{ item.value.image_name | replace('/', '_') }}-{{ test_stack_version }}.tar
49 with_dict: "{{ framework[testfw] }}"
50 args:
51 chdir: "{{ containers_folder }}"
52 become: true
53 changed_when: false
54
55# NOTE (eprasad): archive fails due to wrong permissions so we fix them
56- name: Fix container image permissions
57 file:
58 path: "{{ containers_folder }}"
59 state: directory
60 recurse: true
61 mode: 0755
62 become: true
63
64# vim: set ts=2 sw=2 expandtab: