| |
| # Copyright 2017-present Open Networking Foundation |
| # |
| # 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. |
| |
| |
| --- |
| # xos-core-build/tasks/main.yml |
| |
| - name: Intialize recipe list |
| set_fact: |
| recipes: ['/opt/cord/orchestration/xos/xos/core/core-onboard.yaml'] |
| |
| - name: Check to see which recipes exist |
| stat: |
| path: "{{ build_cord_dir | realpath }}/{{ item.path }}/xos/{{ item.name }}-{{ item.operation | default('onboard') }}.yaml" |
| register: service_stats |
| with_items: "{{ xos_services }}" |
| |
| - name: Generate list of recipes |
| set_fact: |
| recipes: "{{ recipes }} + [ '/opt/cord/{{ item.0.path }}/xos/{{ item.0.name }}-{{ item.0.operation | default('onboard') }}.yaml']" |
| with_together: |
| - "{{ xos_services }}" |
| - "{{ service_stats.results }}" |
| when: |
| - item.1.stat.exists == true |
| |
| - name: Add in the profile library |
| set_fact: |
| recipes: "{{ recipes }} + [ '/opt/cord/orchestration/profiles/{{ profile_library }}/xos/{{ profile_library }}-onboard.yaml']" |
| when: |
| profile_library != "" |
| |
| - name: Join the list of recipes |
| set_fact: |
| recipes_string: "{{ recipes | join(' ') }}" |
| |
| - debug: |
| msg: "{{ recipes }}" |
| |
| - name: Create the BUILD directory |
| file: |
| path: "{{ build_cord_dir | realpath }}/orchestration/xos/containers/xos/BUILD" |
| state: directory |
| mode: 0755 |
| |
| # Run the corebuilder tool -- we can't do this using a docker ansible command, |
| # as we have to wait for the tool to complete before continuing. |
| |
| - name: Run the corebuilder tool |
| shell: > |
| docker run |
| --rm |
| -v {{ build_cord_dir | realpath }}:/opt/cord |
| -v {{ build_cord_dir ~ "/orchestration/xos/containers/xos/BUILD" | realpath }}:/opt/xos_corebuilder/BUILD |
| xosproject/xos-corebuilder:{{ build_docker_tag }} |
| {{ recipes_string }} |
| tags: |
| - skip_ansible_lint # running a build task |
| |
| - name: Build UI image |
| docker_image: |
| name: "xosproject/xos-ui" |
| path: "{{ build_cord_dir | realpath }}/orchestration/xos" |
| tag: "{{ build_docker_tag }}" |
| dockerfile: "containers/xos/Dockerfile.UI" |
| pull: False |
| force: True |