Skip to content

[Fleet] Ensure install package during buildPackagePolicyFromPackage#190413

Closed
shahzad31 wants to merge 2 commits intoelastic:mainfrom
shahzad31:pkg-install
Closed

[Fleet] Ensure install package during buildPackagePolicyFromPackage#190413
shahzad31 wants to merge 2 commits intoelastic:mainfrom
shahzad31:pkg-install

Conversation

@shahzad31
Copy link
Copy Markdown
Contributor

Summary

Ensure install package during buildPackagePolicyFromPackage !!

@shahzad31 shahzad31 requested a review from a team as a code owner August 13, 2024 13:52
@botelastic botelastic bot added the Team:Fleet Team label for Observability Data Collection Fleet team label Aug 13, 2024
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/fleet (Team:Fleet)

@shahzad31 shahzad31 added release_note:skip Skip the PR/issue when compiling release notes and removed Team:Fleet Team label for Observability Data Collection Fleet team labels Aug 13, 2024
@obltmachine
Copy link
Copy Markdown

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

Copy link
Copy Markdown
Contributor

@juliaElastic juliaElastic left a comment

Choose a reason for hiding this comment

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

Looks good, it would be good to cover with tests.

@botelastic botelastic bot added the Team:Fleet Team label for Observability Data Collection Fleet team label Aug 13, 2024
Copy link
Copy Markdown
Member

@nchaulet nchaulet left a comment

Choose a reason for hiding this comment

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

Looks like it will break the current behavior that uninstall a package if the package was not installed before the package policy creation

https://github.com/elastic/kibana/blob/main/x-pack/plugins/fleet/server/routes/package_policy/handlers.ts#L287

@juliaElastic
Copy link
Copy Markdown
Contributor

juliaElastic commented Aug 14, 2024

Looks like it will break the current behavior that uninstall a package if the package was not installed before the package policy creation

https://github.com/elastic/kibana/blob/main/x-pack/plugins/fleet/server/routes/package_policy/handlers.ts#L287

@nchaulet The uninstall only happens if there was an error creating the package policy and the package was not installed before, why is that an issue?

} catch (error) {
appContextService
.getLogger()
.error(`Error while creating package policy due to error: ${error.message}`);
if (!wasPackageAlreadyInstalled) {
const installation = await getInstallation({
savedObjectsClient: soClient,
pkgName: pkg!.name,
});
if (installation) {
appContextService
.getLogger()
.info(`rollback ${pkg!.name}-${pkg!.version} package installation after error`);
await removeInstallation({
savedObjectsClient: soClient,
pkgName: pkg!.name,
pkgVersion: pkg!.version,
esClient,
});
}
}

@kibana-ci
Copy link
Copy Markdown

kibana-ci commented Aug 27, 2024

💔 Build Failed

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #71 / Agent policies fleet_agent_policies_with_agents_setup In default space POST /api/fleet/agent_policies should create an enrollment key for the policy
  • [job] [logs] FTR Configs #71 / Agent policies fleet_agent_policies_with_agents_setup In default space POST /api/fleet/agent_policies should create an enrollment key for the policy
  • [job] [logs] FTR Configs #14 / Agents fleet_upgrade_agent one agent should allow to upgrade a Fleet server agent to a version > fleet server version
  • [job] [logs] FTR Configs #14 / Agents fleet_upgrade_agent one agent should allow to upgrade a Fleet server agent to a version > fleet server version
  • [job] [logs] FTR Configs #93 / Cloud Security Posture Test adding Cloud Security Posture Integrations CSPM AWS CIS_AWS Organization Manual Direct Access CIS_AWS Organization Manual Direct Access Workflow

Metrics [docs]

✅ unchanged

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@shahzad31
Copy link
Copy Markdown
Contributor Author

closing in favour of #191486

@shahzad31 shahzad31 closed this Aug 27, 2024
@shahzad31 shahzad31 deleted the pkg-install branch August 27, 2024 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants