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 parent fields for categories returned by the proxy mode #1004

Merged
merged 4 commits into from
May 4, 2023

Conversation

mrodm
Copy link
Contributor

@mrodm mrodm commented May 3, 2023

This PR adds the missing fields related to subcategories in the categories entrypoint with proxy mode.

Currently, the output was missing parentIdand parentTitle. Example:

  {
    "id": "productivity",
    "title": "Productivity",
    "count": 1
  },
  {
    "id": "productivity_security",
    "title": "Productivity",
    "count": 9
  },

Adding those fields to the struct, the same request:

  {
    "id": "productivity",
    "title": "Productivity",
    "count": 1
  },
  {
    "id": "productivity_security",
    "title": "Productivity",
    "count": 9,
    "parent_id": "security",
    "parent_title": "Security"
  },

How to test this change

Test with the current production version:

  • In one terminal run
    docker run --rm -it -p 8888:8080 -e EPR_FEATURE_PROXY_MODE=true -e EPR_PROXY_TO=https://epr.elastic.co  docker.elastic.co/package-registry/package-registry:v1.19.0
  • From another terminal, test categories entrypoint for that EPR container:
    curl -s http://localhost:8888/categories

Test with the changes proposed in this PR:

  • Build a new docker image:
    docker build --no-cache -t docker.elastic.co/package-registry/package-registry:v1.19.1 -f Dockerfile .
  • In one terminal run
    docker run --rm -it -p 8888:8080 -e EPR_FEATURE_PROXY_MODE=true -e EPR_PROXY_TO=https://epr.elastic.co  docker.elastic.co/package-registry/package-registry:v1.19.1
  • From another terminal, test categories entrypoint for that EPR container:
    curl -s http://localhost:8888/categories
    

@mrodm mrodm requested a review from a team May 3, 2023 12:18
@mrodm mrodm self-assigned this May 3, 2023
@elasticmachine
Copy link

elasticmachine commented May 3, 2023

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2023-05-03T16:36:26.089+0000

  • Duration: 12 min 48 sec

Test stats 🧪

Test Results
Failed 0
Passed 494
Skipped 0
Total 494

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

@mrodm mrodm changed the title Add parent fields for categoories returned by the proxy Add parent fields for categories returned by the proxy mode May 3, 2023
Copy link
Member

@jsoriano jsoriano 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

categories.go Show resolved Hide resolved
Copy link
Member

@kpollich kpollich left a comment

Choose a reason for hiding this comment

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

Thanks Mario - good catch.

@mrodm mrodm requested a review from jsoriano May 3, 2023 16:50
Copy link
Member

@jsoriano jsoriano left a comment

Choose a reason for hiding this comment

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

👍

@mrodm mrodm merged commit c54dfbf into elastic:main May 4, 2023
@mrodm mrodm deleted the add_missing_fields_categories_proxy branch May 4, 2023 14:35
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.

4 participants