deckhand/tools/gate/roles/build-images/tasks/build-airship-deckhand-image.yaml
Sergiy Markin 31a3dc6b83 Kubeadm based Airskiff gate
This PS replaces old airskiff integration gate
with new kubeadm based airskiff integration gate.
The main goal of this gate is to test new deckhand
image and chart together with other Airship
components.

Change-Id: I4221b7be64e9a7e07964fa817d42c21a3f172db0
2024-03-13 05:04:00 +00:00

86 lines
3.6 KiB
YAML

# Copyright 2018 AT&T Intellectual Property. All other rights reserved.
#
# 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.
- name: Set zuul_site_mirror_fqdn from env var if not defined
when: zuul_site_mirror_fqdn is not defined
set_fact:
zuul_site_mirror_fqdn: "{{ lookup('env','zuul_site_mirror_fqdn') }}"
# NOTE(portdirect): Untill https://github.com/ansible/ansible/issues/21433 is
# resolved, we build with a shell script to make use of the host network.
- name: Build Airship-Deckhand Image
block:
# NOTE(portdirect): We do this to ensure we are feeding the docker build
# a clean path to work with.
- name: Airship-Deckhand image build path
shell: cd "{{ work_dir }}"; pwd
register: airship_deckhand_path
vars:
work_dir: "{{ zuul.project.src_dir | default('') }}/{{ zuul_airship_deckhand_relative_path | default('') }}"
- name: Build Airship-Deckhand Image
when: proxy.http is undefined or (proxy.http | trim == "")
shell: |-
set -ex;
docker build \
--network host \
--force-rm \
--tag deckhand \
--label zuul \
--file images/deckhand/Dockerfile.{{ DISTRO }} \
{% if zuul_site_mirror_fqdn is defined and zuul_site_mirror_fqdn %}
--build-arg UBUNTU_URL="http://{{ zuul_site_mirror_fqdn }}/ubuntu/" \
--build-arg ALLOW_UNAUTHENTICATED="true" \
--build-arg PIP_INDEX_URL="http://{{ zuul_site_mirror_fqdn }}/pypi/simple" \
--build-arg PIP_TRUSTED_HOST="{{ zuul_site_mirror_fqdn }}" \
{% endif %}
.
args:
chdir: "{{ airship_deckhand_path.stdout }}"
executable: /bin/bash
become: yes
- name: Build Airship-Deckhand Image Behind Proxy
when: proxy.http is defined and (proxy.http | trim != "")
shell: |-
set -ex;
docker build \
--network host \
--force-rm \
--tag deckhand \
--label zuul \
--file images/deckhand/Dockerfile.{{ DISTRO }} \
--build-arg HTTP_PROXY="{{ proxy.http }}" \
--build-arg HTTPS_PROXY="{{ proxy.https }}" \
--build-arg NO_PROXY="{{ proxy.noproxy }}" \
{% if zuul_site_mirror_fqdn is defined and zuul_site_mirror_fqdn %}
--build-arg UBUNTU_URL="http://{{ zuul_site_mirror_fqdn }}/ubuntu/" \
--build-arg ALLOW_UNAUTHENTICATED="true" \
--build-arg PIP_INDEX_URL="http://{{ zuul_site_mirror_fqdn }}/pypi/simple" \
--build-arg PIP_TRUSTED_HOST="{{ zuul_site_mirror_fqdn }}" \
{% endif %}
.
args:
chdir: "{{ airship_deckhand_path.stdout }}"
executable: /bin/bash
become: yes
- name: Register Deckhand Image ID
shell: |-
set -e;
echo $( docker images --filter label=zuul | awk '{print $3}' | head -2 | tail -1 )
register: airship_deckhand_image_id
args:
chdir: "{{ airship_deckhand_path.stdout }}"
become: yes