Chore: Upgrade Jenkins-job-builder to 6.3.0
[releng/global-jjb.git] / docs / jjb / lf-openstack-heat.rst
1 ##############
2 OpenStack Heat
3 ##############
4
5 This section contains a series of macros for projects that need to spin up full
6 test labs using HEAT scripts.
7
8 Job Setup
9 =========
10
11 The 2 macros :ref:`lf-stack-create` & :ref:`lf-stack-delete` are companion
12 macros and used together when constructing a job template that needs to spin up
13 a full integration lab using Heat Orchestration Templates (HOT).
14
15 Example Usage:
16
17 .. code-block:: yaml
18
19    - job-template:
20        name: csit-test
21
22        #####################
23        # Default variables #
24        #####################
25
26        openstack-cloud: vex
27        openstack-heat-template: csit-2-instance-type.yaml
28        openstack-heat-template-dir: 'openstack-hot'
29
30        odl_system_count: 1
31        odl_system_flavor: odl-highcpu-4
32        odl_system_image: ZZCI - CentOS 7 - builder - x86_64 - 20181010-215635.956
33        tools_system_count: 1
34        tools_system_flavor: odl-highcpu-2
35        tools_system_image: ZZCI - Ubuntu 16.04 - mininet-ovs-25 - 20181029-223449.514
36
37        #####################
38        # Job configuration #
39        #####################
40
41        builders:
42          - lf-infra-pre-build
43          - lf-stack-create:
44              openstack-cloud: '{openstack-cloud}'
45              openstack-heat-template: '{openstack-heat-template}'
46              openstack-heat-template-dir: '{openstack-heat-template-dir}'
47              openstack-heat-parameters: |
48                  vm_0_count: '{odl_system_count}'
49                  vm_0_flavor: '{odl_system_flavor}'
50                  vm_0_image: '{odl_system_image}'
51                  vm_1_count: '{tools_system_count}'
52                  vm_1_flavor: '{tools_system_flavor}'
53                  vm_1_image: '{tools_system_image}'
54
55        publishers:
56          - lf-stack-delete:
57              openstack-cloud: '{openstack-cloud}'
58
59
60 Macros
61 ======
62
63 .. _lf-stack-create:
64
65 lf-stack-create
66 ---------------
67
68 Creates an OpenStack stack as configured by the job. Name pattern of stack is
69 ``$SILO-$JOB_NAME-$BUILD_NUMBER``.
70
71 Requires ``lf-infra-pre-build`` macro to run first to install the
72 ``openstack`` and ``lftools`` packages.
73
74 Requires a Config File Provider configuration for clouds.yaml named
75 ``clouds-yaml``.
76
77 :Required Parameters:
78
79     :openstack-cloud: The ``OS_CLOUD`` variable to pass to OpenStack client.
80         (Docs: https://docs.openstack.org/python-openstackclient)
81     :openstack-heat-template: Name of template file to use when running stack
82         create.
83     :openstack-heat-template-dir: Directory in the ci-management repo
84         containing the OpenStack heat templates.
85
86 Example:
87
88 .. literalinclude:: ../../.jjb-test/lf-openstack/lf-stack-create-minimal.yaml
89
90 .. _lf-stack-delete:
91
92 lf-stack-delete
93 ---------------
94
95 Deletes the stack associated with this job. Name pattern of stack is
96 ``$SILO-$JOB_NAME-$BUILD_NUMBER``.
97
98 Requires ``lf-infra-pre-build`` macro to run first to install the
99 ``openstack`` and ``lftools`` packages.
100
101 Requires a Config File Provider configuration for clouds.yaml named
102 ``clouds-yaml``.
103
104 :Required Parameters:
105
106     :openstack-cloud: The ``OS_CLOUD`` variable to pass to OpenStack client.
107         (Docs: https://docs.openstack.org/python-openstackclient)
108
109 Example:
110
111 .. literalinclude:: ../../.jjb-test/lf-openstack/lf-stack-delete-minimal.yaml