Persistent Context
Persistent Context is helpfull when you need to save information from the job execution, for example it can be used to save the infracost or save the thread id when using the Slack extension. We can also use it to save any JSON information generated inside Terrakube Jobs.
Using Persistent Contexts with the Terrakube API
In order to save the information the terrakube API exposes the following endpoint
Job context can only be updated when the status of the Job is running.
To get the context you can use the Terrakube API
Using Persistent Contexts in Templates
The persistent context can be used using the Context extension from the Terrakube extension repository. It supports saving a JSON file or saving a new property inside the context JSON.
This is an example of a Terrakube template using the persistent job context to save the infracost information.
You can use persistent context to customize the Job UI, see UI templates for more details.
Last updated