Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Feature/LTH-karectl-integration #304

Feature/LTH-karectl-integration

Feature/LTH-karectl-integration #304

Workflow file for this run

name: Test K8TRE Deployment to K3S
on:
pull_request:
branches:
- main
push:
branches:
- main
- "dev-*"
workflow_dispatch:
jobs:
# pre-commit:
# runs-on: ubuntu-24.04
# steps:
# - uses: actions/checkout@v5
# - uses: actions/setup-python@v6
# - uses: pre-commit/[email protected]
test:
runs-on: ubuntu-24.04
timeout-minutes: 20
env:
K8TRE_DOMAIN: dev.k8tre.internal
steps:
- name: Free up disk space on GitHub runner
uses: manics/[email protected]
with:
desired-space: 40000
- uses: actions/checkout@v5
- name: Install uv
uses: astral-sh/setup-uv@v6
- uses: actions/setup-python@v6
with:
python-version: "3.13"
cache: pip
cache-dependency-path: dev-requirements.txt
- name: Install dependencies
run: |
pip install -r dev-requirements.txt
playwright install
- name: Modify hosts to resolve k8tre.internal URLs
run: |
K8TRE_SUBDOMAINS="jupyter.$K8TRE_DOMAIN guacamole.$K8TRE_DOMAIN keycloak.$K8TRE_DOMAIN"
h=$(grep "$(hostname -i) " /etc/hosts)
if [ -n "$h" ]; then
sudo sed -i -re "s/$h/$h $K8TRE_SUBDOMAINS/" /etc/hosts
else
echo $(hostname -i) $K8TRE_SUBDOMAINS | sudo tee -a /etc/hosts
fi
cat /etc/hosts
- name: Install deployment
run: |
./ci/run_codeblocks.py docs/development/k3s-dev.md --run
- name: Run tests (not UI)
run: |
python -m pytest -v -s --color=yes -m "not ui"
- name: Run tests (UI)
run: |
python -m pytest -v -s --color=yes -m ui
- name: Upload screenshot
uses: actions/upload-artifact@v4
if: always()
with:
name: screenshots
path: screenshots/*
if-no-files-found: error
- name: Get ArgoCD logs, including on failure
if: always()
run: |
echo "::group::argocd-server"
kubectl -nargocd logs deploy/argocd-server
echo "::endgroup::"
- name: Get ArgoCD apps, including on failure
if: always()
run: |
for kind in appprojects applicationsets applications; do
echo "::group::argocd $kind"
kubectl describe $kind -A
echo "::endgroup::"
done
- name: Get main K8s resources, including on failure
if: always()
run: |
# Ignore errors since this is for debugging
set +e
for namespace in $(kubectl get namespace -ojsonpath='{.items[*].metadata.name}'); do
echo "***** $namespace *****"
for kind in daemonset deployment statefulset ingress service pod; do
for name in $(kubectl -n$namespace get $kind -ojsonpath='{.items[*].metadata.name}'); do
echo "::group::$kind/$name"
kubectl -n$namespace describe $kind/$name
echo "::endgroup::"
done
done
done
# Set a single status check for the whole workflow, so that we can use it in a
# branch protection rule
status-check:
runs-on: ubuntu-24.04
needs:
# - pre-commit
- test
if: always()
steps:
- name: Get job statuses
uses: technote-space/[email protected]
with:
FALLBACK_CONCLUSION: failure
STRICT_SUCCESS: true
# Status is saved in env.WORKFLOW_CONCLUSION
- name: Status check
if: env.WORKFLOW_CONCLUSION != 'success'
run: |
exit 1