Browse Source
This adds a new script to the runner container that is run in the entrypoint which runs the log gathering ansible playbook from inside the runner container. The gate then extracts these logs with a new role. This also updates the image_build script to fix how it changes the container imagePullPolicy Closes: #658 Relates-To: #659 Change-Id: I24d11c66e7b71852256e164343f7bb2f331d1fefchanges/78/817078/10
8 changed files with 133 additions and 12 deletions
@ -0,0 +1,13 @@
|
||||
# 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. |
||||
|
||||
kubeconfig: "{{ airshipctl_config_dir_default | default(ansible_env.HOME) }}/.airship/kubeconfig" |
@ -0,0 +1,24 @@
|
||||
# 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. |
||||
|
||||
## This task will populate kctl_context_list variable with list of contexts if they exist |
||||
|
||||
- name: "Download logs from runner container" |
||||
include_tasks: save-runner-logs.yaml |
||||
|
||||
- name: "Downloads runner logs to executor" |
||||
synchronize: |
||||
src: "{{ logs_dir }}/aiap-runner-logs" |
||||
dest: "{{ zuul.executor.log_root }}/{{ inventory_hostname }}" |
||||
mode: pull |
||||
ignore_errors: True |
||||
tags: [zuul] |
@ -0,0 +1,28 @@
|
||||
# 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: "creating directory for pod logs" |
||||
file: |
||||
path: "{{ logs_dir }}/aiap-runner-logs" |
||||
state: directory |
||||
|
||||
- name: "retrieve all container logs, current and previous (if they exist)" |
||||
shell: |- |
||||
set -e |
||||
export KUBECONFIG="{{ kubeconfig }}" |
||||
kubectl cp airship-in-a-pod:/tmp/logs /tmp/logs/aiap-runner-logs -c runner |
||||
args: |
||||
executable: /bin/bash |
||||
ignore_errors: True |
||||
|
||||
... |
@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env bash |
||||
|
||||
# Licensed to the Apache Software Foundation (ASF) under one |
||||
# or more contributor license agreements. See the NOTICE file |
||||
# distributed with this work for additional information |
||||
# regarding copyright ownership. The ASF licenses this file |
||||
# to you 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. |
||||
|
||||
set -xe |
||||
|
||||
export AIRSHIPCTL_WS=${AIRSHIPCTL_WS:-$PWD} |
||||
export TMP_DIR=${TMP_DIR:-"$(dirname "$(mktemp -u)")"} |
||||
|
||||
ANSIBLE_CFG=${ANSIBLE_CFG:-"${HOME}/.ansible.cfg"} |
||||
ANSIBLE_HOSTS=${ANSIBLE_HOSTS:-"${TMP_DIR}/ansible_hosts"} |
||||
PLAYBOOK_CONFIG=${PLAYBOOK_CONFIG:-"${TMP_DIR}/config.yaml"} |
||||
|
||||
mkdir -p "$TMP_DIR" |
||||
envsubst <"${AIRSHIPCTL_WS}/tools/gate/config_template.yaml" > "$PLAYBOOK_CONFIG" |
||||
|
||||
|
||||
echo "primary ansible_host=localhost ansible_connection=local ansible_python_interpreter=/usr/bin/python3" > "$ANSIBLE_HOSTS" |
||||
printf "[defaults]\nroles_path = %s/roles:zuul-jobs/roles\n" "$AIRSHIPCTL_WS" > "$ANSIBLE_CFG" |
||||
|
||||
sudo -E ansible-playbook -i "$ANSIBLE_HOSTS" \ |
||||
playbooks/airship-collect-logs.yaml \ |
||||
-e @"$PLAYBOOK_CONFIG" \ |
||||
-e 'log_roles="[\"gather-system-logs\", \"airship-gather-libvirt-logs\", \"airship-gather-runtime-logs\", \"airship-airshipctl-gather-configs\", \"describe-kubernetes-objects\", \"airship-gather-pod-logs\"]"' |
Loading…
Reference in new issue