@@ -51,6 +51,8 @@ def _get_scenarios_by_definition_file() -> dict[str, set[str]]:
5151# weblogs/scenarios when the library is activated.
5252GITLAB_PR_LIBRARIES : dict [str , dict [str , list [str ]] | None ] = {
5353 "c" : None ,
54+ # THREAD_CONTEXT_SHARING needs a dedicated runner pool: checks that this setup works. One weblog is enough.
55+ "php" : {"apache-mod-8.0" : ["THREAD_CONTEXT_SHARING" ]},
5456 # GitLab runs containers on the default bridge network: checks that the mocked backend network aliases work there
5557 "python" : {
5658 "flask-poc" : [
@@ -61,7 +63,11 @@ def _get_scenarios_by_definition_file() -> dict[str, set[str]]:
6163 ]
6264 },
6365}
64- GITLAB_MAIN = {"python" }
66+ # Libraries run by GitLab end-to-end on main pushes, same format as GITLAB_PR_LIBRARIES
67+ GITLAB_MAIN : dict [str , dict [str , list [str ]] | None ] = {
68+ "php" : GITLAB_PR_LIBRARIES ["php" ],
69+ "python" : None ,
70+ }
6571GITLAB_SSI_LIBRARIES = tuple (sorted (COMPONENT_GROUPS .ssi & COMPONENT_GROUPS .lib_injection ))
6672
6773
@@ -224,15 +230,15 @@ def is_gitlab_pr_pipeline(inputs: Inputs) -> bool:
224230 return inputs .ref != "refs/heads/main" and inputs .event_name in ("pull_request" , "push" )
225231
226232
227- def filter_gitlab_libraries (inputs : Inputs , libraries : set [str ]) -> set [str ]:
228- """Limit the GitLab end-to-end rollout by pipeline context. """
233+ def get_gitlab_libraries (inputs : Inputs ) -> dict [str , dict [ str , list [str ]] | None ]:
234+ """Libraries of the GitLab end-to-end rollout for the pipeline context (see GITLAB_PR_LIBRARIES for the format) """
229235 if inputs .ref == "refs/heads/main" and inputs .event_name != "schedule" :
230- return libraries & GITLAB_MAIN
236+ return GITLAB_MAIN
231237
232238 if is_gitlab_pr_pipeline (inputs ):
233- return libraries & set ( GITLAB_PR_LIBRARIES )
239+ return GITLAB_PR_LIBRARIES
234240
235- return set ()
241+ return {}
236242
237243
238244def _expand_scenario_entries (entries : Iterable [str ]) -> set [str ]:
@@ -247,18 +253,21 @@ def _expand_scenario_entries(entries: Iterable[str]) -> set[str]:
247253
248254
249255def get_gitlab_library_weblog_scenarios (
250- libraries : set [str ], scenario_names : set [str ], scenario_group_names : set [str ]
256+ gitlab_libraries : dict [str , dict [str , list [str ]] | None ],
257+ libraries : set [str ],
258+ scenario_names : set [str ],
259+ scenario_group_names : set [str ],
251260) -> dict [str , dict [str , list [str ]]]:
252- """Return the library_weblog_scenarios map of the GitLab PR pipeline, for the libraries with a weblog map.
261+ """Return the library_weblog_scenarios map of the GitLab pipeline, for the selected libraries with a weblog map.
253262
254- The weblog maps of GITLAB_PR_LIBRARIES are filtered by the scenarios selected from the diff : only selected
255- scenarios are kept, and weblogs (and libraries) with no scenario left are removed.
263+ The weblog maps of gitlab_libraries are filtered by the selected scenarios : only selected scenarios are kept,
264+ and weblogs (and libraries) with no scenario left are removed.
256265 """
257266 selected = _expand_scenario_entries (scenario_names | scenario_group_names )
258267
259268 result : dict [str , dict [str , list [str ]]] = {}
260- for library in sorted (libraries ):
261- weblog_map = GITLAB_PR_LIBRARIES [library ]
269+ for library in sorted (libraries & set ( gitlab_libraries ) ):
270+ weblog_map = gitlab_libraries [library ]
262271 if not weblog_map :
263272 continue
264273 filtered_map : dict [str , list [str ]] = {}
@@ -537,16 +546,19 @@ def process(inputs: Inputs) -> list[str]:
537546 ssi_libraries = get_gitlab_ssi_libraries (inputs .pr_title , library_processor .selected )
538547 outputs ["ssi_libraries" ] = " " .join (sorted (ssi_libraries ))
539548
540- gitlab_libraries = filter_gitlab_libraries (inputs , library_processor .selected )
541- if is_gitlab_pr_pipeline (inputs ):
542- library_weblog_scenarios = get_gitlab_library_weblog_scenarios (
543- gitlab_libraries , scenario_processor .scenarios , scenario_processor .scenario_groups
544- )
545- if library_weblog_scenarios :
546- # JSON in a JSON string, so the output can still be sourced by a shell
547- outputs ["library_weblog_scenarios" ] = json .dumps (library_weblog_scenarios )
548- # libraries with a weblog map are only run through library_weblog_scenarios
549- gitlab_libraries = {library for library in gitlab_libraries if not GITLAB_PR_LIBRARIES [library ]}
549+ rollout = get_gitlab_libraries (inputs )
550+ library_weblog_scenarios = get_gitlab_library_weblog_scenarios (
551+ rollout , library_processor .selected , scenario_processor .scenarios , scenario_processor .scenario_groups
552+ )
553+ if library_weblog_scenarios :
554+ # JSON in a JSON string, so the output can still be sourced by a shell
555+ outputs ["library_weblog_scenarios" ] = json .dumps (library_weblog_scenarios )
556+ # libraries with a weblog map are only run through library_weblog_scenarios
557+ gitlab_libraries = {
558+ library
559+ for library , weblog_map in rollout .items ()
560+ if library in library_processor .selected and not weblog_map
561+ }
550562 if gitlab_libraries :
551563 outputs ["libraries" ] = " " .join (sorted (gitlab_libraries ))
552564 # also used by the SSI pipeline (compute_pipeline job)
0 commit comments