-
Notifications
You must be signed in to change notification settings - Fork 586
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
Use github access token when running docker locally #10056
Conversation
cli/buildengine.ts
Outdated
@@ -387,14 +387,29 @@ function runDockerAsync(args: string[]) { | |||
if (process.platform == "darwin") | |||
mountArg += ":delegated" | |||
|
|||
let fullArgs = ["--rm", "-v", mountArg, "-w", "/src"].concat(dargs).concat([cs.dockerImage]).concat(args); |
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.
All of these concat
s look a little funky to me. Can we use spread syntax here instead?
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.
sure
updateEngineAsync: () => runDockerAsync(["yotta", "update"]), | ||
buildAsync: () => runDockerAsync(["yotta", "build"]), | ||
updateEngineAsync: () => runDockerYottaAsync(["yotta", "update"]), | ||
buildAsync: () => runDockerYottaAsync(["yotta", "build"]), |
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.
If we are special casing Yotta, do we need to include "yotta" in the args?
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 think it's easier to understand with yotta there since that's the command you would be running if you were doing all this manually.
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.
Makes sense!
One annoying thing about using our CLI to build locally w/ docker images is that yotta is constantly getting throttled by GitHub. We even have a GITHUB_ACCESS_TOKEN environment variable that we advertise as something you can configure, but it only gets used by PXT and not yotta which is a bummer.
Well, not anymore! This PR passes that GITHUB_ACCESS_TOKEN variable to the docker container and runs a script to setup the local
~/.yotta/config.json
and~/.netrc
files to prevent throttling. This token doesn't actually need to have any permissions at all, GitHub just wants to use it for authentication.Also, this PR fixes the
--local
flag which I had accidentally disabled in my last pr.Completely unrelated to this, I also converted a function in
cli.ts
to use async await because it was bothering me.