magnificent-eve-10499
05/16/2025, 1:59 PMesc setenv org/project/environment
that would make it easier when it comes to running commands, troubleshooting, and dynamic development. For example, something like esc run org/project/environment -- bash -lc -- "ts-node ./esc.ts"
where esc.ts
is
#!/usr/bin/env ts-node
/**
* Runs the esc command with the ESC environment variable as the stack name.
* Usage: yarn esc
* Requires: ESC environment variable to be set.
*/
import { spawn } from 'child_process';
const escEnv = process.env.ESC;
if (!escEnv) {
console.error('Error: ESC environment variable is not set.');
process.exit(1);
}
const args = [
'run',
escEnv,
'--',
'bash',
'-lc',
'yarn develop:ssh',
];
const child = spawn('esc', args, {
stdio: 'inherit',
env: process.env,
});
child.on('exit', code => process.exit(code ?? 1));
could be simplified to esc run yarn develop:ssh
freezing-pilot-97749
05/20/2025, 7:50 PMesc run org/project/environment -- yarn develop:ssh
work?magnificent-eve-10499
05/20/2025, 8:02 PMif (escEnv && stackName) {
const envRef = project && env ? `${project}/${env}` : escEnv;
const stackArgs: automation.InlineProgramArgs = {
stackName,
projectName,
program: async () => {}, // No-op, just managing config
};
const stack = await automation.LocalWorkspace.createOrSelectStack(stackArgs);
const currentEnvs = await stack.listEnvironments();
if (!currentEnvs.includes(envRef)) {
await stack.addEnvironments(envRef);
console.log(`Added ESC environment '${envRef}' to stack '${stackName}'.`);
}
}
but I am not seeing it populate I am getting this in the console: [acrStack] Pulumi config at stack start: {}
I assume that the problem is that LocalWorkspace is wrong but I havent found the right method or functions yet.
Run yarn ts-node index.ts --stack acr-infra
Added ESC environment 'marketforge/scouten' to stack 'setup-acr-infra'.
[index.ts] ENV_ESC: ajwtech/marketforge/scouten
[index.ts] GITHUB_JOB: setup-acr-infra
[acrStack] Pulumi config at stack start: {}
ConfigMissingError: Missing required configuration variable 'project:location'
please set a value using the command `pulumi config set project:location <value>`
at Config.requireImpl (/__w/MarketForge/MarketForge/azure-deploy/node_modules/@pulumi/config.ts:301:19)
at Config.require (/__w/MarketForge/MarketForge/azure-deploy/node_modules/@pulumi/config.ts:313:21)
at Object.<anonymous> (/__w/MarketForge/MarketForge/azure-deploy/infrastructure/resourceGroup.ts:5:25)
at Module._compile (node:internal/modules/cjs/loader:1730:14)
at Module.m._compile (/__w/MarketForge/MarketForge/azure-deploy/node_modules/ts-node/src/index.ts:1618:23)
at node:internal/modules/cjs/loader:1895:10
at Object.require.extensions.<computed> [as .ts] (/__w/MarketForge/MarketForge/azure-deploy/node_modules/ts-node/src/index.ts:1621:12)
at Module.load (node:internal/modules/cjs/loader:1465:32)
at Function._load (node:internal/modules/cjs/loader:1282:12)
at TracingChannel.traceSync (node:diagnostics_channel:322:14) {
__pulumiRunError: true,
key: 'project:location',
secret: false
}
Error: Process completed with exit code