Compare commits

..

2 Commits

Author SHA1 Message Date
Graham Christensen e50d5f73bf Log in to flakehub on existing installs (#129)
* Log in to flakehub if the machine is already installed

* Put the nix store paths first (in the PATH)

* set the path earlier

* Warn on login failures
2024-11-14 11:41:23 -05:00
detsys-pr-bot 25431d2798 Update detsys-ts for: Merge pull request #67 from DeterminateSystems/allow-obliterating-id-token-privs (4280bc94c9545f31ccf08001cc16f20ccb91b770) (#128)
Co-authored-by: grahamc <76716+grahamc@users.noreply.github.com>
2024-11-06 14:54:15 -05:00
3 changed files with 2169 additions and 144 deletions
Generated Vendored
+2095 -114
View File
File diff suppressed because it is too large Load Diff
+52 -20
View File
@@ -16,7 +16,7 @@ dependencies:
version: 5.1.1
detsys-ts:
specifier: github:DeterminateSystems/detsys-ts
version: github.com/DeterminateSystems/detsys-ts/65dd73c562ac60a068340f8e0c040bdcf2c59afe
version: github.com/DeterminateSystems/detsys-ts/4280bc94c9545f31ccf08001cc16f20ccb91b770
got:
specifier: ^14.3.0
version: 14.3.0
@@ -96,6 +96,16 @@ packages:
uuid: 8.3.2
dev: false
/@actions/core@1.11.1:
resolution:
{
integrity: sha512-hXJCSrkwfA46Vd9Z3q4cpEpHB1rL5NG04+/rbqW9d3+CSvtB1tYe8UTpAlixa1vj0m/ULglfEK2UKxMGxCxv5A==,
}
dependencies:
"@actions/exec": 1.1.1
"@actions/http-client": 2.2.3
dev: false
/@actions/exec@1.1.1:
resolution:
{
@@ -139,6 +149,16 @@ packages:
undici: 5.28.4
dev: false
/@actions/http-client@2.2.3:
resolution:
{
integrity: sha512-mx8hyJi/hjFvbPokCg4uRd4ZX78t+YyRPtnKWwIl+RzNaVuFpQHfmlGVfsKEJN8LwTCvL+DfVgAM04XaHkm6bA==,
}
dependencies:
tunnel: 0.0.6
undici: 5.28.4
dev: false
/@actions/io@1.1.3:
resolution:
{
@@ -1270,10 +1290,10 @@ packages:
engines: { node: ">=16" }
dev: false
/@sindresorhus/is@7.0.0:
/@sindresorhus/is@7.0.1:
resolution:
{
integrity: sha512-WDTlVTyvFivSOuyvMeedzg2hdoBLZ3f1uNVuEida2Rl9BrfjrIRjWA/VZIrMRLvSwJYCAlCRA3usDt1THytxWQ==,
integrity: sha512-QWLl2P+rsCJeofkDNIT3WFmb6NrRud1SUYW8dIhXK/46XFV8Q/g7Bsvib0Askb0reRLe+WYPeeE+l5cH7SlkuQ==,
}
engines: { node: ">=18" }
dev: false
@@ -1467,7 +1487,7 @@ packages:
"@typescript-eslint/types": 7.18.0
"@typescript-eslint/typescript-estree": 7.18.0(typescript@5.4.5)
"@typescript-eslint/visitor-keys": 7.18.0
debug: 4.3.6
debug: 4.3.7
eslint: 8.57.0
typescript: 5.4.5
transitivePeerDependencies:
@@ -1574,12 +1594,12 @@ packages:
dependencies:
"@typescript-eslint/types": 7.18.0
"@typescript-eslint/visitor-keys": 7.18.0
debug: 4.3.6
debug: 4.3.7
globby: 11.1.0
is-glob: 4.0.3
minimatch: 9.0.5
semver: 7.6.3
ts-api-utils: 1.3.0(typescript@5.4.5)
ts-api-utils: 1.4.0(typescript@5.4.5)
typescript: 5.4.5
transitivePeerDependencies:
- supports-color
@@ -2213,10 +2233,10 @@ packages:
ms: 2.1.2
dev: true
/debug@4.3.6:
/debug@4.3.7:
resolution:
{
integrity: sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg==,
integrity: sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==,
}
engines: { node: ">=6.0" }
peerDependencies:
@@ -2225,7 +2245,7 @@ packages:
supports-color:
optional: true
dependencies:
ms: 2.1.2
ms: 2.1.3
dev: true
/decompress-response@6.0.0:
@@ -3448,14 +3468,14 @@ packages:
responselike: 3.0.0
dev: false
/got@14.4.2:
/got@14.4.4:
resolution:
{
integrity: sha512-+Te/qEZ6hr7i+f0FNgXx/6WQteSM/QqueGvxeYQQFm0GDfoxLVJ/oiwUKYMTeioColWUTdewZ06hmrBjw6F7tw==,
integrity: sha512-tqiF7eSgTBwQkxb1LxsEpva8TaMYVisbhplrFVmw9GQE3855Z+MH/mnsXLLOkDxR6hZJRFMj5VTAZ8lmTF8ZOA==,
}
engines: { node: ">=20" }
dependencies:
"@sindresorhus/is": 7.0.0
"@sindresorhus/is": 7.0.1
"@szmarczak/http-timer": 5.0.1
cacheable-lookup: 7.0.0
cacheable-request: 12.0.1
@@ -3465,7 +3485,7 @@ packages:
lowercase-keys: 3.0.0
p-cancelable: 4.0.1
responselike: 3.0.0
type-fest: 4.23.0
type-fest: 4.26.1
dev: false
/graceful-fs@4.2.11:
@@ -5256,6 +5276,18 @@ packages:
typescript: 5.4.5
dev: true
/ts-api-utils@1.4.0(typescript@5.4.5):
resolution:
{
integrity: sha512-032cPxaEKwM+GT3vA5JXNzIaizx388rhsSW79vGRNGXfRRAdEAn2mvk36PvK5HnOchyWZ7afLEXqYCvPCrzuzQ==,
}
engines: { node: ">=16" }
peerDependencies:
typescript: ">=4.2.0"
dependencies:
typescript: 5.4.5
dev: true
/ts-interface-checker@0.1.13:
resolution:
{
@@ -5356,10 +5388,10 @@ packages:
engines: { node: ">=10" }
dev: true
/type-fest@4.23.0:
/type-fest@4.26.1:
resolution:
{
integrity: sha512-ZiBujro2ohr5+Z/hZWHESLz3g08BBdrdLMieYFULJO+tWc437sn8kQsWLJoZErY8alNhxre9K4p3GURAG11n+w==,
integrity: sha512-yOGpmOAL7CkKe/91I5O3gPICmJNLJ1G4zFYVAsRHg7M64biSnPtRj0WNQt++bRkjYOqjWXrhnUw1utzmVErAdg==,
}
engines: { node: ">=16" }
dev: false
@@ -5685,19 +5717,19 @@ packages:
engines: { node: ">=10" }
dev: true
github.com/DeterminateSystems/detsys-ts/65dd73c562ac60a068340f8e0c040bdcf2c59afe:
github.com/DeterminateSystems/detsys-ts/4280bc94c9545f31ccf08001cc16f20ccb91b770:
resolution:
{
tarball: https://codeload.github.com/DeterminateSystems/detsys-ts/tar.gz/65dd73c562ac60a068340f8e0c040bdcf2c59afe,
tarball: https://codeload.github.com/DeterminateSystems/detsys-ts/tar.gz/4280bc94c9545f31ccf08001cc16f20ccb91b770,
}
name: detsys-ts
version: 1.0.0
dependencies:
"@actions/cache": 3.2.4
"@actions/core": 1.10.1
"@actions/core": 1.11.1
"@actions/exec": 1.1.1
got: 14.4.2
type-fest: 4.23.0
got: 14.4.4
type-fest: 4.26.1
transitivePeerDependencies:
- encoding
dev: false
+22 -10
View File
@@ -614,8 +614,13 @@ class NixInstallerAction extends DetSysAction {
);
await this.executeUninstall();
} else {
// We're already installed, and not reinstalling, just set GITHUB_PATH and finish early
// We're already installed, and not reinstalling, just log in to FlakeHub, set GITHUB_PATH and finish early
await this.setGithubPath();
if (this.determinate) {
await this.flakehubLogin();
}
actionsCore.info("Nix was already installed, using existing install");
return;
}
@@ -643,11 +648,11 @@ class NixInstallerAction extends DetSysAction {
await this.spawnDockerShim();
}
await this.setGithubPath();
if (this.determinate) {
await this.flakehubLogin();
}
await this.setGithubPath();
}
async spawnDockerShim(): Promise<void> {
@@ -859,13 +864,19 @@ class NixInstallerAction extends DetSysAction {
async setGithubPath(): Promise<void> {
// Interim versions of the `nix-installer` crate may have already manipulated `$GITHUB_PATH`, as root even! Accessing that will be an error.
try {
const nixVarNixProfilePath = "/nix/var/nix/profiles/default/bin";
const homeNixProfilePath = `${process.env["HOME"]}/.nix-profile/bin`;
actionsCore.addPath(nixVarNixProfilePath);
actionsCore.addPath(homeNixProfilePath);
actionsCore.info(
`Added \`${nixVarNixProfilePath}\` and \`${homeNixProfilePath}\` to \`$GITHUB_PATH\``,
);
const paths = [];
if (this.determinate) {
paths.push("/usr/local/bin");
}
paths.push("/nix/var/nix/profiles/default/bin");
paths.push(`${process.env["HOME"]}/.nix-profile/bin`);
for (const p of paths) {
actionsCore.addPath(p);
actionsCore.debug(`Added \`${p}\` to \`$GITHUB_PATH\``);
}
} catch {
actionsCore.info(
"Skipping setting $GITHUB_PATH in action, the `nix-installer` crate seems to have done this already. From `nix-installer` version 0.11.0 and up, this step is done in the action. Prior to 0.11.0, this was only done in the `nix-installer` binary.",
@@ -883,6 +894,7 @@ class NixInstallerAction extends DetSysAction {
try {
await actionsExec.exec(`determinate-nixd`, ["login", "github-action"]);
} catch (e: unknown) {
actionsCore.warning(`FlakeHub Login failure: ${stringifyError(e)}`);
this.recordEvent("flakehub-login:failure", {
exception: stringifyError(e),
});