Skip to content

Commit cf88bea

Browse files
author
Alex Dubrouski
committed
Adding trait class, messages, build files and license
0 parents  commit cf88bea

File tree

10 files changed

+368
-0
lines changed

10 files changed

+368
-0
lines changed

.gitignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
target
2+
work
3+
.idea
4+
.classpath
5+
.project
6+
.settings
7+
bin
8+
9+
*.iml

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Changelog
2+
3+
## 1.0.0
4+
5+
* Trait for bitbucket-branch-source-plugin

Jenkinsfile

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
buildPlugin()

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License
2+
3+
Copyright (c) 2017 Javier Delgado
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Branch Source Plugin custom trait
2+
3+
This repository contains a custom trait to disable build status notifications
4+
5+
It provides trait for
6+
- Bitbucket: Skip build notifications
7+
8+

pom.xml

+228
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,228 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ The MIT License
4+
~
5+
~ Copyright (c) 2016, CloudBees, Inc.
6+
~
7+
~ Permission is hereby granted, free of charge, to any person obtaining a copy
8+
~ of this software and associated documentation files (the "Software"), to deal
9+
~ in the Software without restriction, including without limitation the rights
10+
~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
~ copies of the Software, and to permit persons to whom the Software is
12+
~ furnished to do so, subject to the following conditions:
13+
~
14+
~ The above copyright notice and this permission notice shall be included in
15+
~ all copies or substantial portions of the Software.
16+
~
17+
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23+
~ THE SOFTWARE.
24+
-->
25+
<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">
26+
<modelVersion>4.0.0</modelVersion>
27+
28+
<parent>
29+
<groupId>org.jenkins-ci.plugins</groupId>
30+
<artifactId>plugin</artifactId>
31+
<version>3.2</version>
32+
<relativePath />
33+
</parent>
34+
35+
<artifactId>skip-notifications-trait-plugin</artifactId>
36+
<version>1.0.0-SNAPSHOT</version>
37+
<packaging>hpi</packaging>
38+
39+
<name>Skip Notifications Trait plugin</name>
40+
<url>https://wiki.jenkins.io/display/JENKINS/Bitbucket+Branch+Source+Plugin</url>
41+
<description>This is an extension for Bitbucket Branch Source Plugin, which allows to skip notifying BitBucket instance about build statuses.</description>
42+
<licenses>
43+
<license>
44+
<name>MIT License</name>
45+
<url>https://opensource.org/licenses/MIT</url>
46+
</license>
47+
</licenses>
48+
49+
<properties>
50+
<jenkins.version>1.642.3</jenkins.version>
51+
<java.level>7</java.level>
52+
<branchsource.version>2.2.0</branchsource.version>
53+
<scm-api.version>2.2.0</scm-api.version>
54+
<git.version>3.6.0</git.version>
55+
</properties>
56+
57+
<developers>
58+
<developer>
59+
<id>alex-dubrouski</id>
60+
<name>Alex Dubrouski</name>
61+
</developer>
62+
</developers>
63+
64+
<scm>
65+
<connection>scm:git:git://github.com/jenkinsci/skip-notifications-trait-plugin.git</connection>
66+
<developerConnection>scm:git:[email protected]:jenkinsci/skip-notifications-trait-plugin.git</developerConnection>
67+
<url>https://github.com/jenkinsci/skip-notifications-trait-plugin</url>
68+
<tag>HEAD</tag>
69+
</scm>
70+
71+
<dependencyManagement>
72+
<dependencies>
73+
<dependency>
74+
<groupId>org.jenkins-ci.plugins</groupId>
75+
<artifactId>scm-api</artifactId>
76+
<version>${scm-api.version}</version>
77+
</dependency>
78+
<dependency>
79+
<groupId>com.jcraft</groupId>
80+
<artifactId>jsch</artifactId>
81+
<version>0.1.53</version>
82+
</dependency>
83+
<dependency>
84+
<groupId>org.jenkins-ci.plugins.workflow</groupId>
85+
<artifactId>workflow-scm-step</artifactId>
86+
<version>2.2</version>
87+
</dependency>
88+
<dependency>
89+
<groupId>org.jenkins-ci.plugins.workflow</groupId>
90+
<artifactId>workflow-support</artifactId>
91+
<version>2.6</version>
92+
</dependency>
93+
</dependencies>
94+
</dependencyManagement>
95+
<dependencies>
96+
<dependency>
97+
<groupId>org.jenkins-ci.plugins</groupId>
98+
<artifactId>cloudbees-bitbucket-branch-source</artifactId>
99+
<version>${branchsource.version}</version>
100+
</dependency>
101+
<dependency>
102+
<groupId>org.jenkins-ci.plugins</groupId>
103+
<artifactId>apache-httpcomponents-client-4-api</artifactId>
104+
<version>4.5.3-2.0</version>
105+
</dependency>
106+
<dependency>
107+
<groupId>org.jenkins-ci.plugins</groupId>
108+
<artifactId>structs</artifactId>
109+
<version>1.10</version>
110+
</dependency>
111+
<dependency>
112+
<groupId>org.jenkins-ci.plugins</groupId>
113+
<artifactId>scm-api</artifactId>
114+
</dependency>
115+
<dependency>
116+
<groupId>org.jenkins-ci.plugins</groupId>
117+
<artifactId>git</artifactId>
118+
<version>${git.version}</version>
119+
<exclusions>
120+
<exclusion>
121+
<groupId>org.apache.httpcomponents</groupId>
122+
<artifactId>httpclient</artifactId>
123+
</exclusion>
124+
</exclusions>
125+
</dependency>
126+
<dependency>
127+
<groupId>org.jenkins-ci.plugins</groupId>
128+
<artifactId>mercurial</artifactId>
129+
<version>2.0</version>
130+
</dependency>
131+
<dependency>
132+
<groupId>org.codehaus.jackson</groupId>
133+
<artifactId>jackson-jaxrs</artifactId>
134+
<version>1.9.13</version>
135+
</dependency>
136+
<dependency>
137+
<groupId>org.jenkins-ci.plugins</groupId>
138+
<artifactId>display-url-api</artifactId>
139+
<version>0.2</version>
140+
</dependency>
141+
<dependency>
142+
<groupId>org.jenkins-ci.plugins</groupId>
143+
<artifactId>branch-api</artifactId>
144+
<version>2.0.11</version>
145+
<scope>test</scope>
146+
</dependency>
147+
<dependency>
148+
<groupId>org.jenkins-ci.plugins</groupId>
149+
<artifactId>scm-api</artifactId>
150+
<version>${scm-api.version}</version>
151+
<classifier>tests</classifier>
152+
<scope>test</scope>
153+
</dependency>
154+
<dependency>
155+
<groupId>org.jenkins-ci.plugins</groupId>
156+
<artifactId>handy-uri-templates-2-api</artifactId>
157+
<version>2.1.6-1.0</version>
158+
</dependency>
159+
<dependency>
160+
<groupId>org.mockito</groupId>
161+
<artifactId>mockito-core</artifactId>
162+
<version>1.10.19</version>
163+
<scope>test</scope>
164+
</dependency>
165+
<dependency>
166+
<groupId>org.hamcrest</groupId>
167+
<artifactId>hamcrest-core</artifactId>
168+
<version>1.3</version>
169+
<scope>test</scope>
170+
</dependency>
171+
<dependency>
172+
<groupId>org.jenkins-ci.plugins</groupId>
173+
<artifactId>git</artifactId>
174+
<version>${git.version}</version>
175+
<classifier>tests</classifier>
176+
<scope>test</scope>
177+
</dependency>
178+
<dependency>
179+
<groupId>org.jenkins-ci.plugins.workflow</groupId>
180+
<artifactId>workflow-multibranch</artifactId>
181+
<version>2.11</version>
182+
<scope>test</scope>
183+
</dependency>
184+
</dependencies>
185+
186+
<repositories>
187+
<repository>
188+
<id>repo.jenkins-ci.org</id>
189+
<url>http://repo.jenkins-ci.org/public/</url>
190+
</repository>
191+
</repositories>
192+
<pluginRepositories>
193+
<pluginRepository>
194+
<id>repo.jenkins-ci.org</id>
195+
<url>https://repo.jenkins-ci.org/public/</url>
196+
</pluginRepository>
197+
</pluginRepositories>
198+
199+
<build>
200+
<plugins>
201+
<plugin>
202+
<groupId>org.jenkins-ci.tools</groupId>
203+
<artifactId>maven-hpi-plugin</artifactId>
204+
<executions>
205+
<execution>
206+
<goals>
207+
<goal>generate-taglib-interface</goal>
208+
</goals>
209+
</execution>
210+
</executions>
211+
<configuration>
212+
<compatibleSinceVersion>2.0.0</compatibleSinceVersion>
213+
</configuration>
214+
</plugin>
215+
<plugin> <!-- TODO scm-api gratuitously restricts deprecated APIs, preventing us from compiling even deprecated classes in *this* plugin -->
216+
<groupId>org.kohsuke</groupId>
217+
<artifactId>access-modifier-checker</artifactId>
218+
<executions>
219+
<execution>
220+
<id>default-enforce</id>
221+
<phase /> <!-- https://stackoverflow.com/a/19540026/12916 -->
222+
</execution>
223+
</executions>
224+
</plugin>
225+
</plugins>
226+
</build>
227+
228+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
/*
2+
The MIT License
3+
4+
Copyright (c) 2016, CloudBees, Inc.
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in
14+
all copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
THE SOFTWARE.
23+
*/
24+
package com.cloudbees.jenkins.plugins.bitbucket.notifications;
25+
26+
import com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource;
27+
import com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSourceContext;
28+
import hudson.Extension;
29+
import jenkins.scm.api.SCMSource;
30+
import jenkins.scm.api.trait.SCMSourceContext;
31+
import jenkins.scm.api.trait.SCMSourceTrait;
32+
import jenkins.scm.api.trait.SCMSourceTraitDescriptor;
33+
import jenkins.scm.impl.trait.Discovery;
34+
import org.kohsuke.stapler.DataBoundConstructor;
35+
36+
public class SkipNotificationsTrait extends SCMSourceTrait {
37+
38+
/**
39+
* Constructor for stapler.
40+
*
41+
*/
42+
@DataBoundConstructor
43+
public SkipNotificationsTrait() {
44+
//empty
45+
}
46+
47+
/**
48+
* {@inheritDoc}
49+
*/
50+
@Override
51+
protected void decorateContext(SCMSourceContext<?, ?> context) {
52+
if (context instanceof BitbucketSCMSourceContext) {
53+
BitbucketSCMSourceContext ctx = (BitbucketSCMSourceContext) context;
54+
ctx.withNotificationsDisabled(true);
55+
}
56+
}
57+
58+
/**
59+
* Our descriptor.
60+
*/
61+
@Extension
62+
@Discovery
63+
public static class DescriptorImpl extends SCMSourceTraitDescriptor {
64+
65+
/**
66+
* {@inheritDoc}
67+
*/
68+
@Override
69+
public String getDisplayName() {
70+
return Messages.SkipNotificationsTrait_displayName();
71+
}
72+
73+
/**
74+
* {@inheritDoc}
75+
*/
76+
@Override
77+
public Class<? extends SCMSourceContext> getContextClass() {
78+
return BitbucketSCMSourceContext.class;
79+
}
80+
81+
/**
82+
* {@inheritDoc}
83+
*/
84+
@Override
85+
public Class<? extends SCMSource> getSourceClass() {
86+
return BitbucketSCMSource.class;
87+
}
88+
89+
}
90+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
SkipNotificationsTrait.displayName=Skip build status notifications
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?jelly escape-by-default='true'?>
2+
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form"/>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<div>
2+
Allows disabling build status notifications.
3+
</div>

0 commit comments

Comments
 (0)