-
-
Notifications
You must be signed in to change notification settings - Fork 736
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1298 from RehanSaeed/Go.CD-GetHistory
GH1296: Add Go.CD build history API call
- Loading branch information
Showing
10 changed files
with
407 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System.Collections.Generic; | ||
using System.Runtime.Serialization; | ||
|
||
namespace Cake.Common.Build.GoCD.Data | ||
{ | ||
/// <summary> | ||
/// The Go.CD build cause. | ||
/// </summary> | ||
[DataContract] | ||
public class GoCDBuildCauseInfo | ||
{ | ||
/// <summary> | ||
/// Gets or sets the approver. | ||
/// </summary> | ||
/// <value> | ||
/// The approver. | ||
/// </value> | ||
[DataMember(Name = "approver")] | ||
public string Approver { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the material revisions. | ||
/// </summary> | ||
/// <value> | ||
/// The material revisions. | ||
/// </value> | ||
[DataMember(Name = "material_revisions")] | ||
public IEnumerable<GoCDMaterialRevisionsInfo> MaterialRevisions { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets a value indicating whether the trigger was forced. | ||
/// </summary> | ||
/// <value> | ||
/// <c>true</c> if the trigger was forced; otherwise, <c>false</c>. | ||
/// </value> | ||
[DataMember(Name = "trigger_forced")] | ||
public bool TriggerForced { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the trigger message. | ||
/// </summary> | ||
/// <value> | ||
/// The trigger message. | ||
/// </value> | ||
[DataMember(Name = "trigger_message")] | ||
public string TriggerMessage { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System.Collections.Generic; | ||
using System.Runtime.Serialization; | ||
|
||
namespace Cake.Common.Build.GoCD.Data | ||
{ | ||
/// <summary> | ||
/// The Go.CD history. | ||
/// </summary> | ||
[DataContract] | ||
public class GoCDHistoryInfo | ||
{ | ||
/// <summary> | ||
/// Gets or sets the pipelines. | ||
/// </summary> | ||
/// <value> | ||
/// The pipelines. | ||
/// </value> | ||
[DataMember(Name = "pipelines")] | ||
public IEnumerable<GoCDPipelineHistoryInfo> Pipelines { get; set; } | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/Cake.Common/Build/GoCD/Data/GoCDMaterialRevisionsInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System.Collections.Generic; | ||
using System.Runtime.Serialization; | ||
|
||
namespace Cake.Common.Build.GoCD.Data | ||
{ | ||
/// <summary> | ||
/// The Go.CD material revision information. | ||
/// </summary> | ||
[DataContract] | ||
public class GoCDMaterialRevisionsInfo | ||
{ | ||
/// <summary> | ||
/// Gets or sets a value indicating whether a change was made. | ||
/// </summary> | ||
/// <value> | ||
/// <c>true</c> if changed; otherwise, <c>false</c>. | ||
/// </value> | ||
[DataMember(Name = "changed")] | ||
public bool Changed { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the modifications. | ||
/// </summary> | ||
/// <value> | ||
/// The modifications. | ||
/// </value> | ||
[DataMember(Name = "modifications")] | ||
public IEnumerable<GoCDModificationInfo> Modifications { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
using System.Runtime.Serialization; | ||
|
||
namespace Cake.Common.Build.GoCD.Data | ||
{ | ||
/// <summary> | ||
/// A change made in the repository since the last time the Go.CD pipeline was run. | ||
/// </summary> | ||
[DataContract] | ||
public class GoCDModificationInfo | ||
{ | ||
/// <summary> | ||
/// Gets or sets the email address. | ||
/// </summary> | ||
/// <value> | ||
/// The email address. | ||
/// </value> | ||
[DataMember(Name = "email_address")] | ||
public string EmailAddress { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the identifier. | ||
/// </summary> | ||
/// <value> | ||
/// The identifier. | ||
/// </value> | ||
[DataMember(Name = "id")] | ||
public int Id { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the modified time in milliseconds from the Unix epoch. | ||
/// </summary> | ||
/// <value> | ||
/// The modified time in milliseconds from the Unix epoch. | ||
/// </value> | ||
[DataMember(Name = "modified_time")] | ||
public long ModifiedTimeUnixMilliseconds { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the modified time. | ||
/// </summary> | ||
/// <value> | ||
/// The modified time. | ||
/// </value> | ||
public DateTime ModifiedTime | ||
{ | ||
get { return FromUnixTimeMilliseconds(ModifiedTimeUnixMilliseconds); } | ||
set { ModifiedTimeUnixMilliseconds = ToUnixTimeMilliseconds(value); } | ||
} | ||
|
||
/// <summary> | ||
/// Gets or sets the username. | ||
/// </summary> | ||
/// <value> | ||
/// The username. | ||
/// </value> | ||
[DataMember(Name = "user_name")] | ||
public string Username { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the comment. | ||
/// </summary> | ||
/// <value> | ||
/// The comment. | ||
/// </value> | ||
[DataMember(Name = "comment")] | ||
public string Comment { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the revision. | ||
/// </summary> | ||
/// <value> | ||
/// The revision. | ||
/// </value> | ||
[DataMember(Name = "revision")] | ||
public string Revision { get; set; } | ||
|
||
private static DateTime FromUnixTimeMilliseconds(long milliseconds) | ||
{ | ||
if ((milliseconds < -62135596800000L) || (milliseconds > 0xe677d21fdbffL)) | ||
{ | ||
throw new ArgumentOutOfRangeException(nameof(milliseconds)); | ||
} | ||
|
||
return new DateTime((milliseconds * 0x2710L) + 0x89f7ff5f7b58000L); | ||
} | ||
|
||
private static long ToUnixTimeMilliseconds(DateTime dateTime) | ||
{ | ||
long num = dateTime.Ticks / 0x2710L; | ||
return num - 0x3883122cd800L; | ||
} | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
src/Cake.Common/Build/GoCD/Data/GoCDPipelineHistoryInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System.Runtime.Serialization; | ||
|
||
namespace Cake.Common.Build.GoCD.Data | ||
{ | ||
/// <summary> | ||
/// The Go.CD pipeline history. | ||
/// </summary> | ||
[DataContract] | ||
public class GoCDPipelineHistoryInfo | ||
{ | ||
/// <summary> | ||
/// Gets or sets the build cause. | ||
/// </summary> | ||
/// <value> | ||
/// The build cause. | ||
/// </value> | ||
[DataMember(Name = "build_cause")] | ||
public GoCDBuildCauseInfo BuildCause { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the comment. | ||
/// </summary> | ||
/// <value> | ||
/// The comment. | ||
/// </value> | ||
[DataMember(Name = "comment")] | ||
public string Comment { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the name. | ||
/// </summary> | ||
/// <value> | ||
/// The name. | ||
/// </value> | ||
[DataMember(Name = "name")] | ||
public string Name { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the natural order. | ||
/// </summary> | ||
/// <value> | ||
/// The natural order. | ||
/// </value> | ||
[DataMember(Name = "natural_order")] | ||
public string NaturalOrder { get; set; } | ||
} | ||
} |
Oops, something went wrong.