-
Couldn't load subscription status.
- Fork 70
Creating new templates
IMPORTANT: make sure you're familiar with template development guide
Let's create sag-mytemplate template!
- Fork this project and clone it locally
- Create a new folder for the template
mkdir templates/sag-mytemplate - Create a new
templates/sag-mytemplate/template.yamlfile with the initial minimal content like this:
alias: sag-mytemplate description: My template environments: default: templates: mytemplate: fixes: [] <MY_PRODUCT_ID>: layers: runtime: productRepo: ${repo.product} # default repository to install products from fixRepo: ${repo.fix} # default repository to install fixes from templates: - mytemplate provision: default: runtime: ${nodes} # apply to selected nodes -
Import, apply and test template application
-
Add a smoke test as
templates/sag-mytemplate/test.sh. The smoke test should validate the template application by asserting the following aspects:
- Required products are installed/present
- Required fixes are installed/present. NOTE: this might be difficult to assert if fixes are optional
- The runtime instance can be successfully started and the runtime status is
ONLINE - Configurations, if provided, are successfully applied
- Runtime is alive
A typical example of test.sh if provided below:
#!/bin/sh -e # if managed image if [ -d $SAG_HOME/profiles/SPM ] ; then # point to local SPM export CC_SERVER=http://localhost:8092/spm echo "Verifying managed container $CC_SERVER ..." sagcc get inventory products -e <MY_PRODUCT_ID> --wait-for-cc export CC_WAIT=5 echo "Verifying fixes ..." sagcc get inventory fixes echo "Verifying instances ..." sagcc get inventory components -e <MY_COMPONENT_ID> echo "Start the instance ..." sagcc exec lifecycle components <MY_COMPONENT_ID> start -e "DONE" --sync-job echo "Verifying status ..." sagcc get monitoring runtimestatus <MY_COMPONENT_ID> -e ONLINE -w 60 echo "Verifying configs ..." sagcc get configuration data <MY_COMPONENT_ID> <MY_CONFIG_ID> -f text -e <CONFIG_VALUE> fi # echo "Verifying product runtime using REST API, if avaiable ..." # curl -s http://`hostname`:<PORT>/<PRODUCT_API> echo "TEST SUCCESSFUL"TIP: Please see
test.shshipped with other templates for a reference implementation
Perform template application and execute test.sh at the end:
- Add
templates/sag-mytemplate/README.md.
The minimal content looks like this:
# My Template > STATUS: INCUBATING Use this template to provision <My Product> 10.1 and higher. ## Requirements ### Supported Software AG releases * Command Central 10.1 and higher * <My Product> 10.1 and higher ### Supported platforms All supported Windows and UNIX platforms. ### Supported use cases * Provisioning of new environments * Installing latest fixes ## Running as a composite template ``bash sagcc exec templates composite apply sag-mytemplate nodes=node \ my.param=value \ repo.product=products \ repo.fix=fixes \ --sync-job --wait 600 `` TIP: Please see examples of the README files that come with other templates.
-
Commit to your forked repo
-
Please develop the template according to the Template requirements and guidelines
-
Open pull request against the main repo