-
Notifications
You must be signed in to change notification settings - Fork 70
Creating new templates
Sergei Pogrebnyak edited this page Apr 30, 2018
·
10 revisions
Let's create sag-mytemplate
template!
- Create a new branch
git checkout -b sag-mytemplate
- Create a new folder for the template
mkdir templates/sag-mytemplate && cd templates/sag-mytemplate
- Create a new
template.yaml
file with the initial minimal content like this:
alias: sag-mytemplate
description: My template
environments:
default:
templates:
my:
layers:
runtime:
productRepo: ${repo.product} # default repository to install products from
fixRepo: ${repo.fix} # default repository to install fixes from
templates:
- my
provision:
default:
runtime: ${nodes} # apply to selected nodes
- Create empty
env.properties
file - Create
docker-compose.yml
file with the minimal content like this:
version: "3.2"
networks:
default:
external:
name: sagdevopstemplates_default
services:
node: # empty managed node to provision to for dev/test
image: ${NODE_IMAGE}
environment:
- CC_AUTO_REGISTER=0
provision: # perform provision and smoke test
image: ${CLIENT_IMAGE}
volumes:
- ./:/src/
environment:
- CC_SERVER
- CC_WAIT=1200
- CC_CHECK_EVERY=10
depends_on:
- node # starts an empty node
command: >
bash -c '
echo "Register the node and wait until ready ..." &&
sagcc add landscape nodes alias=${COMPOSE_PROJECT_NAME} url="${COMPOSE_PROJECT_NAME}_node_1" -e OK --wait-for-cc &&
sagcc list landscape nodes ${COMPOSE_PROJECT_NAME} -e ONLINE &&
echo "Apply the template ..." &&
sagcc exec templates composite apply sag-mytemplate -e DONE --sync-job -i env.properties nodes=${COMPOSE_PROJECT_NAME} repo.product=products repo.fix=fixes
'
- Run provisioning service to test template application:
docker-compose run --rm provision