nice-butcher-64302
05/17/2023, 4:11 PMLocalProgramArgs
.
I've set up the container with the required PULUMI_ACCESS_TOKEN
env var and I've also provided the env-vars for AWS.
Here the command I'm using to launch the container with bash.
docker run -it \
-e AWS_ACCESS_KEY_ID=<some-value> \
-e AWS_SECRET_ACCESS_KEY=<some-value> \
-e AWS_REGION=<some-value> \
-e PULUMI_ACCESS_TOKEN=<pulumi-access-token-value> \
-e PULUMI_BACKEND_URL='<https://api.pulumi.com>' \
-w /app \
-v $(pwd):/app \
--entrypoint bash \
pulumi/pulumi
Inside the container I'm able to navigate to the directory with the pulumi program and run the CLI commands (e.g. pulumi preview -s <stack>).
When I try to run the program using the automation api, I use this command:
npx ts-node index.ts preview
Here the content of the file index.ts
import * as upath from 'upath';
import * as auto from '@pulumi/pulumi/automation';
import process = require('node:process');
const args = process.argv.slice(2);
let preview = false;
if (args.length > 0 && args[0]) {
preview = args[0] === 'preview';
}
const run = async (options: TenantConfig) => {
const wsArgs: auto.LocalProgramArgs = {
stackName: 'mrc',
workDir: upath.joinSafe(__dirname, '..', 'tenant-applications'),
};
const fullConfig = { ...baseConfig, ...options }; // create (or select if one already exists) a stack that uses our local program
const stack = await auto.LocalWorkspace.createOrSelectStack(wsArgs);
<http://console.info|console.info>('successfully initialized stack');
<http://console.info|console.info>('setting up config');
await stack.setAllConfig(fullConfig);
<http://console.info|console.info>('config set');
if (preview) {
<http://console.info|console.info>('previewing stack...');
await stack.preview({ onOutput: <http://console.info|console.info> });
} else {
<http://console.info|console.info>('updating stack...');
const upRes = await stack.up({ onOutput: <http://console.info|console.info> });
console.log(`update summary: \n${JSON.stringify(upRes.summary.resourceChanges, null, 4)}`);
}
};
run(newConfig).catch((err) => console.error(err));
But I get this error:
CommandError: code: -2
stdout:
stderr: Command failed with exit code 255: pulumi stack select --stack mrc --non-interactive
Logging in using access token from PULUMI_ACCESS_TOKEN
error: failed to get the home path: getting current user: luser: unable to get current user
err?: Error: Command failed with exit code 255: pulumi stack select --stack mrc --non-interactive
Logging in using access token from PULUMI_ACCESS_TOKEN
error: failed to get the home path: getting current user: luser: unable to get current user
at Object.createCommandError (/app/tenant-automation/node_modules/@pulumi/automation/errors.ts:75:27)
at Object.<anonymous> (/app/tenant-automation/node_modules/@pulumi/automation/cmd.ts:84:15)
at Generator.throw (<anonymous>)
at rejected (/app/tenant-automation/node_modules/@pulumi/pulumi/automation/cmd.js:19:65)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
commandResult: CommandResult {
stdout: '',
stderr: 'Command failed with exit code 255: pulumi stack select --stack mrc --non-interactive\n' +
'Logging in using access token from PULUMI_ACCESS_TOKEN\n' +
'error: failed to get the home path: getting current user: luser: unable to get current user',
code: -2,
err: Error: Command failed with exit code 255: pulumi stack select --stack mrc --non-interactive
Logging in using access token from PULUMI_ACCESS_TOKEN
error: failed to get the home path: getting current user: luser: unable to get current user
at makeError (/app/tenant-automation/node_modules/execa/lib/error.js:60:11)
at handlePromise (/app/tenant-automation/node_modules/execa/index.js:118:26)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
shortMessage: 'Command failed with exit code 255: pulumi stack select --stack mrc --non-interactive',
command: 'pulumi stack select --stack mrc --non-interactive',
escapedCommand: 'pulumi stack select --stack mrc --non-interactive',
exitCode: 255,
signal: undefined,
signalDescription: undefined,
stdout: '',
stderr: 'Logging in using access token from PULUMI_ACCESS_TOKEN\n' +
'error: failed to get the home path: getting current user: luser: unable to get current user',
failed: true,
timedOut: false,
isCanceled: false,
killed: false
}
}
}
I don't understand what I'm doing wrong, any help would be very much appreciatedbillowy-army-68599
05/17/2023, 4:21 PMnice-butcher-64302
05/17/2023, 4:22 PMbillowy-army-68599
05/17/2023, 4:26 PMpulumi/pulumi
?nice-butcher-64302
05/17/2023, 4:26 PMbillowy-army-68599
05/17/2023, 4:28 PM-e PULUMI_HOME='/app' \
nice-butcher-64302
05/17/2023, 4:31 PMbillowy-army-68599
05/17/2023, 5:00 PMlemon-agent-27707
05/18/2023, 11:53 PM