Skip to content

Commit

Permalink
Adding a commit trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
jdewinne committed Nov 21, 2017
1 parent 901d39b commit 6c846ef
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 3 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ Restart the XL Release server after installing the JAR files.

![image-pull-request](images/pr-trigger.png)

### Commit Trigger

![image-commit-trigger](images/commit-trigger.png)

## References

### Development
Expand Down
Binary file added images/commit-trigger.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 13 additions & 3 deletions src/main/resources/synthetic.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,7 @@
<property name="tagMessage" category="input" description="The tag message" />
</type>

<type type="github.PullRequestTrigger" extends="xlrelease.ReleaseTrigger">
<property name="scriptLocation" hidden="true" default="xlr/github/PullRequestTrigger.py"/>

<type type="github.Trigger" extends="xlrelease.ReleaseTrigger" virtual="true">
<property name="server" category="input" referenced-type="github.Server" kind="ci"/>
<property name="loginOrToken" label="Login" category="input" kind="string" required="false" description="Overrides shared configuration Login or token" />
<property name="password" label="Password" category="input" kind="string" required="false" description="Overrides shared configuration User password" password="true"/>
Expand All @@ -92,8 +90,20 @@

<property name="organization" category="input" required="false" />
<property name="repositoryName" category="input" />
</type>

<type type="github.PullRequestTrigger" extends="github.Trigger">
<property name="scriptLocation" hidden="true" default="xlr/github/PullRequestTrigger.py"/>

<property name="pullRequest" category="variables" required="false" />
</type>

<type type="github.CommitTrigger" extends="github.Trigger">
<property name="scriptLocation" hidden="true" default="xlr/github/CommitTrigger.py"/>

<property name="branch" category="input" default="master"/>

<property name="commitId" category="variables" required="false" />
</type>

</synthetic>
19 changes: 19 additions & 0 deletions src/main/resources/xlr/github/CommitTrigger.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#
# Copyright 2017 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.
#

from xlr.github.GithubClient import GithubClient


g_client = GithubClient(server)
g = g_client.get_github_client(locals())
repo = g_client.get_repo(g, organization, repositoryName)

commitId = repo.get_branch(branch).commit.sha
triggerState = commitId

0 comments on commit 6c846ef

Please sign in to comment.