[8.19] [Automatic Migration] Introduce Last execution info for a migration (#221635)#223379
Merged
kibanamachine merged 1 commit intoelastic:8.19from Jun 11, 2025
Merged
Conversation
…lastic#221635) ## Resolves - elastic/security-team#12681 - elastic/security-team#12682 ## Summary Please find the summary of all the changes below. ### Last Execution Info This Enhancement introduces `last_execution` object to the `migration` document. There is some information that we need to add for the last run migration ( eg. `error` occured or `connector_id` used ). This PR add that info. Below is how a sample `migration` document looks like with `last_execution` info and shape of `last_execution` object. ```ts export const RuleMigrationLastExecution = z.object({ /** * The moment the last execution started. */ started_at: z.string().optional(), /** * The moment the last execution ended. */ ended_at: z.string().optional(), /** * The connector ID used for the last execution, if applicable. */ connector_id: z.string().optional(), /** * The error message if the last execution failed. */ error: z.string().optional(), /** * Indicates if the last execution was aborted by the user. */ is_aborted: z.boolean().optional(), }); ``` ```json { "created_by": "u_v6jVi3qZ21kAEUwmbl-sfujRnwydrltycxyByl3jtIM_0", "created_at": "2025-05-28T06:10:37.638Z", "last_execution": { "connector_id": "azureOpenAiGPT4o", "started_at": "2025-05-28T06:10:48.030Z", "is_aborted": false, "error": "Failed to populate ELSER indices. Make sure the ELSER model is deployed and running at Machine Learning > Trained Models. Error: Exception when running inference id [.elser-2-elasticsearch] on field [elser_embedding]", "ended_at": "2025-05-28T06:11:31.464Z" } ``` ### Why `Last Execution` info was needed? - An automatic migration can run into an error and terminate. Today, we store that error in server state and do not persist. This can be a problem when server is restarted and user will not be able to see that error. - So, we need a way to persist the error for last execution. - Additionally, we do not have any details on when the last execution was started and finished. - We also need to store the connector_id so that we can re-use it when user is restarting a migration. In addition to resolving above issues, this Ticket makes some minor UI Changes to the Migration Ready Panel in different states of a Migration ### When Migration is Ready to be started. This remains exactly the same as before:  ### When Migration was Aborted |Before|After| |---|---| ||| ### When there was an error |Before|After| |---|---| ||| ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) (cherry picked from commit 6458650)
7 tasks
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport
This will backport the following commits from
mainto8.19:Questions ?
Please refer to the Backport tool documentation