Skip to content

Commit

Permalink
Update license date, add PostMessage task
Browse files Browse the repository at this point in the history
  • Loading branch information
droberts2013 committed Apr 6, 2018
1 parent e8c4e45 commit 7cdb34a
Show file tree
Hide file tree
Showing 15 changed files with 109 additions and 21 deletions.
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
# Preface

This document describes the functionality provided by the XL Release Flowdock plugin.

See the [XL Release Documentation](https://docs.xebialabs.com/xl-release/) for background information on XL Release and release orchestration concepts.
# XL Release Flowdock plugin

[![Build Status][xlr-flowdock-plugin-travis-image] ][xlr-flowdock-plugin-travis-url]
[![Codacy][xlr-flowdock-plugin-codacy-image] ][xlr-flowdock-plugin-codacy-url]
Expand All @@ -20,7 +16,11 @@ See the [XL Release Documentation](https://docs.xebialabs.com/xl-release/) for b
[xlr-flowdock-plugin-license-url]: https://opensource.org/licenses/MIT
[xlr-flowdock-plugin-downloads-image]: https://img.shields.io/github/downloads/xebialabs-community/xlr-flowdock-plugin/total.svg

## Preface

This document describes the functionality provided by the XL Release Flowdock plugin.

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

## Overview

Expand All @@ -33,7 +33,8 @@ The XL Release Flowdock plugin is a XL Release plugin that adds capability for s

## Installation

Place the plugin JAR file into your `SERVER_HOME/plugins` directory.
* Copy the latest JAR file from the [releases page](https://github.com/xebialabs-community/xlr-flowdock-plugin/releases) into the `XL_RELEASE_SERVER/plugins` directory.
* Restart the XL Release server.

## Usage

Expand All @@ -45,6 +46,7 @@ Place the plugin JAR file into your `SERVER_HOME/plugins` directory.
![Flowdock configuration](images/Flowdock_configuration.png?raw=true "Flowdock configuration")
4. Each time XL Release stores something into the Activity logs, this will also be send to Flowdock.

### Tasks
## Tasks

+ SendTeamInboxMessage: Allows to send a specific message to a TeamInbox.
+ SendTeamInboxMessage: Send a specific message to a TeamInbox.
+ PostMessage: Send a specific message to a flow (inbox) using the Messages API. A Flowdock server should be configured. In this case the flow token must be one associated with a source. See <https://www.flowdock.com/api/integration-getting-started>.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2017 XEBIALABS
* Copyright 2018 XEBIALABS
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2017 XEBIALABS
* Copyright 2018 XEBIALABS
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2017 XEBIALABS
* Copyright 2018 XEBIALABS
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2017 XEBIALABS
* Copyright 2018 XEBIALABS
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2017 XEBIALABS
* Copyright 2018 XEBIALABS
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2017 XEBIALABS
* Copyright 2018 XEBIALABS
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2017 XEBIALABS
* Copyright 2018 XEBIALABS
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2017 XEBIALABS
* Copyright 2018 XEBIALABS
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2017 XEBIALABS
* Copyright 2018 XEBIALABS
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/caflowdock/FlowdockHelper.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright 2017 XEBIALABS
# Copyright 2018 XEBIALABS
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
#
Expand Down
62 changes: 62 additions & 0 deletions src/main/resources/caflowdock/PostMessage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#
# Copyright 2018 XEBIALABS
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#

import sys
import com.xhaus.jyson.JysonCodec as json
from sets import Set

http_success = Set([200, 201, 202])
contentType = "application/json"

def addToDictionary(dictionary, name, value):
if value:
dictionary[name] = value

def addMapToDictionary(dictionary, name, map):
if map:
dictionary[name] = {}
for key in map.keys():
if map[key]:
dictionary[name][key] = map[key]

message = {
"event" : "activity",
"flow_token" : flowToken,
"author" : {
"name" : "XL Release"
},
"title" : messageTitle,
"external_thread_id" : externalThreadId
}
addToDictionary(message, "body", messageBody)

thread = {}
addToDictionary(thread, "title", threadTitle)
addToDictionary(thread, "body", threadBody)
addToDictionary(thread, "external_url", threadExternalUrl)
threadFieldList = []
for key in threadFields.keys():
if threadFields[key]:
threadFieldList.append({"label" :key, "value" : threadFields[key]})
addToDictionary(thread, "fields", threadFieldList)
threadStatus = {}
addToDictionary(threadStatus, "value", threadStatusValue)
addToDictionary(threadStatus, "color", threadStatusColor)
addToDictionary(thread, "status", threadStatus)

addToDictionary(message, "thread", thread)

request = HttpRequest(flowdockServer)
response = request.post("/messages", json.dumps(message), contentType=contentType)
if response.status in http_success:
print "Successful %s" % response.status
else:
response.errorDump()
sys.exit(1)
2 changes: 1 addition & 1 deletion src/main/resources/caflowdock/SendTeamInboxMessage.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright 2017 XEBIALABS
# Copyright 2018 XEBIALABS
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
#
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/caflowdock/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright 2017 XEBIALABS
# Copyright 2018 XEBIALABS
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
#
Expand Down
26 changes: 25 additions & 1 deletion src/main/resources/synthetic.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!--
Copyright 2017 XEBIALABS
Copyright 2018 XEBIALABS
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
Expand Down Expand Up @@ -38,4 +38,28 @@
<property name="link" category="input" label="Link" required="false" description="a URL to associate with this post" />

</type>

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

<type type="flowdock.PostMessage" extends="xlrelease.PythonScript">
<property name="scriptLocation" default="caflowdock/PostMessage.py" hidden="true"/>
<property name="flowdockServer" category="input" kind="ci" label="Server" referenced-type="flowdock.Server" />

<!-- Message properties -->
<property name="flowToken" category="input" password="true"/>
<!-- <property name="author" category="input "/> use author={"name":"XL Release"} -->
<!-- <property name="event" category="input" /> use event="activity"-->
<property name="externalThreadId" category="input" />
<property name="messageTitle" category="input" />
<property name="messageBody" category="input" required="false" />

<!-- Thread properties -->
<property name="threadTitle" category="input" required="false" />
<property name="threadExternalUrl" category="input" required="false" />
<property name="threadBody" category="input" required="false" />
<property name="threadStatusValue" category="input" required="false" />
<property name="threadStatusColor" category="input" required="false" />
<property name="threadFields" category="input" kind="map_string_string" required="false" />
</type>

</synthetic>

0 comments on commit 7cdb34a

Please sign in to comment.