Skip to content

fix(ci): let the openldap image import the test LDIF files - #4057

Merged
v-scharf merged 1 commit into
mainfrom
ci/ldap-ldif-import
Nov 18, 2026
Merged

v-scharf merged 1 commit into
mainfrom
ci/ldap-ldif-import

Conversation

@butonic

@butonic butonic commented Nov 18, 2026

Copy link
Copy Markdown
Member

The multiTenancy tests flake because the test LDAP server sometimes has no users. We now let the bitnami image import our LDIF files itself instead of racing it with ldapadd.

Our override copied the LDIF files to /opt/bitnami/openldap/ldifs, but the image only imports from LDAP_CUSTOM_LDIF_DIR (default /ldifs). So it created its default tree, and our script imported the files as soon as LDAP answered ... which can be the temporary slapd the image runs during setup. From https://ci.opencloud.rocks/repos/3/pipeline/5531/21:

ldap_add: Already exists (68)
adding new entry "dc=opencloud,dc=eu"
Importing 20_users.ldif...
6afd7f09.0f6e23f9 0x72c23a65f6c0 conn=1008 op=1 ADD dn="uid=alice,ou=users,dc=opencloud,dc=eu"
6afd7f09.0f7c5165 0x72c23b6616c0 daemon: shutdown requested and initiated.
ldap_result: Can't contact LDAP server (-1)

No admin user, so wait-for-opencloud-server timed out after 300s.

With LDAP_CUSTOM_LDIF_DIR set the image imports the files during setup, before slapd listens, and skips the default tree. Only the multiTenancy pipeline uses this LDAP server.

Tested locally: started the container with the step's commands three times, all 5 users with their tenant ids were there on the first LDAPS answer (~3s). Then ran apiTenancy against a server with the multiTenancy env: 2 scenarios passed.

AI assistance: Claude Code (claude-opus-5-5) analyzed the CI logs, wrote the fix, tested it locally and wrote this description.

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 <[email protected]>
@butonic butonic self-assigned this Nov 18, 2026
@codacy-production

codacy-production Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Up to standards βœ…

🟒 Issues 0 issues

Results:
0 new issues

View in Codacy

🟒 Coverage βˆ… diff coverage Β· -0.01% coverage variation

Metric Results
Coverage variation βœ… -0.01% coverage variation (-1.00%)
Diff coverage βœ… βˆ… diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (f8a8ecf) 94293 28310 30.02%
Head commit (d9d5e11) 94293 (+0) 28296 (-14) 30.01% (-0.01%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#4057) 0 0 βˆ… (not applicable)

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@v-scharf
v-scharf merged commit b9dc5cb into main Nov 18, 2026
61 of 62 checks passed
@v-scharf
v-scharf deleted the ci/ldap-ldif-import branch November 18, 2026 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants