-
Notifications
You must be signed in to change notification settings - Fork 6
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 working directory to build plugin action, enable yarn 4 #28
Add working directory to build plugin action, enable yarn 4 #28
Conversation
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.
I have tested this PR and I can see it working in both the cases when a subdirectory is passed and when is not, so nothing is breaking.
But I am not confident this is the direction we should take to address mono repos with a plugin (or multiple plugins) inside. I understand in your case you have your whole plugin setup isolated in a subfolder but it is not really a "mono repo" setup with namespaces as normally a mono repo would be.
The current status of the PR will solve this very specific scenario but not the normal mono-repo case.
About adding corepack to the action. Corepack is still an experimental API and might be removed from nodejs in the future (even in a minor version release). We also don't have enough information how adding this will affect people using the action already. I prefer we keep this action as stable as possible without experimental apis.
Regarding your particular problem, perhaps you should consider setting working-directory
as a run default in your workflow where you call the build-action?
Because I did need this to run for me on a short timeline, I ended up copying the action code into my repo so that I can modify it. I am not especially worried about this PR in particular, especially the part around handling Yarn which is legitimately tricky and odd. Backing up, from a much higher-level view, I have consistently had basically these requirements:
What I'd want is a reusable action which can be upstreamed and maintained that supports
I don't see a path to upstreaming anything that accomplishes this. Things like setting the working directory in an action that was written for a plugin in root have not worked for me because usually at least one step of the action assumes in some way that the plugin is in root (e.g., the golang setup step will fail to cache dependencies and make builds very slow if your plugin is not in root). I have sort of a bad workflow that accomplishes this on one plugin. The plugin build I was looking at this for currently works but doesn't do 3), the building and signing platform-specific zip files, and I will probably try to reimplement that in a way that is less bad. However, once I have that it's not clear that it can be reusable even in principle because if it's the build for a specific plugin no other plugin would be able to reasonably expect that it would be maintained for other plugins. If there were a path to upstreaming an action that did meet team requirements for building plugins with backends, that would seem like it would reduce work much more in the long run. |
This does the following:
Adds a working directory option to the build plugin option, which allows building plugins not in the root. By default this is project root; any project currently using the action will not change.
Enables corepack, which lets projects using yarn 4 build. Core grafana is using yarn 4, and this seems to provide a better match for dependency resolution behavior.