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

Switch to pure Javascript implementation (no dockerfile) #11

Closed
3 tasks
20k-ultra opened this issue Oct 25, 2021 · 3 comments
Closed
3 tasks

Switch to pure Javascript implementation (no dockerfile) #11

20k-ultra opened this issue Oct 25, 2021 · 3 comments

Comments

@20k-ultra
Copy link
Contributor

20k-ultra commented Oct 25, 2021

Actions which use a Dockerfile are built every time they are invoked and it doesn't use any caching so this adds considerable time for your action to finally deploy a release. We are using a Dockerfile because we had to install balena cli because the balena sdk does not do everything we want on its own.

@klutchell installed the balena-cli as a project dependency and symlinked the binary to /usr/bin here so anything can call it effectively achieving the same thing as us installing the cli on container build (this also reduced build time since Github doesn't have to compile balena cli).

With this technique and knowing that Github's checkout action uses a preinstalled git binary shown here we no longer need a Dockerfile to install the CLI or for git to checkout branches...we can use git exactly how the checkout action does.

This change will significantly reduce the time for this action to deploy releases. We can also improve action speed by implementing #27.

  • Modify git.ts to use the installed git binary like Checkout action
  • Modify balena-utils.ts to use the balena cli binary in the node_modules folder
  • Remove Dockerfile
@20k-ultra
Copy link
Contributor Author

20k-ultra commented Oct 25, 2021

One significant issue with actually doing this is actions don't install any dependencies. It is a JS runtime that calls a JS file and that's it. If we want a node_modules folder to exist at runtime then we have to actually commit it to this repository. Github recommends using ncc to compile your JS and its dependencies into a single js file to work around this: https://docs.github.com/en/actions/creating-actions/creating-a-javascript-action#commit-tag-and-push-your-action-to-github

The reduced time is really substantial so might be worth considering or trying to figure out another solution.

@20k-ultra
Copy link
Contributor Author

I think another limitation is the dependencies the CLI has on the host machine. If we do commit node_modules then the cli binary still depends on python3, curl, etc I believe.

@20k-ultra
Copy link
Contributor Author

I don't see how this issue could be solved other then via #27 so closing.

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

No branches or pull requests

1 participant