12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- #!/bin/bash
- set -xeuo pipefail
- if [ -n "${PAPR_BRANCH:-}" ]; then
- target_branch=$PAPR_BRANCH
- else
- target_branch=$PAPR_PULL_TARGET_BRANCH
- fi
- target_branch_in=${target_branch}
- if [[ "${target_branch}" =~ ^release- ]]; then
- target_branch="${target_branch/release-/}"
- else
- dnf install -y sed
- target_branch="$( git describe | sed 's/^openshift-ansible-\([0-9]*\.[0-9]*\)\.[0-9]*-.*/\1/' )"
- fi
- export target_branch
- git config --global user.email "ci@openshift.org"
- git config --global user.name "OpenShift Atomic CI"
- git fetch origin ${target_branch_in} && git rebase origin/${target_branch_in}
- pip install -r requirements.txt
- PAPR_INVENTORY=${PAPR_INVENTORY:-.papr.inventory}
- PAPR_RUN_UPDATE=${PAPR_RUN_UPDATE:-0}
- ansible -vvv -i $PAPR_INVENTORY nodes -a 'rpm-ostree status'
- upload_journals() {
- mkdir journals
- ansible -vvv -i $PAPR_INVENTORY all \
- -m shell -a 'journalctl --no-pager > /tmp/journal'
- ansible -vvv -i $PAPR_INVENTORY all \
- -m fetch -a "src=/tmp/journal dest=journals/{{ inventory_hostname }}.log flat=yes"
- }
- trap upload_journals ERR
- export ANSIBLE_LOG_PATH=ansible.log
- ansible-playbook -v -i $PAPR_INVENTORY playbooks/prerequisites.yml
- ansible-playbook -v -i $PAPR_INVENTORY playbooks/deploy_cluster.yml
- if [[ "${PAPR_RUN_UPDATE:-0}" != "0" ]]; then
- update_version="$(echo $target_branch | sed 's/\./_/')"
- ansible-playbook -v -i $PAPR_INVENTORY playbooks/byo/openshift-cluster/upgrades/v${update_version}/upgrade.yml
- fi
|