When running a job inside the executor component the following logic is used:
A folder to execute the job will be created using the organization id and workspace id:
/home/cnb/.terraform-spring-boot/executor/{{ORGANIZATION_ID}}//{{WORKSPACE_ID}}
The executor component will initially clone the workspace to the following folder:
/home/cnb/.terraform-spring-boot/executor/{{ORGANIZATION_ID}}//{{WORKSPACE_ID}}/.originRepository
All the files inside ".originalRepository" are moved to {{ORGANIZATION_ID}}//{{WORKSPACE_ID}} folder from previous step.
Te executor component will create the extension folders where you can store BASH or GROOVY extensions:
/home/cnb/.terraform-spring-boot/executor/{{ORGANIZATION_ID}}/{{WORKSPACE_ID}}/.terrakube/toolsRepository
By default it will clone the repository "https://github.com/AzBuilder/terrakube-extensions", this can be change by using TerrakubeToolsRepository and TerrakubeToolsBranch environment variables.
The executor component will scan the extension folder and will add all the "sh" files to the linux path when using BASH commands.
The executor component will scan the extension folder and will add all the ".groovy" files as Groovy dependencies dynamical when using GROOVY commands.
When using GROOVY extension to download an external tools, the extension can use the following folder /home/cnb/.terraform-spring-boot/executor/{{ORGANIZATION_ID}}/{{WORKSPACE_ID}}/.terrakube/tools all the folder inside the "tools" folder are also included in the linux execution PATH
By default the executor component will also include all the "sh" from the imported workspace files
Once the executor component has all the necesarry information it will execute the selected template flow for the job.
When the job execution is completed the current {{ORGANIZATION_ID}}/{{WORKSPACE_ID}} is deleted.
An example of how to import external tools can be found in the Terratag Groovy extension
https://github.com/AzBuilder/terrakube-extensions/tree/main/groovy/TerraTag
This extension download the terratag binary and expose the binary to be used inside the linux PATH when using BASH commands.
When using the following template:
The following directory structure will be generating when using a workspace with the workspace with "https://github.com/AzBuilder/terrakube-docker-compose"