Skip to content

Commit ef62aa1

Browse files
author
ENDAVA\mzorec
committed
Adds Disable custom workspace flubu feature.
1 parent e93d2f5 commit ef62aa1

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

src/FlubuCore/BuildServers/Configurations/JenkinsConfigurationSerializer.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@ private StringBuilder BuildJenkinsPipeline(JenkinsPipeline pipeline)
1818
{
1919
StringBuilder stringBuilder = new StringBuilder();
2020

21+
22+
if (!pipeline.DisableCustomWorkspaceFlubuFeature)
23+
{
24+
stringBuilder.AppendBlockWithNewLine("def getWorkspace()", sb =>
25+
{
26+
sb.AppendIndent(4).Append(@"pwd().replace(""%2F"", ""_"")");
27+
});
28+
}
29+
2130
stringBuilder.AppendBlock("pipeline", sb =>
2231
{
2332
sb.Append(new string(' ', 4)).Append("agent ").AppendLine(pipeline.Agent).AppendLine();

src/FlubuCore/BuildServers/Configurations/JenkinsOptions.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ public class JenkinsOptions
3131

3232
protected internal FlubuToolType FlubuToolType { get; set; }
3333

34+
/// <summary>
35+
/// When enabled (by default) it fixes jenkins multibranch issue if branch contains "/" in the name. More info. https://issues.jenkins.io/browse/JENKINS-30744
36+
/// </summary>
37+
protected internal bool CustomWorkspaceFlubuFeature { get; set; }
38+
3439
protected internal bool RemoveBuiltInCheckoutStage { get; set; }
3540

3641
public JenkinsOptions SetFlubuToolType(FlubuToolType flubuToolType)
@@ -39,6 +44,15 @@ public JenkinsOptions SetFlubuToolType(FlubuToolType flubuToolType)
3944
return this;
4045
}
4146

47+
/// <summary>
48+
/// When enabled (by default) it fixes jenkins multibranch issue if branch contains "/" in the name. More info. https://issues.jenkins.io/browse/JENKINS-30744
49+
/// </summary>
50+
public JenkinsOptions DisableCustomWorkspaceFlubuFeature()
51+
{
52+
CustomWorkspaceFlubuFeature = true;
53+
return this;
54+
}
55+
4256
public JenkinsOptions AddEnvironment(string key, string value)
4357
{
4458
Environment.Add(key, value);

src/FlubuCore/BuildServers/Configurations/Models/Jenkins/JenkinsPipeline.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ public class JenkinsPipeline
2020

2121
public string FlubuCommand { get; set; }
2222

23+
/// <summary>
24+
/// When enabled (by default) it fixes jenkins multibranch issue if branch contains / in the name. https://issues.jenkins.io/browse/JENKINS-30744
25+
/// </summary>
26+
public bool DisableCustomWorkspaceFlubuFeature { get; set; }
27+
2328
public void FromOptions(JenkinsOptions options)
2429
{
2530
switch (options.FlubuToolType)
@@ -35,6 +40,8 @@ public void FromOptions(JenkinsOptions options)
3540

3641
Options = options.Options;
3742

43+
DisableCustomWorkspaceFlubuFeature = options.CustomWorkspaceFlubuFeature;
44+
3845
if (options.Environment != null && options.Environment.Count != 0)
3946
{
4047
Environment = options.Environment;

0 commit comments

Comments
 (0)