-
Notifications
You must be signed in to change notification settings - Fork 129
Fix build updateReadme inside zip package
#3065
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
Fix build updateReadme inside zip package
#3065
Conversation
internal/builder/packages.go
Outdated
| return "", nil, fmt.Errorf("resolving transform manifests failed: %w", err) | ||
| } | ||
|
|
||
| updatedReadmesTargets, err := readmeUpdater(options.RepositoryRoot, options.PackageRootPath, options.BuildDir) |
There was a problem hiding this comment.
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.
| updatedReadmesTargets, err := readmeUpdater(options.RepositoryRoot, options.PackageRootPath, options.BuildDir) | |
| updatedReadmesTargets, err := docs.UpdateReadmes(options.RepositoryRoot, options.PackageRootPath, options.BuildDir) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
💛 Build succeeded, but was flaky
Failed CI StepsHistory
|
mrodm
left a comment
There was a problem hiding this 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).
jsoriano
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
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.