CumulusCI icon indicating copy to clipboard operation
CumulusCI copied to clipboard

Inject Username for Tokens On Deploy

Open Julian88Tex opened this issue 3 years ago • 2 comments
trafficstars

Feature Type

I'm interested in extensions to existing CumulusCI functionality (e.g., broader applicability of an existing Task or Flow).

Does your feature request solve a current problem?

Currently, AuthProvider metadata requires an executionUser which must be a Salesforce username. This is difficult to do dynamically without writing scripts to pull the username and set the username before a metadata deployment.

Describe the solution you'd like

It would be helpful to have this injected on deploy similar to namespace injection.

Describe alternatives you've considered

  • Looked into creating a script to get the username and set an environment variable using the command task, but as @davidmreed describes, this isn't possible within a subshell. Even tried using source with no luck.

Additional context

  • Found others with the same issue: https://salesforce.stackexchange.com/questions/363730/issue-on-deploying-authprovider
  • One concern I have thought of but don't have an easy answer for how to specify different users if you don't want the username of the running user. Also theoretically you might want other data about the user besides the username for other usecases.

Julian88Tex avatar Jan 05 '22 04:01 Julian88Tex

@Julian88Tex How would automation determine which Salesforce username to inject upon deployment? Is it guaranteed to be the scratch org user? Or would the automation engineer need to specify in all cases?

davidmreed avatar Jan 28 '22 22:01 davidmreed

@davidmreed A fair question I thought about some. I feel like for an MVP injecting that username for the running user makes sense. Theoretically, if you are creating additional users you'd probably know their username. The trickiest one is the user-created by the CLI since the username is random.

I could see a phase 2 of this feature include some parameters in cumulusci.yml in order to set a user to be injected similar to the namespace.

Julian88Tex avatar Jan 29 '22 23:01 Julian88Tex

@davidmreed Oooo this exists now? https://github.com/SFDO-Tooling/CumulusCI/blob/5b07db38b3262520da3a177dd063352ead16cdf4/docs/history.md?plain=1#L13

Julian88Tex avatar Jan 08 '23 05:01 Julian88Tex

Sure does. Closed in #3460, kudos to @TheBitShepherd.

davidmreed avatar Jan 08 '23 21:01 davidmreed