Skip to content

[kbn/scout] move samlAuth call to create ES security indexes after servers start#247630

Merged
dmlemeshko merged 5 commits intoelastic:mainfrom
dmlemeshko:scout/trigger-saml-auth-after-servers-start
Jan 5, 2026
Merged

[kbn/scout] move samlAuth call to create ES security indexes after servers start#247630
dmlemeshko merged 5 commits intoelastic:mainfrom
dmlemeshko:scout/trigger-saml-auth-after-servers-start

Conversation

@dmlemeshko
Copy link
Copy Markdown
Contributor

@dmlemeshko dmlemeshko commented Dec 30, 2025

Originally we added this code as part of preCreateSecurityIndexesFixture called in globalSetupHook.

It automatically enforces global.setup.ts creation even if the hook has no tests-specific logic: file existence triggers the hook call.

This PR moves the logic to server start assuming it is only needed for the local cluster and it should simplify Scout/Playwright hook logic and make hook optional as it was originally intended.

From CI logs we can see indexes were created before Playwright tests were started:


2025-12-30 15:41:35 UTC | info [o.e.x.s.s.SecurityIndexManager] [scout] security index does not exist, creating [.security-tokens-7] with alias [.security-tokens] in project [default]
2025-12-30 15:41:35 UTC | info [o.e.c.m.MetadataCreateIndexService] [scout] creating index [.security-tokens-7] in project [default], cause [api], templates [], shards [1]/[1]
2025-12-30 15:41:35 UTC | info [o.e.c.r.a.AllocationService] [scout] in project [default] updating number_of_replicas to [0] for indices [.security-tokens-7]
2025-12-30 15:41:35 UTC | info [o.e.c.r.a.AllocationService] [scout] current.health="GREEN" message="Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[.security-tokens-7][0]]])." previous.health="YELLOW" reason="shards started [[.security-tokens-7][0]]"
2025-12-30 15:41:35 UTC | info [o.e.x.s.s.SecurityIndexManager] [scout] security index does not exist, creating [.security-profile-8] with alias [.security-profile] in project [default]
2025-12-30 15:41:35 UTC | info [o.e.c.m.MetadataCreateIndexService] [scout] creating index [.security-profile-8] in project [default], cause [api], templates [], shards [1]/[1]
2025-12-30 15:41:35 UTC | info [o.e.c.r.a.AllocationService] [scout] in project [default] updating number_of_replicas to [0] for indices [.security-profile-8]
2025-12-30 15:41:36 UTC | info [o.e.c.r.a.AllocationService] [scout] current.health="GREEN" message="Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[.security-profile-8][0]]])." previous.health="YELLOW" reason="shards started [[.security-profile-8][0]]"
2025-12-30 15:41:37 UTC | proc [kibana] [2025-12-30T15:41:37.010+00:00][INFO ][plugins.security.authentication] Login attempt with "saml" provider succeeded (requires redirect: true). {"service":{"node":{"roles":["background_tasks","ui"]}}}
2025-12-30 15:41:37 UTC | info starting [playwright] > /<redacted>kibana/node_modules/.bin/playwright test --config=x-pack/platform/plugins/private/discover_enhanced/test/scout/ui/parallel.playwright.config.ts --grep=@ess --project=local

Copy link
Copy Markdown
Member

@csr csr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code LGTM. We discussed separately that you'll be running the flaky test runner to ensure no issues.

@kibanamachine
Copy link
Copy Markdown
Contributor

Flaky Test Runner Stats

🎉 All tests passed! - kibana-flaky-test-suite-runner#10281

[✅] x-pack/platform/plugins/private/discover_enhanced/test/scout/ui/parallel.playwright.config.ts: 20/20 tests passed.

see run history

@dmlemeshko dmlemeshko added backport:all-open Backport to all branches that could still receive a release test:scout labels Dec 30, 2025
@dmlemeshko dmlemeshko marked this pull request as ready for review December 30, 2025 15:51
@dmlemeshko dmlemeshko requested a review from a team as a code owner December 30, 2025 15:51
@dmlemeshko dmlemeshko added the release_note:skip Skip the PR/issue when compiling release notes label Dec 30, 2025
@kibanamachine
Copy link
Copy Markdown
Contributor

Flaky Test Runner Stats

🎉 All tests passed! - kibana-flaky-test-suite-runner#10283

[✅] x-pack/platform/plugins/private/discover_enhanced/test/scout/ui/parallel.playwright.config.ts: 20/20 tests passed.

see run history

@dmlemeshko dmlemeshko enabled auto-merge (squash) January 5, 2026 09:08
@dmlemeshko dmlemeshko merged commit f109902 into elastic:main Jan 5, 2026
14 checks passed
@kibanamachine
Copy link
Copy Markdown
Contributor

Starting backport for target branches: 8.19, 9.1, 9.2, 9.3

https://github.com/elastic/kibana/actions/runs/20712629597

@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jan 5, 2026
…rvers start (elastic#247630)

Originally we added this code as part of
`preCreateSecurityIndexesFixture` called in `globalSetupHook`.

It automatically enforces `global.setup.ts` creation even if the hook
has no tests-specific logic: file existence triggers the hook call.

This PR moves the logic to server start assuming it is only needed for
the local cluster and it should simplify Scout/Playwright hook logic and
make hook optional as it was originally intended.

From CI logs we can see indexes were created before Playwright tests
were started:
```

2025-12-30 15:41:35 UTC | info [o.e.x.s.s.SecurityIndexManager] [scout] security index does not exist, creating [.security-tokens-7] with alias [.security-tokens] in project [default]
2025-12-30 15:41:35 UTC | info [o.e.c.m.MetadataCreateIndexService] [scout] creating index [.security-tokens-7] in project [default], cause [api], templates [], shards [1]/[1]
2025-12-30 15:41:35 UTC | info [o.e.c.r.a.AllocationService] [scout] in project [default] updating number_of_replicas to [0] for indices [.security-tokens-7]
2025-12-30 15:41:35 UTC | info [o.e.c.r.a.AllocationService] [scout] current.health="GREEN" message="Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[.security-tokens-7][0]]])." previous.health="YELLOW" reason="shards started [[.security-tokens-7][0]]"
2025-12-30 15:41:35 UTC | info [o.e.x.s.s.SecurityIndexManager] [scout] security index does not exist, creating [.security-profile-8] with alias [.security-profile] in project [default]
2025-12-30 15:41:35 UTC | info [o.e.c.m.MetadataCreateIndexService] [scout] creating index [.security-profile-8] in project [default], cause [api], templates [], shards [1]/[1]
2025-12-30 15:41:35 UTC | info [o.e.c.r.a.AllocationService] [scout] in project [default] updating number_of_replicas to [0] for indices [.security-profile-8]
2025-12-30 15:41:36 UTC | info [o.e.c.r.a.AllocationService] [scout] current.health="GREEN" message="Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[.security-profile-8][0]]])." previous.health="YELLOW" reason="shards started [[.security-profile-8][0]]"
2025-12-30 15:41:37 UTC | proc [kibana] [2025-12-30T15:41:37.010+00:00][INFO ][plugins.security.authentication] Login attempt with "saml" provider succeeded (requires redirect: true). {"service":{"node":{"roles":["background_tasks","ui"]}}}
2025-12-30 15:41:37 UTC | info starting [playwright] > /<redacted>kibana/node_modules/.bin/playwright test --config=x-pack/platform/plugins/private/discover_enhanced/test/scout/ui/parallel.playwright.config.ts --grep=@ess --project=local
```

(cherry picked from commit f109902)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jan 5, 2026
…rvers start (elastic#247630)

Originally we added this code as part of
`preCreateSecurityIndexesFixture` called in `globalSetupHook`.

It automatically enforces `global.setup.ts` creation even if the hook
has no tests-specific logic: file existence triggers the hook call.

This PR moves the logic to server start assuming it is only needed for
the local cluster and it should simplify Scout/Playwright hook logic and
make hook optional as it was originally intended.

From CI logs we can see indexes were created before Playwright tests
were started:
```

2025-12-30 15:41:35 UTC | info [o.e.x.s.s.SecurityIndexManager] [scout] security index does not exist, creating [.security-tokens-7] with alias [.security-tokens] in project [default]
2025-12-30 15:41:35 UTC | info [o.e.c.m.MetadataCreateIndexService] [scout] creating index [.security-tokens-7] in project [default], cause [api], templates [], shards [1]/[1]
2025-12-30 15:41:35 UTC | info [o.e.c.r.a.AllocationService] [scout] in project [default] updating number_of_replicas to [0] for indices [.security-tokens-7]
2025-12-30 15:41:35 UTC | info [o.e.c.r.a.AllocationService] [scout] current.health="GREEN" message="Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[.security-tokens-7][0]]])." previous.health="YELLOW" reason="shards started [[.security-tokens-7][0]]"
2025-12-30 15:41:35 UTC | info [o.e.x.s.s.SecurityIndexManager] [scout] security index does not exist, creating [.security-profile-8] with alias [.security-profile] in project [default]
2025-12-30 15:41:35 UTC | info [o.e.c.m.MetadataCreateIndexService] [scout] creating index [.security-profile-8] in project [default], cause [api], templates [], shards [1]/[1]
2025-12-30 15:41:35 UTC | info [o.e.c.r.a.AllocationService] [scout] in project [default] updating number_of_replicas to [0] for indices [.security-profile-8]
2025-12-30 15:41:36 UTC | info [o.e.c.r.a.AllocationService] [scout] current.health="GREEN" message="Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[.security-profile-8][0]]])." previous.health="YELLOW" reason="shards started [[.security-profile-8][0]]"
2025-12-30 15:41:37 UTC | proc [kibana] [2025-12-30T15:41:37.010+00:00][INFO ][plugins.security.authentication] Login attempt with "saml" provider succeeded (requires redirect: true). {"service":{"node":{"roles":["background_tasks","ui"]}}}
2025-12-30 15:41:37 UTC | info starting [playwright] > /<redacted>kibana/node_modules/.bin/playwright test --config=x-pack/platform/plugins/private/discover_enhanced/test/scout/ui/parallel.playwright.config.ts --grep=@ess --project=local
```

(cherry picked from commit f109902)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jan 5, 2026
…rvers start (elastic#247630)

Originally we added this code as part of
`preCreateSecurityIndexesFixture` called in `globalSetupHook`.

It automatically enforces `global.setup.ts` creation even if the hook
has no tests-specific logic: file existence triggers the hook call.

This PR moves the logic to server start assuming it is only needed for
the local cluster and it should simplify Scout/Playwright hook logic and
make hook optional as it was originally intended.

From CI logs we can see indexes were created before Playwright tests
were started:
```

2025-12-30 15:41:35 UTC | info [o.e.x.s.s.SecurityIndexManager] [scout] security index does not exist, creating [.security-tokens-7] with alias [.security-tokens] in project [default]
2025-12-30 15:41:35 UTC | info [o.e.c.m.MetadataCreateIndexService] [scout] creating index [.security-tokens-7] in project [default], cause [api], templates [], shards [1]/[1]
2025-12-30 15:41:35 UTC | info [o.e.c.r.a.AllocationService] [scout] in project [default] updating number_of_replicas to [0] for indices [.security-tokens-7]
2025-12-30 15:41:35 UTC | info [o.e.c.r.a.AllocationService] [scout] current.health="GREEN" message="Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[.security-tokens-7][0]]])." previous.health="YELLOW" reason="shards started [[.security-tokens-7][0]]"
2025-12-30 15:41:35 UTC | info [o.e.x.s.s.SecurityIndexManager] [scout] security index does not exist, creating [.security-profile-8] with alias [.security-profile] in project [default]
2025-12-30 15:41:35 UTC | info [o.e.c.m.MetadataCreateIndexService] [scout] creating index [.security-profile-8] in project [default], cause [api], templates [], shards [1]/[1]
2025-12-30 15:41:35 UTC | info [o.e.c.r.a.AllocationService] [scout] in project [default] updating number_of_replicas to [0] for indices [.security-profile-8]
2025-12-30 15:41:36 UTC | info [o.e.c.r.a.AllocationService] [scout] current.health="GREEN" message="Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[.security-profile-8][0]]])." previous.health="YELLOW" reason="shards started [[.security-profile-8][0]]"
2025-12-30 15:41:37 UTC | proc [kibana] [2025-12-30T15:41:37.010+00:00][INFO ][plugins.security.authentication] Login attempt with "saml" provider succeeded (requires redirect: true). {"service":{"node":{"roles":["background_tasks","ui"]}}}
2025-12-30 15:41:37 UTC | info starting [playwright] > /<redacted>kibana/node_modules/.bin/playwright test --config=x-pack/platform/plugins/private/discover_enhanced/test/scout/ui/parallel.playwright.config.ts --grep=@ess --project=local
```

(cherry picked from commit f109902)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jan 5, 2026
…rvers start (elastic#247630)

Originally we added this code as part of
`preCreateSecurityIndexesFixture` called in `globalSetupHook`.

It automatically enforces `global.setup.ts` creation even if the hook
has no tests-specific logic: file existence triggers the hook call.

This PR moves the logic to server start assuming it is only needed for
the local cluster and it should simplify Scout/Playwright hook logic and
make hook optional as it was originally intended.

From CI logs we can see indexes were created before Playwright tests
were started:
```

2025-12-30 15:41:35 UTC | info [o.e.x.s.s.SecurityIndexManager] [scout] security index does not exist, creating [.security-tokens-7] with alias [.security-tokens] in project [default]
2025-12-30 15:41:35 UTC | info [o.e.c.m.MetadataCreateIndexService] [scout] creating index [.security-tokens-7] in project [default], cause [api], templates [], shards [1]/[1]
2025-12-30 15:41:35 UTC | info [o.e.c.r.a.AllocationService] [scout] in project [default] updating number_of_replicas to [0] for indices [.security-tokens-7]
2025-12-30 15:41:35 UTC | info [o.e.c.r.a.AllocationService] [scout] current.health="GREEN" message="Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[.security-tokens-7][0]]])." previous.health="YELLOW" reason="shards started [[.security-tokens-7][0]]"
2025-12-30 15:41:35 UTC | info [o.e.x.s.s.SecurityIndexManager] [scout] security index does not exist, creating [.security-profile-8] with alias [.security-profile] in project [default]
2025-12-30 15:41:35 UTC | info [o.e.c.m.MetadataCreateIndexService] [scout] creating index [.security-profile-8] in project [default], cause [api], templates [], shards [1]/[1]
2025-12-30 15:41:35 UTC | info [o.e.c.r.a.AllocationService] [scout] in project [default] updating number_of_replicas to [0] for indices [.security-profile-8]
2025-12-30 15:41:36 UTC | info [o.e.c.r.a.AllocationService] [scout] current.health="GREEN" message="Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[.security-profile-8][0]]])." previous.health="YELLOW" reason="shards started [[.security-profile-8][0]]"
2025-12-30 15:41:37 UTC | proc [kibana] [2025-12-30T15:41:37.010+00:00][INFO ][plugins.security.authentication] Login attempt with "saml" provider succeeded (requires redirect: true). {"service":{"node":{"roles":["background_tasks","ui"]}}}
2025-12-30 15:41:37 UTC | info starting [playwright] > /<redacted>kibana/node_modules/.bin/playwright test --config=x-pack/platform/plugins/private/discover_enhanced/test/scout/ui/parallel.playwright.config.ts --grep=@ess --project=local
```

(cherry picked from commit f109902)
@kibanamachine
Copy link
Copy Markdown
Contributor

💚 All backports created successfully

Status Branch Result
8.19
9.1
9.2
9.3

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Jan 5, 2026
…ter servers start (#247630) (#247796)

# Backport

This will backport the following commits from `main` to `9.2`:
- [[kbn/scout] move samlAuth call to create ES security indexes after
servers start (#247630)](#247630)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Dzmitry
Lemechko","email":"dzmitry.lemechko@elastic.co"},"sourceCommit":{"committedDate":"2026-01-05T10:33:17Z","message":"[kbn/scout]
move samlAuth call to create ES security indexes after servers start
(#247630)\n\nOriginally we added this code as part
of\n`preCreateSecurityIndexesFixture` called in `globalSetupHook`.\n\nIt
automatically enforces `global.setup.ts` creation even if the hook\nhas
no tests-specific logic: file existence triggers the hook call.\n\nThis
PR moves the logic to server start assuming it is only needed for\nthe
local cluster and it should simplify Scout/Playwright hook logic
and\nmake hook optional as it was originally intended.\n\nFrom CI logs
we can see indexes were created before Playwright tests\nwere
started:\n```\n\n2025-12-30 15:41:35 UTC | info
[o.e.x.s.s.SecurityIndexManager] [scout] security index does not exist,
creating [.security-tokens-7] with alias [.security-tokens] in project
[default]\n2025-12-30 15:41:35 UTC | info
[o.e.c.m.MetadataCreateIndexService] [scout] creating index
[.security-tokens-7] in project [default], cause [api], templates [],
shards [1]/[1]\n2025-12-30 15:41:35 UTC | info
[o.e.c.r.a.AllocationService] [scout] in project [default] updating
number_of_replicas to [0] for indices [.security-tokens-7]\n2025-12-30
15:41:35 UTC | info [o.e.c.r.a.AllocationService] [scout]
current.health=\"GREEN\" message=\"Cluster health status changed from
[YELLOW] to [GREEN] (reason: [shards started
[[.security-tokens-7][0]]]).\" previous.health=\"YELLOW\"
reason=\"shards started [[.security-tokens-7][0]]\"\n2025-12-30 15:41:35
UTC | info [o.e.x.s.s.SecurityIndexManager] [scout] security index does
not exist, creating [.security-profile-8] with alias [.security-profile]
in project [default]\n2025-12-30 15:41:35 UTC | info
[o.e.c.m.MetadataCreateIndexService] [scout] creating index
[.security-profile-8] in project [default], cause [api], templates [],
shards [1]/[1]\n2025-12-30 15:41:35 UTC | info
[o.e.c.r.a.AllocationService] [scout] in project [default] updating
number_of_replicas to [0] for indices [.security-profile-8]\n2025-12-30
15:41:36 UTC | info [o.e.c.r.a.AllocationService] [scout]
current.health=\"GREEN\" message=\"Cluster health status changed from
[YELLOW] to [GREEN] (reason: [shards started
[[.security-profile-8][0]]]).\" previous.health=\"YELLOW\"
reason=\"shards started [[.security-profile-8][0]]\"\n2025-12-30
15:41:37 UTC | proc [kibana] [2025-12-30T15:41:37.010+00:00][INFO
][plugins.security.authentication] Login attempt with \"saml\" provider
succeeded (requires redirect: true).
{\"service\":{\"node\":{\"roles\":[\"background_tasks\",\"ui\"]}}}\n2025-12-30
15:41:37 UTC | info starting [playwright] >
/<redacted>kibana/node_modules/.bin/playwright test
--config=x-pack/platform/plugins/private/discover_enhanced/test/scout/ui/parallel.playwright.config.ts
--grep=@ess
--project=local\n```","sha":"f1099028f7e4c613b792fdae881613a69711909f","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:all-open","test:scout","v9.4.0"],"title":"[kbn/scout]
move samlAuth call to create ES security indexes after servers
start","number":247630,"url":"https://github.com/elastic/kibana/pull/247630","mergeCommit":{"message":"[kbn/scout]
move samlAuth call to create ES security indexes after servers start
(#247630)\n\nOriginally we added this code as part
of\n`preCreateSecurityIndexesFixture` called in `globalSetupHook`.\n\nIt
automatically enforces `global.setup.ts` creation even if the hook\nhas
no tests-specific logic: file existence triggers the hook call.\n\nThis
PR moves the logic to server start assuming it is only needed for\nthe
local cluster and it should simplify Scout/Playwright hook logic
and\nmake hook optional as it was originally intended.\n\nFrom CI logs
we can see indexes were created before Playwright tests\nwere
started:\n```\n\n2025-12-30 15:41:35 UTC | info
[o.e.x.s.s.SecurityIndexManager] [scout] security index does not exist,
creating [.security-tokens-7] with alias [.security-tokens] in project
[default]\n2025-12-30 15:41:35 UTC | info
[o.e.c.m.MetadataCreateIndexService] [scout] creating index
[.security-tokens-7] in project [default], cause [api], templates [],
shards [1]/[1]\n2025-12-30 15:41:35 UTC | info
[o.e.c.r.a.AllocationService] [scout] in project [default] updating
number_of_replicas to [0] for indices [.security-tokens-7]\n2025-12-30
15:41:35 UTC | info [o.e.c.r.a.AllocationService] [scout]
current.health=\"GREEN\" message=\"Cluster health status changed from
[YELLOW] to [GREEN] (reason: [shards started
[[.security-tokens-7][0]]]).\" previous.health=\"YELLOW\"
reason=\"shards started [[.security-tokens-7][0]]\"\n2025-12-30 15:41:35
UTC | info [o.e.x.s.s.SecurityIndexManager] [scout] security index does
not exist, creating [.security-profile-8] with alias [.security-profile]
in project [default]\n2025-12-30 15:41:35 UTC | info
[o.e.c.m.MetadataCreateIndexService] [scout] creating index
[.security-profile-8] in project [default], cause [api], templates [],
shards [1]/[1]\n2025-12-30 15:41:35 UTC | info
[o.e.c.r.a.AllocationService] [scout] in project [default] updating
number_of_replicas to [0] for indices [.security-profile-8]\n2025-12-30
15:41:36 UTC | info [o.e.c.r.a.AllocationService] [scout]
current.health=\"GREEN\" message=\"Cluster health status changed from
[YELLOW] to [GREEN] (reason: [shards started
[[.security-profile-8][0]]]).\" previous.health=\"YELLOW\"
reason=\"shards started [[.security-profile-8][0]]\"\n2025-12-30
15:41:37 UTC | proc [kibana] [2025-12-30T15:41:37.010+00:00][INFO
][plugins.security.authentication] Login attempt with \"saml\" provider
succeeded (requires redirect: true).
{\"service\":{\"node\":{\"roles\":[\"background_tasks\",\"ui\"]}}}\n2025-12-30
15:41:37 UTC | info starting [playwright] >
/<redacted>kibana/node_modules/.bin/playwright test
--config=x-pack/platform/plugins/private/discover_enhanced/test/scout/ui/parallel.playwright.config.ts
--grep=@ess
--project=local\n```","sha":"f1099028f7e4c613b792fdae881613a69711909f"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/247630","number":247630,"mergeCommit":{"message":"[kbn/scout]
move samlAuth call to create ES security indexes after servers start
(#247630)\n\nOriginally we added this code as part
of\n`preCreateSecurityIndexesFixture` called in `globalSetupHook`.\n\nIt
automatically enforces `global.setup.ts` creation even if the hook\nhas
no tests-specific logic: file existence triggers the hook call.\n\nThis
PR moves the logic to server start assuming it is only needed for\nthe
local cluster and it should simplify Scout/Playwright hook logic
and\nmake hook optional as it was originally intended.\n\nFrom CI logs
we can see indexes were created before Playwright tests\nwere
started:\n```\n\n2025-12-30 15:41:35 UTC | info
[o.e.x.s.s.SecurityIndexManager] [scout] security index does not exist,
creating [.security-tokens-7] with alias [.security-tokens] in project
[default]\n2025-12-30 15:41:35 UTC | info
[o.e.c.m.MetadataCreateIndexService] [scout] creating index
[.security-tokens-7] in project [default], cause [api], templates [],
shards [1]/[1]\n2025-12-30 15:41:35 UTC | info
[o.e.c.r.a.AllocationService] [scout] in project [default] updating
number_of_replicas to [0] for indices [.security-tokens-7]\n2025-12-30
15:41:35 UTC | info [o.e.c.r.a.AllocationService] [scout]
current.health=\"GREEN\" message=\"Cluster health status changed from
[YELLOW] to [GREEN] (reason: [shards started
[[.security-tokens-7][0]]]).\" previous.health=\"YELLOW\"
reason=\"shards started [[.security-tokens-7][0]]\"\n2025-12-30 15:41:35
UTC | info [o.e.x.s.s.SecurityIndexManager] [scout] security index does
not exist, creating [.security-profile-8] with alias [.security-profile]
in project [default]\n2025-12-30 15:41:35 UTC | info
[o.e.c.m.MetadataCreateIndexService] [scout] creating index
[.security-profile-8] in project [default], cause [api], templates [],
shards [1]/[1]\n2025-12-30 15:41:35 UTC | info
[o.e.c.r.a.AllocationService] [scout] in project [default] updating
number_of_replicas to [0] for indices [.security-profile-8]\n2025-12-30
15:41:36 UTC | info [o.e.c.r.a.AllocationService] [scout]
current.health=\"GREEN\" message=\"Cluster health status changed from
[YELLOW] to [GREEN] (reason: [shards started
[[.security-profile-8][0]]]).\" previous.health=\"YELLOW\"
reason=\"shards started [[.security-profile-8][0]]\"\n2025-12-30
15:41:37 UTC | proc [kibana] [2025-12-30T15:41:37.010+00:00][INFO
][plugins.security.authentication] Login attempt with \"saml\" provider
succeeded (requires redirect: true).
{\"service\":{\"node\":{\"roles\":[\"background_tasks\",\"ui\"]}}}\n2025-12-30
15:41:37 UTC | info starting [playwright] >
/<redacted>kibana/node_modules/.bin/playwright test
--config=x-pack/platform/plugins/private/discover_enhanced/test/scout/ui/parallel.playwright.config.ts
--grep=@ess
--project=local\n```","sha":"f1099028f7e4c613b792fdae881613a69711909f"}}]}]
BACKPORT-->

Co-authored-by: Dzmitry Lemechko <dzmitry.lemechko@elastic.co>
kibanamachine added a commit that referenced this pull request Jan 5, 2026
…ter servers start (#247630) (#247797)

# Backport

This will backport the following commits from `main` to `9.3`:
- [[kbn/scout] move samlAuth call to create ES security indexes after
servers start (#247630)](#247630)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Dzmitry
Lemechko","email":"dzmitry.lemechko@elastic.co"},"sourceCommit":{"committedDate":"2026-01-05T10:33:17Z","message":"[kbn/scout]
move samlAuth call to create ES security indexes after servers start
(#247630)\n\nOriginally we added this code as part
of\n`preCreateSecurityIndexesFixture` called in `globalSetupHook`.\n\nIt
automatically enforces `global.setup.ts` creation even if the hook\nhas
no tests-specific logic: file existence triggers the hook call.\n\nThis
PR moves the logic to server start assuming it is only needed for\nthe
local cluster and it should simplify Scout/Playwright hook logic
and\nmake hook optional as it was originally intended.\n\nFrom CI logs
we can see indexes were created before Playwright tests\nwere
started:\n```\n\n2025-12-30 15:41:35 UTC | info
[o.e.x.s.s.SecurityIndexManager] [scout] security index does not exist,
creating [.security-tokens-7] with alias [.security-tokens] in project
[default]\n2025-12-30 15:41:35 UTC | info
[o.e.c.m.MetadataCreateIndexService] [scout] creating index
[.security-tokens-7] in project [default], cause [api], templates [],
shards [1]/[1]\n2025-12-30 15:41:35 UTC | info
[o.e.c.r.a.AllocationService] [scout] in project [default] updating
number_of_replicas to [0] for indices [.security-tokens-7]\n2025-12-30
15:41:35 UTC | info [o.e.c.r.a.AllocationService] [scout]
current.health=\"GREEN\" message=\"Cluster health status changed from
[YELLOW] to [GREEN] (reason: [shards started
[[.security-tokens-7][0]]]).\" previous.health=\"YELLOW\"
reason=\"shards started [[.security-tokens-7][0]]\"\n2025-12-30 15:41:35
UTC | info [o.e.x.s.s.SecurityIndexManager] [scout] security index does
not exist, creating [.security-profile-8] with alias [.security-profile]
in project [default]\n2025-12-30 15:41:35 UTC | info
[o.e.c.m.MetadataCreateIndexService] [scout] creating index
[.security-profile-8] in project [default], cause [api], templates [],
shards [1]/[1]\n2025-12-30 15:41:35 UTC | info
[o.e.c.r.a.AllocationService] [scout] in project [default] updating
number_of_replicas to [0] for indices [.security-profile-8]\n2025-12-30
15:41:36 UTC | info [o.e.c.r.a.AllocationService] [scout]
current.health=\"GREEN\" message=\"Cluster health status changed from
[YELLOW] to [GREEN] (reason: [shards started
[[.security-profile-8][0]]]).\" previous.health=\"YELLOW\"
reason=\"shards started [[.security-profile-8][0]]\"\n2025-12-30
15:41:37 UTC | proc [kibana] [2025-12-30T15:41:37.010+00:00][INFO
][plugins.security.authentication] Login attempt with \"saml\" provider
succeeded (requires redirect: true).
{\"service\":{\"node\":{\"roles\":[\"background_tasks\",\"ui\"]}}}\n2025-12-30
15:41:37 UTC | info starting [playwright] >
/<redacted>kibana/node_modules/.bin/playwright test
--config=x-pack/platform/plugins/private/discover_enhanced/test/scout/ui/parallel.playwright.config.ts
--grep=@ess
--project=local\n```","sha":"f1099028f7e4c613b792fdae881613a69711909f","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:all-open","test:scout","v9.4.0"],"title":"[kbn/scout]
move samlAuth call to create ES security indexes after servers
start","number":247630,"url":"https://github.com/elastic/kibana/pull/247630","mergeCommit":{"message":"[kbn/scout]
move samlAuth call to create ES security indexes after servers start
(#247630)\n\nOriginally we added this code as part
of\n`preCreateSecurityIndexesFixture` called in `globalSetupHook`.\n\nIt
automatically enforces `global.setup.ts` creation even if the hook\nhas
no tests-specific logic: file existence triggers the hook call.\n\nThis
PR moves the logic to server start assuming it is only needed for\nthe
local cluster and it should simplify Scout/Playwright hook logic
and\nmake hook optional as it was originally intended.\n\nFrom CI logs
we can see indexes were created before Playwright tests\nwere
started:\n```\n\n2025-12-30 15:41:35 UTC | info
[o.e.x.s.s.SecurityIndexManager] [scout] security index does not exist,
creating [.security-tokens-7] with alias [.security-tokens] in project
[default]\n2025-12-30 15:41:35 UTC | info
[o.e.c.m.MetadataCreateIndexService] [scout] creating index
[.security-tokens-7] in project [default], cause [api], templates [],
shards [1]/[1]\n2025-12-30 15:41:35 UTC | info
[o.e.c.r.a.AllocationService] [scout] in project [default] updating
number_of_replicas to [0] for indices [.security-tokens-7]\n2025-12-30
15:41:35 UTC | info [o.e.c.r.a.AllocationService] [scout]
current.health=\"GREEN\" message=\"Cluster health status changed from
[YELLOW] to [GREEN] (reason: [shards started
[[.security-tokens-7][0]]]).\" previous.health=\"YELLOW\"
reason=\"shards started [[.security-tokens-7][0]]\"\n2025-12-30 15:41:35
UTC | info [o.e.x.s.s.SecurityIndexManager] [scout] security index does
not exist, creating [.security-profile-8] with alias [.security-profile]
in project [default]\n2025-12-30 15:41:35 UTC | info
[o.e.c.m.MetadataCreateIndexService] [scout] creating index
[.security-profile-8] in project [default], cause [api], templates [],
shards [1]/[1]\n2025-12-30 15:41:35 UTC | info
[o.e.c.r.a.AllocationService] [scout] in project [default] updating
number_of_replicas to [0] for indices [.security-profile-8]\n2025-12-30
15:41:36 UTC | info [o.e.c.r.a.AllocationService] [scout]
current.health=\"GREEN\" message=\"Cluster health status changed from
[YELLOW] to [GREEN] (reason: [shards started
[[.security-profile-8][0]]]).\" previous.health=\"YELLOW\"
reason=\"shards started [[.security-profile-8][0]]\"\n2025-12-30
15:41:37 UTC | proc [kibana] [2025-12-30T15:41:37.010+00:00][INFO
][plugins.security.authentication] Login attempt with \"saml\" provider
succeeded (requires redirect: true).
{\"service\":{\"node\":{\"roles\":[\"background_tasks\",\"ui\"]}}}\n2025-12-30
15:41:37 UTC | info starting [playwright] >
/<redacted>kibana/node_modules/.bin/playwright test
--config=x-pack/platform/plugins/private/discover_enhanced/test/scout/ui/parallel.playwright.config.ts
--grep=@ess
--project=local\n```","sha":"f1099028f7e4c613b792fdae881613a69711909f"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/247630","number":247630,"mergeCommit":{"message":"[kbn/scout]
move samlAuth call to create ES security indexes after servers start
(#247630)\n\nOriginally we added this code as part
of\n`preCreateSecurityIndexesFixture` called in `globalSetupHook`.\n\nIt
automatically enforces `global.setup.ts` creation even if the hook\nhas
no tests-specific logic: file existence triggers the hook call.\n\nThis
PR moves the logic to server start assuming it is only needed for\nthe
local cluster and it should simplify Scout/Playwright hook logic
and\nmake hook optional as it was originally intended.\n\nFrom CI logs
we can see indexes were created before Playwright tests\nwere
started:\n```\n\n2025-12-30 15:41:35 UTC | info
[o.e.x.s.s.SecurityIndexManager] [scout] security index does not exist,
creating [.security-tokens-7] with alias [.security-tokens] in project
[default]\n2025-12-30 15:41:35 UTC | info
[o.e.c.m.MetadataCreateIndexService] [scout] creating index
[.security-tokens-7] in project [default], cause [api], templates [],
shards [1]/[1]\n2025-12-30 15:41:35 UTC | info
[o.e.c.r.a.AllocationService] [scout] in project [default] updating
number_of_replicas to [0] for indices [.security-tokens-7]\n2025-12-30
15:41:35 UTC | info [o.e.c.r.a.AllocationService] [scout]
current.health=\"GREEN\" message=\"Cluster health status changed from
[YELLOW] to [GREEN] (reason: [shards started
[[.security-tokens-7][0]]]).\" previous.health=\"YELLOW\"
reason=\"shards started [[.security-tokens-7][0]]\"\n2025-12-30 15:41:35
UTC | info [o.e.x.s.s.SecurityIndexManager] [scout] security index does
not exist, creating [.security-profile-8] with alias [.security-profile]
in project [default]\n2025-12-30 15:41:35 UTC | info
[o.e.c.m.MetadataCreateIndexService] [scout] creating index
[.security-profile-8] in project [default], cause [api], templates [],
shards [1]/[1]\n2025-12-30 15:41:35 UTC | info
[o.e.c.r.a.AllocationService] [scout] in project [default] updating
number_of_replicas to [0] for indices [.security-profile-8]\n2025-12-30
15:41:36 UTC | info [o.e.c.r.a.AllocationService] [scout]
current.health=\"GREEN\" message=\"Cluster health status changed from
[YELLOW] to [GREEN] (reason: [shards started
[[.security-profile-8][0]]]).\" previous.health=\"YELLOW\"
reason=\"shards started [[.security-profile-8][0]]\"\n2025-12-30
15:41:37 UTC | proc [kibana] [2025-12-30T15:41:37.010+00:00][INFO
][plugins.security.authentication] Login attempt with \"saml\" provider
succeeded (requires redirect: true).
{\"service\":{\"node\":{\"roles\":[\"background_tasks\",\"ui\"]}}}\n2025-12-30
15:41:37 UTC | info starting [playwright] >
/<redacted>kibana/node_modules/.bin/playwright test
--config=x-pack/platform/plugins/private/discover_enhanced/test/scout/ui/parallel.playwright.config.ts
--grep=@ess
--project=local\n```","sha":"f1099028f7e4c613b792fdae881613a69711909f"}}]}]
BACKPORT-->

Co-authored-by: Dzmitry Lemechko <dzmitry.lemechko@elastic.co>
kibanamachine added a commit that referenced this pull request Jan 5, 2026
…ter servers start (#247630) (#247795)

# Backport

This will backport the following commits from `main` to `9.1`:
- [[kbn/scout] move samlAuth call to create ES security indexes after
servers start (#247630)](#247630)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Dzmitry
Lemechko","email":"dzmitry.lemechko@elastic.co"},"sourceCommit":{"committedDate":"2026-01-05T10:33:17Z","message":"[kbn/scout]
move samlAuth call to create ES security indexes after servers start
(#247630)\n\nOriginally we added this code as part
of\n`preCreateSecurityIndexesFixture` called in `globalSetupHook`.\n\nIt
automatically enforces `global.setup.ts` creation even if the hook\nhas
no tests-specific logic: file existence triggers the hook call.\n\nThis
PR moves the logic to server start assuming it is only needed for\nthe
local cluster and it should simplify Scout/Playwright hook logic
and\nmake hook optional as it was originally intended.\n\nFrom CI logs
we can see indexes were created before Playwright tests\nwere
started:\n```\n\n2025-12-30 15:41:35 UTC | info
[o.e.x.s.s.SecurityIndexManager] [scout] security index does not exist,
creating [.security-tokens-7] with alias [.security-tokens] in project
[default]\n2025-12-30 15:41:35 UTC | info
[o.e.c.m.MetadataCreateIndexService] [scout] creating index
[.security-tokens-7] in project [default], cause [api], templates [],
shards [1]/[1]\n2025-12-30 15:41:35 UTC | info
[o.e.c.r.a.AllocationService] [scout] in project [default] updating
number_of_replicas to [0] for indices [.security-tokens-7]\n2025-12-30
15:41:35 UTC | info [o.e.c.r.a.AllocationService] [scout]
current.health=\"GREEN\" message=\"Cluster health status changed from
[YELLOW] to [GREEN] (reason: [shards started
[[.security-tokens-7][0]]]).\" previous.health=\"YELLOW\"
reason=\"shards started [[.security-tokens-7][0]]\"\n2025-12-30 15:41:35
UTC | info [o.e.x.s.s.SecurityIndexManager] [scout] security index does
not exist, creating [.security-profile-8] with alias [.security-profile]
in project [default]\n2025-12-30 15:41:35 UTC | info
[o.e.c.m.MetadataCreateIndexService] [scout] creating index
[.security-profile-8] in project [default], cause [api], templates [],
shards [1]/[1]\n2025-12-30 15:41:35 UTC | info
[o.e.c.r.a.AllocationService] [scout] in project [default] updating
number_of_replicas to [0] for indices [.security-profile-8]\n2025-12-30
15:41:36 UTC | info [o.e.c.r.a.AllocationService] [scout]
current.health=\"GREEN\" message=\"Cluster health status changed from
[YELLOW] to [GREEN] (reason: [shards started
[[.security-profile-8][0]]]).\" previous.health=\"YELLOW\"
reason=\"shards started [[.security-profile-8][0]]\"\n2025-12-30
15:41:37 UTC | proc [kibana] [2025-12-30T15:41:37.010+00:00][INFO
][plugins.security.authentication] Login attempt with \"saml\" provider
succeeded (requires redirect: true).
{\"service\":{\"node\":{\"roles\":[\"background_tasks\",\"ui\"]}}}\n2025-12-30
15:41:37 UTC | info starting [playwright] >
/<redacted>kibana/node_modules/.bin/playwright test
--config=x-pack/platform/plugins/private/discover_enhanced/test/scout/ui/parallel.playwright.config.ts
--grep=@ess
--project=local\n```","sha":"f1099028f7e4c613b792fdae881613a69711909f","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:all-open","test:scout","v9.4.0"],"title":"[kbn/scout]
move samlAuth call to create ES security indexes after servers
start","number":247630,"url":"https://github.com/elastic/kibana/pull/247630","mergeCommit":{"message":"[kbn/scout]
move samlAuth call to create ES security indexes after servers start
(#247630)\n\nOriginally we added this code as part
of\n`preCreateSecurityIndexesFixture` called in `globalSetupHook`.\n\nIt
automatically enforces `global.setup.ts` creation even if the hook\nhas
no tests-specific logic: file existence triggers the hook call.\n\nThis
PR moves the logic to server start assuming it is only needed for\nthe
local cluster and it should simplify Scout/Playwright hook logic
and\nmake hook optional as it was originally intended.\n\nFrom CI logs
we can see indexes were created before Playwright tests\nwere
started:\n```\n\n2025-12-30 15:41:35 UTC | info
[o.e.x.s.s.SecurityIndexManager] [scout] security index does not exist,
creating [.security-tokens-7] with alias [.security-tokens] in project
[default]\n2025-12-30 15:41:35 UTC | info
[o.e.c.m.MetadataCreateIndexService] [scout] creating index
[.security-tokens-7] in project [default], cause [api], templates [],
shards [1]/[1]\n2025-12-30 15:41:35 UTC | info
[o.e.c.r.a.AllocationService] [scout] in project [default] updating
number_of_replicas to [0] for indices [.security-tokens-7]\n2025-12-30
15:41:35 UTC | info [o.e.c.r.a.AllocationService] [scout]
current.health=\"GREEN\" message=\"Cluster health status changed from
[YELLOW] to [GREEN] (reason: [shards started
[[.security-tokens-7][0]]]).\" previous.health=\"YELLOW\"
reason=\"shards started [[.security-tokens-7][0]]\"\n2025-12-30 15:41:35
UTC | info [o.e.x.s.s.SecurityIndexManager] [scout] security index does
not exist, creating [.security-profile-8] with alias [.security-profile]
in project [default]\n2025-12-30 15:41:35 UTC | info
[o.e.c.m.MetadataCreateIndexService] [scout] creating index
[.security-profile-8] in project [default], cause [api], templates [],
shards [1]/[1]\n2025-12-30 15:41:35 UTC | info
[o.e.c.r.a.AllocationService] [scout] in project [default] updating
number_of_replicas to [0] for indices [.security-profile-8]\n2025-12-30
15:41:36 UTC | info [o.e.c.r.a.AllocationService] [scout]
current.health=\"GREEN\" message=\"Cluster health status changed from
[YELLOW] to [GREEN] (reason: [shards started
[[.security-profile-8][0]]]).\" previous.health=\"YELLOW\"
reason=\"shards started [[.security-profile-8][0]]\"\n2025-12-30
15:41:37 UTC | proc [kibana] [2025-12-30T15:41:37.010+00:00][INFO
][plugins.security.authentication] Login attempt with \"saml\" provider
succeeded (requires redirect: true).
{\"service\":{\"node\":{\"roles\":[\"background_tasks\",\"ui\"]}}}\n2025-12-30
15:41:37 UTC | info starting [playwright] >
/<redacted>kibana/node_modules/.bin/playwright test
--config=x-pack/platform/plugins/private/discover_enhanced/test/scout/ui/parallel.playwright.config.ts
--grep=@ess
--project=local\n```","sha":"f1099028f7e4c613b792fdae881613a69711909f"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/247630","number":247630,"mergeCommit":{"message":"[kbn/scout]
move samlAuth call to create ES security indexes after servers start
(#247630)\n\nOriginally we added this code as part
of\n`preCreateSecurityIndexesFixture` called in `globalSetupHook`.\n\nIt
automatically enforces `global.setup.ts` creation even if the hook\nhas
no tests-specific logic: file existence triggers the hook call.\n\nThis
PR moves the logic to server start assuming it is only needed for\nthe
local cluster and it should simplify Scout/Playwright hook logic
and\nmake hook optional as it was originally intended.\n\nFrom CI logs
we can see indexes were created before Playwright tests\nwere
started:\n```\n\n2025-12-30 15:41:35 UTC | info
[o.e.x.s.s.SecurityIndexManager] [scout] security index does not exist,
creating [.security-tokens-7] with alias [.security-tokens] in project
[default]\n2025-12-30 15:41:35 UTC | info
[o.e.c.m.MetadataCreateIndexService] [scout] creating index
[.security-tokens-7] in project [default], cause [api], templates [],
shards [1]/[1]\n2025-12-30 15:41:35 UTC | info
[o.e.c.r.a.AllocationService] [scout] in project [default] updating
number_of_replicas to [0] for indices [.security-tokens-7]\n2025-12-30
15:41:35 UTC | info [o.e.c.r.a.AllocationService] [scout]
current.health=\"GREEN\" message=\"Cluster health status changed from
[YELLOW] to [GREEN] (reason: [shards started
[[.security-tokens-7][0]]]).\" previous.health=\"YELLOW\"
reason=\"shards started [[.security-tokens-7][0]]\"\n2025-12-30 15:41:35
UTC | info [o.e.x.s.s.SecurityIndexManager] [scout] security index does
not exist, creating [.security-profile-8] with alias [.security-profile]
in project [default]\n2025-12-30 15:41:35 UTC | info
[o.e.c.m.MetadataCreateIndexService] [scout] creating index
[.security-profile-8] in project [default], cause [api], templates [],
shards [1]/[1]\n2025-12-30 15:41:35 UTC | info
[o.e.c.r.a.AllocationService] [scout] in project [default] updating
number_of_replicas to [0] for indices [.security-profile-8]\n2025-12-30
15:41:36 UTC | info [o.e.c.r.a.AllocationService] [scout]
current.health=\"GREEN\" message=\"Cluster health status changed from
[YELLOW] to [GREEN] (reason: [shards started
[[.security-profile-8][0]]]).\" previous.health=\"YELLOW\"
reason=\"shards started [[.security-profile-8][0]]\"\n2025-12-30
15:41:37 UTC | proc [kibana] [2025-12-30T15:41:37.010+00:00][INFO
][plugins.security.authentication] Login attempt with \"saml\" provider
succeeded (requires redirect: true).
{\"service\":{\"node\":{\"roles\":[\"background_tasks\",\"ui\"]}}}\n2025-12-30
15:41:37 UTC | info starting [playwright] >
/<redacted>kibana/node_modules/.bin/playwright test
--config=x-pack/platform/plugins/private/discover_enhanced/test/scout/ui/parallel.playwright.config.ts
--grep=@ess
--project=local\n```","sha":"f1099028f7e4c613b792fdae881613a69711909f"}}]}]
BACKPORT-->

Co-authored-by: Dzmitry Lemechko <dzmitry.lemechko@elastic.co>
kibanamachine added a commit that referenced this pull request Jan 5, 2026
…fter servers start (#247630) (#247794)

# Backport

This will backport the following commits from `main` to `8.19`:
- [[kbn/scout] move samlAuth call to create ES security indexes after
servers start (#247630)](#247630)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Dzmitry
Lemechko","email":"dzmitry.lemechko@elastic.co"},"sourceCommit":{"committedDate":"2026-01-05T10:33:17Z","message":"[kbn/scout]
move samlAuth call to create ES security indexes after servers start
(#247630)\n\nOriginally we added this code as part
of\n`preCreateSecurityIndexesFixture` called in `globalSetupHook`.\n\nIt
automatically enforces `global.setup.ts` creation even if the hook\nhas
no tests-specific logic: file existence triggers the hook call.\n\nThis
PR moves the logic to server start assuming it is only needed for\nthe
local cluster and it should simplify Scout/Playwright hook logic
and\nmake hook optional as it was originally intended.\n\nFrom CI logs
we can see indexes were created before Playwright tests\nwere
started:\n```\n\n2025-12-30 15:41:35 UTC | info
[o.e.x.s.s.SecurityIndexManager] [scout] security index does not exist,
creating [.security-tokens-7] with alias [.security-tokens] in project
[default]\n2025-12-30 15:41:35 UTC | info
[o.e.c.m.MetadataCreateIndexService] [scout] creating index
[.security-tokens-7] in project [default], cause [api], templates [],
shards [1]/[1]\n2025-12-30 15:41:35 UTC | info
[o.e.c.r.a.AllocationService] [scout] in project [default] updating
number_of_replicas to [0] for indices [.security-tokens-7]\n2025-12-30
15:41:35 UTC | info [o.e.c.r.a.AllocationService] [scout]
current.health=\"GREEN\" message=\"Cluster health status changed from
[YELLOW] to [GREEN] (reason: [shards started
[[.security-tokens-7][0]]]).\" previous.health=\"YELLOW\"
reason=\"shards started [[.security-tokens-7][0]]\"\n2025-12-30 15:41:35
UTC | info [o.e.x.s.s.SecurityIndexManager] [scout] security index does
not exist, creating [.security-profile-8] with alias [.security-profile]
in project [default]\n2025-12-30 15:41:35 UTC | info
[o.e.c.m.MetadataCreateIndexService] [scout] creating index
[.security-profile-8] in project [default], cause [api], templates [],
shards [1]/[1]\n2025-12-30 15:41:35 UTC | info
[o.e.c.r.a.AllocationService] [scout] in project [default] updating
number_of_replicas to [0] for indices [.security-profile-8]\n2025-12-30
15:41:36 UTC | info [o.e.c.r.a.AllocationService] [scout]
current.health=\"GREEN\" message=\"Cluster health status changed from
[YELLOW] to [GREEN] (reason: [shards started
[[.security-profile-8][0]]]).\" previous.health=\"YELLOW\"
reason=\"shards started [[.security-profile-8][0]]\"\n2025-12-30
15:41:37 UTC | proc [kibana] [2025-12-30T15:41:37.010+00:00][INFO
][plugins.security.authentication] Login attempt with \"saml\" provider
succeeded (requires redirect: true).
{\"service\":{\"node\":{\"roles\":[\"background_tasks\",\"ui\"]}}}\n2025-12-30
15:41:37 UTC | info starting [playwright] >
/<redacted>kibana/node_modules/.bin/playwright test
--config=x-pack/platform/plugins/private/discover_enhanced/test/scout/ui/parallel.playwright.config.ts
--grep=@ess
--project=local\n```","sha":"f1099028f7e4c613b792fdae881613a69711909f","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:all-open","test:scout","v9.4.0"],"title":"[kbn/scout]
move samlAuth call to create ES security indexes after servers
start","number":247630,"url":"https://github.com/elastic/kibana/pull/247630","mergeCommit":{"message":"[kbn/scout]
move samlAuth call to create ES security indexes after servers start
(#247630)\n\nOriginally we added this code as part
of\n`preCreateSecurityIndexesFixture` called in `globalSetupHook`.\n\nIt
automatically enforces `global.setup.ts` creation even if the hook\nhas
no tests-specific logic: file existence triggers the hook call.\n\nThis
PR moves the logic to server start assuming it is only needed for\nthe
local cluster and it should simplify Scout/Playwright hook logic
and\nmake hook optional as it was originally intended.\n\nFrom CI logs
we can see indexes were created before Playwright tests\nwere
started:\n```\n\n2025-12-30 15:41:35 UTC | info
[o.e.x.s.s.SecurityIndexManager] [scout] security index does not exist,
creating [.security-tokens-7] with alias [.security-tokens] in project
[default]\n2025-12-30 15:41:35 UTC | info
[o.e.c.m.MetadataCreateIndexService] [scout] creating index
[.security-tokens-7] in project [default], cause [api], templates [],
shards [1]/[1]\n2025-12-30 15:41:35 UTC | info
[o.e.c.r.a.AllocationService] [scout] in project [default] updating
number_of_replicas to [0] for indices [.security-tokens-7]\n2025-12-30
15:41:35 UTC | info [o.e.c.r.a.AllocationService] [scout]
current.health=\"GREEN\" message=\"Cluster health status changed from
[YELLOW] to [GREEN] (reason: [shards started
[[.security-tokens-7][0]]]).\" previous.health=\"YELLOW\"
reason=\"shards started [[.security-tokens-7][0]]\"\n2025-12-30 15:41:35
UTC | info [o.e.x.s.s.SecurityIndexManager] [scout] security index does
not exist, creating [.security-profile-8] with alias [.security-profile]
in project [default]\n2025-12-30 15:41:35 UTC | info
[o.e.c.m.MetadataCreateIndexService] [scout] creating index
[.security-profile-8] in project [default], cause [api], templates [],
shards [1]/[1]\n2025-12-30 15:41:35 UTC | info
[o.e.c.r.a.AllocationService] [scout] in project [default] updating
number_of_replicas to [0] for indices [.security-profile-8]\n2025-12-30
15:41:36 UTC | info [o.e.c.r.a.AllocationService] [scout]
current.health=\"GREEN\" message=\"Cluster health status changed from
[YELLOW] to [GREEN] (reason: [shards started
[[.security-profile-8][0]]]).\" previous.health=\"YELLOW\"
reason=\"shards started [[.security-profile-8][0]]\"\n2025-12-30
15:41:37 UTC | proc [kibana] [2025-12-30T15:41:37.010+00:00][INFO
][plugins.security.authentication] Login attempt with \"saml\" provider
succeeded (requires redirect: true).
{\"service\":{\"node\":{\"roles\":[\"background_tasks\",\"ui\"]}}}\n2025-12-30
15:41:37 UTC | info starting [playwright] >
/<redacted>kibana/node_modules/.bin/playwright test
--config=x-pack/platform/plugins/private/discover_enhanced/test/scout/ui/parallel.playwright.config.ts
--grep=@ess
--project=local\n```","sha":"f1099028f7e4c613b792fdae881613a69711909f"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/247630","number":247630,"mergeCommit":{"message":"[kbn/scout]
move samlAuth call to create ES security indexes after servers start
(#247630)\n\nOriginally we added this code as part
of\n`preCreateSecurityIndexesFixture` called in `globalSetupHook`.\n\nIt
automatically enforces `global.setup.ts` creation even if the hook\nhas
no tests-specific logic: file existence triggers the hook call.\n\nThis
PR moves the logic to server start assuming it is only needed for\nthe
local cluster and it should simplify Scout/Playwright hook logic
and\nmake hook optional as it was originally intended.\n\nFrom CI logs
we can see indexes were created before Playwright tests\nwere
started:\n```\n\n2025-12-30 15:41:35 UTC | info
[o.e.x.s.s.SecurityIndexManager] [scout] security index does not exist,
creating [.security-tokens-7] with alias [.security-tokens] in project
[default]\n2025-12-30 15:41:35 UTC | info
[o.e.c.m.MetadataCreateIndexService] [scout] creating index
[.security-tokens-7] in project [default], cause [api], templates [],
shards [1]/[1]\n2025-12-30 15:41:35 UTC | info
[o.e.c.r.a.AllocationService] [scout] in project [default] updating
number_of_replicas to [0] for indices [.security-tokens-7]\n2025-12-30
15:41:35 UTC | info [o.e.c.r.a.AllocationService] [scout]
current.health=\"GREEN\" message=\"Cluster health status changed from
[YELLOW] to [GREEN] (reason: [shards started
[[.security-tokens-7][0]]]).\" previous.health=\"YELLOW\"
reason=\"shards started [[.security-tokens-7][0]]\"\n2025-12-30 15:41:35
UTC | info [o.e.x.s.s.SecurityIndexManager] [scout] security index does
not exist, creating [.security-profile-8] with alias [.security-profile]
in project [default]\n2025-12-30 15:41:35 UTC | info
[o.e.c.m.MetadataCreateIndexService] [scout] creating index
[.security-profile-8] in project [default], cause [api], templates [],
shards [1]/[1]\n2025-12-30 15:41:35 UTC | info
[o.e.c.r.a.AllocationService] [scout] in project [default] updating
number_of_replicas to [0] for indices [.security-profile-8]\n2025-12-30
15:41:36 UTC | info [o.e.c.r.a.AllocationService] [scout]
current.health=\"GREEN\" message=\"Cluster health status changed from
[YELLOW] to [GREEN] (reason: [shards started
[[.security-profile-8][0]]]).\" previous.health=\"YELLOW\"
reason=\"shards started [[.security-profile-8][0]]\"\n2025-12-30
15:41:37 UTC | proc [kibana] [2025-12-30T15:41:37.010+00:00][INFO
][plugins.security.authentication] Login attempt with \"saml\" provider
succeeded (requires redirect: true).
{\"service\":{\"node\":{\"roles\":[\"background_tasks\",\"ui\"]}}}\n2025-12-30
15:41:37 UTC | info starting [playwright] >
/<redacted>kibana/node_modules/.bin/playwright test
--config=x-pack/platform/plugins/private/discover_enhanced/test/scout/ui/parallel.playwright.config.ts
--grep=@ess
--project=local\n```","sha":"f1099028f7e4c613b792fdae881613a69711909f"}}]}]
BACKPORT-->

---------

Co-authored-by: Dzmitry Lemechko <dzmitry.lemechko@elastic.co>
CAWilson94 pushed a commit to CAWilson94/kibana that referenced this pull request Jan 6, 2026
…rvers start (elastic#247630)

Originally we added this code as part of
`preCreateSecurityIndexesFixture` called in `globalSetupHook`.

It automatically enforces `global.setup.ts` creation even if the hook
has no tests-specific logic: file existence triggers the hook call.

This PR moves the logic to server start assuming it is only needed for
the local cluster and it should simplify Scout/Playwright hook logic and
make hook optional as it was originally intended.

From CI logs we can see indexes were created before Playwright tests
were started:
```

2025-12-30 15:41:35 UTC | info [o.e.x.s.s.SecurityIndexManager] [scout] security index does not exist, creating [.security-tokens-7] with alias [.security-tokens] in project [default]
2025-12-30 15:41:35 UTC | info [o.e.c.m.MetadataCreateIndexService] [scout] creating index [.security-tokens-7] in project [default], cause [api], templates [], shards [1]/[1]
2025-12-30 15:41:35 UTC | info [o.e.c.r.a.AllocationService] [scout] in project [default] updating number_of_replicas to [0] for indices [.security-tokens-7]
2025-12-30 15:41:35 UTC | info [o.e.c.r.a.AllocationService] [scout] current.health="GREEN" message="Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[.security-tokens-7][0]]])." previous.health="YELLOW" reason="shards started [[.security-tokens-7][0]]"
2025-12-30 15:41:35 UTC | info [o.e.x.s.s.SecurityIndexManager] [scout] security index does not exist, creating [.security-profile-8] with alias [.security-profile] in project [default]
2025-12-30 15:41:35 UTC | info [o.e.c.m.MetadataCreateIndexService] [scout] creating index [.security-profile-8] in project [default], cause [api], templates [], shards [1]/[1]
2025-12-30 15:41:35 UTC | info [o.e.c.r.a.AllocationService] [scout] in project [default] updating number_of_replicas to [0] for indices [.security-profile-8]
2025-12-30 15:41:36 UTC | info [o.e.c.r.a.AllocationService] [scout] current.health="GREEN" message="Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[.security-profile-8][0]]])." previous.health="YELLOW" reason="shards started [[.security-profile-8][0]]"
2025-12-30 15:41:37 UTC | proc [kibana] [2025-12-30T15:41:37.010+00:00][INFO ][plugins.security.authentication] Login attempt with "saml" provider succeeded (requires redirect: true). {"service":{"node":{"roles":["background_tasks","ui"]}}}
2025-12-30 15:41:37 UTC | info starting [playwright] > /<redacted>kibana/node_modules/.bin/playwright test --config=x-pack/platform/plugins/private/discover_enhanced/test/scout/ui/parallel.playwright.config.ts --grep=@ess --project=local
```
dej611 pushed a commit to dej611/kibana that referenced this pull request Jan 8, 2026
…rvers start (elastic#247630)

Originally we added this code as part of
`preCreateSecurityIndexesFixture` called in `globalSetupHook`.

It automatically enforces `global.setup.ts` creation even if the hook
has no tests-specific logic: file existence triggers the hook call.

This PR moves the logic to server start assuming it is only needed for
the local cluster and it should simplify Scout/Playwright hook logic and
make hook optional as it was originally intended.

From CI logs we can see indexes were created before Playwright tests
were started:
```

2025-12-30 15:41:35 UTC | info [o.e.x.s.s.SecurityIndexManager] [scout] security index does not exist, creating [.security-tokens-7] with alias [.security-tokens] in project [default]
2025-12-30 15:41:35 UTC | info [o.e.c.m.MetadataCreateIndexService] [scout] creating index [.security-tokens-7] in project [default], cause [api], templates [], shards [1]/[1]
2025-12-30 15:41:35 UTC | info [o.e.c.r.a.AllocationService] [scout] in project [default] updating number_of_replicas to [0] for indices [.security-tokens-7]
2025-12-30 15:41:35 UTC | info [o.e.c.r.a.AllocationService] [scout] current.health="GREEN" message="Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[.security-tokens-7][0]]])." previous.health="YELLOW" reason="shards started [[.security-tokens-7][0]]"
2025-12-30 15:41:35 UTC | info [o.e.x.s.s.SecurityIndexManager] [scout] security index does not exist, creating [.security-profile-8] with alias [.security-profile] in project [default]
2025-12-30 15:41:35 UTC | info [o.e.c.m.MetadataCreateIndexService] [scout] creating index [.security-profile-8] in project [default], cause [api], templates [], shards [1]/[1]
2025-12-30 15:41:35 UTC | info [o.e.c.r.a.AllocationService] [scout] in project [default] updating number_of_replicas to [0] for indices [.security-profile-8]
2025-12-30 15:41:36 UTC | info [o.e.c.r.a.AllocationService] [scout] current.health="GREEN" message="Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[.security-profile-8][0]]])." previous.health="YELLOW" reason="shards started [[.security-profile-8][0]]"
2025-12-30 15:41:37 UTC | proc [kibana] [2025-12-30T15:41:37.010+00:00][INFO ][plugins.security.authentication] Login attempt with "saml" provider succeeded (requires redirect: true). {"service":{"node":{"roles":["background_tasks","ui"]}}}
2025-12-30 15:41:37 UTC | info starting [playwright] > /<redacted>kibana/node_modules/.bin/playwright test --config=x-pack/platform/plugins/private/discover_enhanced/test/scout/ui/parallel.playwright.config.ts --grep=@ess --project=local
```
devamanv pushed a commit to devamanv/kibana that referenced this pull request Jan 12, 2026
…rvers start (elastic#247630)

Originally we added this code as part of
`preCreateSecurityIndexesFixture` called in `globalSetupHook`.

It automatically enforces `global.setup.ts` creation even if the hook
has no tests-specific logic: file existence triggers the hook call.

This PR moves the logic to server start assuming it is only needed for
the local cluster and it should simplify Scout/Playwright hook logic and
make hook optional as it was originally intended.

From CI logs we can see indexes were created before Playwright tests
were started:
```

2025-12-30 15:41:35 UTC | info [o.e.x.s.s.SecurityIndexManager] [scout] security index does not exist, creating [.security-tokens-7] with alias [.security-tokens] in project [default]
2025-12-30 15:41:35 UTC | info [o.e.c.m.MetadataCreateIndexService] [scout] creating index [.security-tokens-7] in project [default], cause [api], templates [], shards [1]/[1]
2025-12-30 15:41:35 UTC | info [o.e.c.r.a.AllocationService] [scout] in project [default] updating number_of_replicas to [0] for indices [.security-tokens-7]
2025-12-30 15:41:35 UTC | info [o.e.c.r.a.AllocationService] [scout] current.health="GREEN" message="Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[.security-tokens-7][0]]])." previous.health="YELLOW" reason="shards started [[.security-tokens-7][0]]"
2025-12-30 15:41:35 UTC | info [o.e.x.s.s.SecurityIndexManager] [scout] security index does not exist, creating [.security-profile-8] with alias [.security-profile] in project [default]
2025-12-30 15:41:35 UTC | info [o.e.c.m.MetadataCreateIndexService] [scout] creating index [.security-profile-8] in project [default], cause [api], templates [], shards [1]/[1]
2025-12-30 15:41:35 UTC | info [o.e.c.r.a.AllocationService] [scout] in project [default] updating number_of_replicas to [0] for indices [.security-profile-8]
2025-12-30 15:41:36 UTC | info [o.e.c.r.a.AllocationService] [scout] current.health="GREEN" message="Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[.security-profile-8][0]]])." previous.health="YELLOW" reason="shards started [[.security-profile-8][0]]"
2025-12-30 15:41:37 UTC | proc [kibana] [2025-12-30T15:41:37.010+00:00][INFO ][plugins.security.authentication] Login attempt with "saml" provider succeeded (requires redirect: true). {"service":{"node":{"roles":["background_tasks","ui"]}}}
2025-12-30 15:41:37 UTC | info starting [playwright] > /<redacted>kibana/node_modules/.bin/playwright test --config=x-pack/platform/plugins/private/discover_enhanced/test/scout/ui/parallel.playwright.config.ts --grep=@ess --project=local
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:all-open Backport to all branches that could still receive a release release_note:skip Skip the PR/issue when compiling release notes test:scout v8.19.10 v9.1.10 v9.2.4 v9.3.0 v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants