Downloading compact Git repositories
Schematics workspaces act as a container of a Terraform template with the input data, output state, jobs, and job log files. The workspace uses the Git URL of the Terraform template. For example, if the user provides the URL https://github.com/terraform-ibm-modules/terraform-ibm-database/tree/main/examples/simple-etcd
to download and securely store the template files. The default execution of the Schematics is to download the whole Git repository and to save securely. Schematics assumes that the Terraform templates have relative references to modules, script,
or data files that reside in other folders in the repository.
However, sometimes, the user may be aware that the Terraform templates are isolated to a specific folder and its sub directory
, for example, examples/simple-etcd
in the Git repository. Now the user wants the workspace
to download, only the relevant files from the Git repository. This can be achieved by using the compact download feature. The compact download feature improves the time it takes to download, and process the files from the Git
repository while creating, or updating the workspace.
Using compact download
You can activate compact download feature through console
by unchecking the Download entire repo
checkbox on the Create a Schematics workspace page. By
default, the checkbox is selected to download the full Git repository.
You can also activate compact download through the API or CLI
by using compact
field in the workspace create, or update payload, as illustrated in the code block.
{
"name": "Testmyservice",
"type": [
"terraform_v1.4"
],
"description": "Create Terraform workspace to test compact feature",
"tags": [
"test:bbbranch"
],
"template_repo": {
"url": "https://github.com/IBM-Cloud/terraform-provider-ibm/tree/master/examples/ibm-resource-instance"
},
"template_data": [{
"folder": ".",
"compact": true,
"type": "terraform_v1.4"
}]
}
Note
- In case the compact field is not specified in the workspace create request payload, the default execution is
full repository download
orcompact : false
. - In case the compact field is absent in the workspace update request payload, the default execution uses the previous
compact
setting. - Git repository URL is mandatory in both create, or update workspace request payload only if compact flag is set.
- The GET workspace response includes the compact field, only if the compact download mode is enabled.
- If the Git repository URL is the root of the repository, as stated in this template, the compact download, and full download are the exact same thing. It doesn't matter if the compact
checkbox is
checked
orunchecked
.