Type Error: The "path" argument must be of type string. Received an instance of Object
at validateString (node:internal/validators:162:11)
at Object.normalize (node:path:1131:5)
at readJsonFile (/Users/corentin.girard/go/src/github.com/DataDog/datadog-ci.git/master/src/helpers/tags.ts:240:25)
at parseTagsFile (/Users/corentin.girard/go/src/github.com/DataDog/datadog-ci.git/master/src/helpers/tags.ts:136:23)
at TagCommand.<anonymous> (/Users/corentin.girard/go/src/github.com/DataDog/datadog-ci.git/master/src/commands/tag/tag.ts:74:48)
at Generator.next (<anonymous>)
at /Users/corentin.girard/go/src/github.com/DataDog/datadog-ci.git/master/src/commands/tag/tag.ts:8:71
at new Promise (<anonymous>)
at Object.<anonymous>.__awaiter (/Users/corentin.girard/go/src/github.com/DataDog/datadog-ci.git/master/src/commands/tag/tag.ts:4:12)
at TagCommand.execute (/Users/corentin.girard/go/src/github.com/DataDog/datadog-ci.git/master/src/commands/tag/tag.ts:51:16)
at DeploymentMarkCommand.<anonymous> (/Users/corentin.girard/go/src/github.com/DataDog/datadog-ci.git/master/src/commands/deployment/mark.ts:72:55)
at Generator.next (<anonymous>)
at /Users/corentin.girard/go/src/github.com/DataDog/datadog-ci.git/master/src/commands/deployment/mark.ts:8:71
at new Promise (<anonymous>)
at Object.<anonymous>.__awaiter (/Users/corentin.girard/go/src/github.com/DataDog/datadog-ci.git/master/src/commands/deployment/mark.ts:4:12)
at DeploymentMarkCommand.execute (/Users/corentin.girard/go/src/github.com/DataDog/datadog-ci.git/master/src/commands/deployment/mark.ts:37:16)
at DeploymentMarkCommand.validateAndExecute (/Users/corentin.girard/go/src/github.com/DataDog/datadog-ci.git/master/node_modules/clipanion/lib/advanced/Command.js:73:37)
When running DD_BETA_COMMANDS_ENABLED=1 datadog-ci deployment mark
How?
The validateAndExecute() function in Clipanion is resolving Option.* objects into their final form, just before running execute().
But since DeploymentMarkCommand is not extending from TagCommand but constructing it manually, Clipanion doesn't resolve the option fields. So we end up with this.tagsFile being an object instead of a string.
Review checklist
[x] Feature or bugfix MUST have appropriate tests (unit, integration)
What and why?
This PR fixes the following error:
When running
DD_BETA_COMMANDS_ENABLED=1 datadog-ci deployment mark
How?
The
validateAndExecute()
function in Clipanion is resolvingOption.*
objects into their final form, just before runningexecute()
.But since
DeploymentMarkCommand
is not extending fromTagCommand
but constructing it manually, Clipanion doesn't resolve the option fields. So we end up withthis.tagsFile
being an object instead of a string.Review checklist