Automate deployment
Introduction to deployment automation
Since all deployment jobs are performed by Indicium, it is possible to automate the entire process using the Thinkwise Platform API. You can find the run jobs in the Software Factory menu Maintenance > Jobs. You can also use third-party CI/CD tools to automate the build pipeline, see Build integrations.
For deployment automation, use the Indicium instance running on the IAM facilitating the Software Factory.
Definitions of CI/CD
CI/CD means Continuous Integration/Continuous Delivery or Continuous Deployment. It is a set of practices that automate the integration of code changes from multiple developers into a single software project. Benefits of CI/CD are faster release cycles, improved code quality, reduced manual errors, and faster feedback and issue detection.
-
Continuous Integration (CI) is the practice of frequently integrating code changes into a shared repository. Developers commit code regularly (multiple times a day), automated builds and tests are triggered on each commit, and immediate feedback is provided on the integration status. The main goals are to detect errors quickly, improve software quality, and reduce integration problems.
-
Continuous Delivery (CD) is the practice of ensuring that code changes are automatically prepared for a release to production. Builds are automatically tested and staged, code is always in a deployable state, and deployment to production requires a manual approval.
-
Continuous Deployment (CD) goes one step further than Continuous Delivery. Every code change that passes all stages of the pipeline is automatically deployed to production without human intervention.
Get the current job status
To obtain the current job status (field job_status) of a given job:
GET [indicium]/iam/sf/job([job_id])
Possible values of the job_status:
| Value | Description |
|---|---|
| 0 | Queued |
| 1 | Pending (to be picked up by Indicium) |
| 2 | Active |
| 3 | Completed |
| 4 | Failed |
| 5 | Canceled |
| 6 | Aborted |
Cancel all jobs
To be sure that no other jobs are running, you can cancel all jobs for the model and branch before starting the planned job.
Use the following parameters:
| Parameter | Description | Possible values |
|---|---|---|
model_id | The ID of the model you want to create the deployment package for. | Example: MY_MODEL |
branch_id | The branch ID. | Example: 1.12 |
Sample request:
POST [indicium]/iam/sf/cancel_all_jobs
{
"model_id": "MY_PROJECT",
"branch_id": "MAIN"
}
Automate the Creation process
This chapter describes how to automate the entire Creation process or its separate steps.
For more information on the Creation process and how to run it in the user interface, see Creation.
Wait for a Creation step to finish
All Creation jobs return the (last) created job_id through an output parameter.
The wait for job procedure specifies that a Creation process waits until a specific job has been completed before continuing execution. Once that job has
finished, the procedure will end automatically.
Use the following parameters:
| Parameter | Description | Possible values |
|---|---|---|
job_id | The (integer) id of the job that has to be completed before continuing. | Example: 123 |
show_msg | Shows a message about what went wrong if a job cannot be completed successfully. | - 0 = No- 1 = Yes |
Sample request:
POST [indicium]/iam/sf/wait_for_job
{
"job_id": 123,
"show_msg": 1
}
Automate 'Execute all creation steps'
You can automate the the task Execute all creation steps using a POST request to Indicium.
Use the parameters below in the request to call add_job_to_do_complete_creation.
| Parameter | Description | Possible values |
|---|---|---|
model_id | The ID of the model you want to create the deployment package for. | Example: MY_MODEL |
branch_id | The branch ID. | Example: 1.12 |
execute_complete_creation | Determines whether all Creation steps are executed, or only a manual selection of them. Note: each step parameter below defaults to true if omitted, so explicitly set a step to false to exclude it. | - 1 = Execute all steps- 0 = Select steps manually. Set the parameters below to true or false to include or exclude the step:- generate_definition - validate_definition - generate_source_code - execute_source_code - execute_unit_tests - execute_smoke_test - run_sync |
model_vrs_name | The version name of the model for which you want to execute the creation steps. | Example: 1.13 |
generate_definition | Whether to generate the definition. | - true- false |
generate_definition_error_handling | What happens when a control procedure fails to execute properly while the definition is generated. Leave empty when not generating the definition. Defaults to 0 (pause and await user input) if omitted while generating the definition. | - 0 = Pause and await user input- 1 = Skip the control procedure in error and continue- 2 = Abort generate definition |
validate_definition | Whether to validate the definition. | - true- false |
validate_definition_error_handling | How the validation results affect the subsequent Creation steps. Leave empty when not validating the definition. Defaults to 0 (abort on errors) if omitted while validating the definition. | - 0 = Abort on errors- 1 = Abort on warnings- 2 = Abort on any validation message- 3 = Always continue the subsequent Creation steps |
generate_source_code | Whether to generate the source code. | - true- false |
upgrade_method | Determines the method for generating source code. Leave empty when not generating the source code. For more information, see Generation method. | - 0 = Smart- 1 = Full |
write_code_files | Whether to write the generated source code to files. Leave empty when not generating the source code. | - true- false |
write_prog_objects | Whether to write the generated program objects to files. Leave empty when not generating the source code. | - true- false |
execute_source_code | Whether to execute the generated source code. | - true- false |
runtime_configuration_id | Code execution, unit test execution, and smoke test execution will all be done on the provided runtime configuration. Leave empty when not running these steps. Note: this has to be the exact name of the runtime configuration as configured in the Software Factory. You cannot use an application id or application alias. | Example: default |
execute_source_code_error_handling | What happens when a control procedure fails to execute properly while the source code is executed. Leave empty when not executing the source code. Defaults to 0 (pause and await user input) if omitted while executing the source code. | - 0 = Pause and await user input- 1 = Skip the control procedure in error and continue- 2 = Abort execute source code |
execute_unit_tests | Whether to execute unit tests. Set to false when not executing the source code. | - true- false |
execute_smoke_test | Whether to execute smoke tests. Set to false when not executing the source code. | - true- false |
run_sync | Whether to run synchronization to IAM. Set to false when you do not want to synchronize. | - true- false |
sync_run_type | Whether to directly synchronize to IAM or to write a synchronization script to storage. Leave empty when not synchronizing. | - 0 = Synchronize to IAM- 1 = Synchronize to storage |
sync_target_iam_id | The target IAM to synchronize with. Leave empty when not synchronizing directly to IAM. Note: this has to be the exact value of the IAM configuration as configured in the Software Factory. | Example: 1 |
debug | Relevant during the Generate definition process. Logs when the branch is 'locked' and 'unlocked', and actions taken by the user after a process step has failed. | - 1 = Enabled - 0 = Disabled |
Sample request:
POST [indicium]/iam/sf/add_job_to_do_complete_creation
{
"model_id": "MY_MODEL",
"branch_id": "1.12",
"execute_complete_creation": 0,
"model_vrs_name": "1.13",
"generate_definition": true,
"generate_definition_error_handling": 1,
"validate_definition": true,
"validate_definition_error_handling": 3,
"generate_source_code": true,
"write_code_files": false,
"write_prog_objects": false,
"upgrade_method": 0,
"execute_source_code": false,
"execute_unit_tests": false,
"execute_smoke_test": false,
"run_sync": true,
"sync_run_type": 0,
"sync_target_iam_id": 1,
"debug": 1
}
Automate 'Generate definition'
Use the following parameters to call add_job_to_generate_definition:
| Parameter | Description | Possible values |
|---|---|---|
model_id | The ID of the model for which you want to generate the definitions. | Example: MY_MODEL |
branch_id | The branch ID. | Example: 1.12 |
error_handling | What happens when a control procedure fails to execute properly while the definition is generated. | - 0 = Pause and await user input- 1 = Skip the control procedure in error and continue- 2 = Abort generate definition |
debug | Logs when the branch is 'locked' and 'unlocked', and actions taken by the user after a process step has failed. | - 1 = Enabled- 0 = Disabled |
Sample request:
POST [indicium]/iam/sf/add_job_to_generate_definition
{
"model_id": "MY_MODEL",
"branch_id": "1.12",
"error_handling": 1,
"debug": 1
}
Automate 'Validate definition'
Use the following parameters to call add_job_to_validate_all:
| Parameter | Description | Possible values |
|---|---|---|
model_id | The ID of the model for which you want to validate the definition. | Example: MY_MODEL |
branch_id | The branch ID. | Example: 1.12 |
validation_type | Allows execution of specific validation types. Leave empty to execute all validations. | - 0 = Model- 1 = Branching- 2 = Requirements- 3 = Datamodel- 4 = User interface- 5 = Process flows- 6 = Application logic- 7 = Documentation- 8 = Dynamic model- 9 = Validation- 10 = Functionality- 11 = Generation- 12 = Test- 13 = All (not: 'all validations', but: validation type 'All')- 14 = Subroutines- 15 = Access control |
POST [indicium]/iam/sf/add_job_to_validate_all
{
"model_id": "MY_MODEL",
"branch_id": "1.12",
"validation_type": null
}
Automate 'Generate source code'
Use the following parameters to call add_job_to_generate_code:
| Parameter | Description | Possible values |
|---|---|---|
model_id | The ID of the model for which you want to generate the source code. | Example: MY_MODEL |
branch_id | The branch ID. | Example: 1.12 |
upgrade_method | Determines the method for generating source code. See Generation method. | - 0 = Smart- 1 = Full |
write_code_files | Whether to write code files to storage. | - 0 = No- 1 = Yes |
write_prog_objects | Whether to write program objects to storage. | - 0 = No- 1 = Yes |
store_offline_logic | Rarely used. Only for program objects containing code groups with JavaScript. | - 0 = No- 1 = Yes |
Sample request:
POST [indicium]/iam/sf/add_job_to_generate_code
{
"model_id": "MY_MODEL",
"branch_id": "1.12",
"upgrade_method": 0
}
Automate 'Source code execution'
Use the following parameters to call add_job_to_execute_source_code or connect_to_db:
| Parameter | Description | Possible values |
|---|---|---|
model_id | The ID of the model for which you want to execute the source code. | Example: MY_MODEL |
branch_id | The branch ID. | Example: 1.12 |
runtime_configuration_id | The target for the source code execution. Note: this has to be the exact name of the runtime configuration as configured in the Software Factory. You cannot use an application id or application alias. | Example: default |
error_handling | What happens when a control procedure fails to execute properly while the code files are executed. | - 0 = Abort the code execution- 1 = Ignore the current code file and resume execution from the next code file- 2 = Retry the current code file and resume execution from the next statement after the error occurred- 3 = Suspend the code execution and wait for user input |
Sample request:
POST [indicium]/iam/sf/add_job_to_execute_source_code
Or, to start the Source code execution job using Connect:
POST [indicium]/iam/sf/connect_to_db
For both options:
{
"model_id": "MY_MODEL",
"branch_id": "1.12",
"runtime_configuration_id": "default",
"error_handling": 1
}
Automate 'Unit test execution'
Use the following parameters to call add_job_to_test_unit_test (all unit tests). Inactive unit tests will not be executed.
| Parameter | Description | Possible values |
|---|---|---|
model_id | The ID of the model for which you want to execute the unit tests. | Example: MY_MODEL |
branch_id | The branch ID. | Example: 1.12 |
runtime_configuration_id | The target for the source code execution. Note: this has to be the exact name of the runtime configuration as configured in the Software Factory. You cannot use an application id or application alias. | Example: default |
Sample request:
POST [indicium]/iam/sf/add_job_to_test_unit_test
{
"model_id": "MY_MODEL",
"branch_id": "1.12",
"runtime_configuration_id": "default"
}
Automate 'Smoke test execution'
Use the following parameters to call add_job_to_run_smoke_tests.
| Parameter | Description | Possible values |
|---|---|---|
model_id | The ID of the model for which you want to execute the unit tests. | Example: MY_MODEL |
branch_id | The branch ID. | Example: 1.12 |
runtime_configuration_id | The target for the source code execution. Note: this has to be the exact name of the runtime configuration as configured in the Software Factory. You cannot use an application id or application alias. | Example: default |
Sample request:
POST [indicium]/iam/sf/add_job_to_run_smoke_tests
{
"model_id": "MY_MODEL",
"branch_id": "1.12",
"runtime_configuration_id": "default"
}
If you use a SQL query to execute this task, remove the host and db_name parameters from the execution query.
Automate Synchronization to IAM
This chapter describes how to automate the synchronization to IAM.
For more information on the Synchronization process and how to run it in the user interface, see Synchronization to IAM.
Generate synchronization scripts
Generating synchronization scripts is a prerequisite for synchronizing to either IAM or storage. During script generation, the synchronized model is automatically verified to ensure the quality and integrity of the model. For more information, see Verify synchronization.
Use the following parameters to call add_job_to_generate_sync_objects:
| Parameter | Description | Possible values |
|---|---|---|
vrs_name | The version name of the model for which you want to generate the synchronization scripts. | Example: 1.13 |
model_id | The ID of the model for which you want to generate the synchronization scripts. | Example: MY_MODEL |
branch_id | The branch ID. | Example: 1.12 |
sync_all_modules | Only if a model includes modules, select if all modules should be included. | - 1 = Yes- 0 = No |
deployment_modules | Only if a model includes modules, select if you wish to include a collection of modules. If you select a collection of modules, set parameter sync_all_modules to 0.If this parameter is empty and sync_all_modules equals 0, then the last configuration of modules will be used. | Example: <deployment_module_id>Module1</deployment_module_id><deployment_module_id>Module2</deployment_module_id><deployment_module_id>Module3</deployment_module_id> |
Sample request:
POST [indicium]/iam/sf/add_job_to_generate_sync_objects
{
"vrs_name": "1.13",
"model_id": "MY_MODEL",
"branch_id": "1.12",
"sync_all_modules": 1,
"deployment_modules": null
}
Automate task Synchronize to IAM
After generating the synchronization scripts as described above, you can start the synchronization to IAM:
Use the following parameters to call add_job_to_sync_to_iam:
| Parameter | Description | Possible values |
|---|---|---|
vrs_name | The version name of the model for which you want to synchronize to IAM. | Example: 1.13 |
model_id | The ID of the model you want to synchronize to IAM. | Example: MY_MODEL |
branch_id | The branch ID. | Example: 1.12 |
sync_target_iam_id | Requires the unique identifier of the IAM configuration. Note: this has to be the exact value of the IAM configuration as configured in the Software Factory. | Example: 1 |
POST [indicium]/iam/sf/add_job_to_sync_to_iam
{
"vrs_name": "1.13",
"model_id": "MY_MODEL",
"branch_id": "1.12",
"sync_target_iam_id": 1
}
Automate task Synchronize to storage
After generating the synchronization scripts as described above, you can start the synchronization to storage.
Use the following parameters to call add_job_to_sync_to_disk:
| Parameter | Description | Possible values |
|---|---|---|
model_id | The ID of the model you want to synchronize to storage. | Example: MY_MODEL |
vrs_name | Add the name of the model version to write the synchronization scripts to an alternate path. The scripts will be written to \\server\base_path\model\model_vrs_name instead of ...\branch. | Example: 1.13 |
branch_id | The branch ID. | Example: 1.12 |
deployment_package | Decides if the job is used for a deployment package and therefore written to the Deploy folder instead of the root of the model specification folder. | - 1 = Yes- 0 = No |
Sample request:
POST [indicium]/iam/sf/add_job_to_sync_to_disk
{
"model_id": "MY_MODEL",
"vrs_name": "1.13",
"branch_id": "1.12",
"deployment_package": 0
}
Automate the creation of a deployment package
Use the following parameters to call the task_start_deployment_package:
| Parameter | Description | Possible values |
|---|---|---|
model_id | The ID of the model you want to create the deployment package for. | Example: MY_MODEL |
model_vrs_name | The version name of the model for which you want to create the deployment package. | Example: 1.13 |
branch_id | The branch ID. | Example: 1.12 |
upgrade_method | Determines the method for generating source code. See Generation method. | - 0 = Smart- 1 = Full |
deployment_note | Optional. The reason why you create the deployment package. | Example: The reason why you create the deployment package. |
Sample request:
POST [indicium]/iam/sf/start_deployment_package
{
"model_id": "MY_MODEL",
"model_vrs_name": "1.13",
"branch_id": "1.12",
"upgrade_method": 0,
"deployment_note": "The reason why you create the deployment package."
}
Responses
Deployment automation calls only queue the job and respond with a 200 - OK directly after. Only when you start the synchronization via the API, the created
job_id is returned.
Automate the creation of the infrastructure
In certain cases, for example, if you want to deploy your application to multiple tenants, you might also want to automate the configuration of the infrastructure.
For an overview of third-party tools that you can use to do this, see Configuration management.