AIAP: Cause AIAP to fail faster

Currently, when a container in AIAP fails, the container continues to
run in the backgroud. This causes the container to be marked as failed
so that the deployment will fail faster.

Closes: #626

Change-Id: I34de366390b6ddc0ef434f7e642e73797a790edf
This commit is contained in:
Ian Howell 2021-09-02 10:16:28 -05:00
parent b32e9b669b
commit cde9648718
4 changed files with 68 additions and 13 deletions

View File

@ -14,7 +14,19 @@
set -ex set -ex
function cloneRepo(){ # Create the "canary" file, indicating that the container is healthy
mkdir -p /tmp/healthy
touch /tmp/healthy/artifact-setup
success=false
function cleanup() {
if [[ "$success" == "false" ]]; then
rm /tmp/healthy/artifact-setup
fi
}
trap cleanup EXIT
function cloneRepo() {
repo_dir=$1 repo_dir=$1
repo_url=$2 repo_url=$2
repo_ref=$3 repo_ref=$3
@ -44,4 +56,5 @@ else
cp "$(command -v airshipctl)" bin cp "$(command -v airshipctl)" bin
fi fi
success=true
/signal_complete artifact-setup /signal_complete artifact-setup

View File

@ -121,9 +121,7 @@ spec:
--interface 10.23.25.1 \ --interface 10.23.25.1 \
--port 8443 \ --port 8443 \
--ssl-key /airship_gate_redfish_auth.key \ --ssl-key /airship_gate_redfish_auth.key \
--ssl-certificate /airship_gate_redfish_auth.pem || true --ssl-certificate /airship_gate_redfish_auth.pem
tail -f /dev/null
volumeMounts: volumeMounts:
- name: var-run-libvirt - name: var-run-libvirt
mountPath: /var/run/libvirt mountPath: /var/run/libvirt
@ -200,15 +198,21 @@ spec:
command: command:
- bash - bash
- -cex - -cex
- | - /entrypoint.sh
/entrypoint.sh || true
tail -f /dev/null
readinessProbe: readinessProbe:
exec: exec:
command: command:
- test - test
- -e - -e
- /tmp/completed/artifact-setup - /tmp/completed/artifact-setup
livenessProbe:
exec:
command:
- test
- -e
- /tmp/healthy/artifact-setup
initialDelaySeconds: 5
periodSeconds: 5
env: env:
- name: CACHE_DIR - name: CACHE_DIR
value: /opt/aiap-cache value: /opt/aiap-cache
@ -249,15 +253,21 @@ spec:
command: command:
- bash - bash
- -cex - -cex
- | - /entrypoint.sh
/entrypoint.sh || true
tail -f /dev/null
readinessProbe: readinessProbe:
exec: exec:
command: command:
- test - test
- -e - -e
- /tmp/completed/infra-builder - /tmp/completed/infra-builder
livenessProbe:
exec:
command:
- test
- -e
- /tmp/healthy/infra-builder
initialDelaySeconds: 5
periodSeconds: 5
env: env:
- name: CACHE_DIR - name: CACHE_DIR
value: /opt/aiap-cache value: /opt/aiap-cache
@ -298,9 +308,7 @@ spec:
command: command:
- bash - bash
- -cex - -cex
- | - /entrypoint.sh
/entrypoint.sh || true
tail -f /dev/null
readinessProbe: readinessProbe:
exec: exec:
command: command:
@ -309,6 +317,14 @@ spec:
- /tmp/completed/runner - /tmp/completed/runner
initialDelaySeconds: 600 initialDelaySeconds: 600
periodSeconds: 30 periodSeconds: 30
livenessProbe:
exec:
command:
- test
- -e
- /tmp/healthy/runner
initialDelaySeconds: 5
periodSeconds: 5
env: env:
- name: CACHE_DIR - name: CACHE_DIR
value: /opt/aiap-cache value: /opt/aiap-cache

View File

@ -14,10 +14,23 @@
set -ex set -ex
# Create the "canary" file, indicating that the container is healthy
mkdir -p /tmp/healthy
touch /tmp/healthy/infra-builder
success=false
function cleanup() {
if [[ "$success" == "false" ]]; then
rm /tmp/healthy/infra-builder
fi
}
trap cleanup EXIT
printf "Waiting 30 seconds for the libvirt and docker services to be ready\n" printf "Waiting 30 seconds for the libvirt and docker services to be ready\n"
sleep 30 sleep 30
ansible-playbook -v /opt/ansible/playbooks/build-infra.yaml \ ansible-playbook -v /opt/ansible/playbooks/build-infra.yaml \
-e local_src_dir="$(pwd)" -e local_src_dir="$(pwd)"
success=true
/signal_complete infra-builder /signal_complete infra-builder

View File

@ -14,6 +14,18 @@
set -ex set -ex
# Create the "canary" file, indicating that the container is healthy
mkdir -p /tmp/healthy
touch /tmp/healthy/runner
success=false
function cleanup() {
if [[ "$success" == "false" ]]; then
rm /tmp/healthy/runner
fi
}
trap cleanup EXIT
# Wait until artifact-setup and libvirt infrastructure has been built # Wait until artifact-setup and libvirt infrastructure has been built
/wait_for artifact-setup /wait_for artifact-setup
/wait_for infra-builder /wait_for infra-builder
@ -67,4 +79,5 @@ fi
./tools/deployment/25_deploy_gating.sh ./tools/deployment/25_deploy_gating.sh
success=true
/signal_complete runner /signal_complete runner