[Fleet] Sync Remote integrations: Show warning when package is not found in remote (#223248)

Closes https://github.com/elastic/kibana/issues/220850

## Summary
Add logic that handles the case of custom integrations that cannot be
installed in the remote because of error
` PackageNotFoundError: [pkgName] package not found in registry`

Currently, when the installation is attempted, we just log the error and
exit. I added some logic that creates an "empty" installation SO in
`epm-packages` with status `install_failed` and populates
the`latest_install_failed_attempts` field so we know what happened.
**NOTE**: we could add this logic in the regular install process as
well, it would be useful for debugging purpose

- I also added some logic to `compareSyncIntegrations` to make this
error a warning and because I also made the logic for the warning more
generic

### Testing 
- Install a custom integration in the main cluster, let the
syncIntegrationsTask run and after a while check `GET
.kibana_ingest/_doc/epm-packages:PKGNAME`. You should see the error
saved under `latest_install_failed_attempts`:

<img width="1804" alt="Screenshot 2025-06-10 at 16 20 09"
src="https://github.com/user-attachments/assets/2cffbf01-15f2-4091-bcbd-660fbb390c56"
/>

- In the remote, query `GET
kbn:/api/fleet/remote_synced_integrations/status` and verify that it
returns a warning for the custom integration. Example:
```
 "integrations": [
    {
      "package_name": "agentless_package_links",
      "package_version": "0.0.2",
      "install_status": {
        "main": "installed",
        "remote": "not_installed"
      },
      "updated_at": "2025-05-21T08:55:47.981Z",
      "sync_status": "warning",
      "warning": {
        "title": "agentless_package_links can't be automatically synced",
        "message": "This integration must be manually installed on the remote cluster. Automatic updates and remote installs are not supported."
      }
    },
...
```

- Test the UI - go to Fleet settings and verify that the custom
integration shows a warning:

![Uploading Screenshot 2025-06-11 at 16.26.47.png…]()


### Checklist

- [ ] 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
- [ ] [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

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Cristina Amico 2025-06-12 11:53:57 +02:00 committed by GitHub
parent 1ae725ae01
commit 9cf2b7b799
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 757 additions and 170 deletions

View file

@ -45416,7 +45416,19 @@
"type": "string"
},
"warning": {
"type": "string"
"additionalProperties": false,
"properties": {
"message": {
"type": "string"
},
"title": {
"type": "string"
}
},
"required": [
"title"
],
"type": "object"
}
},
"required": [
@ -45428,7 +45440,19 @@
"type": "array"
},
"warning": {
"type": "string"
"additionalProperties": false,
"properties": {
"message": {
"type": "string"
},
"title": {
"type": "string"
}
},
"required": [
"title"
],
"type": "object"
}
},
"required": [
@ -45587,7 +45611,19 @@
"type": "string"
},
"warning": {
"type": "string"
"additionalProperties": false,
"properties": {
"message": {
"type": "string"
},
"title": {
"type": "string"
}
},
"required": [
"title"
],
"type": "object"
}
},
"required": [
@ -45599,7 +45635,19 @@
"type": "array"
},
"warning": {
"type": "string"
"additionalProperties": false,
"properties": {
"message": {
"type": "string"
},
"title": {
"type": "string"
}
},
"required": [
"title"
],
"type": "object"
}
},
"required": [

View file

@ -45416,7 +45416,19 @@
"type": "string"
},
"warning": {
"type": "string"
"additionalProperties": false,
"properties": {
"message": {
"type": "string"
},
"title": {
"type": "string"
}
},
"required": [
"title"
],
"type": "object"
}
},
"required": [
@ -45428,7 +45440,19 @@
"type": "array"
},
"warning": {
"type": "string"
"additionalProperties": false,
"properties": {
"message": {
"type": "string"
},
"title": {
"type": "string"
}
},
"required": [
"title"
],
"type": "object"
}
},
"required": [
@ -45587,7 +45611,19 @@
"type": "string"
},
"warning": {
"type": "string"
"additionalProperties": false,
"properties": {
"message": {
"type": "string"
},
"title": {
"type": "string"
}
},
"required": [
"title"
],
"type": "object"
}
},
"required": [
@ -45599,7 +45635,19 @@
"type": "array"
},
"warning": {
"type": "string"
"additionalProperties": false,
"properties": {
"message": {
"type": "string"
},
"title": {
"type": "string"
}
},
"required": [
"title"
],
"type": "object"
}
},
"required": [

View file

@ -39855,13 +39855,29 @@ paths:
updated_at:
type: string
warning:
type: string
additionalProperties: false
type: object
properties:
message:
type: string
title:
type: string
required:
- title
required:
- sync_status
- install_status
type: array
warning:
type: string
additionalProperties: false
type: object
properties:
message:
type: string
title:
type: string
required:
- title
required:
- integrations
'400':
@ -39966,13 +39982,29 @@ paths:
updated_at:
type: string
warning:
type: string
additionalProperties: false
type: object
properties:
message:
type: string
title:
type: string
required:
- title
required:
- sync_status
- install_status
type: array
warning:
type: string
additionalProperties: false
type: object
properties:
message:
type: string
title:
type: string
required:
- title
required:
- integrations
'400':

View file

@ -42097,13 +42097,29 @@ paths:
updated_at:
type: string
warning:
type: string
additionalProperties: false
type: object
properties:
message:
type: string
title:
type: string
required:
- title
required:
- sync_status
- install_status
type: array
warning:
type: string
additionalProperties: false
type: object
properties:
message:
type: string
title:
type: string
required:
- title
required:
- integrations
'400':
@ -42208,13 +42224,29 @@ paths:
updated_at:
type: string
warning:
type: string
additionalProperties: false
type: object
properties:
message:
type: string
title:
type: string
required:
- title
required:
- sync_status
- install_status
type: array
warning:
type: string
additionalProperties: false
type: object
properties:
message:
type: string
title:
type: string
required:
- title
required:
- integrations
'400':