Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move saml-provider-plugin to packages #198184

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

dmlemeshko
Copy link
Member

@dmlemeshko dmlemeshko commented Oct 29, 2024

Summary

This PR moves saml-provider plugin from x-pack/test into kbn package to simplify importing metadata and plugin root path into other packages, as we will keep using it in both FTR and new test framework.

Changes are scoped only to plugin + helpers saml tools migration and updating imports.

@dmlemeshko dmlemeshko requested a review from azasypkin October 29, 2024 19:00
@dmlemeshko dmlemeshko added v9.0.0 v8.17.0 release_note:skip Skip the PR/issue when compiling release notes backport:version Backport to applied version labels labels Oct 29, 2024
@dmlemeshko dmlemeshko self-assigned this Oct 29, 2024
@dmlemeshko dmlemeshko marked this pull request as ready for review October 30, 2024 10:33
@dmlemeshko dmlemeshko requested review from a team as code owners October 30, 2024 10:33
Copy link
Member

@wayneseymour wayneseymour 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 but I've questions


export const pluginPath = path.resolve(__dirname);

export * from './helpers/saml_tools';
Copy link
Member

Choose a reason for hiding this comment

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

Does this make it harder to use the IDE to see what * resolves to?
I know using the asterisk makes it easier at development time, but does it make it harder in maintenance?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't have strong opinion here. I would like to hear @azasypkin thoughts on it as code owner.

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, I don’t have a strong opinion either, and I’m not particularly concerned about the IDE itself. However, I’m slightly leaning towards explicit exports since it’s easier to see what we export and allows us to export only what we believe needs to be exported, making it easier to maintain.

Copy link
Member

Choose a reason for hiding this comment

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

yeah the maintenance bit is what worries me.

@@ -743,7 +743,7 @@ packages/kbn-rule-data-utils @elastic/security-detections-response @elastic/resp
x-pack/plugins/rule_registry @elastic/response-ops @elastic/obs-ux-management-team
x-pack/plugins/runtime_fields @elastic/kibana-management
packages/kbn-safer-lodash-set @elastic/kibana-security
x-pack/test/security_api_integration/plugins/saml_provider @elastic/kibana-security
packages/kbn-saml-provider-plugin @elastic/kibana-security
Copy link
Member

Choose a reason for hiding this comment

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

Why not leave this to the jsonc file instead? ..and let the owners file be generated from the jsonc file

Copy link
Member Author

Choose a reason for hiding this comment

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

good point, removing

Copy link
Member

Choose a reason for hiding this comment

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

I thought we were removing this line? No?

Copy link
Member Author

Choose a reason for hiding this comment

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

it is auto-added by kibanamachine :)

Copy link
Member

@azasypkin azasypkin 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 to me, thanks! Just left a few minor suggestions.

packages/kbn-saml-provider-plugin/kibana.jsonc Outdated Show resolved Hide resolved
@@ -0,0 +1,3 @@
# @kbn/saml-provider-plugin
Copy link
Member

Choose a reason for hiding this comment

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

question: is there any reason we put this plugin under packages/ and not under x-pack/packages/? Do we plan to use in any package or test outside of x-pack?

Copy link
Member Author

Choose a reason for hiding this comment

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

The new test framework will leave under packages/, it was the main reason to put this plugin in the same location. I also can't exclude feature rework in kbn-test / kbn-es in relation to this plugin test tools.

Copy link
Member

Choose a reason for hiding this comment

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

Got it, thanks for clarifying, makes sense to me 👍

Copy link
Member Author

Choose a reason for hiding this comment

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

updated in 804d7af

@@ -0,0 +1,3 @@
# @kbn/saml-provider-plugin

Saml provider plugin for testing purpose
Copy link
Member

Choose a reason for hiding this comment

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

Tip

Maybe we can name it slightly differently to be more consistent with the existing kbn-mock-idp-plugin: kbn-mock-test-idp-plugin or kbn-mock-idp-test-plugin or kbn-test-idp-plugin?

Feel free to ignore if it requires too much work to update all the affected files though.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm ok with changing it, better now than later 😄

Just to clarify: you think it is better to use idp in title over saml?

kbn-test-idp-plugin sounds good.

Copy link
Member

Choose a reason for hiding this comment

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

Just to clarify: you think it is better to use idp in title over saml?

Yeah, we have two packages that start with kbn-mock-idp-{plugin|test} and don't mention SAML, so I think it's fine to omit SAML.

import path from 'path';

const resourcesPath = path.resolve(__dirname, 'resources');
export const saml1IdPMetadataPath = path.resolve(resourcesPath, 'idp_metadata.xml');
Copy link
Member

Choose a reason for hiding this comment

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

Tip

How about grouping this paths together?

export const IDP_METADATA_PATHS = {
    default: path.resolve(resourcesPath, 'metadata.xml'),
    saml1: path.resolve(resourcesPath, 'idp_metadata.xml'),
    saml2: path.resolve(resourcesPath, 'idp_metadata_2.xml'),
    neverLogin: path.resolve(resourcesPath, 'idp_metadata_never_login.xml'),
    mockIdpPlugin: ath.resolve(resourcesPath, 'idp_metadata_mock_idp.xml'),
};

Copy link
Member Author

Choose a reason for hiding this comment

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

Great suggestion, updated in 804d7af


export const pluginPath = path.resolve(__dirname);

export * from './helpers/saml_tools';
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, I don’t have a strong opinion either, and I’m not particularly concerned about the IDE itself. However, I’m slightly leaning towards explicit exports since it’s easier to see what we export and allows us to export only what we believe needs to be exported, making it easier to maintain.

@elasticmachine
Copy link
Contributor

elasticmachine commented Oct 30, 2024

💔 Build Failed

Failed CI Steps

History

cc @dmlemeshko

Copy link
Member

@wayneseymour wayneseymour left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:version Backport to applied version labels release_note:skip Skip the PR/issue when compiling release notes v8.17.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants