Skip to content

Update test_upgrade.yaml #2

Update test_upgrade.yaml

Update test_upgrade.yaml #2

Workflow file for this run

on: push
jobs:
test-commit:
name: Test commit
runs-on: ubuntu-24.04
steps:
# setup
- name: Install deps
run: |-
set -euo pipefail
sudo apt-get update -qy
sudo apt-get install -y podman>=4.4
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Podman socket
run: systemctl --user start podman.socket
- name: Checkout previous
run: git checkout HEAD^
- name: Patch pods for testing
run: |-
set -euxo pipefail
sed -i \
-e '/^[[:blank:]]*env:/ {' \
-e 'a\ - { name: NEXTCLOUD_ADMIN_USER, value: admin }' \
-e 'a\ - { name: NEXTCLOUD_ADMIN_PASSWORD, value: admin }' \
-e '}' \
kube/nextcloud.yaml
sed -i \
-e "s|/run/user/1000/|${XDG_RUNTIME_DIR:-/run/user/1000}/|" \
kube/*.yaml
# startup
- name: Create pods
run: |-
set -euo pipefail
find init/ -name 'secrets.*.yaml' -print -exec podman kube play {} \;
find kube/ -name '*.yaml' -print -exec podman kube play --quiet --start=false {} \;
- name: Create databases
run: |-
set -euo pipefail
podman pod start mariadb
podman wait --condition healthy mariadb-app
./db_usr_pwd.sh MYSQL nextcloud
./db_usr_pwd.sh WORDPRESS_DB wordpress1
./db_usr_pwd.sh WORDPRESS_DB wordpress2
- name: Start pods
run: podman pod start -a
- name: Wait for healthy state
run: |-
set -euo pipefail
yq -ot '. as $parent | (
.spec.containers[] | select(.livenessProbe) | $parent.metadata.name + "-" + .name,
.spec.template.spec.containers[] | select(.livenessProbe) | $parent.metadata.name + "-pod-" + .name
)' kube/*.yaml |
xargs -t podman wait --condition healthy
timeout-minutes: 2
# upgrade
- name: Checkout last
run: |-
set -euo pipefail
git reset --hard
git checkout HEAD
- name: Replace pods
run: |-
set -euo pipefail
find kube/ -name '*.yaml' -print -exec podman kube play --quiet --replace {} \;
- name: Wait for healthy state
run: |-
set -euo pipefail
yq -ot '. as $parent | (
.spec.containers[] | select(.livenessProbe) | $parent.metadata.name + "-" + .name,
.spec.template.spec.containers[] | select(.livenessProbe) | $parent.metadata.name + "-pod-" + .name
)' kube/*.yaml |
xargs -t podman wait --condition healthy
timeout-minutes: 2
# debug info
- name: State pods
if: ${{ always() }}
run: podman pod ls
- name: State containers
if: ${{ always() }}
run: podman ps -a
- name: Container logs
if: ${{ always() }}
run: |-
set -euo pipefail
yq -ot '. as $parent | (
.spec.containers[] | $parent.metadata.name + "-" + .name,
.spec.template.spec.containers[] | $parent.metadata.name + "-pod-" + .name
)' kube/*.yaml |
xargs -tn1 podman logs -n