Skip to content

Commit

Permalink
Merged with latest version
Browse files Browse the repository at this point in the history
  • Loading branch information
jdewinne committed Feb 20, 2015
2 parents 7a5566a + 0dc2d06 commit 4519539
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 33 deletions.
30 changes: 17 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,28 @@

This document describes the functionality provided by the xlr-xlr-plugin.

See the **XL Release Reference Manual** for background information on XL Release and release concepts.
See the **[XL Release Documentation](https://docs.xebialabs.com/xl-release/index.html)** for background information on XL Release and release concepts.

# Overview #

The xlr-xlr-plugin is a XL Release plugin that allows to
* invoke (create and start) another template from an existing template. So you can call from a parent template a subtemplate.
* create a template and associate users/groups to teams within that template
The xlr-xlr-plugin is an XL Release plugin that allows you to:
* programmatically create a template and assign tags to it
* create and start another release from an existing release. So you can create a subrelease from a parent release
* programmatically delete phases in the current release

For XL Release version 4.5.0 and upwards you'll need at least version 1.5 of the plugin.
For XL Release version 4.5.x you'll need at least version 1.5 of the plugin.

## Types ##

+ Create and Start SubRelease
* `templateName`: Name of the template to invoke (`string`)
* `releaseTitle`: Name of the sub release instance (`string`)
* `releaseDescription`: Description of the sub release (`string`)
* `variables`: Comma separated key value pairs, e.g. key1=value1,key2=value2 (`string`)
## Tasks ##
+ Create and Start SubRelease
* `templateName`: Name of the template from which to create the subrelease (`string`)
* `releaseTitle`: Name of the subrelease (`string`)
* `releaseDescription`: Description of the subrelease (`string`)
* `variables`: Comma-separated key-value pairs for the values of variables required by the subrelease, e.g. var1=value1,var2=value2 (`string`)

+ Create Template
* `templateName`: Name of the template to create (`string`)
* `tags`: Comma separated list of tags to associate with this template e.g. tag1,tag2 (`string`)
* `tags`: Comma-separated list of tags to associate with this template e.g. tag1,tag2 (`string`)

+ Delete Phases
* `phases`: Comma-separated list of names of phases in the current release to delete e.g. phase1,phase2 (`string`)
* **This task requires XL Release 4.5.0 or higher**
30 changes: 13 additions & 17 deletions src/main/resources/synthetic.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,33 @@
-->
<synthetic xsi:schemaLocation="http://www.xebialabs.com/deployit/synthetic synthetic.xsd" xmlns="http://www.xebialabs.com/deployit/synthetic" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<type type="xlr.CreateAndStartSubRelease" extends="xlrelease.PythonScript">
<property name="scriptLocation" default="xlr/CreateAndStartSubRelease.py" hidden="true" />
<type type="xlr.XlrControlTask" extends="xlrelease.PythonScript" virtual="true">
<property name="iconLocation" default="xlr/xlr.png" hidden="true" />

<property name="xlrServer" category="input" label="Server" referenced-type="xlr.Server" kind="ci"/>
<property name="username" category="input" label="username" required="true" />
<property name="password" password="true" category="input" required="true" />
<property name="xlrServer" category="input" label="Server" referenced-type="xlr.Server" kind="ci" />
<property name="username" category="input" />
<property name="password" password="true" category="input" />
</type>

<type type="xlr.CreateAndStartSubRelease" extends="xlr.XlrControlTask">
<property name="templateName" category="input" label="Template Name" required="true" />
<property name="releaseTitle" category="input" label="Release Title" required="true" />
<property name="releaseDescription" category="input" label="Release Description" required="false" />
<property name="variables" category="input" required="false" />

<property name="status" category="output"/>
<property name="status" category="output" />
</type>

<type type="xlr.CreateTemplate" extends="xlrelease.PythonScript">
<property name="scriptLocation" default="xlr/CreateTemplate.py" hidden="true" />
<property name="iconLocation" default="xlr/xlr.png" hidden="true" />
<property name="xlrServer" category="input" label="Server" referenced-type="xlr.Server" kind="ci"/>
<property name="username" category="input" label="username" required="true" />
<property name="password" password="true" category="input" required="true" />

<type type="xlr.CreateTemplate" extends="xlr.XlrControlTask">
<property name="templateName" category="input" label="Template Name" required="true" />
<property name="tags" category="input" required="false" />

<property name="templateId" category="output"/>
<property name="templateId" category="output" />
</type>

<type type="xlr.Server" extends="configuration.HttpConnection"/>


<type type="xlr.DeletePhases" extends="xlr.XlrControlTask">
<property name="phases" category="input" description="Comma-seperated list of phases to delete" />
</type>

<type type="xlr.Server" extends="configuration.HttpConnection" />
</synthetic>
4 changes: 1 addition & 3 deletions src/main/resources/xlr/CreateTemplate.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,4 @@ def processTags(tags):
else:
print "Failed to create Template in XLR"
xlrResponse.errorDump()
sys.exit(1)


sys.exit(1)
35 changes: 35 additions & 0 deletions src/main/resources/xlr/DeletePhases.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#
# THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS
# FOR A PARTICULAR PURPOSE. THIS CODE AND INFORMATION ARE NOT SUPPORTED BY XEBIALABS.
#

import sys, string, time, urllib
import com.xhaus.jyson.JysonCodec as json

if xlrServer is None:
print "No server provided."
sys.exit(1)

xlrUrl = xlrServer['url']
xlrUrl = xlrUrl.rstrip("/")

credentials = CredentialsFallback(xlrServer, username, password).getCredentials()

phases = phases.split(",")
idlist = []

# find any matching phase in the existing release (release.id)
request = HttpRequest({'url': xlrUrl}, credentials['username'], credentials['password'])
response = request.get('/releases/' + release.id.split("/")[1], contentType = 'application/json')

releasedata = json.loads(response.response)
for phaseToDelete in phases:
for phase in releasedata['phases']:
if phase['title'] == phaseToDelete:
idlist.append(phase['id'])

# Delete all relevant phases from the release

for id in idlist:
response = request.delete('/phases/' + id, contentType = 'application/json')

0 comments on commit 4519539

Please sign in to comment.