blob: f2bb0b304d0452e51cafe01baab0e5c077636ce8 [file] [log] [blame]
Matteo Scandolo3896c472017-08-01 13:31:42 -07001
2# Copyright 2017-present Open Networking Foundation
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16
Scott Baker57196542017-04-11 15:48:17 -070017---
18# xos-core-build/tasks/main.yml
19
20- name: Intialize recipe list
21 set_fact:
Scott Bakera14cd422018-02-27 16:33:06 -080022 recipes: []
Scott Baker57196542017-04-11 15:48:17 -070023
Scott Baker294ee422018-02-08 17:15:13 -080024- name: Check to see which recipes exist
25 stat:
26 path: "{{ build_cord_dir | realpath }}/{{ item.path }}/xos/{{ item.name }}-{{ item.operation | default('onboard') }}.yaml"
27 register: service_stats
28 with_items: "{{ xos_services }}"
29
Scott Baker57196542017-04-11 15:48:17 -070030- name: Generate list of recipes
31 set_fact:
Scott Baker294ee422018-02-08 17:15:13 -080032 recipes: "{{ recipes }} + [ '/opt/cord/{{ item.0.path }}/xos/{{ item.0.name }}-{{ item.0.operation | default('onboard') }}.yaml']"
33 with_together:
34 - "{{ xos_services }}"
35 - "{{ service_stats.results }}"
36 when:
37 - item.1.stat.exists == true
Scott Baker57196542017-04-11 15:48:17 -070038
Scott Baker6a2065c2017-04-20 15:27:41 -070039- name: Add in the profile library
40 set_fact:
41 recipes: "{{ recipes }} + [ '/opt/cord/orchestration/profiles/{{ profile_library }}/xos/{{ profile_library }}-onboard.yaml']"
42 when:
43 profile_library != ""
44
Scott Baker57196542017-04-11 15:48:17 -070045- name: Join the list of recipes
46 set_fact:
47 recipes_string: "{{ recipes | join(' ') }}"
48
49- debug:
50 msg: "{{ recipes }}"
51
52- name: Create the BUILD directory
53 file:
Zack Williamsc989f262017-05-11 13:02:59 -070054 path: "{{ build_cord_dir | realpath }}/orchestration/xos/containers/xos/BUILD"
Scott Baker57196542017-04-11 15:48:17 -070055 state: directory
56 mode: 0755
57
58# Run the corebuilder tool -- we can't do this using a docker ansible command,
59# as we have to wait for the tool to complete before continuing.
60
61- name: Run the corebuilder tool
62 shell: >
63 docker run
64 --rm
Zack Williamsc989f262017-05-11 13:02:59 -070065 -v {{ build_cord_dir | realpath }}:/opt/cord
66 -v {{ build_cord_dir ~ "/orchestration/xos/containers/xos/BUILD" | realpath }}:/opt/xos_corebuilder/BUILD
67 xosproject/xos-corebuilder:{{ build_docker_tag }}
Scott Baker57196542017-04-11 15:48:17 -070068 {{ recipes_string }}
Scott Bakera14cd422018-02-27 16:33:06 -080069 when: recipes_string != ""
Scott Baker57196542017-04-11 15:48:17 -070070 tags:
71 - skip_ansible_lint # running a build task
72
73- name: Build UI image
74 docker_image:
75 name: "xosproject/xos-ui"
Zack Williamsc989f262017-05-11 13:02:59 -070076 path: "{{ build_cord_dir | realpath }}/orchestration/xos"
Scott Baker57196542017-04-11 15:48:17 -070077 tag: "{{ build_docker_tag }}"
78 dockerfile: "containers/xos/Dockerfile.UI"
79 pull: False
Andy Bavierfa53a8d2017-05-03 08:47:16 -070080 force: True