Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
739a6ac
Merge pull request #190 from jenkinsci/users/kej/updateChangesetURL
keljos Dec 11, 2017
526a5a0
Dev/adelcast/fix author (#188)
Jan 4, 2018
cdda7a0
Release configuration and archiving VSTS logs improvement (#189)
zackliu Feb 7, 2018
f6fe6de
Allow users to map sub-folders of cloaked paths (#181)
pvandervelde Feb 7, 2018
da8a2ae
Update POMs and cleanup the dependencies/code (#192)
oleg-nenashev Feb 7, 2018
d87876e
Revert "Allow users to map sub-folders of cloaked paths (#181)" (#195)
keljos Mar 22, 2018
3de417a
Prepare for release 5.133.0 (#197)
keljos Mar 23, 2018
c450410
[maven-release-plugin] prepare release tfs-5.133.0
jpricket-Microsoft Mar 23, 2018
0dcc6f9
[maven-release-plugin] prepare for next development iteration
jpricket-Microsoft Mar 23, 2018
de8c46a
Recreating the instanceReference object correctly for every artifact,…
Kalyan-microsoft Jun 12, 2018
05a1233
updating authors list (#203)
Kalyan-microsoft Jun 27, 2018
5c4d1b1
To release 5.133.1 version
Kalyan-microsoft Jul 31, 2018
0d6adac
setting the current version
Kalyan-microsoft Jul 31, 2018
1e29edb
fixing release notes for the correct version
Kalyan-microsoft Jul 31, 2018
46a5299
fixing the tag
Kalyan-microsoft Jul 31, 2018
a1c4931
Merge pull request #205 from jenkinsci/users/kasubram/torelease
Kalyan-microsoft Jul 31, 2018
a548eec
bumping version to 5.139.1 (#206)
Kalyan-microsoft Jul 31, 2018
90044ee
bumping version to 5.139.2. Added missing SNAPSHOT keyword in version…
Kalyan-microsoft Aug 1, 2018
867936c
[maven-release-plugin] prepare release tfs-5.139.2
jpricket-Microsoft Aug 1, 2018
2070fb0
[maven-release-plugin] prepare for next development iteration
jpricket-Microsoft Aug 1, 2018
02c5a77
Clear out Release Notes for next release.
keljos Aug 1, 2018
fd9e944
RM webhook changes (#201)
Kalyan-microsoft Aug 20, 2018
a8e3dd6
Adding release webhook configuration to global configuration (#208)
Kalyan-microsoft Sep 9, 2018
f7d6103
Improve VSTS Service Hook integration (#200)
fbaeuerle Sep 24, 2018
c3f4f90
BuildCommand: abort a build only if it was caused by the same PR (#211)
fbaeuerle Oct 1, 2018
497a6c3
Bumping up version to 5.142.0 (#212)
Kalyan-microsoft Oct 4, 2018
ce3c29d
[maven-release-plugin] prepare release tfs-5.142.0
jpricket-Microsoft Oct 4, 2018
40db54c
[maven-release-plugin] prepare for next development iteration
jpricket-Microsoft Oct 4, 2018
8486127
Clear out Release Notes for next release. (#213)
Kalyan-microsoft Oct 5, 2018
9643446
Add Azure DevOps to repo docs (#225)
bbenz Jul 29, 2019
a1e56e6
Minor updates to naming.
keljos Aug 5, 2019
ccf9ea9
Prepare for release 5.157.0 (#227)
keljos Aug 12, 2019
73bc5fc
Update to reflect handle changes
keljos Aug 12, 2019
fb0791a
[maven-release-plugin] prepare release tfs-5.157.0
jpricket-Microsoft Aug 12, 2019
fccd8b6
[maven-release-plugin] prepare for next development iteration
jpricket-Microsoft Aug 12, 2019
bb3fb4e
Clear out Release Notes for next release.
keljos Aug 13, 2019
913fb8a
Add leantk as contributor (#229)
keljos Jan 8, 2020
009fe59
Using full name of the project to make sure rm webhook trigger works …
Kalyan-microsoft Feb 15, 2020
f1387fc
Encoding payload string to UTF-8 before publishing the evennt. (#232)
Kalyan-microsoft Feb 15, 2020
bbae1e5
Preparing for release 5.157.1 (#234)
Kalyan-microsoft Feb 20, 2020
0ebfc2a
[maven-release-plugin] prepare release tfs-5.157.1
jpricket-Microsoft Feb 20, 2020
b616cd7
[maven-release-plugin] prepare for next development iteration
jpricket-Microsoft Feb 20, 2020
cdc4977
Clear out Release Notes for next release. (#235)
Kalyan-microsoft Feb 21, 2020
aea4ce0
[JENKINS-50331] Remove use of reflection (#230)
Dohbedoh Jun 9, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 58 additions & 58 deletions README.md

Large diffs are not rendered by default.

14 changes: 6 additions & 8 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
These notes are for release **5.126.0**.
These notes are for release **(to be determined)**.
Other releases and their notes can be found at the [tfs-plugin GitHub Releases](https://github.com/jenkinsci/tfs-plugin/releases) page.

* Major:
* Update VSTS PR Jenkins build status back to VSTS. Thanks to @smile21prc for pull request #175
* Use default values for parameters when value not supplied, via pull request #177
* Add pipeline support. Thanks to @adelcast for pull request #176
* TODO

* Minor:
* Add code to explicitly require either TLS 1.1 or 1.2, via pull request #179
* Fixing missing import. Thanks to @pvandervelde for pull request #180

* TODO

6 changes: 3 additions & 3 deletions Releasing.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ Pre-requisites
```
2. A great test is to try to perform a `mvn deploy`, which should attempt to upload some files to the snapshot repo and will need those credentials.
3. If you're worried about putting your "Jenkins infrastructure" password in plain-text in that file, Maven has a password encryption facility that relies on a master password in another file. Presumably, you secure access to the 2nd file by placing it on a thumbdrive that you carry with you when you're not at your computer, etc.
1. A TFS server or a VSTS account, configured as per `Testing.md`
1. A TFS server or a Azure DevOps account, configured as per `Testing.md`

Release
=======

1. Pre-release. Perform these manual steps on your workstation:
1. Run a full build, with all its end-to-end tests; it takes about 5 minutes:
```
mvn clean verify --batch-mode -Dtfs_server_name=<TFS host name or VSTS account host name> -Dtfs_user_name=<user> -Dtfs_user_password=<password>
mvn clean verify --batch-mode -Dtfs_server_name=<TFS host name or Azure DevOps account host name> -Dtfs_user_name=<user> -Dtfs_user_password=<password>
```
2. Look at the commits since the last release by going to https://github.com/jenkinsci/tfs-plugin/releases and clicking the "XX commits to master since this release" link. It will be easiest to surf the associated pull requests, so hit Ctrl+F, search for "Merge pull request" and Ctrl+click every #XXX link to the right of the highlights.
3. Fill in the categories of the `ReleaseNotes.md` template, usually in one of the following formats:
Expand Down Expand Up @@ -64,7 +64,7 @@ Release
1. Add timestamps to the Console Output
2. Inject environment variables to the build process
1. **COMPUTERNAME** (the host name of the Jenkins node that will run the job)
2. **TFS_SERVER_NAME** (the TFS host name or VSTS account host name)
2. **TFS_SERVER_NAME** (the TFS host name or Azure DevOps account host name)
3. Use secret text(s) or file(s)
1. **TFS_USER_NAME** and **TFS_USER_PASSWORD** are initialized from a credential
4. Build. Add the following steps:
Expand Down
2 changes: 1 addition & 1 deletion Testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ You'll need to be (or involve) an administrator. It is assumed your TFS server
4. Confirm you can browse to the **FunctionalTests** team project.


How to configure your Team Services account
How to configure your Azure DevOps account
-------------------------------------------
TODO: write this

Expand Down
30 changes: 25 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>2.29</version>
<version>3.2</version>
</parent>

<artifactId>tfs-parent</artifactId>
<packaging>pom</packaging>
<name>Team Foundation Server Plug-in parent</name>
<version>5.126.0-SNAPSHOT</version>
<version>5.157.1-SNAPSHOT</version>
<properties>
<jenkins.version>1.625.1</jenkins.version>
<!-- Version is required to be compatible with current Pipeline plugin dependencies -->
<jenkins.version>1.642.3</jenkins.version>
<java.level>7</java.level>
<maven-surefire-plugin.version>2.19.1</maven-surefire-plugin.version>
<!-- overriding old version from parent to be consistent with the above in this project -->
<maven-surefire-report-plugin.version>${maven-surefire-plugin.version}</maven-surefire-report-plugin.version>
Expand All @@ -28,7 +30,7 @@
<timezone>-5</timezone>
</developer>
<developer>
<id>jpricketmsft</id>
<id>jpricket</id>
<name>Jason Prickett</name>
<email>jpricket@microsoft.com</email>
<timezone>-5</timezone>
Expand All @@ -40,7 +42,19 @@
<timezone>-5</timezone>
</developer>
<developer>
<id>kelliejos</id>
<id>jenkinssriramb</id>
<name>Sriram Balasubramaniyan</name>
<email>sriramb@microsoft.com</email>
<timezone>+5</timezone>
</developer>
<developer>
<id>kalyan</id>
<name>Kalyan</name>
<email>kasubram@microsoft.com</email>
<timezone>+5</timezone>
</developer>
<developer>
<id>keljos</id>
<name>Kellie Jos</name>
<email>kej@microsoft.com</email>
<timezone>-5</timezone>
Expand All @@ -51,6 +65,12 @@
<email>manfred@simpligility.com</email>
<timezone>-8</timezone>
</developer>
<developer>
<id>leantk</id>
<name>Leah Antkiewicz</name>
<email>leantk@microsoft.com</email>
<timezone>-5</timezone>
</developer>
</developers>
<scm>
<connection>scm:git:https://github.com/jenkinsci/tfs-plugin.git</connection>
Expand Down
2 changes: 1 addition & 1 deletion tfs-sdk/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>tfs-parent</artifactId>
<version>5.126.0-SNAPSHOT</version>
<version>5.157.1-SNAPSHOT</version>
</parent>

<artifactId>tfs-sdk</artifactId>
Expand Down
40 changes: 21 additions & 19 deletions tfs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,20 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>tfs-parent</artifactId>
<version>5.126.0-SNAPSHOT</version>
<version>5.157.1-SNAPSHOT</version>
</parent>

<artifactId>tfs</artifactId>
<packaging>hpi</packaging>
<name>Team Foundation Server Plug-in</name>
<version>5.126.0-SNAPSHOT</version>
<version>5.157.1-SNAPSHOT</version>
<url>http://wiki.jenkins-ci.org/display/JENKINS/Team+Foundation+Server+Plugin</url>

<properties>
<!-- TODO: enable once FindBugs issues are fixed -->
<findbugs.failOnError>false</findbugs.failOnError>
</properties>

<licenses>
<license><name>MIT license</name><comments>All source code is under the MIT license.</comments></license>
<license>
Expand Down Expand Up @@ -175,23 +181,6 @@
</profiles>

<dependencies>
<!--
com.microsoft.tfs.sdk includes its dependencies inline, some of which conflict with those of jenkins-core.
We have to repeat dependencies here to make sure they are considered before those inside the TFS SDK.
-->
<dependency>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>jenkins-war</artifactId>
<version>${jenkins.version}</version>
<type>war</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>jenkins-core</artifactId>
<version>${jenkins.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
<!-- We need this plugin for the [current] TfsUserLookup implementation -->
Expand All @@ -216,6 +205,19 @@
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-cps</artifactId>
<version>2.30</version>
<exclusions>
<exclusion>
<!-- Provided by the core -->
<groupId>org.jenkins-ci</groupId>
<artifactId>annotation-indexer</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<!-- Used for configuring collections globally, resolves upper bound dependency conflicts in other Pipeline plugins -->
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-support</artifactId>
<version>2.14</version>
</dependency>
<dependency>
<!-- Used for augmenting Git-related activities, like commit status -->
Expand Down
76 changes: 18 additions & 58 deletions tfs/src/main/java/hudson/plugins/tfs/JenkinsEventNotifier.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
package hudson.plugins.tfs;

import hudson.plugins.tfs.model.ConnectionParameters;
import hudson.plugins.tfs.model.GitStatusContext;
import hudson.plugins.tfs.model.GitStatusState;
import hudson.plugins.tfs.model.JobCompletionEventArgs;
import hudson.plugins.tfs.model.PullRequestMergeCommitCreatedEventArgs;
import hudson.plugins.tfs.model.TeamGitStatus;
import hudson.plugins.tfs.util.TeamRestClient;
import jenkins.model.Jenkins;
import net.sf.json.JSONObject;
Expand All @@ -19,11 +15,9 @@
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URI;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
Expand Down Expand Up @@ -60,54 +54,14 @@ public static void sendJobCompletionEvent(final JSONObject payload) {
final JobCompletionEventArgs args = new JobCompletionEventArgs(
connectionParameters.getConnectionKey(),
jsonPayload,
getPayloadSignature(connectionParameters, jsonPayload));
getPayloadSignature(connectionParameters.getConnectionSignature(), jsonPayload));
client.sendJobCompletionEvent(args);
} catch (final Exception e) {
log.warning("ERROR: sendJobCompletionEvent: (collection=" + c.getCollectionUrl() + ") " + e.getMessage());
}
}
}

/**
* Send the build status of VSTS pull request back to connected TFS/VSTS servers only for those jobs kicked off by PRs.
*/
public static void sendPullRequestBuildStatusEvent(final CommitParameterAction commitParameter, final GitStatusState buildState, final String buildDescription, final String targetUrl, final String jobFullPath) {
try {
if (commitParameter != null) {
if (commitParameter instanceof PullRequestParameterAction) {
final PullRequestParameterAction prpa = (PullRequestParameterAction) commitParameter;
final PullRequestMergeCommitCreatedEventArgs pullRequestMergeCommitCreatedEventArgs = prpa.getPullRequestMergeCommitCreatedEventArgs();
sendPullRequestBuildStatusEvent(pullRequestMergeCommitCreatedEventArgs, buildState, buildDescription, targetUrl, jobFullPath);
}
}
} catch (final Exception e) {
log.warning("ERROR: sendPullRequestBuildStatusEvent fails due to exception: " + e.getMessage());
}
return;
}

/**
* Send the build status of VSTS pull request back to connected TFS/VSTS servers.
*/
public static void sendPullRequestBuildStatusEvent(final PullRequestMergeCommitCreatedEventArgs gitCodePushedEventArgs, final GitStatusState buildState, final String buildDescription, final String targetUrl, final String jobFullPath) {
try {
final TeamGitStatus status = new TeamGitStatus();
status.state = buildState;
status.description = buildDescription;
status.targetUrl = targetUrl;
status.context = new GitStatusContext(" ", StringUtils.stripEnd(jobFullPath, "/"));

final URI collectionUri = gitCodePushedEventArgs.collectionUri;
final TeamRestClient client = new TeamRestClient(collectionUri);
client.addPullRequestStatus(gitCodePushedEventArgs, status);
} catch (MalformedURLException e) {
log.warning("ERROR: sendPullRequestBuildStatusEvent fails due to MalformedURLException: " + e.getMessage());
} catch (IOException e) {
log.warning("ERROR: sendPullRequestBuildStatusEvent fails due to IOException: " + e.getMessage());
}
return;
}

/**
* This is a helper method to get the JSON for a Jenkins object.
* @param url
Expand Down Expand Up @@ -154,6 +108,23 @@ public static String getApiJson(final String url) {
}
}

/**
* Calculates the payload hash.
* @param secret
* @param payload
* @return
* @throws NoSuchAlgorithmException
* @throws InvalidKeyException
* @throws UnsupportedEncodingException
*/
public static String getPayloadSignature(final String secret, final String payload)
throws NoSuchAlgorithmException, InvalidKeyException, UnsupportedEncodingException {
final SecretKeySpec signingKey = new SecretKeySpec(secret.getBytes(ENCODING), "HmacSHA1");
final Mac mac = Mac.getInstance("HmacSHA1");
mac.init(signingKey);
return toHexString(mac.doFinal(payload.getBytes(ENCODING)));
}

private static String urlCombine(final String url, final String... parts) {
final StringBuilder sb = new StringBuilder();
if (url != null) {
Expand All @@ -170,15 +141,6 @@ private static String urlCombine(final String url, final String... parts) {
return sb.toString();
}

private static String getPayloadSignature(final ConnectionParameters connectionParameters, final String payload)
throws NoSuchAlgorithmException, InvalidKeyException, UnsupportedEncodingException {
final String key = connectionParameters.getConnectionSignature();
final SecretKeySpec signingKey = new SecretKeySpec(key.getBytes(ENCODING), "HmacSHA1");
final Mac mac = Mac.getInstance("HmacSHA1");
mac.init(signingKey);
return toHexString(mac.doFinal(payload.getBytes(ENCODING)));
}

private static String toHexString(final byte[] bytes) {
final Formatter formatter = new Formatter();
for (final byte b : bytes) {
Expand All @@ -187,6 +149,4 @@ private static String toHexString(final byte[] bytes) {

return formatter.toString();
}


}
Loading