playbooks: fix DISTRO not passed to make in image build

Replace the >- block scalar in set_fact for _build_params with an inline
template to ensure the result is stored as a dict; when folded via
>-, combine() received a string and silently dropped DISTRO.

Pass _build_params to the verbose shell make run via `items() |
map('join', '=')`, matching how the make module passes params as
command-line variables.

Add a debug task for _build_params so DISTRO is visible in job logs.

Added time limits for waiting for service availability for setting up UI
port forwarding.

Change-Id: I860551cb9c40073083b21c15bf3162e32e8fab55
Signed-off-by: Sergiy Markin <smarkin@mirantis.com>
This commit is contained in:
Sergiy Markin committed 2026-05-14 03:05:30 +00:00
1 parent 4454fc572f
commit 3bbe38b3dc
4 files changed
+22 -4

No files matched your search

@@ -37,11 +37,15 @@ get_external_ip() {
}
# Wait until airflow-int service exists and has a ClusterIP
END=$(($(date +%s) + 600))
until kubectl get svc -n "${NAMESPACE}" airflow-int &>/dev/null; do
[ "$(date +%s)" -gt "${END}" ] && { echo "Timed out waiting for airflow-int service to be created"; exit 1; }
echo "Waiting for airflow-int service to be created..."
sleep 10
done
END=$(($(date +%s) + 120))
until [[ -n "$(kubectl get svc -n "${NAMESPACE}" airflow-int -o jsonpath='{.spec.clusterIP}' 2>/dev/null)" ]]; do
[ "$(date +%s)" -gt "${END}" ] && { echo "Timed out waiting for airflow-int service to get a ClusterIP"; exit 1; }
echo "Waiting for airflow-int service to get a ClusterIP..."
sleep 5
done
@@ -70,7 +74,9 @@ for attempt in 1 2 3; do
done
# Wait for port-forward to be ready
END=$(($(date +%s) + 180))
until curl -so /dev/null "http://localhost:${AIRFLOW_UI_EXTERNAL_PORT}/"; do
[ "$(date +%s)" -gt "${END}" ] && { echo "Timed out waiting for airflow port-forward to become ready"; exit 1; }
sleep 2
done
@@ -45,7 +45,9 @@ if ! curl -so /dev/null --max-time 3 "http://localhost:${AIRFLOW_UI_EXTERNAL_POR
disown $!
fi
END=$(($(date +%s) + 180))
until curl -so /dev/null "http://localhost:${AIRFLOW_UI_EXTERNAL_PORT}/"; do
[ "$(date +%s)" -gt "${END}" ] && { echo "Timed out waiting for airflow port-forward to become ready"; exit 1; }
sleep 2
done
@@ -40,7 +40,9 @@ if ! curl -so /dev/null --max-time 3 "http://localhost:${AIRFLOW_UI_EXTERNAL_POR
disown $!
fi
END=$(($(date +%s) + 180))
until curl -so /dev/null "http://localhost:${AIRFLOW_UI_EXTERNAL_PORT}/"; do
[ "$(date +%s)" -gt "${END}" ] && { echo "Timed out waiting for airflow port-forward to become ready"; exit 1; }
sleep 2
done
@@ -88,7 +90,9 @@ for attempt in 1 2 3; do
sleep 2
done
END=$(($(date +%s) + 180))
until curl -so /dev/null "http://localhost:5240/MAAS"; do
[ "$(date +%s)" -gt "${END}" ] && { echo "Timed out waiting for maas port-forward to become ready"; exit 1; }
sleep 2
done
curl -siv "http://localhost:5240/MAAS" | head -10
@@ -199,11 +203,15 @@ rm -f "${CHART_CRD_PATCH_JSON}"
# Wait until maas-region service exists and has a ClusterIP
END=$(($(date +%s) + 600))
until kubectl get svc -n "${NAMESPACE}" maas-region &>/dev/null; do
[ "$(date +%s)" -gt "${END}" ] && { echo "Timed out waiting for maas-region service to be created"; exit 1; }
echo "Waiting for maas-region service to be created..."
sleep 10
done
END=$(($(date +%s) + 120))
until [[ -n "$(kubectl get svc -n "${NAMESPACE}" maas-region -o jsonpath='{.spec.clusterIP}' 2>/dev/null)" ]]; do
[ "$(date +%s)" -gt "${END}" ] && { echo "Timed out waiting for maas-region service to get a ClusterIP"; exit 1; }
echo "Waiting for maas-region service to get a ClusterIP..."
sleep 5
done
@@ -202,12 +202,14 @@
- name: Set make build params
set_fact:
_build_params: >-
{{ ({'DISTRO': distro} if use_distro_param | default(true) | bool else {})
| combine(extra_make_params | default({})) }}
_build_params: "{{ ({'DISTRO': distro} if (use_distro_param | default(true) | bool) else {}) | combine(extra_make_params | default({})) }}"
- name: Debug make build params
debug:
var: _build_params
- name: Make images (verbose shell run for full debug output)
shell: "make {{ make_verbose_target | default(make_target | default('images')) }}"
shell: "make {{ _build_params.items() | map('join', '=') | join(' ') }} {{ make_verbose_target | default(make_target | default('images')) }}"
args:
chdir: "{{ _make_chdir }}"
executable: /bin/bash