Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/main/resources/synthetic.xml
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,9 @@
<property name="scriptLocation" default="xlr_xldeploy/getAllVersionsTask.py" hidden="true"/>
<property name="applicationId" category="input" label="Application ID" required="true"/>
<!-- <property name="stripApplications" category="input" kind="boolean" /> -->
<property name="throwOnFail" category="input" kind="boolean" label="Throw on Fail"
description="If True, the Task will fail if the CI doesn't exist" default="false"/>
<property name="throwOnFail" category="input" kind="boolean" label="Throw on Fail" description="If True, the Task will fail if the CI doesn't exist" default="false"/>
<property name="recurse" category="input" kind="boolean" label="Recursive" description="If True, recurses through child directories" default="false"/>
<property name="target_list_box" category="input" kind="string" label="List Box" description="If you wish to populate a List Box, provide the existing release variable name here (without ${ or })"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this not be an output property?


<property name="packageIds" category="output" kind="list_of_string" label="Package IDs"/>
</type>
Expand Down
35 changes: 27 additions & 8 deletions src/main/resources/xlr_xldeploy/XLDeployClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,15 +303,34 @@ def get_latest_package_version(self, application_id):
latest_package = items[-1].attrib['ref']
return latest_package

def get_all_package_version(self, application_id):
query_task = "/deployit/repository/query?parent=%s&resultsPerPage=-1" % application_id
query_task_response = self.http_request.get(query_task, contentType='application/xml')
root = ET.fromstring(query_task_response.getResponse())
items = root.findall('ci')
def get_all_package_version(self, application_id,recurse=False):
noMoreDirectories = False
all_package = list()
for item in items:
all_package.append(item.attrib['ref'])
return all_package
directories = list()
if recurse == False:
query_task = "/deployit/repository/query?parent=%s&resultsPerPage=-1" % application_id
query_task_response = self.http_request.get(query_task, contentType='application/xml')
root = ET.fromstring(query_task_response.getResponse())
items = root.findall('ci')
for item in items:
all_package.append(item.attrib['ref'])
return all_package
else:
while noMoreDirectories == False:
query_task = "/deployit/repository/query?parent=%s&resultsPerPage=-1" % application_id
query_task_response = self.http_request.get(query_task, contentType='application/xml')
root = ET.fromstring(query_task_response.getResponse())
items = root.findall('ci')
for item in items:
if item.attrib['type'] == 'core.Directory':
directories.append(item.attrib['ref'])
else:
all_package.append(item.attrib['ref'])
if len(directories) >= 1:
application_id = directories.pop(0)
else:
noMoreDirectories = True
return all_package

def get_latest_deployed_version(self, environment_id, application_name):
query_task_response = self.get_ci("%s/%s" % (environment_id, application_name), 'xml')
Expand Down
5 changes: 5 additions & 0 deletions src/main/resources/xlr_xldeploy/getAllVersionsTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,8 @@

if throwOnFail and len(packageIds) == 0:
raise Exception(applicationId + " exists but has no versions")

if target_list_box:
target = getCurrentRelease().variablesByKeys[target_list_box]
target.valueProvider.setValues(packageIds)
releaseApi.updateVariable(target)