Compare commits

...

28 Commits

Author SHA1 Message Date
1a1115db6d Debugging workflow - only built workload container so far
Some checks failed
Build containers when image tags change / build-if-image-changed (., web, containers, main container, git.baumann.gr/adebaumann/vui) (push) Has been cancelled
Build containers when image tags change / build-if-image-changed (data-loader, loader, initContainers, init-container, git.baumann.gr/adebaumann/vui-data-loader) (push) Has been cancelled
2025-11-07 10:24:07 +01:00
34275addaf Debugging workflow - only built workload container so far
All checks were successful
Build containers when image tags change / build-if-image-changed (., web, containers, main container, git.baumann.gr/adebaumann/vui) (push) Successful in 6s
Build containers when image tags change / build-if-image-changed (data-loader, loader, initContainers, init-container, git.baumann.gr/adebaumann/vui-data-loader) (push) Successful in 18s
2025-11-07 10:21:14 +01:00
0df0cef681 Debugging workflow - only built workload container so far
All checks were successful
Build containers when image tags change / build-if-image-changed (., web, containers, main container, git.baumann.gr/adebaumann/vui) (push) Successful in 5s
Build containers when image tags change / build-if-image-changed (data-loader, loader, initContainers, init-container, git.baumann.gr/adebaumann/vui-data-loader) (push) Successful in 6s
2025-11-07 10:20:40 +01:00
3c5a69f30a Test 4 - data-loader should build
All checks were successful
Build containers when image tags change / build-if-image-changed (., web, containers, main container, git.baumann.gr/adebaumann/vui) (push) Successful in 7s
Build containers when image tags change / build-if-image-changed (data-loader, loader, initContainers, init-container, git.baumann.gr/adebaumann/vui-data-loader) (push) Successful in 18s
2025-11-07 10:17:22 +01:00
aa5a95844a Debugging workflow - only built workload container so far
All checks were successful
Build containers when image tags change / build-if-image-changed (., web, containers, main container, git.baumann.gr/adebaumann/vui) (push) Successful in 6s
Build containers when image tags change / build-if-image-changed (data-loader, loader, initContainers, init-container, git.baumann.gr/adebaumann/vui-data-loader) (push) Successful in 7s
2025-11-07 10:16:14 +01:00
eedc63741f Test 3 - both containers should build
All checks were successful
Build containers when image tags change / build-if-image-changed (., web, containers, main container, git.baumann.gr/adebaumann/vui) (push) Successful in 1m10s
Build containers when image tags change / build-if-image-changed (data-loader, loader, initContainers, init-container, git.baumann.gr/adebaumann/vui-data-loader) (push) Successful in 33s
2025-11-07 10:12:41 +01:00
105f00f126 Test 3 - data-loader should build
All checks were successful
Build containers when image tags change / build-if-image-changed (., web, containers, main container, git.baumann.gr/adebaumann/vui) (push) Successful in 9s
Build containers when image tags change / build-if-image-changed (data-loader, loader, initContainers, init-container, git.baumann.gr/adebaumann/vui-data-loader) (push) Successful in 20s
2025-11-07 10:11:30 +01:00
d0d163282d Test 2 - runner should run
All checks were successful
Build containers when image tags change / build-if-image-changed (., web, containers, main container, git.baumann.gr/adebaumann/vui) (push) Successful in 10s
Build containers when image tags change / build-if-image-changed (data-loader, loader, initContainers, init-container, git.baumann.gr/adebaumann/vui-data-loader) (push) Successful in 6s
2025-11-07 10:09:55 +01:00
e88f862a0f Test 1 - shouldn't build any containers 2025-11-07 10:08:59 +01:00
79cb730115 consolidated workflow for containers
All checks were successful
Build containers when image tags change / build-if-image-changed (., web, containers, main container, git.baumann.gr/adebaumann/vui) (push) Successful in 11s
Build containers when image tags change / build-if-image-changed (data-loader, loader, initContainers, init-container, git.baumann.gr/adebaumann/vui-data-loader) (push) Successful in 8s
2025-11-07 10:07:36 +01:00
a34ec67576 Testing data-loader pipeline
All checks were successful
Build data-loader when init-container image tag changes / build-if-image-changed (push) Successful in 26s
Build image when workload image tag changes / build-if-image-changed (push) Successful in 6s
2025-11-07 10:00:15 +01:00
d1c7218fcf Action for data loader container added
All checks were successful
Build data-loader when init-container image tag changes / build-if-image-changed (push) Successful in 35s
2025-11-07 09:58:15 +01:00
683d53dac0 Names now in alphabetical order
All checks were successful
Build image when workload image tag changes / build-if-image-changed (push) Successful in 35s
2025-11-07 00:36:22 +01:00
d2d260381e Runner works. Now on another machine.
All checks were successful
Build image when workload image tag changes / build-if-image-changed (push) Successful in 3m21s
2025-11-07 00:06:39 +01:00
dfdd68e9de Runner should work - incresed deployment to 946 without building it first. Let's see...
All checks were successful
Build image when workload image tag changes / build-if-image-changed (push) Successful in 9m8s
2025-11-06 23:49:26 +01:00
04fa504bb2 Checking runner
All checks were successful
Build image when workload image tag changes / build-if-image-changed (push) Successful in 28s
2025-11-06 23:47:17 +01:00
2204eb762a Checking runner
Some checks failed
Build image when workload image tag changes / build-if-image-changed (push) Failing after 31s
2025-11-06 23:42:37 +01:00
892c229647 Deployment rewound to check
Some checks failed
Build image when workload image tag changes / build-if-image-changed (push) Has been cancelled
2025-11-06 23:39:00 +01:00
441b9c99d2 Changes in workflow 2025-11-06 23:36:41 +01:00
a84e5b34b6 Changes in workflow 2025-11-06 23:33:19 +01:00
55a5b10d6a Automatic deployment test
Some checks failed
Build image when workload image tag changes / build-if-image-changed (push) Failing after 1m16s
2025-11-06 23:24:28 +01:00
d11d666f45 Test without branch in runner 2025-11-06 23:23:21 +01:00
d7b6d05cb5 Merge branch 'development' of https://git.baumann.gr/adebaumann/vgui-cicd into development 2025-11-06 23:16:58 +01:00
254317ee08 Testing runner 2025-11-06 23:16:41 +01:00
d9345a0251 Testing runner 2025-11-06 23:13:10 +01:00
362f474e3d Testing build on demand 2025-11-06 23:09:42 +01:00
b8069802f6 Debug print removed from dokumente/test.py 2025-11-06 16:04:44 +01:00
26d62014c9 Merge pull request 'feature/add-missing-tests' (#8) from feature/add-missing-tests into development
Reviewed-on: #8
2025-11-06 14:34:54 +00:00
6 changed files with 264 additions and 3 deletions

View File

@@ -0,0 +1,259 @@
name: Build containers when image tags change
on:
push:
# Uncomment/adjust once working:
# branches: [ main ]
paths:
- "argocd/deployment.yaml"
- "Dockerfile"
- "data-loader/**"
- ".gitea/workflows/build-containers-on-demand.yml"
jobs:
build-if-image-changed:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- container_name: web
expected_repo: git.baumann.gr/adebaumann/vui
build_context: .
container_type: containers
description: main container
- container_name: loader
expected_repo: git.baumann.gr/adebaumann/vui-data-loader
build_context: data-loader
container_type: initContainers
description: init-container
env:
DEPLOY_FILE: "argocd/deployment.yaml"
CONTAINER_NAME: ${{ matrix.container_name }}
EXPECTED_REPO: ${{ matrix.expected_repo }}
CONTAINER_TYPE: ${{ matrix.container_type }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Determine base commit
id: base
shell: bash
run: |
set -euo pipefail
if git rev-parse --verify -q HEAD~1 >/dev/null; then
echo "base=$(git rev-parse HEAD~1)" >> "$GITHUB_OUTPUT"
else
echo "base=$(git hash-object -t tree /dev/null)" >> "$GITHUB_OUTPUT"
fi
- name: Install yq
shell: bash
run: |
set -euo pipefail
YQ_VER=v4.44.3
curl -sL "https://github.com/mikefarah/yq/releases/download/${YQ_VER}/yq_linux_amd64" -o /usr/local/bin/yq
chmod +x /usr/local/bin/yq
yq --version
- name: Read ${{ matrix.description }} image from deployment (old vs new)
id: img
shell: bash
run: |
set -euo pipefail
file="${DEPLOY_FILE:-argocd/deployment.yaml}"
cname="${CONTAINER_NAME}"
expected_repo="${EXPECTED_REPO}"
ctype="${CONTAINER_TYPE}"
export cname
export expected_repo
export ctype
echo "========================================"
echo "Checking: $ctype / $cname"
echo "Expected repo: $expected_repo"
echo "========================================"
# --- functions ------------------------------------------------------
have_yq() { command -v yq >/dev/null 2>&1; }
# yq-based extractor (multi-doc aware; Deployment only; container name match)
yq_extract() {
if [[ "$ctype" == "initContainers" ]]; then
yq -r '
select(.kind == "Deployment") |
.spec.template.spec.initContainers // [] |
map(select(.name == env(cname))) |
.[]?.image
' "$1" 2>/dev/null | tail -n 1
else
yq -r '
select(.kind == "Deployment") |
.spec.template.spec.containers // [] |
map(select(.name == env(cname))) |
.[]?.image
' "$1" 2>/dev/null | tail -n 1
fi
}
# ultra-tolerant fallback: grep around the appropriate block
fallback_extract() {
local block_pattern
local end_pattern
if [[ "$ctype" == "initContainers" ]]; then
block_pattern="^[[:space:]]*initContainers:"
end_pattern="^[[:space:]]*containers:|^[[:alpha:]][[:alnum:]_:-]*:"
else
block_pattern="^[[:space:]]*containers:"
end_pattern="^[[:alpha:]][[:alnum:]_:-]*:|^[[:space:]]*initContainers:"
fi
awk -v cname="$cname" -v block="$block_pattern" -v endp="$end_pattern" '
BEGIN{ in_cont=0; name=""; image="" }
$0 ~ block {in_cont=1; next}
in_cont {
# end of block when we hit the end pattern
if ($0 ~ endp) { in_cont=0 }
# capture name and image lines
if ($0 ~ /^[[:space:]]*-?[[:space:]]*name:[[:space:]]*/) {
name=$0; sub(/^.*name:[[:space:]]*/,"",name); gsub(/^[ "\047]+|[ "\047]+$/,"",name)
}
if ($0 ~ /^[[:space:]]*image:[[:space:]]*/) {
image=$0; sub(/^.*image:[[:space:]]*/,"",image); gsub(/^[ "\047]+|[ "\047]+$/,"",image)
if (name==cname) { print image; exit }
}
}
' "$1"
}
list_workload_images() {
echo "== workload $ctype in $1 ==" >&2
if have_yq; then
if [[ "$ctype" == "initContainers" ]]; then
yq -r '
select(.kind == "Deployment") |
.spec.template.spec.initContainers // [] |
.[] | "\(.name): \(.image)"
' "$1" 2>/dev/null | nl -ba >&2 || true
else
yq -r '
select(.kind == "Deployment") |
.spec.template.spec.containers // [] |
.[] | "\(.name): \(.image)"
' "$1" 2>/dev/null | nl -ba >&2 || true
fi
else
# coarse list for visibility
if [[ "$ctype" == "initContainers" ]]; then
awk '
/^ *initContainers:/, /^ *containers:/ { if ($0 ~ /name:|image:/) print }
' "$1" | nl -ba >&2 || true
else
awk '
/^ *containers:/, /^[^ ]/ { if ($0 ~ /name:|image:/) print }
' "$1" | nl -ba >&2 || true
fi
fi
}
# --------------------------------------------------------------------
# Ensure yq is present; if install failed earlier, try once more
if ! have_yq; then
echo "yq missing; attempting quick install..." >&2
curl -fsSL https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -o /usr/local/bin/yq || true
chmod +x /usr/local/bin/yq || true
fi
# Prepare old file (previous commit) if exists
if git cat-file -e "${{ steps.base.outputs.base }}":"$file" 2>/dev/null; then
git show "${{ steps.base.outputs.base }}:$file" > /tmp/old.yaml
else
: > /tmp/old.yaml
fi
list_workload_images /tmp/old.yaml || true
list_workload_images "$file" || true
if have_yq; then
old_image="$(yq_extract /tmp/old.yaml || true)"
new_image="$(yq_extract "$file" || true)"
else
old_image="$(fallback_extract /tmp/old.yaml || true)"
new_image="$(fallback_extract "$file" || true)"
fi
# If yq path failed to find it, try fallback once more as safety
if [ -z "${new_image:-}" ]; then
new_image="$(fallback_extract "$file" || true)"
fi
if [ -z "${old_image:-}" ]; then
old_image="$(fallback_extract /tmp/old.yaml || true)"
fi
echo "Old $ctype image: ${old_image:-<none>}"
echo "New $ctype image: ${new_image:-<none>}"
if [ -z "${new_image:-}" ]; then
echo "ERROR: Could not find $ctype[].name == \"$cname\" image in $file"
exit 1
fi
# Split repo and tag
new_repo="${new_image%:*}"
new_tag="${new_image##*:}"
if [[ "$new_repo" != "$expected_repo" ]]; then
echo "ERROR: Found $ctype \"$cname\" image repo is \"$new_repo\" but expected \"$expected_repo\""
exit 1
fi
if [ -n "${old_image:-}" ]; then
old_tag="${old_image##*:}"
else
old_tag=""
fi
registry="$(echo "$new_repo" | awk -F/ '{print $1}')"
{
echo "changed=$([ "$old_tag" != "$new_tag" ] && echo true || echo false)"
echo "new_image=$new_image"
echo "new_repo=$new_repo"
echo "new_tag=$new_tag"
echo "registry=$registry"
} >> "$GITHUB_OUTPUT"
- name: Skip if tag unchanged
if: steps.img.outputs.changed != 'true'
run: echo "${{ matrix.description }} image tag unchanged; skipping build."
- name: Set up Buildx
if: steps.img.outputs.changed == 'true'
uses: docker/setup-buildx-action@v3
- name: Log in to registry
if: steps.img.outputs.changed == 'true'
uses: docker/login-action@v3
with:
registry: ${{ steps.img.outputs.registry }}
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build and push ${{ matrix.description }} (exact tag from deployment)
if: steps.img.outputs.changed == 'true'
uses: docker/build-push-action@v6
with:
context: ${{ matrix.build_context }}
push: true
tags: |
${{ steps.img.outputs.new_image }}
${{ steps.img.outputs.new_repo }}:latest
labels: |
org.opencontainers.image.source=${{ gitea.repository }}
org.opencontainers.image.revision=${{ gitea.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max

View File

@@ -25,7 +25,7 @@ spec:
mountPath: /data
containers:
- name: web
image: git.baumann.gr/adebaumann/vui:0.945
image: git.baumann.gr/adebaumann/vui:0.949-test
imagePullPolicy: Always
ports:
- containerPort: 8000

View File

@@ -191,6 +191,7 @@ class PersonAdmin(admin.ModelAdmin):
js = ['admin/js/jquery.init.js', 'custom/js/inline_toggle.js']
css = {'all': ['custom/css/admin_extras.css']}
list_display=['name']
ordering = ['name']

View File

@@ -26,6 +26,7 @@ class Person(models.Model):
return self.name
class Meta:
verbose_name_plural="Personen"
ordering = ['name']
class Thema(models.Model):
name = models.CharField(max_length=100, primary_key=True)

View File

@@ -1075,7 +1075,7 @@ class IncompleteVorgabenTest(TestCase):
response = self.client.get(reverse('incomplete_vorgaben'))
# Debug: print response content to see where it appears
print("Response content:", response.content.decode())
#print("Response content:", response.content.decode())
# Should NOT appear in "no text" list because it has Langtext
self.assertNotContains(response, 'Vorgabe nur mit Langtext')

View File

@@ -31,6 +31,6 @@
<div class="flex-fill">{% block content %}Main Content{% endblock %}</div>
<div class="col-md-2">{% block sidebar_right %}{% endblock %}</div>
</div>
<div>VorgabenUI v0.945</div>
<div>VorgabenUI v0.949</div>
</body>
</html>