mirror of
https://github.com/DeterminateSystems/nix-installer-action.git
synced 2025-01-10 14:22:04 +01:00
Constify events and facts
This commit is contained in:
parent
8f4ca496eb
commit
413fb1beb4
3 changed files with 113 additions and 51 deletions
53
dist/index.js
generated
vendored
53
dist/index.js
generated
vendored
|
@ -97673,6 +97673,25 @@ function mungeDiagnosticEndpoint(inputUrl) {
|
|||
|
||||
|
||||
|
||||
// Nix installation events
|
||||
const EVENT_INSTALL_NIX_FAILURE = "install_nix_failure";
|
||||
const EVENT_INSTALL_NIX_START = "install_nix_start";
|
||||
const EVENT_INSTALL_NIX_SUCCESS = "install_nix_start";
|
||||
const EVENT_SETUP_KVM = "setup_kvm";
|
||||
const EVENT_UNINSTALL_NIX = "uninstall";
|
||||
// Docker events
|
||||
const EVENT_CLEAN_UP_DOCKER_SHIM = "clean_up_docker_shim";
|
||||
const EVENT_START_DOCKER_SHIM = "start_docker_shim";
|
||||
// FlakeHub events
|
||||
const EVENT_LOGIN_TO_FLAKEHUB = "login_to_flakehub";
|
||||
// Other events
|
||||
const EVENT_CONCLUDE_WORKFLOW = "conclude_workflow";
|
||||
// Facts
|
||||
const FACT_HAS_DOCKER = "has_docker";
|
||||
const FACT_HAS_SYSTEMD = "has_systemd";
|
||||
const FACT_IN_GITHUB_ACTIONS = "in_act";
|
||||
const FACT_IN_NAMESPACE_SO = "in_namespace_so";
|
||||
const FACT_NIX_INSTALLER_PLANNER = "nix_installer_planner";
|
||||
class NixInstallerAction {
|
||||
constructor() {
|
||||
this.idslib = new IdsToolbox({
|
||||
|
@ -97730,13 +97749,13 @@ class NixInstallerAction {
|
|||
core.warning("Systemd is detected, but ignoring it since force-docker-shim is enabled.");
|
||||
}
|
||||
else {
|
||||
this.idslib.addFact("has_systemd", true);
|
||||
this.idslib.addFact(FACT_HAS_SYSTEMD, true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.idslib.addFact("has_systemd", false);
|
||||
this.idslib.addFact(FACT_HAS_SYSTEMD, false);
|
||||
core.debug("Linux detected without systemd, testing for Docker with `docker info` as an alternative daemon supervisor.");
|
||||
this.idslib.addFact("has_docker", false); // Set to false here, and only in the success case do we set it to true
|
||||
this.idslib.addFact(FACT_HAS_DOCKER, false); // Set to false here, and only in the success case do we set it to true
|
||||
let exitCode;
|
||||
try {
|
||||
exitCode = await exec.exec("docker", ["info"], {
|
||||
|
@ -97769,7 +97788,7 @@ class NixInstallerAction {
|
|||
return;
|
||||
}
|
||||
}
|
||||
this.idslib.addFact("has_docker", true);
|
||||
this.idslib.addFact(FACT_HAS_DOCKER, true);
|
||||
if (!this.forceDockerShim &&
|
||||
(await this.detectDockerWithMountedDockerSocket())) {
|
||||
core.debug("Detected a Docker container with a Docker socket mounted, not enabling docker shim.");
|
||||
|
@ -97985,12 +98004,12 @@ class NixInstallerAction {
|
|||
}
|
||||
executionEnv.NIX_INSTALLER_EXTRA_CONF = extraConf;
|
||||
if (process.env.ACT && !process.env.NOT_ACT) {
|
||||
this.idslib.addFact("in_act", true);
|
||||
this.idslib.addFact(FACT_IN_GITHUB_ACTIONS, true);
|
||||
core.info("Detected `$ACT` environment, assuming this is a https://github.com/nektos/act created container, set `NOT_ACT=true` to override this. This will change the setting of the `init` to be compatible with `act`");
|
||||
executionEnv.NIX_INSTALLER_INIT = "none";
|
||||
}
|
||||
if (process.env.NSC_VM_ID && !process.env.NOT_NAMESPACE) {
|
||||
this.idslib.addFact("in_namespace_so", true);
|
||||
this.idslib.addFact(FACT_IN_NAMESPACE_SO, true);
|
||||
core.info("Detected Namespace runner, assuming this is a https://namespace.so created container, set `NOT_NAMESPACE=true` to override this. This will change the setting of the `init` to be compatible with Namespace");
|
||||
executionEnv.NIX_INSTALLER_INIT = "none";
|
||||
}
|
||||
|
@ -98001,18 +98020,18 @@ class NixInstallerAction {
|
|||
core.debug(`Execution environment: ${JSON.stringify(executionEnv, null, 4)}`);
|
||||
const args = ["install"];
|
||||
if (this.planner) {
|
||||
this.idslib.addFact("nix_installer_planner", this.planner);
|
||||
this.idslib.addFact(FACT_NIX_INSTALLER_PLANNER, this.planner);
|
||||
args.push(this.planner);
|
||||
}
|
||||
else {
|
||||
this.idslib.addFact("nix_installer_planner", getDefaultPlanner());
|
||||
this.idslib.addFact(FACT_NIX_INSTALLER_PLANNER, getDefaultPlanner());
|
||||
args.push(getDefaultPlanner());
|
||||
}
|
||||
if (this.extraArgs) {
|
||||
const extraArgs = parseArgsStringToArgv(this.extraArgs);
|
||||
args.concat(extraArgs);
|
||||
}
|
||||
this.idslib.recordEvent("install_nix_start");
|
||||
this.idslib.recordEvent(EVENT_INSTALL_NIX_START);
|
||||
const exitCode = await exec.exec(binaryPath, args, {
|
||||
env: {
|
||||
...executionEnv,
|
||||
|
@ -98020,12 +98039,12 @@ class NixInstallerAction {
|
|||
},
|
||||
});
|
||||
if (exitCode !== 0) {
|
||||
this.idslib.recordEvent("install_nix_failure", {
|
||||
this.idslib.recordEvent(EVENT_INSTALL_NIX_FAILURE, {
|
||||
exitCode,
|
||||
});
|
||||
throw new Error(`Non-zero exit code of \`${exitCode}\` detected`);
|
||||
}
|
||||
this.idslib.recordEvent("install_nix_success");
|
||||
this.idslib.recordEvent(EVENT_INSTALL_NIX_SUCCESS);
|
||||
return exitCode;
|
||||
}
|
||||
async install() {
|
||||
|
@ -98107,7 +98126,7 @@ class NixInstallerAction {
|
|||
}
|
||||
{
|
||||
core.debug("Starting the Nix daemon through Docker...");
|
||||
this.idslib.recordEvent("start_docker_shim");
|
||||
this.idslib.recordEvent(EVENT_START_DOCKER_SHIM);
|
||||
const exitCode = await exec.exec("docker", [
|
||||
"--log-level=debug",
|
||||
"run",
|
||||
|
@ -98184,7 +98203,7 @@ class NixInstallerAction {
|
|||
}
|
||||
}
|
||||
if (cleaned) {
|
||||
this.idslib.recordEvent("clean_up_docker_shim");
|
||||
this.idslib.recordEvent(EVENT_CLEAN_UP_DOCKER_SHIM);
|
||||
}
|
||||
else {
|
||||
core.warning("Giving up on cleaning up the nix daemon container");
|
||||
|
@ -98206,7 +98225,7 @@ class NixInstallerAction {
|
|||
}
|
||||
}
|
||||
async flakehubLogin() {
|
||||
this.idslib.recordEvent("login_to_flakehub");
|
||||
this.idslib.recordEvent(EVENT_LOGIN_TO_FLAKEHUB);
|
||||
const netrcPath = `${process.env["RUNNER_TEMP"]}/determinate-nix-installer-netrc`;
|
||||
const jwt = await core.getIDToken("api.flakehub.com");
|
||||
await (0,promises_namespaceObject.writeFile)(netrcPath, [
|
||||
|
@ -98222,7 +98241,7 @@ class NixInstallerAction {
|
|||
return netrcPath;
|
||||
}
|
||||
async executeUninstall() {
|
||||
this.idslib.recordEvent("uninstall");
|
||||
this.idslib.recordEvent(EVENT_UNINSTALL_NIX);
|
||||
const exitCode = await exec.exec(`/nix/nix-installer`, ["uninstall"], {
|
||||
env: {
|
||||
NIX_INSTALLER_NO_CONFIRM: "true",
|
||||
|
@ -98247,7 +98266,7 @@ class NixInstallerAction {
|
|||
}
|
||||
}
|
||||
async setupKvm() {
|
||||
this.idslib.recordEvent("setup_kvm");
|
||||
this.idslib.recordEvent(EVENT_SETUP_KVM);
|
||||
const currentUser = (0,external_node_os_.userInfo)();
|
||||
const isRoot = currentUser.uid === 0;
|
||||
const maybeSudo = isRoot ? "" : "sudo";
|
||||
|
@ -98334,7 +98353,7 @@ class NixInstallerAction {
|
|||
}
|
||||
async reportOverall() {
|
||||
try {
|
||||
this.idslib.recordEvent("conclude_workflow", {
|
||||
this.idslib.recordEvent(EVENT_CONCLUDE_WORKFLOW, {
|
||||
conclusion: await this.getWorkflowConclusion(),
|
||||
});
|
||||
}
|
||||
|
|
53
dist/main.js
generated
vendored
53
dist/main.js
generated
vendored
|
@ -9,6 +9,25 @@ import stringArgv from "string-argv";
|
|||
import * as path from "path";
|
||||
import { IdsToolbox, inputs, platform } from "detsys-ts";
|
||||
import { randomUUID } from "node:crypto";
|
||||
// Nix installation events
|
||||
const EVENT_INSTALL_NIX_FAILURE = "install_nix_failure";
|
||||
const EVENT_INSTALL_NIX_START = "install_nix_start";
|
||||
const EVENT_INSTALL_NIX_SUCCESS = "install_nix_start";
|
||||
const EVENT_SETUP_KVM = "setup_kvm";
|
||||
const EVENT_UNINSTALL_NIX = "uninstall";
|
||||
// Docker events
|
||||
const EVENT_CLEAN_UP_DOCKER_SHIM = "clean_up_docker_shim";
|
||||
const EVENT_START_DOCKER_SHIM = "start_docker_shim";
|
||||
// FlakeHub events
|
||||
const EVENT_LOGIN_TO_FLAKEHUB = "login_to_flakehub";
|
||||
// Other events
|
||||
const EVENT_CONCLUDE_WORKFLOW = "conclude_workflow";
|
||||
// Facts
|
||||
const FACT_HAS_DOCKER = "has_docker";
|
||||
const FACT_HAS_SYSTEMD = "has_systemd";
|
||||
const FACT_IN_GITHUB_ACTIONS = "in_act";
|
||||
const FACT_IN_NAMESPACE_SO = "in_namespace_so";
|
||||
const FACT_NIX_INSTALLER_PLANNER = "nix_installer_planner";
|
||||
class NixInstallerAction {
|
||||
constructor() {
|
||||
this.idslib = new IdsToolbox({
|
||||
|
@ -66,13 +85,13 @@ class NixInstallerAction {
|
|||
actionsCore.warning("Systemd is detected, but ignoring it since force-docker-shim is enabled.");
|
||||
}
|
||||
else {
|
||||
this.idslib.addFact("has_systemd", true);
|
||||
this.idslib.addFact(FACT_HAS_SYSTEMD, true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.idslib.addFact("has_systemd", false);
|
||||
this.idslib.addFact(FACT_HAS_SYSTEMD, false);
|
||||
actionsCore.debug("Linux detected without systemd, testing for Docker with `docker info` as an alternative daemon supervisor.");
|
||||
this.idslib.addFact("has_docker", false); // Set to false here, and only in the success case do we set it to true
|
||||
this.idslib.addFact(FACT_HAS_DOCKER, false); // Set to false here, and only in the success case do we set it to true
|
||||
let exitCode;
|
||||
try {
|
||||
exitCode = await actionsExec.exec("docker", ["info"], {
|
||||
|
@ -105,7 +124,7 @@ class NixInstallerAction {
|
|||
return;
|
||||
}
|
||||
}
|
||||
this.idslib.addFact("has_docker", true);
|
||||
this.idslib.addFact(FACT_HAS_DOCKER, true);
|
||||
if (!this.forceDockerShim &&
|
||||
(await this.detectDockerWithMountedDockerSocket())) {
|
||||
actionsCore.debug("Detected a Docker container with a Docker socket mounted, not enabling docker shim.");
|
||||
|
@ -321,12 +340,12 @@ class NixInstallerAction {
|
|||
}
|
||||
executionEnv.NIX_INSTALLER_EXTRA_CONF = extraConf;
|
||||
if (process.env.ACT && !process.env.NOT_ACT) {
|
||||
this.idslib.addFact("in_act", true);
|
||||
this.idslib.addFact(FACT_IN_GITHUB_ACTIONS, true);
|
||||
actionsCore.info("Detected `$ACT` environment, assuming this is a https://github.com/nektos/act created container, set `NOT_ACT=true` to override this. This will change the setting of the `init` to be compatible with `act`");
|
||||
executionEnv.NIX_INSTALLER_INIT = "none";
|
||||
}
|
||||
if (process.env.NSC_VM_ID && !process.env.NOT_NAMESPACE) {
|
||||
this.idslib.addFact("in_namespace_so", true);
|
||||
this.idslib.addFact(FACT_IN_NAMESPACE_SO, true);
|
||||
actionsCore.info("Detected Namespace runner, assuming this is a https://namespace.so created container, set `NOT_NAMESPACE=true` to override this. This will change the setting of the `init` to be compatible with Namespace");
|
||||
executionEnv.NIX_INSTALLER_INIT = "none";
|
||||
}
|
||||
|
@ -337,18 +356,18 @@ class NixInstallerAction {
|
|||
actionsCore.debug(`Execution environment: ${JSON.stringify(executionEnv, null, 4)}`);
|
||||
const args = ["install"];
|
||||
if (this.planner) {
|
||||
this.idslib.addFact("nix_installer_planner", this.planner);
|
||||
this.idslib.addFact(FACT_NIX_INSTALLER_PLANNER, this.planner);
|
||||
args.push(this.planner);
|
||||
}
|
||||
else {
|
||||
this.idslib.addFact("nix_installer_planner", getDefaultPlanner());
|
||||
this.idslib.addFact(FACT_NIX_INSTALLER_PLANNER, getDefaultPlanner());
|
||||
args.push(getDefaultPlanner());
|
||||
}
|
||||
if (this.extraArgs) {
|
||||
const extraArgs = stringArgv(this.extraArgs);
|
||||
args.concat(extraArgs);
|
||||
}
|
||||
this.idslib.recordEvent("install_nix_start");
|
||||
this.idslib.recordEvent(EVENT_INSTALL_NIX_START);
|
||||
const exitCode = await actionsExec.exec(binaryPath, args, {
|
||||
env: {
|
||||
...executionEnv,
|
||||
|
@ -356,12 +375,12 @@ class NixInstallerAction {
|
|||
},
|
||||
});
|
||||
if (exitCode !== 0) {
|
||||
this.idslib.recordEvent("install_nix_failure", {
|
||||
this.idslib.recordEvent(EVENT_INSTALL_NIX_FAILURE, {
|
||||
exitCode,
|
||||
});
|
||||
throw new Error(`Non-zero exit code of \`${exitCode}\` detected`);
|
||||
}
|
||||
this.idslib.recordEvent("install_nix_success");
|
||||
this.idslib.recordEvent(EVENT_INSTALL_NIX_SUCCESS);
|
||||
return exitCode;
|
||||
}
|
||||
async install() {
|
||||
|
@ -443,7 +462,7 @@ class NixInstallerAction {
|
|||
}
|
||||
{
|
||||
actionsCore.debug("Starting the Nix daemon through Docker...");
|
||||
this.idslib.recordEvent("start_docker_shim");
|
||||
this.idslib.recordEvent(EVENT_START_DOCKER_SHIM);
|
||||
const exitCode = await actionsExec.exec("docker", [
|
||||
"--log-level=debug",
|
||||
"run",
|
||||
|
@ -520,7 +539,7 @@ class NixInstallerAction {
|
|||
}
|
||||
}
|
||||
if (cleaned) {
|
||||
this.idslib.recordEvent("clean_up_docker_shim");
|
||||
this.idslib.recordEvent(EVENT_CLEAN_UP_DOCKER_SHIM);
|
||||
}
|
||||
else {
|
||||
actionsCore.warning("Giving up on cleaning up the nix daemon container");
|
||||
|
@ -542,7 +561,7 @@ class NixInstallerAction {
|
|||
}
|
||||
}
|
||||
async flakehubLogin() {
|
||||
this.idslib.recordEvent("login_to_flakehub");
|
||||
this.idslib.recordEvent(EVENT_LOGIN_TO_FLAKEHUB);
|
||||
const netrcPath = `${process.env["RUNNER_TEMP"]}/determinate-nix-installer-netrc`;
|
||||
const jwt = await actionsCore.getIDToken("api.flakehub.com");
|
||||
await writeFile(netrcPath, [
|
||||
|
@ -558,7 +577,7 @@ class NixInstallerAction {
|
|||
return netrcPath;
|
||||
}
|
||||
async executeUninstall() {
|
||||
this.idslib.recordEvent("uninstall");
|
||||
this.idslib.recordEvent(EVENT_UNINSTALL_NIX);
|
||||
const exitCode = await actionsExec.exec(`/nix/nix-installer`, ["uninstall"], {
|
||||
env: {
|
||||
NIX_INSTALLER_NO_CONFIRM: "true",
|
||||
|
@ -583,7 +602,7 @@ class NixInstallerAction {
|
|||
}
|
||||
}
|
||||
async setupKvm() {
|
||||
this.idslib.recordEvent("setup_kvm");
|
||||
this.idslib.recordEvent(EVENT_SETUP_KVM);
|
||||
const currentUser = userInfo();
|
||||
const isRoot = currentUser.uid === 0;
|
||||
const maybeSudo = isRoot ? "" : "sudo";
|
||||
|
@ -670,7 +689,7 @@ class NixInstallerAction {
|
|||
}
|
||||
async reportOverall() {
|
||||
try {
|
||||
this.idslib.recordEvent("conclude_workflow", {
|
||||
this.idslib.recordEvent(EVENT_CONCLUDE_WORKFLOW, {
|
||||
conclusion: await this.getWorkflowConclusion(),
|
||||
});
|
||||
}
|
||||
|
|
58
src/main.ts
58
src/main.ts
|
@ -10,6 +10,30 @@ import * as path from "path";
|
|||
import { IdsToolbox, inputs, platform } from "detsys-ts";
|
||||
import { randomUUID } from "node:crypto";
|
||||
|
||||
// Nix installation events
|
||||
const EVENT_INSTALL_NIX_FAILURE = "install_nix_failure";
|
||||
const EVENT_INSTALL_NIX_START = "install_nix_start";
|
||||
const EVENT_INSTALL_NIX_SUCCESS = "install_nix_start";
|
||||
const EVENT_SETUP_KVM = "setup_kvm";
|
||||
const EVENT_UNINSTALL_NIX = "uninstall";
|
||||
|
||||
// Docker events
|
||||
const EVENT_CLEAN_UP_DOCKER_SHIM = "clean_up_docker_shim";
|
||||
const EVENT_START_DOCKER_SHIM = "start_docker_shim";
|
||||
|
||||
// FlakeHub events
|
||||
const EVENT_LOGIN_TO_FLAKEHUB = "login_to_flakehub";
|
||||
|
||||
// Other events
|
||||
const EVENT_CONCLUDE_WORKFLOW = "conclude_workflow";
|
||||
|
||||
// Facts
|
||||
const FACT_HAS_DOCKER = "has_docker";
|
||||
const FACT_HAS_SYSTEMD = "has_systemd";
|
||||
const FACT_IN_GITHUB_ACTIONS = "in_act";
|
||||
const FACT_IN_NAMESPACE_SO = "in_namespace_so";
|
||||
const FACT_NIX_INSTALLER_PLANNER = "nix_installer_planner";
|
||||
|
||||
class NixInstallerAction {
|
||||
idslib: IdsToolbox;
|
||||
platform: string;
|
||||
|
@ -105,17 +129,17 @@ class NixInstallerAction {
|
|||
"Systemd is detected, but ignoring it since force-docker-shim is enabled.",
|
||||
);
|
||||
} else {
|
||||
this.idslib.addFact("has_systemd", true);
|
||||
this.idslib.addFact(FACT_HAS_SYSTEMD, true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.idslib.addFact("has_systemd", false);
|
||||
this.idslib.addFact(FACT_HAS_SYSTEMD, false);
|
||||
|
||||
actionsCore.debug(
|
||||
"Linux detected without systemd, testing for Docker with `docker info` as an alternative daemon supervisor.",
|
||||
);
|
||||
|
||||
this.idslib.addFact("has_docker", false); // Set to false here, and only in the success case do we set it to true
|
||||
this.idslib.addFact(FACT_HAS_DOCKER, false); // Set to false here, and only in the success case do we set it to true
|
||||
let exitCode;
|
||||
try {
|
||||
exitCode = await actionsExec.exec("docker", ["info"], {
|
||||
|
@ -149,7 +173,7 @@ class NixInstallerAction {
|
|||
return;
|
||||
}
|
||||
}
|
||||
this.idslib.addFact("has_docker", true);
|
||||
this.idslib.addFact(FACT_HAS_DOCKER, true);
|
||||
|
||||
if (
|
||||
!this.forceDockerShim &&
|
||||
|
@ -420,7 +444,7 @@ class NixInstallerAction {
|
|||
executionEnv.NIX_INSTALLER_EXTRA_CONF = extraConf;
|
||||
|
||||
if (process.env.ACT && !process.env.NOT_ACT) {
|
||||
this.idslib.addFact("in_act", true);
|
||||
this.idslib.addFact(FACT_IN_GITHUB_ACTIONS, true);
|
||||
actionsCore.info(
|
||||
"Detected `$ACT` environment, assuming this is a https://github.com/nektos/act created container, set `NOT_ACT=true` to override this. This will change the setting of the `init` to be compatible with `act`",
|
||||
);
|
||||
|
@ -428,7 +452,7 @@ class NixInstallerAction {
|
|||
}
|
||||
|
||||
if (process.env.NSC_VM_ID && !process.env.NOT_NAMESPACE) {
|
||||
this.idslib.addFact("in_namespace_so", true);
|
||||
this.idslib.addFact(FACT_IN_NAMESPACE_SO, true);
|
||||
actionsCore.info(
|
||||
"Detected Namespace runner, assuming this is a https://namespace.so created container, set `NOT_NAMESPACE=true` to override this. This will change the setting of the `init` to be compatible with Namespace",
|
||||
);
|
||||
|
@ -446,10 +470,10 @@ class NixInstallerAction {
|
|||
|
||||
const args = ["install"];
|
||||
if (this.planner) {
|
||||
this.idslib.addFact("nix_installer_planner", this.planner);
|
||||
this.idslib.addFact(FACT_NIX_INSTALLER_PLANNER, this.planner);
|
||||
args.push(this.planner);
|
||||
} else {
|
||||
this.idslib.addFact("nix_installer_planner", getDefaultPlanner());
|
||||
this.idslib.addFact(FACT_NIX_INSTALLER_PLANNER, getDefaultPlanner());
|
||||
args.push(getDefaultPlanner());
|
||||
}
|
||||
|
||||
|
@ -458,7 +482,7 @@ class NixInstallerAction {
|
|||
args.concat(extraArgs);
|
||||
}
|
||||
|
||||
this.idslib.recordEvent("install_nix_start");
|
||||
this.idslib.recordEvent(EVENT_INSTALL_NIX_START);
|
||||
const exitCode = await actionsExec.exec(binaryPath, args, {
|
||||
env: {
|
||||
...executionEnv,
|
||||
|
@ -467,13 +491,13 @@ class NixInstallerAction {
|
|||
});
|
||||
|
||||
if (exitCode !== 0) {
|
||||
this.idslib.recordEvent("install_nix_failure", {
|
||||
this.idslib.recordEvent(EVENT_INSTALL_NIX_FAILURE, {
|
||||
exitCode,
|
||||
});
|
||||
throw new Error(`Non-zero exit code of \`${exitCode}\` detected`);
|
||||
}
|
||||
|
||||
this.idslib.recordEvent("install_nix_success");
|
||||
this.idslib.recordEvent(EVENT_INSTALL_NIX_SUCCESS);
|
||||
|
||||
return exitCode;
|
||||
}
|
||||
|
@ -571,7 +595,7 @@ class NixInstallerAction {
|
|||
|
||||
{
|
||||
actionsCore.debug("Starting the Nix daemon through Docker...");
|
||||
this.idslib.recordEvent("start_docker_shim");
|
||||
this.idslib.recordEvent(EVENT_START_DOCKER_SHIM);
|
||||
const exitCode = await actionsExec.exec(
|
||||
"docker",
|
||||
[
|
||||
|
@ -661,7 +685,7 @@ class NixInstallerAction {
|
|||
}
|
||||
|
||||
if (cleaned) {
|
||||
this.idslib.recordEvent("clean_up_docker_shim");
|
||||
this.idslib.recordEvent(EVENT_CLEAN_UP_DOCKER_SHIM);
|
||||
} else {
|
||||
actionsCore.warning(
|
||||
"Giving up on cleaning up the nix daemon container",
|
||||
|
@ -690,7 +714,7 @@ class NixInstallerAction {
|
|||
}
|
||||
|
||||
async flakehubLogin(): Promise<string> {
|
||||
this.idslib.recordEvent("login_to_flakehub");
|
||||
this.idslib.recordEvent(EVENT_LOGIN_TO_FLAKEHUB);
|
||||
const netrcPath = `${process.env["RUNNER_TEMP"]}/determinate-nix-installer-netrc`;
|
||||
|
||||
const jwt = await actionsCore.getIDToken("api.flakehub.com");
|
||||
|
@ -717,7 +741,7 @@ class NixInstallerAction {
|
|||
}
|
||||
|
||||
async executeUninstall(): Promise<number> {
|
||||
this.idslib.recordEvent("uninstall");
|
||||
this.idslib.recordEvent(EVENT_UNINSTALL_NIX);
|
||||
const exitCode = await actionsExec.exec(
|
||||
`/nix/nix-installer`,
|
||||
["uninstall"],
|
||||
|
@ -749,7 +773,7 @@ class NixInstallerAction {
|
|||
}
|
||||
|
||||
private async setupKvm(): Promise<boolean> {
|
||||
this.idslib.recordEvent("setup_kvm");
|
||||
this.idslib.recordEvent(EVENT_SETUP_KVM);
|
||||
const currentUser = userInfo();
|
||||
const isRoot = currentUser.uid === 0;
|
||||
const maybeSudo = isRoot ? "" : "sudo";
|
||||
|
@ -855,7 +879,7 @@ class NixInstallerAction {
|
|||
|
||||
async reportOverall(): Promise<void> {
|
||||
try {
|
||||
this.idslib.recordEvent("conclude_workflow", {
|
||||
this.idslib.recordEvent(EVENT_CONCLUDE_WORKFLOW, {
|
||||
conclusion: await this.getWorkflowConclusion(),
|
||||
});
|
||||
} catch (error) {
|
||||
|
|
Loading…
Reference in a new issue