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

Add security-rule kibana assets to be checked by tests #1960

Merged
merged 4 commits into from
Jul 11, 2024

Conversation

mrodm
Copy link
Contributor

@mrodm mrodm commented Jul 9, 2024

Follows #1915

Include security-rule assets into the assets checked by elastic-package test asset.

Those kibana assets are reported by the fleet API:

GET kbn:/api/fleet/epm/packages/security_detection_engine

Example of response (truncated):

{
  "response": {
    ...
   "savedObject": {
      "id": "security_detection_engine",
      "type": "epm-packages",
      "namespaces": [],
      "updated_at": "2024-07-09T14:33:46.715Z",
      "created_at": "2024-07-09T14:33:45.355Z",
      "version": "WzcxMTEsMV0=",
      "attributes": {
        "installed_kibana": [
          {
            "id": "000047bb-b27a-47ec-8b62-ef1a5d2c9e19_106",
            "type": "security-rule"
          },
          ...
        ],
      },
    },
  },
}

@mrodm mrodm self-assigned this Jul 9, 2024
@@ -159,7 +162,7 @@ func loadElasticsearchAssets(pkgRootPath string) ([]Asset, error) {
}

func loadFileBasedAssets(kibanaAssetsFolderPath string, assetType AssetType) ([]Asset, error) {
assetsFolderPath := filepath.Join(kibanaAssetsFolderPath, string(assetType))
assetsFolderPath := filepath.Join(kibanaAssetsFolderPath, strings.ReplaceAll(string(assetType), "-", "_"))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Folder in packages is names security_rule, but the type name is security-rule.

Copy link
Member

Choose a reason for hiding this comment

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

Nit. Maybe add this as a comment to understand why we do the replace? Or maybe we could make AssetType more explicit, with a type that contains the asset type name and the folder name.

@mrodm
Copy link
Contributor Author

mrodm commented Jul 9, 2024

test integrations

@elasticmachine
Copy link
Collaborator

Created or updated PR in integrations repository to test this version. Check elastic/integrations#10435

@mrodm mrodm requested a review from jsoriano July 9, 2024 17:10
@mrodm mrodm marked this pull request as ready for review July 10, 2024 09:27
@@ -159,7 +162,7 @@ func loadElasticsearchAssets(pkgRootPath string) ([]Asset, error) {
}

func loadFileBasedAssets(kibanaAssetsFolderPath string, assetType AssetType) ([]Asset, error) {
assetsFolderPath := filepath.Join(kibanaAssetsFolderPath, string(assetType))
assetsFolderPath := filepath.Join(kibanaAssetsFolderPath, strings.ReplaceAll(string(assetType), "-", "_"))
Copy link
Member

Choose a reason for hiding this comment

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

Nit. Maybe add this as a comment to understand why we do the replace? Or maybe we could make AssetType more explicit, with a type that contains the asset type name and the folder name.

internal/packages/assets.go Outdated Show resolved Hide resolved
@mrodm
Copy link
Contributor Author

mrodm commented Jul 11, 2024

test integrations

@elasticmachine
Copy link
Collaborator

Created or updated PR in integrations repository to test this version. Check elastic/integrations#10435

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @mrodm

@mrodm mrodm merged commit ff95e6f into elastic:main Jul 11, 2024
3 checks passed
@mrodm mrodm deleted the support-security-rule-assets branch July 11, 2024 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants