From 68c9aa5b3a4d35277b25179d867fcdaab76b9d3c Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Sat, 7 Nov 2026 06:53:47 +0000 Subject: [PATCH 1/5] fix(web-app-jenkins): pin the OIDC scopes to openid profile email MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Main run 42235551402 (5d78f3ae7d), job 128223280276 Jenkins#0: the OIDC redirect ended at /securityRealm/finishLogin?error=invalid_scope. With a wellKnown server configuration and no scopesOverride, oic-auth requests every entry of the discovery document's scopes_supported (OicServerWellKnownConfiguration). Keycloak rejects the whole request when one scope is not a default or optional scope of the client. The requested list minus the scopes of the infinito.nexus client leaves exactly kc-admin-api, a Keycloak built-in assigned only to admin-cli and security-admin-console. casc.yaml.j2 now pins scopesOverride to 'openid profile email'; groups keeps arriving as a default client scope. The new unit test renders casc.yaml.j2 and the shared client template default.json.j2 and asserts every requested scope is one the client carries; without the override both tests fail. 🎯 Fix: 91 % 💥 Break: 7 % 💸 Cost: 100 % ⏱️ Time: 100 % 🛡️ Security: ~100 % 🏆 Score: 85 🚦 Gate: ⛔ break 7 % > 5 Co-Authored-By: Claude Opus 5.5 --- roles/web-app-jenkins/templates/casc.yaml.j2 | 1 + .../python/roles/web-app-jenkins/__init__.py | 0 .../web-app-jenkins/templates/__init__.py | 5 + .../templates/test_casc_oidc_scopes.py | 102 ++++++++++++++++++ 4 files changed, 108 insertions(+) create mode 100644 tests/unit/python/roles/web-app-jenkins/__init__.py create mode 100644 tests/unit/python/roles/web-app-jenkins/templates/__init__.py create mode 100644 tests/unit/python/roles/web-app-jenkins/templates/test_casc_oidc_scopes.py diff --git a/roles/web-app-jenkins/templates/casc.yaml.j2 b/roles/web-app-jenkins/templates/casc.yaml.j2 index e66a916a60..1eefc3b21a 100644 --- a/roles/web-app-jenkins/templates/casc.yaml.j2 +++ b/roles/web-app-jenkins/templates/casc.yaml.j2 @@ -17,6 +17,7 @@ jenkins: serverConfiguration: wellKnown: wellKnownOpenIDConfigurationUrl: "{{ OIDC.CLIENT.DISCOVERY_DOCUMENT }}" + scopesOverride: "openid profile email" userNameField: "preferred_username" groupsFieldName: "groups" logoutFromOpenidProvider: true diff --git a/tests/unit/python/roles/web-app-jenkins/__init__.py b/tests/unit/python/roles/web-app-jenkins/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/unit/python/roles/web-app-jenkins/templates/__init__.py b/tests/unit/python/roles/web-app-jenkins/templates/__init__.py new file mode 100644 index 0000000000..087c384b57 --- /dev/null +++ b/tests/unit/python/roles/web-app-jenkins/templates/__init__.py @@ -0,0 +1,5 @@ +from pathlib import Path + +PROJECT_ROOT: Path = Path(__file__).resolve().parents[6] + +__all__ = ["PROJECT_ROOT"] diff --git a/tests/unit/python/roles/web-app-jenkins/templates/test_casc_oidc_scopes.py b/tests/unit/python/roles/web-app-jenkins/templates/test_casc_oidc_scopes.py new file mode 100644 index 0000000000..362c0c988e --- /dev/null +++ b/tests/unit/python/roles/web-app-jenkins/templates/test_casc_oidc_scopes.py @@ -0,0 +1,102 @@ +from __future__ import annotations + +import json +import re +import unittest +from types import SimpleNamespace + +import yaml +from jinja2 import Environment, FileSystemLoader, StrictUndefined, select_autoescape + +from . import PROJECT_ROOT + +CASC = "roles/web-app-jenkins/templates/casc.yaml.j2" +KEYCLOAK_CLIENT = "roles/web-app-keycloak/templates/import/clients/default.json.j2" +OIDC = { + "CLIENT": { + "ID": "infinito.nexus", + "SECRET": "secret", + "DISCOVERY_DOCUMENT": "https://auth.example.org/realms/infinito.nexus/.well-known/openid-configuration", + } +} + + +def environment() -> Environment: + env = Environment( + loader=FileSystemLoader(str(PROJECT_ROOT)), + undefined=StrictUndefined, + autoescape=select_autoescape(), + ) + env.filters["bool"] = bool + env.filters["to_json"] = json.dumps + env.filters["regex_replace"] = lambda value, pattern, repl: re.sub( + pattern, repl, value + ) + return env + + +def requested_scopes() -> list[str]: + administrator = SimpleNamespace(username="administrator", password="secret") + + def lookup(kind, *_args, **_kw): + if kind == "users": + return administrator + if kind == "tls": + return "https://jenkins.example.org/" + raise AssertionError(f"unexpected lookup {kind!r}") + + rendered = ( + environment() + .get_template(CASC) + .render( + SOFTWARE_NAME="Infinito.Nexus", + JENKINS_OIDC_ENABLED=True, + JENKINS_LDAP_ENABLED=False, + OIDC=OIDC, + application_id="web-app-jenkins", + lookup=lookup, + ) + ) + well_known = yaml.safe_load(rendered)["jenkins"]["securityRealm"]["oic"][ + "serverConfiguration" + ]["wellKnown"] + return well_known["scopesOverride"].split() + + +def client_scopes() -> set[str]: + def lookup(kind, _app, key): + if kind != "config": + raise AssertionError(f"unexpected lookup {kind!r}") + return key.rsplit(".", 1)[-1] + + rendered = ( + environment() + .get_template(KEYCLOAK_CLIENT) + .render( + KEYCLOAK_CLIENT_ID="infinito.nexus", + KEYCLOAK_REALM_URL="https://auth.example.org/realms/infinito.nexus", + OIDC=OIDC, + KEYCLOAK_REDIRECT_URIS=[], + KEYCLOAK_WEB_ORIGINS=[], + KEYCLOAK_FRONTCHANNEL_LOGOUT_URL="", + KEYCLOAK_POST_LOGOUT_URIS="", + KEYCLOAK_RBAC_GROUP_CLAIM="groups", + KEYCLOAK_MOODLE_ENABLED=False, + application_id="web-app-keycloak", + lookup=lookup, + ) + ) + client = json.loads(rendered) + return set(client["defaultClientScopes"]) | set(client["optionalClientScopes"]) + + +class TestOidcScopes(unittest.TestCase): + def test_jenkins_asks_for_identity_scopes_only(self) -> None: + self.assertEqual(requested_scopes(), ["openid", "profile", "email"]) + + def test_every_requested_scope_is_one_the_client_carries(self) -> None: + self.assertLessEqual(set(requested_scopes()), client_scopes()) + + +if __name__ == "__main__": + unittest.main() From 727ba456263cb2c5b8ed69bc4fc4387b8531c78f Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Sat, 7 Nov 2026 06:55:17 +0000 Subject: [PATCH 2/5] fix(web-app-moodle): stand a second bootstrap down and gate the ownership walks on a settled one MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Main run 42235551402 (5d78f3ae7d), job 128223280156 Moodle#2 (swarm): 03_ownership.yml:24 'find -exec chmod 0644' failed with hundreds of 'No such file or directory' under public/lib/yuilib. moodle_code is one NFS export shared by three replicas and cron, all on release 5.3.0. The bootstrap lock lives on that export and does not serialize across NFS clients (workers log 'flock: 9: Input/output error'). So a second same-release bootstrap swapped the tree in while the deploy walked it; the rescue listing at 02:22:34 shows neither .bootstrap.stage nor .bootstrap.done, the window between the stage rmdir and the sentinel write. Port of two store-i18n commits by Stage; 5c3749c437 and 7bc5822421 are already on main: - moodle_bootstrap_code_dir re-reads the sentinel after its copy and stands down when another container finished the same release (cherry picked from commit db1a27b3f2). - The ownership walks wait until the stage is gone and the sentinel holds the expected release, prune the stage and batch through -exec +; stage and sentinel paths come from vars/main.yml via ARG/ENV (cherry picked from commit 9a5965b87c). The rationale header the port added to moodle-entrypoint.sh and a stray comment line in 03_ownership.yml are dropped. test_moodle_entrypoint: 8/8 green; without the stand-down test_a_sibling_that_finishes_first_keeps_its_tree fails. 🎯 Fix: 88 % 💥 Break: 6 % 💸 Cost: 100 % ⏱️ Time: 100 % 🛡️ Security: ~100 % 🏆 Score: 83 🚦 Gate: ⛔ fix 88 % < 90, break 6 % > 5 Co-Authored-By: Claude Opus 5.5 --- roles/web-app-moodle/files/Dockerfile | 6 ++- .../files/build/moodle-entrypoint.sh | 8 +++- roles/web-app-moodle/tasks/03_ownership.yml | 16 ++++++-- roles/web-app-moodle/templates/compose.yml.j2 | 2 + roles/web-app-moodle/vars/main.yml | 2 + .../files/build/test_moodle_entrypoint.py | 40 +++++++++++++++++-- 6 files changed, 64 insertions(+), 10 deletions(-) diff --git a/roles/web-app-moodle/files/Dockerfile b/roles/web-app-moodle/files/Dockerfile index f6aa1f92c2..ca6230f732 100644 --- a/roles/web-app-moodle/files/Dockerfile +++ b/roles/web-app-moodle/files/Dockerfile @@ -4,7 +4,7 @@ # compose.yml.j2, which derives them from roles/web-app-moodle/vars/main.yml. # That vars file is the single source of truth for: # - container paths (MOODLE_CODE_DIR, MOODLE_DATA_DIR, MOODLE_SOURCE_DIR, -# MOODLE_ENTRYPOINT_PATH) +# MOODLE_ENTRYPOINT_PATH, MOODLE_BOOTSTRAP_STAGE) # - build-asset names (MOODLE_BUILD_DIR, MOODLE_BUILD_FILES.*) # # The COPY src paths and the ENTRYPOINT JSON-array literal in this @@ -22,6 +22,8 @@ ARG MOODLE_CODE_DIR ARG MOODLE_DATA_DIR ARG MOODLE_LOCAL_CACHE_DIR ARG MOODLE_SOURCE_DIR +ARG MOODLE_BOOTSTRAP_STAGE +ARG MOODLE_BOOTSTRAP_SENTINEL ARG MOODLE_RUNTIME_USER ARG MOODLE_OIDC_ENABLED ARG MOODLE_OIDC_PLUGIN_RELPATH @@ -39,6 +41,8 @@ ENV MOODLE_CODE_DIR=${MOODLE_CODE_DIR} \ MOODLE_DATA_DIR=${MOODLE_DATA_DIR} \ MOODLE_LOCAL_CACHE_DIR=${MOODLE_LOCAL_CACHE_DIR} \ MOODLE_SOURCE_DIR=${MOODLE_SOURCE_DIR} \ + MOODLE_BOOTSTRAP_STAGE=${MOODLE_BOOTSTRAP_STAGE} \ + MOODLE_BOOTSTRAP_SENTINEL=${MOODLE_BOOTSTRAP_SENTINEL} \ MOODLE_RUNTIME_USER=${MOODLE_RUNTIME_USER} \ MOODLE_OIDC_PLUGIN_RELPATH=${MOODLE_OIDC_PLUGIN_RELPATH} \ MOODLE_MCP_PLUGIN_RELPATH=${MOODLE_MCP_PLUGIN_RELPATH} \ diff --git a/roles/web-app-moodle/files/build/moodle-entrypoint.sh b/roles/web-app-moodle/files/build/moodle-entrypoint.sh index 30083ff2ff..6da08daa4f 100644 --- a/roles/web-app-moodle/files/build/moodle-entrypoint.sh +++ b/roles/web-app-moodle/files/build/moodle-entrypoint.sh @@ -12,13 +12,13 @@ set -euo pipefail : "${MOODLE_DATA_DIR:?required}" : "${MOODLE_LOCAL_CACHE_DIR:?required}" : "${MOODLE_SOURCE_DIR:?required}" +: "${MOODLE_BOOTSTRAP_STAGE:?required}" +: "${MOODLE_BOOTSTRAP_SENTINEL:?required}" : "${MOODLE_RUNTIME_USER:?required}" : "${MOODLE_VERSION_FILE:?required}" : "${MOODLE_RELEASE:?required}" -MOODLE_BOOTSTRAP_SENTINEL="${MOODLE_CODE_DIR}/.bootstrap.done" MOODLE_BOOTSTRAP_LOCK="${MOODLE_CODE_DIR}/.bootstrap.lock" -MOODLE_BOOTSTRAP_STAGE="${MOODLE_CODE_DIR}/.bootstrap.stage" mkdir -p "${MOODLE_DATA_DIR}" chown -R "${MOODLE_RUNTIME_USER}:${MOODLE_RUNTIME_USER}" "${MOODLE_DATA_DIR}" || true # nocheck: shell-or-true -- grandfathered: worked in practice; TODO: sharpen to catch only the exact tolerated error @@ -51,6 +51,10 @@ moodle_bootstrap_code_dir() { rm -rf "${MOODLE_BOOTSTRAP_STAGE}" mkdir "${MOODLE_BOOTSTRAP_STAGE}" cp -a "${MOODLE_SOURCE_DIR}/." "${MOODLE_BOOTSTRAP_STAGE}/" + if moodle_code_dir_is_current; then + rm -rf "${MOODLE_BOOTSTRAP_STAGE}" + return 0 + fi find "${MOODLE_CODE_DIR}" -mindepth 1 -maxdepth 1 ! -name "${MOODLE_BOOTSTRAP_LOCK##*/}" ! -name "${MOODLE_BOOTSTRAP_STAGE##*/}" -exec rm -rf {} + find "${MOODLE_BOOTSTRAP_STAGE}" -mindepth 1 -maxdepth 1 -exec mv -t "${MOODLE_CODE_DIR}" {} + rmdir "${MOODLE_BOOTSTRAP_STAGE}" diff --git a/roles/web-app-moodle/tasks/03_ownership.yml b/roles/web-app-moodle/tasks/03_ownership.yml index 7dd3958eaf..c441e3752d 100644 --- a/roles/web-app-moodle/tasks/03_ownership.yml +++ b/roles/web-app-moodle/tasks/03_ownership.yml @@ -9,8 +9,18 @@ # because only Moodle FPM (running as MOODLE_RUNTIME_USER) needs to # read/write user-uploaded content. +- name: "⏳ Wait until no container is still bootstrapping the shared code volume" + shell: > + container exec --user root {{ MOODLE_CONTAINER_ADDRESS }} + sh -c 'test ! -e {{ MOODLE_BOOTSTRAP_STAGE }} && test "$(cat {{ MOODLE_BOOTSTRAP_SENTINEL }} 2>/dev/null)" = "{{ MOODLE_RELEASE }}"' + register: moodle_bootstrap_settled + until: moodle_bootstrap_settled.rc == 0 + retries: 120 + delay: 5 + changed_when: false + - name: "✅ Ensure ownership is correct on Moodle code dir" - shell: "container exec --user root {{ MOODLE_CONTAINER_ADDRESS }} chown -R {{ MOODLE_RUNTIME_USER_GROUP }} {{ MOODLE_CODE_DIR }}" + shell: "container exec --user root {{ MOODLE_CONTAINER_ADDRESS }} find {{ MOODLE_CODE_DIR }} -path {{ MOODLE_BOOTSTRAP_STAGE }} -prune -o -exec chown -h {{ MOODLE_RUNTIME_USER_GROUP }} {} +" changed_when: false - name: "✅ Ensure ownership is correct on Moodle data dir" @@ -18,11 +28,11 @@ changed_when: false - name: "📁 Code dir: 0755 dirs (nginx-readable)" - shell: "container exec --user root {{ MOODLE_CONTAINER_ADDRESS }} find {{ MOODLE_CODE_DIR }} -type d -exec chmod 0755 {} \\;" + shell: "container exec --user root {{ MOODLE_CONTAINER_ADDRESS }} find {{ MOODLE_CODE_DIR }} -path {{ MOODLE_BOOTSTRAP_STAGE }} -prune -o -type d -exec chmod 0755 {} +" changed_when: false - name: "📁 Code dir: 0644 files (nginx-readable)" - shell: "container exec --user root {{ MOODLE_CONTAINER_ADDRESS }} find {{ MOODLE_CODE_DIR }} -type f -exec chmod 0644 {} \\;" + shell: "container exec --user root {{ MOODLE_CONTAINER_ADDRESS }} find {{ MOODLE_CODE_DIR }} -path {{ MOODLE_BOOTSTRAP_STAGE }} -prune -o -type f -exec chmod 0644 {} +" changed_when: false - name: "📁 Code dir: 0640 config.php (FPM-only)" diff --git a/roles/web-app-moodle/templates/compose.yml.j2 b/roles/web-app-moodle/templates/compose.yml.j2 index 0bb8966b57..f440a872c2 100644 --- a/roles/web-app-moodle/templates/compose.yml.j2 +++ b/roles/web-app-moodle/templates/compose.yml.j2 @@ -14,6 +14,8 @@ MOODLE_DATA_DIR: "{{ MOODLE_DATA_DIR }}" MOODLE_LOCAL_CACHE_DIR: "{{ MOODLE_LOCAL_CACHE_DIR }}" MOODLE_SOURCE_DIR: "{{ MOODLE_SOURCE_DIR }}" + MOODLE_BOOTSTRAP_STAGE: "{{ MOODLE_BOOTSTRAP_STAGE }}" + MOODLE_BOOTSTRAP_SENTINEL: "{{ MOODLE_BOOTSTRAP_SENTINEL }}" MOODLE_RUNTIME_USER: "{{ MOODLE_RUNTIME_USER }}" MOODLE_OIDC_ENABLED: "{{ MOODLE_OIDC_ENABLED | bool | ternary('1','0') }}" MOODLE_OIDC_PLUGIN_RELPATH: "{{ MOODLE_OIDC_PLUGIN_RELPATH }}" diff --git a/roles/web-app-moodle/vars/main.yml b/roles/web-app-moodle/vars/main.yml index e6cab65f67..d9737b3410 100644 --- a/roles/web-app-moodle/vars/main.yml +++ b/roles/web-app-moodle/vars/main.yml @@ -8,6 +8,8 @@ MOODLE_DATA_DIR: "{{ lookup('volume', 'web-app-moodle', 'data').target }}" MOODLE_LOCAL_CACHE_DIR: "{{ lookup('volume', application_id, 'localcache').mounts[0].target }}" MOODLE_SOURCE_DIR: "/opt/moodle-source" MOODLE_ENTRYPOINT_PATH: "/usr/local/bin/moodle-entrypoint.sh" +MOODLE_BOOTSTRAP_STAGE: "{{ [MOODLE_CODE_DIR, '.bootstrap.stage'] | path_join }}" +MOODLE_BOOTSTRAP_SENTINEL: "{{ [MOODLE_CODE_DIR, '.bootstrap.done'] | path_join }}" MOODLE_BUILD_DIR: "build" MOODLE_BUILD_FILES: diff --git a/tests/unit/python/roles/web-app-moodle/files/build/test_moodle_entrypoint.py b/tests/unit/python/roles/web-app-moodle/files/build/test_moodle_entrypoint.py index 9ed0c5bcb0..d75b6510fc 100644 --- a/tests/unit/python/roles/web-app-moodle/files/build/test_moodle_entrypoint.py +++ b/tests/unit/python/roles/web-app-moodle/files/build/test_moodle_entrypoint.py @@ -13,6 +13,12 @@ ENTRYPOINT = PROJECT_ROOT / "roles/web-app-moodle/files/build/moodle-entrypoint. FPM_STUB = "#!/usr/bin/env bash\nexit 0\n" +CP_STUB = ( + "#!/usr/bin/env bash\n" + 'printf %s "$SIBLING_RELEASE" > "${MOODLE_CODE_DIR}/.bootstrap.done"\n' + 'exec @REAL_CP@ "$@"\n' +) + LAYOUT_4 = {"version.php": "4.5.11", "auth/oidc/version.php": "4.5.8"} LAYOUT_5 = {"public/version.php": "5.3.0", "public/auth/oidc/version.php": "5.2.1"} @@ -24,22 +30,38 @@ class TestMoodleEntrypoint(unittest.TestCase): self.root = Path(tmp.name) self.source = self.root / "source" self.code = self.root / "code" - bin_dir = self.root / "bin" - bin_dir.mkdir() - stub = bin_dir / "php-fpm" + self.stage = self.code / ".bootstrap.stage" + self.sentinel = self.code / ".bootstrap.done" + self.bin_dir = self.root / "bin" + self.bin_dir.mkdir() + self.real_cp = shutil.which("cp") + stub = self.bin_dir / "php-fpm" stub.write_text(FPM_STUB) stub.chmod(0o755) self.env = dict(os.environ) self.env.update( - PATH=f"{bin_dir}{os.pathsep}{self.env['PATH']}", + PATH=f"{self.bin_dir}{os.pathsep}{self.env['PATH']}", MOODLE_CODE_DIR=str(self.code), MOODLE_DATA_DIR=str(self.root / "data"), MOODLE_LOCAL_CACHE_DIR=str(self.root / "localcache"), MOODLE_SOURCE_DIR=str(self.source), + MOODLE_BOOTSTRAP_STAGE=str(self.stage), + MOODLE_BOOTSTRAP_SENTINEL=str(self.sentinel), MOODLE_RUNTIME_USER=pwd.getpwuid(os.getuid()).pw_name, MOODLE_VERSION_FILE="public/version.php", ) + def sibling_finishes_during_the_copy(self, release): + """Stub ``cp`` so another container marks the volume done mid-bootstrap. + + Args: + release: release the sibling records in the bootstrap sentinel. + """ + stub = self.bin_dir / "cp" + stub.write_text(CP_STUB.replace("@REAL_CP@", self.real_cp)) + stub.chmod(0o755) + self.env["SIBLING_RELEASE"] = release + def write(self, tree, files): for name, content in files.items(): path = tree / name @@ -109,6 +131,16 @@ class TestMoodleEntrypoint(unittest.TestCase): self.assertEqual(self.shipped_files_in_the_volume(), set(LAYOUT_4)) self.assertEqual(read_text(str(self.code / ".bootstrap.done")), "4.5.11") + def test_a_sibling_that_finishes_first_keeps_its_tree(self): + self.ship(LAYOUT_5) + installed = {"public/local/installed/version.php": "written by the deploy"} + self.write(self.code, installed) + self.sibling_finishes_during_the_copy("5.3.0") + self.start("5.3.0") + self.assertTrue((self.code / "public/local/installed/version.php").is_file()) + self.assertFalse(self.stage.exists()) + self.assertEqual(read_text(str(self.code / ".bootstrap.done")), "5.3.0") + def test_an_image_older_than_the_recorded_release_refuses_to_replace_it(self): self.ship(LAYOUT_5) self.start("5.10.0") From 584f0b99ec2cbc03f2bf7381b537681167ef7878 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Sat, 7 Nov 2026 08:49:32 +0000 Subject: [PATCH 3/5] style(web-app-moodle): wrap the ownership walks as the formatter does MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit make quality-high's autoformat re-wrapped the three long double-quoted shell: lines of 03_ownership.yml that 727ba45626 introduced. A line break inside a double-quoted YAML scalar folds into one space, so the parsed task file at 727ba45626 and after this commit compares equal. 🎯 Fix: 99 % 💥 Break: 1 % 💸 Cost: 100 % ⏱️ Time: – 🛡️ Security: 100 % 🏆 Score: 98 🚦 Gate: ✅ 90/5, cost and time <= 100, security 100 % Co-Authored-By: Claude Opus 5.5 --- roles/web-app-moodle/tasks/03_ownership.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/roles/web-app-moodle/tasks/03_ownership.yml b/roles/web-app-moodle/tasks/03_ownership.yml index c441e3752d..34d28b07a5 100644 --- a/roles/web-app-moodle/tasks/03_ownership.yml +++ b/roles/web-app-moodle/tasks/03_ownership.yml @@ -20,7 +20,8 @@ changed_when: false - name: "✅ Ensure ownership is correct on Moodle code dir" - shell: "container exec --user root {{ MOODLE_CONTAINER_ADDRESS }} find {{ MOODLE_CODE_DIR }} -path {{ MOODLE_BOOTSTRAP_STAGE }} -prune -o -exec chown -h {{ MOODLE_RUNTIME_USER_GROUP }} {} +" + shell: "container exec --user root {{ MOODLE_CONTAINER_ADDRESS }} find {{ MOODLE_CODE_DIR }} -path {{ MOODLE_BOOTSTRAP_STAGE }} -prune -o -exec chown -h {{ MOODLE_RUNTIME_USER_GROUP + }} {} +" changed_when: false - name: "✅ Ensure ownership is correct on Moodle data dir" @@ -28,11 +29,13 @@ changed_when: false - name: "📁 Code dir: 0755 dirs (nginx-readable)" - shell: "container exec --user root {{ MOODLE_CONTAINER_ADDRESS }} find {{ MOODLE_CODE_DIR }} -path {{ MOODLE_BOOTSTRAP_STAGE }} -prune -o -type d -exec chmod 0755 {} +" + shell: "container exec --user root {{ MOODLE_CONTAINER_ADDRESS }} find {{ MOODLE_CODE_DIR }} -path {{ MOODLE_BOOTSTRAP_STAGE }} -prune -o -type d -exec chmod 0755 + {} +" changed_when: false - name: "📁 Code dir: 0644 files (nginx-readable)" - shell: "container exec --user root {{ MOODLE_CONTAINER_ADDRESS }} find {{ MOODLE_CODE_DIR }} -path {{ MOODLE_BOOTSTRAP_STAGE }} -prune -o -type f -exec chmod 0644 {} +" + shell: "container exec --user root {{ MOODLE_CONTAINER_ADDRESS }} find {{ MOODLE_CODE_DIR }} -path {{ MOODLE_BOOTSTRAP_STAGE }} -prune -o -type f -exec chmod 0644 + {} +" changed_when: false - name: "📁 Code dir: 0640 config.php (FPM-only)" From c6b92bb711c62cc2b60fd3ef4f9a696251dbf029 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Sat, 7 Nov 2026 08:50:57 +0000 Subject: [PATCH 4/5] test(web-app-jenkins): parse the rendered casc through utils.cache.yaml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit tests/lint/repository/yaml/test_no_direct_calls.py rejects direct yaml.safe_load calls; test_casc_oidc_scopes.py from 68c9aa5b3a had one. It now uses load_yaml_str. The lint and both scope tests pass. 🎯 Fix: 97 % 💥 Break: 1 % 💸 Cost: 100 % ⏱️ Time: – 🛡️ Security: 100 % 🏆 Score: 96 🚦 Gate: ✅ 90/5, cost and time <= 100, security 100 % Co-Authored-By: Claude Opus 5.5 --- .../roles/web-app-jenkins/templates/test_casc_oidc_scopes.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/unit/python/roles/web-app-jenkins/templates/test_casc_oidc_scopes.py b/tests/unit/python/roles/web-app-jenkins/templates/test_casc_oidc_scopes.py index 362c0c988e..93e5def572 100644 --- a/tests/unit/python/roles/web-app-jenkins/templates/test_casc_oidc_scopes.py +++ b/tests/unit/python/roles/web-app-jenkins/templates/test_casc_oidc_scopes.py @@ -5,9 +5,10 @@ import re import unittest from types import SimpleNamespace -import yaml from jinja2 import Environment, FileSystemLoader, StrictUndefined, select_autoescape +from utils.cache.yaml import load_yaml_str + from . import PROJECT_ROOT CASC = "roles/web-app-jenkins/templates/casc.yaml.j2" @@ -57,7 +58,7 @@ def requested_scopes() -> list[str]: lookup=lookup, ) ) - well_known = yaml.safe_load(rendered)["jenkins"]["securityRealm"]["oic"][ + well_known = load_yaml_str(rendered)["jenkins"]["securityRealm"]["oic"][ "serverConfiguration" ]["wellKnown"] return well_known["scopesOverride"].split() From 54c17d3d41fb9f93ea492f43a5fc4a9ec8802132 Mon Sep 17 00:00:00 2001 From: "infinito-nexus-updater[bot]" <286144613+infinito-nexus-updater[bot]@users.noreply.github.com> Date: Sat, 7 Nov 2026 15:08:27 +0000 Subject: [PATCH 5/5] update(images): update Docker image versions (web-svc-collabora) --- roles/web-svc-collabora/meta/services.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/web-svc-collabora/meta/services.yml b/roles/web-svc-collabora/meta/services.yml index 7a4e234833..9fbad22629 100644 --- a/roles/web-svc-collabora/meta/services.yml +++ b/roles/web-svc-collabora/meta/services.yml @@ -25,7 +25,7 @@ collabora: enabled: true shared: true image: collabora/code - version: "26.04.5.2.1" + version: "26.04.6.1.1" name: collabora min_storage: 734MB cpus: 2