From b9dc5cb60916bd4f318254396c6a160823e4024a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Wed, 18 Nov 2026 16:48:13 +0100 Subject: [PATCH] fix(ci): let the openldap image import the test LDIF files (#4057) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ldap-server step copied our LDIF files to a directory the bitnami image never reads, so the image created its own default tree. Our entrypoint override then polled until LDAP answered and imported the files with ldapadd. That races with the image setup: it answers on a temporary slapd that gets shut down when setup finishes. In https://ci.opencloud.rocks/repos/3/pipeline/5531/21 10_base.ldif failed with "Already exists" and 20_users.ldif was cut off by the slapd shutdown, so there was no admin user and the multiTenancy server never became ready. We now point LDAP_CUSTOM_LDIF_DIR at the LDIF files. The image imports them during setup, before slapd listens, and skips its default tree. The override only creates the TLS certificate. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Jörn Friedrich Dreyer --- .woodpecker.star | 1 + .../ldap/docker-entrypoint-override.sh | 39 ++----------------- 2 files changed, 5 insertions(+), 35 deletions(-) diff --git a/.woodpecker.star b/.woodpecker.star index 122dea3161..811972d218 100644 --- a/.woodpecker.star +++ b/.woodpecker.star @@ -3312,6 +3312,7 @@ def ldapService(): "LDAP_TLS_KEY_FILE": "/opt/bitnami/openldap/share/openldap.key", "LDAP_ROOT": "dc=opencloud,dc=eu", "LDAP_ADMIN_PASSWORD": "admin", + "LDAP_CUSTOM_LDIF_DIR": "/tmp/ldif-files", }, "commands": [ "mkdir -p /opt/bitnami/openldap/share", diff --git a/tests/config/woodpecker/ldap/docker-entrypoint-override.sh b/tests/config/woodpecker/ldap/docker-entrypoint-override.sh index 3a971c3e1f..2eb37b503e 100644 --- a/tests/config/woodpecker/ldap/docker-entrypoint-override.sh +++ b/tests/config/woodpecker/ldap/docker-entrypoint-override.sh @@ -2,41 +2,10 @@ printenv if [ ! -f /opt/bitnami/openldap/share/openldap.key ] -then +then openssl req -x509 -newkey rsa:4096 -keyout /opt/bitnami/openldap/share/openldap.key -out /opt/bitnami/openldap/share/openldap.crt -sha256 -days 365 -batch -nodes fi -mkdir -p /opt/bitnami/openldap/ldifs - -if [ -d "/tmp/ldif-files" ]; then - cp /tmp/ldif-files/*.ldif /opt/bitnami/openldap/ldifs/ -fi - -/opt/bitnami/scripts/openldap/entrypoint.sh "$@" & -ENTRYPOINT_PID=$! - -echo "Waiting for LDAP server to start..." -while ! ldapsearch -x -H ldap://localhost:1389 -D "cn=admin,dc=opencloud,dc=eu" -w admin -b "dc=opencloud,dc=eu" > /dev/null 2>&1; do - sleep 2 -done - -echo "LDAP server is running, importing LDIF files..." - -if [ -f "/opt/bitnami/openldap/ldifs/10_base.ldif" ]; then - echo "Importing 10_base.ldif..." - ldapadd -x -H ldap://localhost:1389 -D "cn=admin,dc=opencloud,dc=eu" -w admin -f /opt/bitnami/openldap/ldifs/10_base.ldif -fi - -if [ -f "/opt/bitnami/openldap/ldifs/20_users.ldif" ]; then - echo "Importing 20_users.ldif..." - ldapadd -x -H ldap://localhost:1389 -D "cn=admin,dc=opencloud,dc=eu" -w admin -f /opt/bitnami/openldap/ldifs/20_users.ldif -fi - -if [ -f "/opt/bitnami/openldap/ldifs/30_groups.ldif" ]; then - echo "Importing 30_groups.ldif..." - ldapadd -x -H ldap://localhost:1389 -D "cn=admin,dc=opencloud,dc=eu" -w admin -f /opt/bitnami/openldap/ldifs/30_groups.ldif -fi - -echo "LDIF import completed!" - -wait $ENTRYPOINT_PID +# the LDIF files in LDAP_CUSTOM_LDIF_DIR are imported by the bitnami setup +# before slapd starts listening, so clients never see a partially seeded tree +exec /opt/bitnami/scripts/openldap/entrypoint.sh "$@"