Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

access to instance id #324

Closed
jensg-st opened this issue Oct 31, 2021 · 5 comments
Closed

access to instance id #324

jensg-st opened this issue Oct 31, 2021 · 5 comments
Labels
improvement New feature or request

Comments

@jensg-st
Copy link
Member

jensg-st commented Oct 31, 2021

Is your feature request related to a problem? Please describe.

It would be good if the instance could access the instance id. If I want to publish events and want to use something as context value to wait for e.g. multiple async subflows.

Describe the solution you'd like

Up for discussion

Describe alternatives you've considered

At the moment I'm using something like jq(.name + (now | todateiso8601 | fromdate | tostring)). Not so nice output.

@jensg-st jensg-st added the improvement New feature or request label Oct 31, 2021
@alankm
Copy link
Member

alankm commented Nov 1, 2021

I've thought about this as well. Do you have any examples where knowing the instance ID is desirable, as opposed to just having some sort of unique key? I don't know if there's any harm in sharing the instance ID to the logic.

If only a unique key is needed, a function/container can easily solve this.

@alankm
Copy link
Member

alankm commented Nov 3, 2021

#315 might be a good use-case for this.

@jensg-st
Copy link
Member Author

jensg-st commented Nov 3, 2021

It does not have to be the instance id but it makes sense. Sometimes I want to create random files and I could just use the instance variable. I'm wondering if adding custom Direktiv commands in jq could be doing this?

@alankm
Copy link
Member

alankm commented Nov 3, 2021

That would be one way to do it. I'd be inclined to add a new state instead of messing with the JQ though. Perhaps some sort of utility state that works just a little bit like how action secrets work: the engine could generate a standardized object with various information that only exists in the scope of a single JQ command, and users could use JQ to extract the things they want from it and store it?

For example:

states:
- id: info
  type: util
  extract: '.instanceID = .util.instanceID'

Input:

{}

Output:

{
  "instanceID": "12345-..."
}

We could extent this state in future. Maybe allow it to grab the current time, namespace, etc.

@jensg-st
Copy link
Member Author

jensg-st commented Nov 4, 2021

It is an interesting idea. As you said namespace, instance id, time, user executing the workflow etc. That would be very helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants