Skip to content

Commit

Permalink
Merge pull request #891 from OctopusDeploy/lourens/add-git-trigger
Browse files Browse the repository at this point in the history
Add Git Repository Trigger
  • Loading branch information
lourens-octopus authored Nov 7, 2024
2 parents f20447c + 6d2ceba commit 90125d4
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7433,6 +7433,27 @@ Octopus.Client.Model.Triggers
DaysPerWeekSchedule = 6
FeedFilter = 7
ArcFeedFilter = 8
GitFilter = 9
}
}
Octopus.Client.Model.Triggers.GitTriggers
{
class GitFilterResource
Octopus.Client.Extensibility.IResource
Octopus.Client.Model.IAuditedResource
Octopus.Client.Model.Triggers.TriggerFilterResource
{
.ctor()
Octopus.Client.Model.Triggers.TriggerFilterType FilterType { get; }
List<GitTriggerSourceResource> Sources { get; set; }
}
class GitTriggerSourceResource
{
.ctor(String, String, String[], String[])
String DeploymentActionSlug { get; set; }
String[] ExcludeFilePaths { get; set; }
String GitDependencyName { get; set; }
String[] IncludeFilePaths { get; set; }
}
}
Octopus.Client.Model.Triggers.ScheduledTriggers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7457,6 +7457,27 @@ Octopus.Client.Model.Triggers
DaysPerWeekSchedule = 6
FeedFilter = 7
ArcFeedFilter = 8
GitFilter = 9
}
}
Octopus.Client.Model.Triggers.GitTriggers
{
class GitFilterResource
Octopus.Client.Extensibility.IResource
Octopus.Client.Model.IAuditedResource
Octopus.Client.Model.Triggers.TriggerFilterResource
{
.ctor()
Octopus.Client.Model.Triggers.TriggerFilterType FilterType { get; }
List<GitTriggerSourceResource> Sources { get; set; }
}
class GitTriggerSourceResource
{
.ctor(String, String, String[], String[])
String DeploymentActionSlug { get; set; }
String[] ExcludeFilePaths { get; set; }
String GitDependencyName { get; set; }
String[] IncludeFilePaths { get; set; }
}
}
Octopus.Client.Model.Triggers.ScheduledTriggers
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#nullable enable
using System.Collections.Generic;
using Newtonsoft.Json;

namespace Octopus.Client.Model.Triggers.GitTriggers;

public class GitFilterResource : TriggerFilterResource
{
public override TriggerFilterType FilterType => TriggerFilterType.GitFilter;

public List<GitTriggerSourceResource> Sources { get; set; } = [];
}

public class GitTriggerSourceResource
{
[JsonConstructor]
public GitTriggerSourceResource(string deploymentActionSlug, string gitDependencyName, string[] includeFilePaths, string[] excludeFilePaths)
{
DeploymentActionSlug = deploymentActionSlug;
GitDependencyName = gitDependencyName;
IncludeFilePaths = includeFilePaths;
ExcludeFilePaths = excludeFilePaths;
}

public string DeploymentActionSlug { get; set; }
public string GitDependencyName { get; set; }
public string[] IncludeFilePaths { get; set; }
public string[] ExcludeFilePaths { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ public enum TriggerFilterType
DailySchedule,
DaysPerWeekSchedule,
FeedFilter,
ArcFeedFilter
ArcFeedFilter,
GitFilter
}

public abstract class TriggerFilterResource : Resource
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using Octopus.Client.Model.Triggers;
using Octopus.Client.Model.Triggers.GitTriggers;
using Octopus.Client.Model.Triggers.ScheduledTriggers;

namespace Octopus.Client.Serialization
Expand All @@ -18,7 +19,8 @@ public class TriggerFilterConverter : InheritedClassConverter<TriggerFilterResou
{ TriggerFilterType.DaysPerWeekSchedule, typeof (DaysPerWeekScheduledTriggerFilterResource)},
{ TriggerFilterType.CronExpressionSchedule, typeof (CronScheduledTriggerFilterResource)},
{ TriggerFilterType.FeedFilter, typeof (FeedFilterResource)},
{ TriggerFilterType.ArcFeedFilter, typeof (ArcFeedFilterResource)}
{ TriggerFilterType.ArcFeedFilter, typeof (ArcFeedFilterResource)},
{ TriggerFilterType.GitFilter, typeof (GitFilterResource)}
};

protected override IDictionary<TriggerFilterType, Type> DerivedTypeMappings => FilterTypes;
Expand Down

0 comments on commit 90125d4

Please sign in to comment.