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

Generate package index.json #479

Merged
merged 7 commits into from
May 25, 2020
Merged

Conversation

mtojek
Copy link
Contributor

@mtojek mtojek commented May 25, 2020

Issue: #464

@jfsiii API hasn't changed in this PR, but I wish to get rid of index.json from inside of a bundle (.tar.gz).

@mtojek mtojek requested a review from ruflin May 25, 2020 12:20
@mtojek mtojek self-assigned this May 25, 2020
@mtojek mtojek marked this pull request as draft May 25, 2020 12:24
@elasticmachine
Copy link

elasticmachine commented May 25, 2020

💚 Build Succeeded

Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: [Pull request #479 updated]

  • Start Time: 2020-05-25T13:36:17.709+0000

  • Duration: 6 min 9 sec

@@ -34,82 +34,14 @@
"type": "image/png"
}
],
"assets": [
Copy link
Member

Choose a reason for hiding this comment

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

What about this missing content here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed. I didn't know I have to load assets additionally.

@@ -63,7 +63,6 @@ func TestEndpoints(t *testing.T) {
{"/search?internal=bar", "/search", "search-package-internal-error.json", searchHandler(packagesBasePath, testCacheTime)},
{"/search?experimental=true", "/search", "search-package-experimental.json", searchHandler(packagesBasePath, testCacheTime)},
{"/search?experimental=foo", "/search", "search-package-experimental-error.json", searchHandler(packagesBasePath, testCacheTime)},
{"/package/example/1.0.0", "", "package.json", catchAll(http.Dir(publicPath), testCacheTime)},
Copy link
Member

Choose a reason for hiding this comment

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

Could we still have a test for this? The API endpoint should still work.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This test is used in the TestPackageIndex method.

@mtojek mtojek marked this pull request as ready for review May 25, 2020 12:35
@mtojek mtojek requested review from ruflin and jfsiii May 25, 2020 12:41
{"/package/example/1.0.0/index.json", packageIndexRouterPath1, "package.json", packageIndexHandler},
{"/package/missing/1.0.0/index.json", packageIndexRouterPath1, "index-package-not-found.txt", packageIndexHandler},
{"/package/example/999.0.0/index.json", packageIndexRouterPath1, "index-package-revision-not-found.txt", packageIndexHandler},
{"/package/example/a.b.c/index.json", packageIndexRouterPath1, "index-package-invalid-version.txt", packageIndexHandler},
Copy link
Member

Choose a reason for hiding this comment

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

Could we add a test that doesn't have index.json inside, for example /package/example/1.0.0?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added

@@ -53,6 +55,11 @@ func ArchivePackage(w io.Writer, properties PackageProperties) (err error) {

rootDir := fmt.Sprintf("%s-%s", properties.Name, properties.Version)

err = writePackageIndexToArchive(properties.Path, rootDir, tarWriter)
Copy link
Member

Choose a reason for hiding this comment

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

Could you add a note here that we have this in because Kibana still relies on it but it should potentially be removed in the future?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I left a note

Copy link
Member

@ruflin ruflin left a comment

Choose a reason for hiding this comment

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

Tested locally and works as expected.

@mtojek mtojek merged commit c7a8967 into elastic:master May 25, 2020
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