Skip to content

Instantly share code, notes, and snippets.

#
# 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 re
import sys
import java.lang.IllegalArgumentException as IllegalArgumentException
from sets import Set
@xlcommunity
xlcommunity / JsonWebhook.py
Last active March 19, 2016 19:18
Code for "Automatically handle failures in XL Release tasks" (https://support.xebialabs.com/hc/en-us/community/posts/204769703)
#
# 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
from java.io import IOException
from com.xebialabs.xlrelease.plugin.webhook import JsonPathResult
from com.xebialabs.xlrelease.plugin.webhook import XmlPathResult
from urlparse import urlparse
@xlcommunity
xlcommunity / OnReleaseFailureEventListener.java
Last active June 16, 2016 21:56
XL Release "on failure handler" example
/*
* 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.
*/
package ext.deployit.onfailurehandler;
import static java.util.concurrent.TimeUnit.SECONDS;
import static com.google.common.base.Strings.isNullOrEmpty;
@xlcommunity
xlcommunity / releases-templates-trigger-count-4.7.x.py
Created January 20, 2016 10:19
Python script to count releases, templates and triggers in XL Release 4.7.x and up
# 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 httplib
import unittest
import urllib2
import base64
import sys
import json
@xlcommunity
xlcommunity / usageinfo4-5-x.py
Created January 14, 2016 14:46
Gathering useful information about your XLD installation (version 4.5.x versions)
######################
# usageinfo.py
#
# Prints a report of Deployit usage.
#
# Usage: CLI_HOME> bin/cli.sh -expose-proxies -username admin -password admin -f usageinfo.py -- -server-home /opt/deployit-server
#
# TO DO:
# text versions of top 5 reports
# number of users having performed deployments
@xlcommunity
xlcommunity / usageinfo5-x.py
Created January 14, 2016 14:45
Gathering useful information about your XLD installation (version 5.0.x and up)
######################
# usageinfo.py
#
# Prints a report of Deployit usage.
#
# Usage: CLI_HOME> bin/cli.sh -expose-proxies -username admin -password admin -f usageinfo.py -- -server-home /opt/deployit-server
#
# TO DO:
# text versions of top 5 reports
# number of users having performed deployments
{
"category": "Deploy",
"provider": "XL-Deploy",
"version": "32",
"settings": {
"entityUrlTemplate": "{Config:XL Deploy URL}",
"executionUrlTemplate": "{Config:XL Deploy URL}"
},
"configurationProperties": [
{
@xlcommunity
xlcommunity / CsvExportHook.py
Created July 28, 2015 01:04
acme.CsvExportHook example
#
# 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 os
def stripApplication(releaseId):
return releaseId.replace('Applications/', '')
@xlcommunity
xlcommunity / CustomNotification.py
Last active August 29, 2015 14:24
Example custom notification task
#
# 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
from org.apache.commons.mail import EmailException, SimpleEmail
SOCKET_TIMEOUT = 30000 # 30s
@xlcommunity
xlcommunity / HttpRequest-snippet.py
Created June 30, 2015 12:15
HttpRequest modified to support PATCH
# 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.
...
from org.apache.http.client.config import RequestConfig
# HttpPatch added here
from org.apache.http.client.methods import HttpGet, HttpPost, HttpPut, HttpPatch, HttpDelete
...