When working with jobs in IBM Cloud Code Engine, I would submit a jobrun for the actual invocation. For the jobrun I can specify environment variables to be passed into the runtime environment (--env FOO=BAR
).
How can I do the same when using a cron subscription to trigger the job, i.e., to set FOO=BAR
?
I believe the correct flag to pass to the CLI is the --ext or --extension.
For example:
After looking at this a bit more it appears that the name=value pairs you pass in to an event subscription prepend the string 'CE_' to the name.
Therefore, to allow for this in the running job, you would need to prepend the environment variable in the job with the
CE_
. For example:When I create the jobdefinition I add the environment variable like this:
CE_FOO=BAR
Then, when I create the event subscription, for the
--ext
flag, I use the original suggestion:--ext FOO=BAR
I believe since the FOO variable in the event subscription automatically gets the prepended
CE_
to theFOO
variable it should work.Please let me know if this does not work or I misunderstood you.