This example demonstrates how to use the skip-deploy: true/false parameter at the module level in an MTA descriptor (mta.yaml).
You may want to include modules or resources in your MTA that should not always be deployed. The skip-deploy parameter allows you to control deployment per module, while the active attribute allows you to control deployment per resource:
-
skip-deploy: true— The module will be skipped during deployment. -
skip-deploy: false— The module will be deployed as usual.
For resources, see active-optional-resources section
The functionalities for skipping modules and resources are similar: use skip-deploy for modules and active for resources to conditionally include or exclude them during deployment.
...
modules:
- name: app-to-deploy
type: application
path: appBits.zip
parameters:
skip-deploy: false # This is the default value, can be omitted
- name: app-to-skip
type: application
path: appBits.zip
parameters:
skip-deploy: trueIn this example, only app-to-deploy will be deployed. app-to-skip will be ignored by the deployment process.
To build and deploy this MTA example, use the following commands:
-
Build the MTA archive (requires Cloud MTA Build Tool):
mbt build
This will generate an
.mtarfile in themta_archivesdirectory. -
Deploy the MTA archive to Cloud Foundry (requires MultiApps CF CLI Plugin):
cf deploy mta_archives/<your-mta-archive>.mtar
Replace
<your-mta-archive>with the actual file name generated by the build step.
$ cf mta skip-app-deploy
Showing health and status for multi-target app skip-app-deploy-example in org ********** / space ******** as **********...
OK
Version: 0.0.1
Namespace:
Apps:
name requested state instances memory disk urls
app-to-deploy STARTED 1/1 19.4M 5.3M orgname-spacename-app-to-deploy.example.com
Services:Validate that only the app-to-deploy is listed as started, while app-to-skip is not deployed.
You can also skip deployment of a module by setting skip-deploy: true in an extension descriptor (.mtaext). This is useful for environment-specific deployments.
skip-app.mtaext)_schema-version: '3.1'
ID: skip-app-deploy-ext
extends: skip-app-deploy-example
version: 0.0.1
modules:
- name: app-to-deploy
parameters:
skip-deploy: true
- name: app-to-skip
parameters:
skip-deploy: falseTo use the extension descriptor during deployment:
cf deploy mta_archives/<your-mta-archive>.mtar -e skip-app.mtaextThis will skip deployment of app-to-deploy and deploy app-to-skip as specified in the extension descriptor.
See skip-app.mtaext in this directory for the real file example.
-
For conditional deployments
-
For development/test scenarios
-
To keep modules in the descriptor but exclude them from certain deployments
-
When partial build/deploy is not usable (see the partial-build-deploy example in this project) for example transport scenarios with Cloud Transport Management Service, where partial deploy is not an option. In these cases,
skip-deployprovides fine-grained control over which modules are deployed.