Typescript rewrite #34
Loading…
Reference in a new issue
No description provided.
Delete branch "hoverbear/ds-893-make-installer-action-use-typescript"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
Port the action to typescript!
This will let us avoid having bash in this part of the codebase. It also gives us the space to add some more intelligence to the action eg richer logging: https://www.npmjs.com/package/@actions/core
This is a fairly basic and direct port, more a starting point than any added features.
Checklist
(while we're here)
or
(I invited some testers via social media, not going to merge this for a day at least)
@ -0,0 +16,4 @@
extra_args: string | null;
extra_conf: string[] | null;
github_token: string | null;
// TODO: linux_init
Do we want to do this now or later?
@ -0,0 +136,4 @@
this.diagnostic_endpoint;
}
// TODO: Error if the user uses these on not-MacOS
Same here, should we do this now or later?
@ -0,0 +177,4 @@
execution_env.NIX_INSTALLER_LOG_DIRECTIVES = this.log_directives;
}
// TODO: Error if the user uses these on MacOS
I think you probably meant "on not-MacOS", since launchd is their only choice. (Also, same as above -- now or later?)
Improve what part? The necessity of trusted-users, or the
$USER
detection?@ -0,0 +211,4 @@
execution_env.NIX_INSTALLER_EXTRA_CONF = extra_conf;
if (process.env.ACT && !process.env.NOT_ACT) {
actions_core.info(
It doesn't look like we actually change anything in extra-conf at this point, so I think that point can be removed (unless it was just an accidental omission of the extra-conf modification).
@ -0,0 +238,4 @@
args.concat(extra_args);
}
const merged_env = {
I wonder how this behaves in the case where a user specifies
env: NIX_INSTALLER_EXTRA_CONF: "asdf"
andwith: extra-conf: "foo"
... Will it choose the input over the env, or error because there are two envs with the same name but conflicting values?@ -0,0 +238,4 @@
args.concat(extra_args);
}
const merged_env = {
In theory a user could not modify the env provided to the javascript!
Looks to me like the first part of this was done (I see a
this.set_github_path();
above :D)How so? I think the smartest it could be is "only check for the receipt when needed", but maybe I'm forgetting something.
I was kinda hoping there was some way to check the installed version is the desired version but at this time it seems overly complex. I'll remove the TODO
@ -0,0 +16,4 @@
extra_args: string | null;
extra_conf: string[] | null;
github_token: string | null;
// TODO: linux_init
Might as well
@ -0,0 +16,4 @@
extra_args: string | null;
extra_conf: string[] | null;
github_token: string | null;
// TODO: linux_init
Thinking on this more, I actually don't know if we should do this. While MacOS might not have an init setting (since we need the services for volume mounting), a future OS we add, such as FreeBSD, will likely have this option.
I think this is fine, actually!
Ya I need to make the other side of this, let me cook a PR.
https://github.com/DeterminateSystems/nix-installer/pull/568
@ -0,0 +471,4 @@
let resolved_nix_installer_url = null;
let num_set = 0;
if (nix_installer_branch !== null) {
Very minor nit: I wonder if it might be a little nicer to set the URL we'll be using in the checks above, and then
return that_url
after we've checked that only 1 of those options is set.Like,
let url = "default install url"; if branch != null, url = "branch install url";
or something.@ -0,0 +238,4 @@
args.concat(extra_args);
}
const merged_env = {
I meant providing both an
env:
and awith:
to the action that touch the same options. But I don't think it's worth being super defensive about until we see issues about it.@ -0,0 +238,4 @@
args.concat(extra_args);
}
const merged_env = {
Ahhh ya, fair.
Added some handling of if
$GITHUB_PATH
has already been written (by the installer running as root) so this won't need tight version cadence.There is a bit of a complication here:
GITHUB_PATH
updatenix-installer
in the future which does not do the updatenix-installer-action
have their CI break because their action isn't doing theGITHUB_PATH
update.We'll need a transitionary period where we have
GITHUB_PATH
being set in both places, and monitor for use of our old versions for a bit. After a few versions (and no public repos using the old action version) we can remove the oldGITHUB_PATH
code.I think in the meantime we should have the
nix-installer
output a warning to update thenix-installer-action
if it detects it's in CI.Looking good!
I think it should gracefully handle https://github.com/DeterminateSystems/nix-installer-action/pull/34#issuecomment-1636127448 now.