Skip to content

Conversation

@teresaromero
Copy link
Contributor

@teresaromero teresaromero commented Nov 11, 2025

Bug introduced at #2957

When a package is built, the readme is not being updated at the zip bundle. When working on the mentioned PR, the readme updater was moved after the built so the linked fields where already there when doing the update. The bundle zip is already created when this happens, so the readme inside the zip is the one at source before running the updater.

This changes propose to inject the updater function in order to run it after the linked files and the external fields are resolved. This way all the files in the bundle are the updated ones.

I've also explored the option of removing from the Builder function the link resolver, but still, the external fields have to be resolved inside the Builder, and if the readme updater runs before this, the readme wont have the external fields documented.

The PR adds a new option to update readmes inside the builder function.

@teresaromero teresaromero requested a review from a team November 11, 2025 15:47
return "", nil, fmt.Errorf("resolving transform manifests failed: %w", err)
}

updatedReadmesTargets, err := readmeUpdater(options.RepositoryRoot, options.PackageRootPath, options.BuildDir)
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 directly use docs.UpdateReadmes instead of having to pass this function? At the end it makes sense to make the update of readmes part of the build.

Suggested change
updatedReadmesTargets, err := readmeUpdater(options.RepositoryRoot, options.PackageRootPath, options.BuildDir)
updatedReadmesTargets, err := docs.UpdateReadmes(options.RepositoryRoot, options.PackageRootPath, options.BuildDir)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

at the installer this step is not done, that is why i passed the function, and at the installer its a noop one to not run the update readme.

we were discussing offline with @mrodm why the installer wasn't updating the readmes. some ideas where to decouple the build function and have one for installing a package and an other for building the package itself.

Copy link
Member

@jsoriano jsoriano Nov 12, 2025

Choose a reason for hiding this comment

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

at the installer this step is not done, that is why i passed the function, and at the installer its a noop one to not run the update readme.

Oh, I see. Could we make this then a boolean option in BuildOptions instead of having to pass a function?

we were discussing offline with @mrodm why the installer wasn't updating the readmes. some ideas where to decouple the build function and have one for installing a package and an other for building the package itself.

Interesting. Maybe it wouldn't make any harm to update the readmes also on the installer 🤔 I would say that the build process should be the same. But well, no need to change this behavior 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.

updated on the last commit to pass a bool option.

@elasticmachine
Copy link
Collaborator

elasticmachine commented Nov 12, 2025

💛 Build succeeded, but was flaky

Failed CI Steps

History

Copy link
Contributor

@mrodm mrodm left a comment

Choose a reason for hiding this comment

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

Thanks @teresaromero !

Just tested locally and checked that now the zip files contain the same files as in the source (with the updated markdown files if any).

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.

👍

@teresaromero teresaromero merged commit 3f00822 into elastic:main Nov 13, 2025
3 checks passed
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