Our Openstack Heat Plugin is now hosted on the official Jenkins Github Repository : https://github.com/jenkinsci/openstack-heat-plugin
Go check it, the lastest news are available on this repo.
Openstack Heat is a Jenkins plugin that allows to interact with OpenStack by using the Heat API.
When you configure a project, you can add a step build HOT player. At this time, you can choose a tenant/yaml file/env file from differents lists.
When a selection is done, the plugin generates automatically the interface from the differents parameters (yaml file, env file...) and you can configure the heat interactions. You can create differents HOT player steps and exchange data between them.
When the job is launched, the plugin calls OpenStack via the Heat API with the configuration and the Jenkins console shows the outputs from the interaction.
The plugin can be install with the differents methods described in the Jenkins documentation : Jenkins Plugins - How to install plugins
- OpenStack Configuration
This section permits to add one or more OpenStack platform(s) by the button Add a new Project(Tenant) configuration.
You need to fill the fields :
- Project(Tenant) OpenStack : Project (Tenant) associated with the identification.
- URL Identity OpenStack : Url to access the identity service.
- Identity V3 : If the identity uses v3, the check box permits to configure the domain.
- Domain : domain used for the identification.
- User OpenStack : User to identify on the project(tenant).
- Password OpenStack : password associated.
Test connection : This button permits to test the parameters by creating a connection.
Delete : This button permits to delete this configuration panel.
Add a new Project(Tenant) configuration : this button permits to add multiple projects(tenants) to deploy on different OpenStack.
- Project(Tenant) OpenStack : Project (Tenant) associated with the identification.
- OpenStack Time Configuration
This section permits to configure the differents timeout associated with OpenStack Heat API.
- Polling Status OpenStack (s) : This input allows to put the interval in seconds in order that the plugin checks the status of a stack in openstack. By default, the time is 20 seconds.
- Timeout Operation OpenStack (s) : This input allows to put the interval in seconds in order that the operation via Heat falls in timeout. By default, the time is 15 minutes (900 s).
- Polling Status OpenStack (s) : This input allows to put the interval in seconds in order that the plugin checks the status of a stack in openstack. By default, the time is 20 seconds.
- Heat Orchestration Template (HOT) Loader Settings
This section allows to choose a loader to consume the HOT data.
A loader is divided in two distincts parts:
- The configuration to load the files yaml to manage stack, this is mandatory.
- The configuration to load optional files env to facilitate sending parameters via the client OpenStack to manage the stacks.
Currently, it exits two defaults loaders. - LoaderFromDir:
- Path to the directory Heat Template : The absolute path (in the same physical machine that hosting Jenkins server) to the repository containing the yaml files.
- Extension for the Heat Template File : The extension associated with the yaml files.<br/
- Test Path Hot : This button permits to test the yaml files configuration.
- Use optional path to the directory Env File : When you check this box, you can configure the optional files env.
- Path to the directory Env : The absolute path (in the same physical machine that hosting Jenkins server) to the repository containing the env files.
- Extension for the Env File : The extension associated with the env files.
- Default full Env filename : You can indicate a file by default. The plugin tries to find an env file with the same name of the hot file else it uses the default or nothing if this field is empty.
- Test Path Env : This button permits to test the env files configuration.
- Path to the directory Heat Template : The absolute path (in the same physical machine that hosting Jenkins server) to the repository containing the yaml files.
- LoaderHttpREST:
- Url to access to the Hots files list: The url to access at the list of the yaml file. The format is an array json. You can find an example (listHots) in the package /openstack.heat/src/test/resources/com/arkea/jenkins/openstack/heat/yaml.
- Test Url Hot : This button permits to test the url yaml files configuration.
- Url to get the Hots detail: The url to access at the detail of an yaml file. The name of the desired yaml file is added at this url for the loading.
- Use optional url to Envs File:When you check this box, you can configure the optional files env.
- Url to access to the Envs files list: The url to access at the list of the yaml file. The format is an array json. You can find an example (listEnvs) in the package /openstack.heat/src/test/resources/com/arkea/jenkins/openstack/heat/yaml.
- Test Url Env : This button permits to test the url env files configuration.
- Url to get the Envs detail: The url to access at the detail of an env file. The name of the desired env file is added at this url for the loading.
- Default full Env filename: You can indicate a file by default. The plugin tries to find an env file with the same name of the hot file else it uses the default or nothing if this field is empty.
- Url to access to the Hots files list: The url to access at the list of the yaml file. The format is an array json. You can find an example (listHots) in the package /openstack.heat/src/test/resources/com/arkea/jenkins/openstack/heat/yaml.
- The configuration to load the files yaml to manage stack, this is mandatory.
If the global configuration is done and all is correct, then in a free-style project you can see the item Heat Orchestration Template (HOT) player in the list build step.
If you have configured many projects, a selectbox appears to choose which project you want to use. Otherwise, if you have only one project, it's selected by default without selectbox.
The Heat Orchestration Template (HOT) player allows to play HOT file to OpenStack.
The HOT player load the HOT file choose in the selectbox and generate dynamically the inputs.
If the Associate Env File is configured than the selectbox permits to choose one file env file.
By default when you choose a HOT file, the selectbox Associate Env File tries to select the same env file name if it exits or the default env file if it is configured.
The inputs are divided in 3 categories :
- Properties:
- Stack name : corresponding to the the name used in OpenStack.
- Delete stack if already exists ? : if you want reuse the same name for a stack, the plugin destroys the stack if already exits.
- Debug mode ? : if it's checked than the console print all the differents values parameters.
- Stack name : corresponding to the the name used in OpenStack.
- Parameters:
- This category is generated dynamically from the differents parameters present in the HOT.
- This category is generated dynamically from the differents parameters present in the HOT.
- Outputs:
- This category is generated dynamically from the differents outputs present in the HOT.
- This category is generated dynamically from the differents outputs present in the HOT.
You can use variable environment in each input. The variable must be start with "$" without "-".
![HOT Step HOT Configuration](./doc/images/step_hot_configuration.png)
If you fly over the help's icon from the _Associate Env File_ when an entry is selected, you can watch the content of the file.
![HOT Step Env Help](./doc/images/step_env_help.png)
When the job is launched, you can follow the interactions between Jenkins and Openstack in the console. If you have checked the debug mode, the outputs are more verbose.
If the job have a problem, the console shows the stacktrace.
You need Java 7 and Maven 3 (3.3.1 minimum) to develop on your computer.
The first step consists to extract the source via the command git clone.
If you need to clean the project, you can do that via the command mvn clean and by deleting the work directory.
If you want import the project under Eclipse, you need to launch mvn eclipse:eclipse under a terminal in the project's directory.
After, you just import the project via the menu File/Import.../Existing Projects into Workspace under Eclipse.
On a terminal, you can launch a jenkins to test the plugin via the command : mvn hpi:run -Djetty.port=8080. You can choose the port.
If you want to debug the plugin, you need to create a debug configuration under Eclipse via the menu Run/Debug configurations.../Remote Java Application/New. Select the openstack.heat project.
After jenkins runs, under Eclipse, launch the previous configuration. If you put a breakpoint, you can debug the code under Eclipse.
The source have some tests. If you want to pass them, it's via the command : mvn test.
If you want to launch a specific test, execute the command : mvn -Dtest=ClassNameTest test where ClassNameTest equals the single class test.
If you want to debug the test, you need to create a debug configuration under Eclipse via the menu Run/Debug configurations.../Remote Java Application/New. Select the openstack.heat project and change the port to 5005.
You need to launch the application via the command : mvn -Dmaven.surefire.debug test.
During the launching, the starter wait a connection to the debug port, so under Eclipse, launch the previous configuration. If you put a breakpoint, you can debug the code under Eclipse.
It is possible to combine the twice, for example : mvn -Dtest=ClassNameTest -Dmaven.surefire.debug test
Copyright 2015 Credit Mutuel Arkea
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.