Retire zmq-event-publisher
The repo has been forked and is maintained elsewhere. OpenStack does not need it anymore, so retire it. Depends-On: https://review.opendev.org/702745 Change-Id: I0787450fdc66beba7d191280b9d208ab2fc024d6
This commit is contained in:
parent
fa543daa00
commit
7c68877e72
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +0,0 @@
|
|||||||
target/
|
|
||||||
work/
|
|
202
LICENSE
202
LICENSE
@ -1,202 +0,0 @@
|
|||||||
|
|
||||||
Apache License
|
|
||||||
Version 2.0, January 2004
|
|
||||||
http://www.apache.org/licenses/
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
||||||
|
|
||||||
1. Definitions.
|
|
||||||
|
|
||||||
"License" shall mean the terms and conditions for use, reproduction,
|
|
||||||
and distribution as defined by Sections 1 through 9 of this document.
|
|
||||||
|
|
||||||
"Licensor" shall mean the copyright owner or entity authorized by
|
|
||||||
the copyright owner that is granting the License.
|
|
||||||
|
|
||||||
"Legal Entity" shall mean the union of the acting entity and all
|
|
||||||
other entities that control, are controlled by, or are under common
|
|
||||||
control with that entity. For the purposes of this definition,
|
|
||||||
"control" means (i) the power, direct or indirect, to cause the
|
|
||||||
direction or management of such entity, whether by contract or
|
|
||||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
||||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
||||||
|
|
||||||
"You" (or "Your") shall mean an individual or Legal Entity
|
|
||||||
exercising permissions granted by this License.
|
|
||||||
|
|
||||||
"Source" form shall mean the preferred form for making modifications,
|
|
||||||
including but not limited to software source code, documentation
|
|
||||||
source, and configuration files.
|
|
||||||
|
|
||||||
"Object" form shall mean any form resulting from mechanical
|
|
||||||
transformation or translation of a Source form, including but
|
|
||||||
not limited to compiled object code, generated documentation,
|
|
||||||
and conversions to other media types.
|
|
||||||
|
|
||||||
"Work" shall mean the work of authorship, whether in Source or
|
|
||||||
Object form, made available under the License, as indicated by a
|
|
||||||
copyright notice that is included in or attached to the work
|
|
||||||
(an example is provided in the Appendix below).
|
|
||||||
|
|
||||||
"Derivative Works" shall mean any work, whether in Source or Object
|
|
||||||
form, that is based on (or derived from) the Work and for which the
|
|
||||||
editorial revisions, annotations, elaborations, or other modifications
|
|
||||||
represent, as a whole, an original work of authorship. For the purposes
|
|
||||||
of this License, Derivative Works shall not include works that remain
|
|
||||||
separable from, or merely link (or bind by name) to the interfaces of,
|
|
||||||
the Work and Derivative Works thereof.
|
|
||||||
|
|
||||||
"Contribution" shall mean any work of authorship, including
|
|
||||||
the original version of the Work and any modifications or additions
|
|
||||||
to that Work or Derivative Works thereof, that is intentionally
|
|
||||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
||||||
or by an individual or Legal Entity authorized to submit on behalf of
|
|
||||||
the copyright owner. For the purposes of this definition, "submitted"
|
|
||||||
means any form of electronic, verbal, or written communication sent
|
|
||||||
to the Licensor or its representatives, including but not limited to
|
|
||||||
communication on electronic mailing lists, source code control systems,
|
|
||||||
and issue tracking systems that are managed by, or on behalf of, the
|
|
||||||
Licensor for the purpose of discussing and improving the Work, but
|
|
||||||
excluding communication that is conspicuously marked or otherwise
|
|
||||||
designated in writing by the copyright owner as "Not a Contribution."
|
|
||||||
|
|
||||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
||||||
on behalf of whom a Contribution has been received by Licensor and
|
|
||||||
subsequently incorporated within the Work.
|
|
||||||
|
|
||||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
copyright license to reproduce, prepare Derivative Works of,
|
|
||||||
publicly display, publicly perform, sublicense, and distribute the
|
|
||||||
Work and such Derivative Works in Source or Object form.
|
|
||||||
|
|
||||||
3. Grant of Patent License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
(except as stated in this section) patent license to make, have made,
|
|
||||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
||||||
where such license applies only to those patent claims licensable
|
|
||||||
by such Contributor that are necessarily infringed by their
|
|
||||||
Contribution(s) alone or by combination of their Contribution(s)
|
|
||||||
with the Work to which such Contribution(s) was submitted. If You
|
|
||||||
institute patent litigation against any entity (including a
|
|
||||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
||||||
or a Contribution incorporated within the Work constitutes direct
|
|
||||||
or contributory patent infringement, then any patent licenses
|
|
||||||
granted to You under this License for that Work shall terminate
|
|
||||||
as of the date such litigation is filed.
|
|
||||||
|
|
||||||
4. Redistribution. You may reproduce and distribute copies of the
|
|
||||||
Work or Derivative Works thereof in any medium, with or without
|
|
||||||
modifications, and in Source or Object form, provided that You
|
|
||||||
meet the following conditions:
|
|
||||||
|
|
||||||
(a) You must give any other recipients of the Work or
|
|
||||||
Derivative Works a copy of this License; and
|
|
||||||
|
|
||||||
(b) You must cause any modified files to carry prominent notices
|
|
||||||
stating that You changed the files; and
|
|
||||||
|
|
||||||
(c) You must retain, in the Source form of any Derivative Works
|
|
||||||
that You distribute, all copyright, patent, trademark, and
|
|
||||||
attribution notices from the Source form of the Work,
|
|
||||||
excluding those notices that do not pertain to any part of
|
|
||||||
the Derivative Works; and
|
|
||||||
|
|
||||||
(d) If the Work includes a "NOTICE" text file as part of its
|
|
||||||
distribution, then any Derivative Works that You distribute must
|
|
||||||
include a readable copy of the attribution notices contained
|
|
||||||
within such NOTICE file, excluding those notices that do not
|
|
||||||
pertain to any part of the Derivative Works, in at least one
|
|
||||||
of the following places: within a NOTICE text file distributed
|
|
||||||
as part of the Derivative Works; within the Source form or
|
|
||||||
documentation, if provided along with the Derivative Works; or,
|
|
||||||
within a display generated by the Derivative Works, if and
|
|
||||||
wherever such third-party notices normally appear. The contents
|
|
||||||
of the NOTICE file are for informational purposes only and
|
|
||||||
do not modify the License. You may add Your own attribution
|
|
||||||
notices within Derivative Works that You distribute, alongside
|
|
||||||
or as an addendum to the NOTICE text from the Work, provided
|
|
||||||
that such additional attribution notices cannot be construed
|
|
||||||
as modifying the License.
|
|
||||||
|
|
||||||
You may add Your own copyright statement to Your modifications and
|
|
||||||
may provide additional or different license terms and conditions
|
|
||||||
for use, reproduction, or distribution of Your modifications, or
|
|
||||||
for any such Derivative Works as a whole, provided Your use,
|
|
||||||
reproduction, and distribution of the Work otherwise complies with
|
|
||||||
the conditions stated in this License.
|
|
||||||
|
|
||||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
||||||
any Contribution intentionally submitted for inclusion in the Work
|
|
||||||
by You to the Licensor shall be under the terms and conditions of
|
|
||||||
this License, without any additional terms or conditions.
|
|
||||||
Notwithstanding the above, nothing herein shall supersede or modify
|
|
||||||
the terms of any separate license agreement you may have executed
|
|
||||||
with Licensor regarding such Contributions.
|
|
||||||
|
|
||||||
6. Trademarks. This License does not grant permission to use the trade
|
|
||||||
names, trademarks, service marks, or product names of the Licensor,
|
|
||||||
except as required for reasonable and customary use in describing the
|
|
||||||
origin of the Work and reproducing the content of the NOTICE file.
|
|
||||||
|
|
||||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
||||||
agreed to in writing, Licensor provides the Work (and each
|
|
||||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
||||||
implied, including, without limitation, any warranties or conditions
|
|
||||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
||||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
||||||
appropriateness of using or redistributing the Work and assume any
|
|
||||||
risks associated with Your exercise of permissions under this License.
|
|
||||||
|
|
||||||
8. Limitation of Liability. In no event and under no legal theory,
|
|
||||||
whether in tort (including negligence), contract, or otherwise,
|
|
||||||
unless required by applicable law (such as deliberate and grossly
|
|
||||||
negligent acts) or agreed to in writing, shall any Contributor be
|
|
||||||
liable to You for damages, including any direct, indirect, special,
|
|
||||||
incidental, or consequential damages of any character arising as a
|
|
||||||
result of this License or out of the use or inability to use the
|
|
||||||
Work (including but not limited to damages for loss of goodwill,
|
|
||||||
work stoppage, computer failure or malfunction, or any and all
|
|
||||||
other commercial damages or losses), even if such Contributor
|
|
||||||
has been advised of the possibility of such damages.
|
|
||||||
|
|
||||||
9. Accepting Warranty or Additional Liability. While redistributing
|
|
||||||
the Work or Derivative Works thereof, You may choose to offer,
|
|
||||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
||||||
or other liability obligations and/or rights consistent with this
|
|
||||||
License. However, in accepting such obligations, You may act only
|
|
||||||
on Your own behalf and on Your sole responsibility, not on behalf
|
|
||||||
of any other Contributor, and only if You agree to indemnify,
|
|
||||||
defend, and hold each Contributor harmless for any liability
|
|
||||||
incurred by, or claims asserted against, such Contributor by reason
|
|
||||||
of your accepting any such warranty or additional liability.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
APPENDIX: How to apply the Apache License to your work.
|
|
||||||
|
|
||||||
To apply the Apache License to your work, attach the following
|
|
||||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
||||||
replaced with your own identifying information. (Don't include
|
|
||||||
the brackets!) The text should be enclosed in the appropriate
|
|
||||||
comment syntax for the file format. We also recommend that a
|
|
||||||
file or class name and description of purpose be included on the
|
|
||||||
same "printed page" as the copyright notice for easier
|
|
||||||
identification within third-party archives.
|
|
||||||
|
|
||||||
Copyright [yyyy] [name of copyright owner]
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
44
README
44
README
@ -1,44 +0,0 @@
|
|||||||
This is a Jenkins plugin that will publish Jenkins Job run events
|
|
||||||
(start, complete, finish) to a ZMQ PUB socket. By default the PUB
|
|
||||||
socket is on TCP port 8888 and no Job events will be published.
|
|
||||||
You can choose to enable event publishing for all jobs in the
|
|
||||||
Jenkins' global config or enable the plugin on a per job basis.
|
|
||||||
|
|
||||||
This plugin uses jeromq to satisfy the dependency on ZMQ. It is
|
|
||||||
possible to use jzmq instead if you need the features that jeromq
|
|
||||||
is lacking; however, it is a pain to get jzmq built and is less
|
|
||||||
portable. If you really really want jzmq look back in the git
|
|
||||||
history and you will find the old versions of this plugin that
|
|
||||||
depended on jzmq.
|
|
||||||
|
|
||||||
TODO:
|
|
||||||
- Avoid reading in the global config for each event if possible.
|
|
||||||
- Need to allow ZMQRunnable thread to die if something truly
|
|
||||||
unexpected happens. The RunListener should then start a new
|
|
||||||
DaemonThread to handle further events.
|
|
||||||
- Cleanup config.jelly for the non global Job config.
|
|
||||||
|
|
||||||
This plugin borrows heavily from the Jenkins Notification Plugin
|
|
||||||
https://github.com/jenkinsci/notification-plugin. That plugin
|
|
||||||
does much of the same work and where applicable I have gone the
|
|
||||||
easy route and copied the work they have done.
|
|
||||||
|
|
||||||
Contributing
|
|
||||||
------------
|
|
||||||
|
|
||||||
To browse the latest code, see:
|
|
||||||
https://git.openstack.org/cgit/openstack-infra/zmq-event-publisher/tree/
|
|
||||||
To clone the latest code, use
|
|
||||||
`git clone https://git.openstack.org/openstack-infra/zmq-event-publisher`
|
|
||||||
|
|
||||||
Bugs are handled at: https://storyboard.openstack.org/#!/project/750
|
|
||||||
|
|
||||||
Code reviews are handled by gerrit. The gerrit in
|
|
||||||
use is http://review.openstack.org
|
|
||||||
|
|
||||||
Use `git review` to submit patches (after creating a gerrit account that
|
|
||||||
links to your launchpad account). Example::
|
|
||||||
|
|
||||||
# Do your commits
|
|
||||||
$ git review
|
|
||||||
# Enter your username if prompted
|
|
10
README.rst
Normal file
10
README.rst
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
This project is no longer maintained.
|
||||||
|
|
||||||
|
The contents of this repository are still available in the Git
|
||||||
|
source code management system. To see the contents of this
|
||||||
|
repository before it reached its end of life, please check out the
|
||||||
|
previous commit with "git checkout HEAD^1".
|
||||||
|
|
||||||
|
For any further questions, please email
|
||||||
|
openstack-discuss@lists.openstack.org or join #openstack-dev on
|
||||||
|
Freenode.
|
337
pom.xml
337
pom.xml
@ -1,337 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Copyright 2013 Hewlett-Packard Development Company, L.P.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Pass in the version on manual builds (i.e. mvn clean package -Dproject-version=1.0)
|
|
||||||
-->
|
|
||||||
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<groupId>org.jenkins-ci.plugins</groupId>
|
|
||||||
<artifactId>plugin</artifactId>
|
|
||||||
<version>1.460</version>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<groupId>org.jenkins-ci.plugins</groupId>
|
|
||||||
<artifactId>zmq-event-publisher</artifactId>
|
|
||||||
<packaging>hpi</packaging>
|
|
||||||
<version>${project-version}</version>
|
|
||||||
|
|
||||||
<name>Jenkins Event Publisher (via ZMQ PUB SUB)</name>
|
|
||||||
<url>https://wiki.jenkins-ci.org/display/JENKINS/ZMQ+Event+Publisher+Plugin</url>
|
|
||||||
|
|
||||||
<licenses>
|
|
||||||
<license>
|
|
||||||
<name>Apache License, Version 2.0</name>
|
|
||||||
<url>http://git.openstack.org/cgit/openstack-infra/zmq-event-publisher/tree/LICENSE</url>
|
|
||||||
<distribution>repo</distribution>
|
|
||||||
</license>
|
|
||||||
</licenses>
|
|
||||||
|
|
||||||
<developers>
|
|
||||||
<developer>
|
|
||||||
<id>clarkb</id>
|
|
||||||
<name>Clark Boylan</name>
|
|
||||||
<email>clark.boylan@gmail.com</email>
|
|
||||||
</developer>
|
|
||||||
</developers>
|
|
||||||
|
|
||||||
<repositories>
|
|
||||||
<repository>
|
|
||||||
<id>repo.jenkins-ci.org</id>
|
|
||||||
<url>http://repo.jenkins-ci.org/public/</url>
|
|
||||||
</repository>
|
|
||||||
</repositories>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.google.code.gson</groupId>
|
|
||||||
<artifactId>gson</artifactId>
|
|
||||||
<version>1.4</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.jeromq</groupId>
|
|
||||||
<artifactId>jeromq</artifactId>
|
|
||||||
<version>0.2.0</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
<profiles>
|
|
||||||
<profile>
|
|
||||||
<id>Windows</id>
|
|
||||||
<activation>
|
|
||||||
<os>
|
|
||||||
<family>windows</family>
|
|
||||||
</os>
|
|
||||||
</activation>
|
|
||||||
<properties>
|
|
||||||
<native.os>Windows</native.os>
|
|
||||||
</properties>
|
|
||||||
</profile>
|
|
||||||
</profiles>
|
|
||||||
|
|
||||||
<pluginRepositories>
|
|
||||||
<pluginRepository>
|
|
||||||
<id>repo.jenkins-ci.org</id>
|
|
||||||
<url>http://repo.jenkins-ci.org/public/</url>
|
|
||||||
</pluginRepository>
|
|
||||||
</pluginRepositories>
|
|
||||||
|
|
||||||
<distributionManagement>
|
|
||||||
<repository>
|
|
||||||
<id>java.net-m2-repository</id>
|
|
||||||
<url>http://maven.jenkins-ci.org/content/repositories/releases/</url>
|
|
||||||
</repository>
|
|
||||||
<site>
|
|
||||||
<id>github-project-site</id>
|
|
||||||
<url>gitsite:git@github.com/jenkinsci/hello-world-plugin</url>
|
|
||||||
</site>
|
|
||||||
</distributionManagement>
|
|
||||||
|
|
||||||
<properties>
|
|
||||||
<native.os>${os.name}</native.os>
|
|
||||||
<!-- http://docs.codehaus.org/display/MAVENUSER/POM+Element+for+Source+File+Encoding -->
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
||||||
<compileTarget>1.6</compileTarget>
|
|
||||||
<!-- define all plugin versions -->
|
|
||||||
<maven.version>3.0.1</maven.version>
|
|
||||||
<maven-antrun-plugin.version>1.6</maven-antrun-plugin.version>
|
|
||||||
<maven-assembly-plugin.version>2.2</maven-assembly-plugin.version>
|
|
||||||
<maven-changelog-plugin.version>2.2</maven-changelog-plugin.version>
|
|
||||||
<maven-checkstyle-plugin.version>2.6</maven-checkstyle-plugin.version>
|
|
||||||
<maven-clean-plugin.version>2.4.1</maven-clean-plugin.version>
|
|
||||||
<maven-compiler-plugin.version>2.3.2</maven-compiler-plugin.version>
|
|
||||||
<maven-dependency-plugin.version>2.1</maven-dependency-plugin.version>
|
|
||||||
<maven-deploy-plugin.version>2.5</maven-deploy-plugin.version>
|
|
||||||
<maven-doap-plugin.version>1.0</maven-doap-plugin.version>
|
|
||||||
<maven-eclipse-plugin.version>2.8</maven-eclipse-plugin.version>
|
|
||||||
<maven-enforcer-plugin.version>1.0</maven-enforcer-plugin.version>
|
|
||||||
<maven-help-plugin.version>2.1.1</maven-help-plugin.version>
|
|
||||||
<maven-install-plugin.version>2.3.1</maven-install-plugin.version>
|
|
||||||
<maven-javadoc-plugin.version>2.7</maven-javadoc-plugin.version>
|
|
||||||
<maven-jar-plugin.version>2.3.1</maven-jar-plugin.version>
|
|
||||||
<maven-jetty-plugin.version>6.1.26</maven-jetty-plugin.version>
|
|
||||||
<maven-jxr-plugin.version>2.2</maven-jxr-plugin.version>
|
|
||||||
<maven-pmd-plugin.version>2.5</maven-pmd-plugin.version>
|
|
||||||
<maven-project-info-reports-plugin.version>2.3.1</maven-project-info-reports-plugin.version>
|
|
||||||
<maven-plugin-plugin.version>2.4.3</maven-plugin-plugin.version>
|
|
||||||
<maven-reactor-plugin.version>1.0</maven-reactor-plugin.version>
|
|
||||||
<maven-release-plugin.version>2.1</maven-release-plugin.version>
|
|
||||||
<maven-remote-resources-plugin.version>1.1</maven-remote-resources-plugin.version>
|
|
||||||
<maven-resources-plugin.version>2.4.3</maven-resources-plugin.version>
|
|
||||||
<maven-site-plugin.version>2.1.1</maven-site-plugin.version>
|
|
||||||
<maven-source-plugin.version>2.1.2</maven-source-plugin.version>
|
|
||||||
<maven-surefire-plugin.version>2.7.2</maven-surefire-plugin.version>
|
|
||||||
<maven-surefire-report-plugin.version>2.7.2</maven-surefire-report-plugin.version>
|
|
||||||
<maven-war-plugin.version>2.1.1</maven-war-plugin.version>
|
|
||||||
<apt-maven-plugin.version>1.0-alpha-4</apt-maven-plugin.version>
|
|
||||||
<axistools-maven-plugin.version>1.4</axistools-maven-plugin.version>
|
|
||||||
<buildnumber-maven-plugin.version>1.0-beta-4</buildnumber-maven-plugin.version>
|
|
||||||
<build-helper-maven-plugin.version>1.5</build-helper-maven-plugin.version>
|
|
||||||
<cargo-maven2-plugin.version>1.0.5</cargo-maven2-plugin.version>
|
|
||||||
<cobertura-maven-plugin.version>2.4</cobertura-maven-plugin.version>
|
|
||||||
<exec-maven-plugin.version>1.2</exec-maven-plugin.version>
|
|
||||||
<findbugs-maven-plugin.version>2.3.1</findbugs-maven-plugin.version>
|
|
||||||
<gwt-maven-plugin.version>2.1.0-1</gwt-maven-plugin.version>
|
|
||||||
<javancss-maven-plugin.version>2.0</javancss-maven-plugin.version>
|
|
||||||
<jdepend-maven-plugin.version>2.0-beta-2</jdepend-maven-plugin.version>
|
|
||||||
<openjpa-maven-plugin.version>1.2</openjpa-maven-plugin.version>
|
|
||||||
<taglist-maven-plugin.version>2.4</taglist-maven-plugin.version>
|
|
||||||
<versions-maven-plugin.version>1.2</versions-maven-plugin.version>
|
|
||||||
<xml-maven-plugin.version>1.0-beta-3</xml-maven-plugin.version>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<build>
|
|
||||||
<pluginManagement>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-clean-plugin</artifactId>
|
|
||||||
<version>${maven-clean-plugin.version}</version>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<version>${maven-compiler-plugin.version}</version>
|
|
||||||
<configuration>
|
|
||||||
<source>${compileSource}</source>
|
|
||||||
<target>${compileTarget}</target>
|
|
||||||
<showDeprecation>true</showDeprecation>
|
|
||||||
<showWarnings>true</showWarnings>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-deploy-plugin</artifactId>
|
|
||||||
<version>${maven-deploy-plugin.version}</version>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-enforcer-plugin</artifactId>
|
|
||||||
<version>${maven-enforcer-plugin.version}</version>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-install-plugin</artifactId>
|
|
||||||
<version>${maven-install-plugin.version}</version>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-jar-plugin</artifactId>
|
|
||||||
<version>${maven-jar-plugin.version}</version>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-release-plugin</artifactId>
|
|
||||||
<version>${maven-release-plugin.version}</version>
|
|
||||||
<configuration>
|
|
||||||
<allowTimestampedSnapshots>true</allowTimestampedSnapshots>
|
|
||||||
<autoVersionSubmodules>true</autoVersionSubmodules>
|
|
||||||
<goals>clean deploy</goals>
|
|
||||||
<preparationGoals>clean deploy</preparationGoals>
|
|
||||||
<releaseProfiles>release</releaseProfiles>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-remote-resources-plugin</artifactId>
|
|
||||||
<version>${maven-remote-resources-plugin.version}</version>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-resources-plugin</artifactId>
|
|
||||||
<version>${maven-resources-plugin.version}</version>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-site-plugin</artifactId>
|
|
||||||
<version>${maven-site-plugin.version}</version>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-source-plugin</artifactId>
|
|
||||||
<version>${maven-source-plugin.version}</version>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
|
||||||
<version>${maven-surefire-plugin.version}</version>
|
|
||||||
<configuration>
|
|
||||||
<parallel>methods</parallel>
|
|
||||||
<testFailureIgnore>true</testFailureIgnore>
|
|
||||||
<threadCount>4</threadCount>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</pluginManagement>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-doap-plugin</artifactId>
|
|
||||||
<version>${maven-doap-plugin.version}</version>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>site</id>
|
|
||||||
<phase>pre-site</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>generate</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
<configuration>
|
|
||||||
<doapFile>${project.reporting.outputDirectory}/doap.rdf</doapFile>
|
|
||||||
<asfExtOptions>
|
|
||||||
<included>false</included>
|
|
||||||
</asfExtOptions>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-site-plugin</artifactId>
|
|
||||||
<version>${maven-site-plugin.version}</version>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
|
|
||||||
<reporting>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-changelog-plugin</artifactId>
|
|
||||||
<version>${maven-changelog-plugin.version}</version>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
|
||||||
<version>${maven-checkstyle-plugin.version}</version>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-javadoc-plugin</artifactId>
|
|
||||||
<version>${maven-javadoc-plugin.version}</version>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-jxr-plugin</artifactId>
|
|
||||||
<version>${maven-jxr-plugin.version}</version>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-pmd-plugin</artifactId>
|
|
||||||
<version>${maven-pmd-plugin.version}</version>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-plugin-plugin</artifactId>
|
|
||||||
<version>${maven-plugin-plugin.version}</version>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-project-info-reports-plugin</artifactId>
|
|
||||||
<version>${maven-project-info-reports-plugin.version}</version>
|
|
||||||
<reportSets>
|
|
||||||
<reportSet>
|
|
||||||
<reports>
|
|
||||||
<report>cim</report>
|
|
||||||
<report>distribution-management</report>
|
|
||||||
<report>index</report>
|
|
||||||
<report>issue-tracking</report>
|
|
||||||
<report>license</report>
|
|
||||||
<report>mailing-list</report>
|
|
||||||
<report>project-team</report>
|
|
||||||
<report>summary</report>
|
|
||||||
</reports>
|
|
||||||
</reportSet>
|
|
||||||
</reportSets>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-surefire-report-plugin</artifactId>
|
|
||||||
<version>${maven-surefire-report-plugin.version}</version>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
|
||||||
<artifactId>cobertura-maven-plugin</artifactId>
|
|
||||||
<version>${cobertura-maven-plugin.version}</version>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
|
||||||
<artifactId>findbugs-maven-plugin</artifactId>
|
|
||||||
<version>${findbugs-maven-plugin.version}</version>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
|
||||||
<artifactId>javancss-maven-plugin</artifactId>
|
|
||||||
<version>${javancss-maven-plugin.version}</version>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
|
||||||
<artifactId>jdepend-maven-plugin</artifactId>
|
|
||||||
<version>${jdepend-maven-plugin.version}</version>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
|
||||||
<artifactId>taglist-maven-plugin</artifactId>
|
|
||||||
<version>${taglist-maven-plugin.version}</version>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</reporting>
|
|
||||||
|
|
||||||
</project>
|
|
||||||
|
|
2
run-fast
2
run-fast
@ -1,2 +0,0 @@
|
|||||||
rm -rf work/plugins
|
|
||||||
mvn -Dmaven.test.skip=true -DskipTests=true clean hpi:run
|
|
@ -1,86 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2013 Hewlett-Packard Development Company, L.P.
|
|
||||||
* Copyright Authors of the Jenkins Notification Plugin
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package org.jenkinsci.plugins.ZMQEventPublisher;
|
|
||||||
|
|
||||||
import hudson.Extension;
|
|
||||||
import hudson.model.Job;
|
|
||||||
import hudson.model.JobProperty;
|
|
||||||
import hudson.model.JobPropertyDescriptor;
|
|
||||||
import hudson.model.AbstractProject;
|
|
||||||
|
|
||||||
import net.sf.json.JSONObject;
|
|
||||||
|
|
||||||
import org.kohsuke.stapler.DataBoundConstructor;
|
|
||||||
import org.kohsuke.stapler.StaplerRequest;
|
|
||||||
|
|
||||||
public class HudsonNotificationProperty extends
|
|
||||||
JobProperty<AbstractProject<?, ?>> {
|
|
||||||
|
|
||||||
final public boolean enabled;
|
|
||||||
|
|
||||||
@DataBoundConstructor
|
|
||||||
public HudsonNotificationProperty(boolean enabled) {
|
|
||||||
this.enabled = enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isEnabled() {
|
|
||||||
return enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HudsonNotificationPropertyDescriptor getDescriptor() {
|
|
||||||
return (HudsonNotificationPropertyDescriptor) super.getDescriptor();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Extension
|
|
||||||
public static final class HudsonNotificationPropertyDescriptor extends JobPropertyDescriptor {
|
|
||||||
|
|
||||||
private boolean globallyEnabled;
|
|
||||||
private int port;
|
|
||||||
|
|
||||||
public HudsonNotificationPropertyDescriptor() {
|
|
||||||
globallyEnabled = false;
|
|
||||||
port = 8888;
|
|
||||||
load();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isApplicable(@SuppressWarnings("rawtypes") Class<? extends Job> jobType) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDisplayName() {
|
|
||||||
return "Jenkins ZMQ Event Publisher";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean configure(StaplerRequest staplerRequest, JSONObject json) throws FormException {
|
|
||||||
globallyEnabled = json.getBoolean("globallyEnabled");
|
|
||||||
port = json.getInt("port");
|
|
||||||
save();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isGloballyEnabled() {
|
|
||||||
return globallyEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getPort() {
|
|
||||||
return port;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,104 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2013 Hewlett-Packard Development Company, L.P.
|
|
||||||
* Copyright Authors of the Jenkins Notification Plugin
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package org.jenkinsci.plugins.ZMQEventPublisher;
|
|
||||||
|
|
||||||
import hudson.EnvVars;
|
|
||||||
import hudson.model.AbstractBuild;
|
|
||||||
import hudson.model.Job;
|
|
||||||
import hudson.model.ParameterValue;
|
|
||||||
import hudson.model.ParametersAction;
|
|
||||||
import hudson.model.Run;
|
|
||||||
import hudson.model.Executor;
|
|
||||||
import hudson.model.Computer;
|
|
||||||
import hudson.model.Node;
|
|
||||||
import hudson.model.TaskListener;
|
|
||||||
import jenkins.model.Jenkins;
|
|
||||||
|
|
||||||
import com.google.gson.FieldNamingPolicy;
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.google.gson.GsonBuilder;
|
|
||||||
|
|
||||||
import org.jenkinsci.plugins.ZMQEventPublisher.model.BuildState;
|
|
||||||
import org.jenkinsci.plugins.ZMQEventPublisher.model.JobState;
|
|
||||||
|
|
||||||
public enum Phase {
|
|
||||||
STARTED, COMPLETED, FINISHED;
|
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
|
||||||
public String handlePhase(Run run, String status, String masterName, TaskListener listener) {
|
|
||||||
Jenkins jenkins = Jenkins.getInstance();
|
|
||||||
HudsonNotificationProperty property = (HudsonNotificationProperty)
|
|
||||||
run.getParent().getProperty(HudsonNotificationProperty.class);
|
|
||||||
HudsonNotificationProperty.HudsonNotificationPropertyDescriptor globalProperty =
|
|
||||||
(HudsonNotificationProperty.HudsonNotificationPropertyDescriptor)
|
|
||||||
jenkins.getDescriptor(HudsonNotificationProperty.class);
|
|
||||||
if ((property != null && property.isEnabled()) ||
|
|
||||||
(globalProperty != null && globalProperty.isGloballyEnabled())) {
|
|
||||||
return buildMessage(run.getParent(), run, status, masterName);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Gson gson = new GsonBuilder().setFieldNamingPolicy(
|
|
||||||
FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES).create();
|
|
||||||
|
|
||||||
private String buildMessage(Job job, Run run, String status, String masterName) {
|
|
||||||
JobState jobState = new JobState();
|
|
||||||
jobState.setName(job.getName());
|
|
||||||
jobState.setUrl(job.getUrl());
|
|
||||||
BuildState buildState = new BuildState();
|
|
||||||
buildState.setNumber(run.number);
|
|
||||||
buildState.setUrl(run.getUrl());
|
|
||||||
buildState.setPhase(this);
|
|
||||||
buildState.setStatus(status);
|
|
||||||
|
|
||||||
Jenkins jenkins = Jenkins.getInstance();
|
|
||||||
String rootUrl = jenkins.getRootUrl();
|
|
||||||
if (rootUrl != null) {
|
|
||||||
buildState.setFullUrl(rootUrl + run.getUrl());
|
|
||||||
}
|
|
||||||
if (masterName != null) {
|
|
||||||
buildState.setHostName(masterName);
|
|
||||||
}
|
|
||||||
|
|
||||||
Executor executor = run.getExecutor();
|
|
||||||
if (executor != null) {
|
|
||||||
Computer computer = executor.getOwner();
|
|
||||||
if (computer != null) {
|
|
||||||
buildState.setNodeName(computer.getName());
|
|
||||||
Node node = computer.getNode();
|
|
||||||
if (node != null) {
|
|
||||||
buildState.setNodeDescription(node.getNodeDescription());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
jobState.setBuild(buildState);
|
|
||||||
|
|
||||||
ParametersAction paramsAction = run.getAction(ParametersAction.class);
|
|
||||||
if (paramsAction != null && run instanceof AbstractBuild) {
|
|
||||||
AbstractBuild build = (AbstractBuild) run;
|
|
||||||
EnvVars env = new EnvVars();
|
|
||||||
for (ParameterValue value : paramsAction.getParameters())
|
|
||||||
if (!value.isSensitive())
|
|
||||||
value.buildEnvVars(build, env);
|
|
||||||
buildState.setParameters(env);
|
|
||||||
}
|
|
||||||
|
|
||||||
return gson.toJson(jobState);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,126 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2013 Hewlett-Packard Development Company, L.P.
|
|
||||||
* Copyright Authors of the Jenkins Notification Plugin
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
||||||
* not use this file except in compliance with the License. You may obtain
|
|
||||||
* a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
||||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
||||||
* License for the specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jenkinsci.plugins.ZMQEventPublisher;
|
|
||||||
|
|
||||||
import hudson.Extension;
|
|
||||||
import hudson.model.Computer;
|
|
||||||
import hudson.model.Result;
|
|
||||||
import hudson.model.Run;
|
|
||||||
import hudson.model.TaskListener;
|
|
||||||
import hudson.model.listeners.RunListener;
|
|
||||||
import hudson.util.DaemonThreadFactory;
|
|
||||||
|
|
||||||
import jenkins.model.Jenkins;
|
|
||||||
|
|
||||||
import java.net.InetAddress;
|
|
||||||
import java.util.concurrent.LinkedBlockingQueue;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Listener to publish Jenkins build events through ZMQ
|
|
||||||
*/
|
|
||||||
@Extension
|
|
||||||
public class RunListenerImpl extends RunListener<Run> {
|
|
||||||
public static final Logger LOGGER =
|
|
||||||
Logger.getLogger(RunListenerImpl.class.getName());
|
|
||||||
private final LinkedBlockingQueue<String> queue =
|
|
||||||
new LinkedBlockingQueue<String>(queueLength);
|
|
||||||
// ZMQ has a high water mark of 1000 events.
|
|
||||||
private static final int queueLength = 1024;
|
|
||||||
private static final DaemonThreadFactory threadFactory =
|
|
||||||
new DaemonThreadFactory();
|
|
||||||
private ZMQRunnable ZMQRunner;
|
|
||||||
private Thread thread;
|
|
||||||
private String masterName;
|
|
||||||
|
|
||||||
public RunListenerImpl() {
|
|
||||||
super(Run.class);
|
|
||||||
ZMQRunner = new ZMQRunnable(queue);
|
|
||||||
thread = threadFactory.newThread(ZMQRunner);
|
|
||||||
thread.start();
|
|
||||||
|
|
||||||
Computer master = null;
|
|
||||||
String hostname = null;
|
|
||||||
// query Jenkins for master's name
|
|
||||||
try {
|
|
||||||
master = Jenkins.getInstance().getComputer("");
|
|
||||||
if (master != null) {
|
|
||||||
hostname = master.getHostName();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// master node may not be enabled so get masterName from system
|
|
||||||
hostname = java.net.InetAddress.getLocalHost().getHostName();
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
}
|
|
||||||
masterName = hostname;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCompleted(Run build, TaskListener listener) {
|
|
||||||
String event = "onCompleted";
|
|
||||||
String json = Phase.COMPLETED.handlePhase(build, getStatus(build), masterName, listener);
|
|
||||||
sendEvent(event, json);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Currently not emitting onDeleted events. This should be fixed.
|
|
||||||
@Override
|
|
||||||
public void onDeleted(Run build) {
|
|
||||||
String update = String.format("onDeleted");
|
|
||||||
bindSocket(build);
|
|
||||||
publisher.send(update.getBytes(), 0);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFinalized(Run build) {
|
|
||||||
String event = "onFinalized";
|
|
||||||
String json = Phase.FINISHED.handlePhase(build, getStatus(build), masterName, TaskListener.NULL);
|
|
||||||
sendEvent(event, json);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onStarted(Run build, TaskListener listener) {
|
|
||||||
String event = "onStarted";
|
|
||||||
String json = Phase.STARTED.handlePhase(build, getStatus(build), masterName, listener);
|
|
||||||
sendEvent(event, json);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void sendEvent(String event, String json) {
|
|
||||||
if (json != null) {
|
|
||||||
event = event + " " + json;
|
|
||||||
// Offer the event. If the queue is full this will not block.
|
|
||||||
// We may drop events but this should prevent starvation in
|
|
||||||
// the calling Jenkins threads.
|
|
||||||
if (!queue.offer(event)) {
|
|
||||||
LOGGER.log(Level.INFO,
|
|
||||||
"Unable to add event to ZMQ queue.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getStatus(Run r) {
|
|
||||||
Result result = r.getResult();
|
|
||||||
String status = null;
|
|
||||||
if (result != null) {
|
|
||||||
status = result.toString();
|
|
||||||
}
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,116 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2013 Hewlett-Packard Development Company, L.P.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
||||||
* not use this file except in compliance with the License. You may obtain
|
|
||||||
* a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
||||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
||||||
* License for the specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jenkinsci.plugins.ZMQEventPublisher;
|
|
||||||
|
|
||||||
import jenkins.model.Jenkins;
|
|
||||||
|
|
||||||
import java.util.concurrent.LinkedBlockingQueue;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import org.jeromq.ZMQ;
|
|
||||||
import org.jeromq.ZMQException;
|
|
||||||
|
|
||||||
public class ZMQRunnable implements Runnable {
|
|
||||||
public static final Logger LOGGER = Logger.getLogger(ZMQRunnable.class.getName());
|
|
||||||
|
|
||||||
private static final String bind_addr = "tcp://*:%d";
|
|
||||||
private int port;
|
|
||||||
|
|
||||||
private final LinkedBlockingQueue<String> queue;
|
|
||||||
private final ZMQ.Context context;
|
|
||||||
private ZMQ.Socket publisher;
|
|
||||||
|
|
||||||
public ZMQRunnable(LinkedBlockingQueue<String> queue) {
|
|
||||||
this.queue = queue;
|
|
||||||
context = ZMQ.context(1);
|
|
||||||
bindSocket();
|
|
||||||
}
|
|
||||||
|
|
||||||
private int getPort() {
|
|
||||||
Jenkins jenkins = Jenkins.getInstance();
|
|
||||||
HudsonNotificationProperty.HudsonNotificationPropertyDescriptor globalProperty =
|
|
||||||
(HudsonNotificationProperty.HudsonNotificationPropertyDescriptor)
|
|
||||||
jenkins.getDescriptor(HudsonNotificationProperty.class);
|
|
||||||
if (globalProperty != null) {
|
|
||||||
return globalProperty.getPort();
|
|
||||||
}
|
|
||||||
return 8888;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void bindSocket() {
|
|
||||||
int tmpPort = getPort();
|
|
||||||
if (publisher == null) {
|
|
||||||
port = tmpPort;
|
|
||||||
LOGGER.log(Level.INFO,
|
|
||||||
String.format("Binding ZMQ PUB to port %d", port));
|
|
||||||
publisher = bindSocket(port);
|
|
||||||
}
|
|
||||||
else if (tmpPort != port) {
|
|
||||||
LOGGER.log(Level.INFO,
|
|
||||||
String.format("Changing ZMQ PUB port from %d to %d", port, tmpPort));
|
|
||||||
try {
|
|
||||||
publisher.close();
|
|
||||||
} catch (ZMQException e) {
|
|
||||||
/* Let the garbage collector sort out cleanup */
|
|
||||||
LOGGER.log(Level.INFO,
|
|
||||||
"Unable to close ZMQ PUB socket. " + e.toString(), e);
|
|
||||||
}
|
|
||||||
port = tmpPort;
|
|
||||||
publisher = bindSocket(port);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private ZMQ.Socket bindSocket(int port) {
|
|
||||||
ZMQ.Socket socket;
|
|
||||||
try {
|
|
||||||
socket = context.socket(ZMQ.PUB);
|
|
||||||
socket.bind(String.format(bind_addr, port));
|
|
||||||
} catch (ZMQException e) {
|
|
||||||
LOGGER.log(Level.SEVERE,
|
|
||||||
"Unable to bind ZMQ PUB socket. " + e.toString(), e);
|
|
||||||
socket = null;
|
|
||||||
}
|
|
||||||
return socket;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void run() {
|
|
||||||
String event;
|
|
||||||
while(true) {
|
|
||||||
try {
|
|
||||||
event = queue.take();
|
|
||||||
bindSocket();
|
|
||||||
if (publisher != null) {
|
|
||||||
try {
|
|
||||||
LOGGER.log(Level.FINE, "Publishing ZMQ event: " + event);
|
|
||||||
publisher.send(event.getBytes(), 0);
|
|
||||||
} catch (ZMQException e) {
|
|
||||||
LOGGER.log(Level.INFO,
|
|
||||||
"Unable to send event. " + e.toString(), e);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
LOGGER.log(Level.WARNING, "ZMQ Publisher is NULL");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Catch all exceptions so that this thread does not die.
|
|
||||||
catch (Exception e) {
|
|
||||||
LOGGER.log(Level.SEVERE,
|
|
||||||
"Unhandled exception publishing ZMQ events " + e.toString(), e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,114 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright Authors of the Jenkins Notification Plugin
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jenkinsci.plugins.ZMQEventPublisher.model;
|
|
||||||
|
|
||||||
import org.jenkinsci.plugins.ZMQEventPublisher.Phase;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class BuildState {
|
|
||||||
|
|
||||||
private String fullUrl;
|
|
||||||
|
|
||||||
private int number;
|
|
||||||
|
|
||||||
private Phase phase;
|
|
||||||
|
|
||||||
private String status;
|
|
||||||
|
|
||||||
private String url;
|
|
||||||
|
|
||||||
private Map<String, String> parameters;
|
|
||||||
|
|
||||||
private String nodeName;
|
|
||||||
|
|
||||||
private String nodeDescription;
|
|
||||||
|
|
||||||
private String hostName;
|
|
||||||
|
|
||||||
public int getNumber() {
|
|
||||||
return number;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNumber(int number) {
|
|
||||||
this.number = number;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Phase getPhase() {
|
|
||||||
return phase;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPhase(Phase phase) {
|
|
||||||
this.phase = phase;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getStatus() {
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStatus(String status) {
|
|
||||||
this.status = status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUrl() {
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUrl(String url) {
|
|
||||||
this.url = url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFullUrl() {
|
|
||||||
return fullUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFullUrl(String fullUrl) {
|
|
||||||
this.fullUrl = fullUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String, String> getParameters() {
|
|
||||||
return parameters;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setParameters(Map<String, String> params) {
|
|
||||||
this.parameters = params;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNodeName() {
|
|
||||||
return nodeName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNodeName(String nodeName) {
|
|
||||||
this.nodeName = nodeName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNodeDescription() {
|
|
||||||
return nodeDescription;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNodeDescription(String nodeDescription) {
|
|
||||||
this.nodeDescription = nodeDescription;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getHostName() {
|
|
||||||
return hostName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHostName(String hostName) {
|
|
||||||
this.hostName = hostName;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,50 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright Authors of the Jenkins Notification Plugin
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jenkinsci.plugins.ZMQEventPublisher.model;
|
|
||||||
|
|
||||||
public class JobState {
|
|
||||||
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
private String url;
|
|
||||||
|
|
||||||
private BuildState build;
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUrl() {
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUrl(String url) {
|
|
||||||
this.url = url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BuildState getBuild() {
|
|
||||||
return build;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBuild(BuildState build) {
|
|
||||||
this.build = build;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
<div>
|
|
||||||
This plugin publishes Jenkins build events in JSON as a ZMQ Publisher.
|
|
||||||
</div>
|
|
@ -1,9 +0,0 @@
|
|||||||
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define"
|
|
||||||
xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
|
|
||||||
|
|
||||||
<f:section title="ZMQ Event Publisher">
|
|
||||||
<f:entry title="ZMQ Events" field="enabled">
|
|
||||||
<f:checkbox title="Check if ZMQ events should be published for this project." name="zmqpublisher.enabled" checked="${HudsonNotificationProperty.isEnabled()}" />
|
|
||||||
</f:entry>
|
|
||||||
</f:section>
|
|
||||||
</j:jelly>
|
|
@ -1,12 +0,0 @@
|
|||||||
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
|
|
||||||
<f:section title="ZMQ Event Publisher">
|
|
||||||
<f:entry title="Enable on all Jobs"
|
|
||||||
description="Check if we should publish events for all jobs.">
|
|
||||||
<f:checkbox name="zmqpublisher.globallyEnabled" checked="${descriptor.isGloballyEnabled()}" />
|
|
||||||
</f:entry>
|
|
||||||
<f:entry title="TCP port to publish on"
|
|
||||||
description="Bind to this TCP port and publish events on it">
|
|
||||||
<f:textbox name="zmqpublisher.port" value="${descriptor.getPort()}" />
|
|
||||||
</f:entry>
|
|
||||||
</f:section>
|
|
||||||
</j:jelly>
|
|
@ -1,6 +0,0 @@
|
|||||||
<div>
|
|
||||||
<p>
|
|
||||||
Plugin that will publish Jenkins Job run events on the specified port
|
|
||||||
via ZMQ PUB SUB.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
Loading…
Reference in New Issue
Block a user