feat: add config-manager push iga-workflows command#103
Conversation
| const { CLOUD_DEPLOYMENT_TYPE_KEY, FORGEOPS_DEPLOYMENT_TYPE_KEY } = | ||
| frodo.utils.constants; | ||
| const deploymentTypes = [ | ||
| CLOUD_DEPLOYMENT_TYPE_KEY, | ||
| FORGEOPS_DEPLOYMENT_TYPE_KEY, | ||
| ]; |
There was a problem hiding this comment.
Workflows are a Cloud only deployment, remove forgeops from this
|
|
||
| export default function setup() { | ||
| const program = new FrodoCommand( | ||
| 'frodo config-manager pull iga-workflows', |
| ) | ||
| ) | ||
| .addOption( | ||
| new Option('--draft', 'Push as draft version instead of publishing.') |
There was a problem hiding this comment.
I would add a shorthand to this, use -d (config-manger uses -r, but I think that was a typo, it should be -d)
| command | ||
| ); | ||
|
|
||
| if (await getTokens(false, true, deploymentTypes)) { |
There was a problem hiding this comment.
Before getTokens, I would add an if-statement checking if the tenant is an IGA tenant, and fail early if not, as I did for the Frodo workflow commands:
frodo-cli/src/cli/iga/config/iga-config-export.ts
Lines 92 to 99 in ccab984
| if (await getTokens(false, true, deploymentTypes)) { | ||
| verboseMessage('Importing config entity iga-workflows'); | ||
| const outcome = await configManagerImportIgaWorkflows( | ||
| options.name, | ||
| options.draft | ||
| ); | ||
| if (!outcome) process.exitCode = 1; | ||
| } |
There was a problem hiding this comment.
Change this code to look something like this:
This is almost correct, although we need to make sure we are setting the exit code to 1 in the event that getTokens fails, which this example does.
| ); | ||
|
|
||
| if (await getTokens(false, true, deploymentTypes)) { | ||
| verboseMessage('Importing config entity iga-workflows'); |
There was a problem hiding this comment.
I would reword this message to be "Importing IGA workflows...", since config entity is typically associated with IDM entities.
There was a problem hiding this comment.
For test configurations, I would update these workflows to have one of each possible node in them so we can test to verify that importing works for all nodes. Currently your test workflows only have the wait node.
| const { stdout } = await exec(CMD, igaEnv); | ||
| expect(removeAnsiEscapeCodes(stdout)).toMatchSnapshot(); |
There was a problem hiding this comment.
I would change these tests to use the await testSuccess(CMD, igaEnv); helper function I created to test success, as it helps simplify the tests some more.
No description provided.