Skip to content

Commit 786ccfa

Browse files
committed
Update calamari argo step to convert git scp to https
1 parent 37ae172 commit 786ccfa

12 files changed

+157
-82
lines changed

source/Calamari.Tests/ArgoCD/ArgoCdApplicationManifestParserTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public void SingleSource_SourceDeserialized()
5353
{
5454
new ApplicationSource()
5555
{
56-
RepoUrl = new Uri("https://github.com/fake/octopus-test.git"),
56+
OriginalRepoUrl = "https://github.com/fake/octopus-test.git",
5757
TargetRevision = "test-branch",
5858
Path = "octopus-app"
5959
}
@@ -109,13 +109,13 @@ public void TwoSources_SourcesDeserialized()
109109
{
110110
new ApplicationSource()
111111
{
112-
RepoUrl = new Uri("https://github.com/fake/octopus-test.git"),
112+
OriginalRepoUrl = "https://github.com/fake/octopus-test.git",
113113
TargetRevision = "test-branch",
114114
Path = "octopus-app"
115115
},
116116
new ApplicationSource()
117117
{
118-
RepoUrl = new Uri("https://github.com/fake/octopus-test2.git"),
118+
OriginalRepoUrl = "https://github.com/fake/octopus-test2.git",
119119
TargetRevision = "test-branch2",
120120
Path = "octopus-app2"
121121
}
@@ -166,7 +166,7 @@ public void NoSourceType_SourceTypesIsEmpty()
166166
{
167167
new ApplicationSource()
168168
{
169-
RepoUrl = new Uri("https://github.com/fake/octopus-test.git"),
169+
OriginalRepoUrl = "https://github.com/fake/octopus-test.git",
170170
TargetRevision = "test-branch",
171171
Path = "octopus-app"
172172
}

source/Calamari.Tests/ArgoCD/Commands/Conventions/UpdateArgoCDAppImagesInstallConventionHelmTests.cs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public void Init()
9595
{
9696
new ApplicationSource()
9797
{
98-
RepoUrl = new Uri(OriginPath),
98+
OriginalRepoUrl = OriginPath,
9999
Path = "files",
100100
TargetRevision = argoCDBranchName.Value,
101101
Helm = new HelmConfig()
@@ -166,7 +166,7 @@ public void HelmSource_NoPath_DontUpdate()
166166
})
167167
.WithSource(new ApplicationSource
168168
{
169-
RepoUrl = new Uri(OriginPath),
169+
OriginalRepoUrl = OriginPath,
170170
TargetRevision = ArgoCDBranchFriendlyName
171171
},
172172
SourceTypeConstants.Helm)
@@ -350,7 +350,7 @@ public void SingleSourceWithWrongScoping_DontUpdate()
350350
{
351351
new ApplicationSource()
352352
{
353-
RepoUrl = new Uri(OriginPath),
353+
OriginalRepoUrl = OriginPath,
354354
Path = "files",
355355
TargetRevision = argoCDBranchName.Value,
356356
Name = "wrong-scoping",
@@ -428,7 +428,7 @@ public void RefSourceWithWrongScoping_DontUpdate()
428428
{
429429
new ApplicationSource()
430430
{
431-
RepoUrl = new Uri("https://github.com/doesnt/exist.git"),
431+
OriginalRepoUrl = "https://github.com/doesnt/exist.git",
432432
Path = "files",
433433
Helm = new HelmConfig()
434434
{
@@ -441,7 +441,7 @@ public void RefSourceWithWrongScoping_DontUpdate()
441441
},
442442
new ApplicationSource()
443443
{
444-
RepoUrl = new Uri(OriginPath),
444+
OriginalRepoUrl = OriginPath,
445445
TargetRevision = argoCDBranchName.Value,
446446
Ref = "values",
447447
}
@@ -517,7 +517,7 @@ public void HelmSourceWithExplicitValuesFile_MissingImagePath_WarnAndDontUpdate(
517517
{
518518
new ApplicationSource()
519519
{
520-
RepoUrl = new Uri(OriginPath),
520+
OriginalRepoUrl = OriginPath,
521521
TargetRevision = argoCDBranchName.Value,
522522
Path = "files",
523523
Helm = new HelmConfig()
@@ -603,7 +603,7 @@ public void HelmSourceWithImplicitValuesFile_MissingImagePath_WarnAndDontUpdate(
603603
{
604604
new ApplicationSource()
605605
{
606-
RepoUrl = new Uri(OriginPath),
606+
OriginalRepoUrl = OriginPath,
607607
TargetRevision = argoCDBranchName.Value,
608608
Path = "files",
609609
Name = "helm-source",
@@ -682,7 +682,7 @@ public void RefSourceWithMissingImagePath_WarnAndDontUpdate()
682682
{
683683
new ApplicationSource()
684684
{
685-
RepoUrl = new Uri("https://github.com/doesnt/exist.git"),
685+
OriginalRepoUrl = "https://github.com/doesnt/exist.git",
686686
Path = "files",
687687
Helm = new HelmConfig()
688688
{
@@ -694,7 +694,7 @@ public void RefSourceWithMissingImagePath_WarnAndDontUpdate()
694694
},
695695
new ApplicationSource()
696696
{
697-
RepoUrl = new Uri(OriginPath),
697+
OriginalRepoUrl = OriginPath,
698698
TargetRevision = argoCDBranchName.Value,
699699
Ref = "values",
700700
Name = "ref-source",
@@ -773,7 +773,7 @@ public void RefSourceWithMissingImagePathIfRefSourceNotInScope_DontWarnAndDontUp
773773
{
774774
new ApplicationSource()
775775
{
776-
RepoUrl = new Uri("https://github.com/doesnt/exist.git"),
776+
OriginalRepoUrl = "https://github.com/doesnt/exist.git",
777777
Path = "files",
778778
Helm = new HelmConfig()
779779
{
@@ -785,7 +785,7 @@ public void RefSourceWithMissingImagePathIfRefSourceNotInScope_DontWarnAndDontUp
785785
},
786786
new ApplicationSource()
787787
{
788-
RepoUrl = new Uri(OriginPath),
788+
OriginalRepoUrl = OriginPath,
789789
TargetRevision = argoCDBranchName.Value,
790790
Ref = "values",
791791
}
@@ -890,7 +890,7 @@ public void HelmSourceWithHelmConfigurationAndImplicitValuesFile_IncludeValuesFi
890890
})
891891
.WithSource(new ApplicationSource
892892
{
893-
RepoUrl = new Uri(OriginPath),
893+
OriginalRepoUrl = OriginPath,
894894
Path = "",
895895
TargetRevision = ArgoCDBranchFriendlyName,
896896
Helm = new HelmConfig()
@@ -980,7 +980,7 @@ public void HelmSourceWithHelmConfigurationAndNoImplicitValuesFile_ExcludeValues
980980
})
981981
.WithSource(new ApplicationSource
982982
{
983-
RepoUrl = new Uri(OriginPath),
983+
OriginalRepoUrl = OriginPath,
984984
Path = "",
985985
TargetRevision = ArgoCDBranchFriendlyName,
986986
Helm = new HelmConfig()
@@ -1071,7 +1071,7 @@ public void HelmSourceWithHelmConfigurationIncludesImplicitValuesFile_IncludeVal
10711071
})
10721072
.WithSource(new ApplicationSource
10731073
{
1074-
RepoUrl = new Uri(OriginPath),
1074+
OriginalRepoUrl = OriginPath,
10751075
Path = "",
10761076
TargetRevision = ArgoCDBranchFriendlyName,
10771077
Helm = new HelmConfig()
@@ -1164,7 +1164,7 @@ public void HelmSourceWithImplicitValuesFile_Update()
11641164
})
11651165
.WithSource(new ApplicationSource
11661166
{
1167-
RepoUrl = new Uri(OriginPath),
1167+
OriginalRepoUrl = OriginPath,
11681168
Path = "",
11691169
TargetRevision = ArgoCDBranchFriendlyName
11701170
},
@@ -1243,7 +1243,7 @@ public void RefSourceWithHelmImageMatches_Update()
12431243
})
12441244
.WithSource(new ApplicationSource
12451245
{
1246-
RepoUrl = new Uri("https://github.com/org/repo"),
1246+
OriginalRepoUrl = "https://github.com/org/repo",
12471247
Path = "",
12481248
TargetRevision = ArgoCDBranchFriendlyName,
12491249
Helm = new HelmConfig
@@ -1261,7 +1261,7 @@ public void RefSourceWithHelmImageMatches_Update()
12611261
Name = "ref-source",
12621262
Ref = "values",
12631263
TargetRevision = ArgoCDBranchFriendlyName,
1264-
RepoUrl = new Uri(OriginPath),
1264+
OriginalRepoUrl = OriginPath,
12651265
},
12661266
SourceTypeConstants.Directory)
12671267
.Build();
@@ -1364,7 +1364,7 @@ public void RefSourceWithHelmImageMatchesAndPath_IgnoresFilesUnderPath()
13641364
})
13651365
.WithSource(new ApplicationSource
13661366
{
1367-
RepoUrl = new Uri("https://github.com/org/repo"),
1367+
OriginalRepoUrl = "https://github.com/org/repo",
13681368
Path = "",
13691369
TargetRevision = ArgoCDBranchFriendlyName,
13701370
Helm = new HelmConfig
@@ -1383,7 +1383,7 @@ public void RefSourceWithHelmImageMatchesAndPath_IgnoresFilesUnderPath()
13831383
Ref = "values",
13841384
Path = "include/",
13851385
TargetRevision = ArgoCDBranchFriendlyName,
1386-
RepoUrl = new Uri(OriginPath),
1386+
OriginalRepoUrl = OriginPath,
13871387
},
13881388
SourceTypeConstants.Directory)
13891389
.Build();
@@ -1427,7 +1427,7 @@ void AssertOutputVariables(bool updated = true, string matchingApplicationTotalS
14271427
using var _ = new AssertionScope();
14281428
var serviceMessages = log.Messages.GetServiceMessagesOfType("setVariable");
14291429
serviceMessages.GetPropertyValue("ArgoCD.GatewayIds").Should().Be(GatewayId);
1430-
serviceMessages.GetPropertyValue("ArgoCD.GitUris").Should().Be(updated ? new Uri(OriginPath).AbsoluteUri : string.Empty);
1430+
serviceMessages.GetPropertyValue("ArgoCD.GitUris").Should().Be(updated ? OriginPath : string.Empty);
14311431
serviceMessages.GetPropertyValue("ArgoCD.UpdatedImages").Should().Be(updated ? updatedImages.ToString() : "0");
14321432
serviceMessages.GetPropertyValue("ArgoCD.MatchingApplications").Should().Be("App1");
14331433
serviceMessages.GetPropertyValue("ArgoCD.MatchingApplicationTotalSourceCounts").Should().Be(matchingApplicationTotalSourceCounts);

source/Calamari.Tests/ArgoCD/Commands/Conventions/UpdateArgoCDAppImagesInstallConventionTest.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public void Init()
8383
})
8484
.WithSource(new ApplicationSource()
8585
{
86-
RepoUrl = new Uri(OriginPath),
86+
OriginalRepoUrl = OriginPath,
8787
Path = "",
8888
TargetRevision = ArgoCDBranchFriendlyName,
8989
}, SourceTypeConstants.Directory)
@@ -138,7 +138,7 @@ public void PluginSourceType_DontUpdate()
138138
})
139139
.WithSource(new ApplicationSource()
140140
{
141-
RepoUrl = new Uri(OriginPath),
141+
OriginalRepoUrl = OriginPath,
142142
Path = "",
143143
TargetRevision = ArgoCDBranchFriendlyName,
144144
}, SourceTypeConstants.Plugin)
@@ -381,7 +381,7 @@ public void DirectorySource_NoPath_DontUpdate()
381381
})
382382
.WithSource(new ApplicationSource()
383383
{
384-
RepoUrl = new Uri(OriginPath),
384+
OriginalRepoUrl = OriginPath,
385385
TargetRevision = ArgoCDBranchFriendlyName,
386386
}, SourceTypeConstants.Directory)
387387
.Build();
@@ -446,7 +446,7 @@ public void KustomizeSource_NoPath_DontUpdate()
446446
})
447447
.WithSource(new ApplicationSource()
448448
{
449-
RepoUrl = new Uri(OriginPath),
449+
OriginalRepoUrl = OriginPath,
450450
TargetRevision = ArgoCDBranchFriendlyName,
451451
}, SourceTypeConstants.Kustomize)
452452
.Build();
@@ -511,7 +511,7 @@ public void KustomizeSource_HasKustomizationFile_Update()
511511
})
512512
.WithSource(new ApplicationSource()
513513
{
514-
RepoUrl = new Uri(OriginPath),
514+
OriginalRepoUrl = OriginPath,
515515
Path = "",
516516
TargetRevision = ArgoCDBranchFriendlyName,
517517
}, SourceTypeConstants.Kustomize)
@@ -599,7 +599,7 @@ public void KustomizeSource_NoKustomizationFile_DontUpdate()
599599
})
600600
.WithSource(new ApplicationSource()
601601
{
602-
RepoUrl = new Uri(OriginPath),
602+
OriginalRepoUrl = OriginPath,
603603
Path = "",
604604
TargetRevision = ArgoCDBranchFriendlyName,
605605
}, SourceTypeConstants.Kustomize)
@@ -634,7 +634,7 @@ void AssertOutputVariables(bool updated = true, string matchingApplicationTotalS
634634
using var _ = new AssertionScope();
635635
var serviceMessages = log.Messages.GetServiceMessagesOfType("setVariable");
636636
serviceMessages.GetPropertyValue("ArgoCD.GatewayIds").Should().Be(GatewayId);
637-
serviceMessages.GetPropertyValue("ArgoCD.GitUris").Should().Be(updated ? new Uri(OriginPath).AbsoluteUri : string.Empty);
637+
serviceMessages.GetPropertyValue("ArgoCD.GitUris").Should().Be(updated ? OriginPath : string.Empty);
638638
serviceMessages.GetPropertyValue("ArgoCD.UpdatedImages").Should().Be(updated ? "1" : "0");
639639
serviceMessages.GetPropertyValue("ArgoCD.MatchingApplications").Should().Be("App1");
640640
serviceMessages.GetPropertyValue("ArgoCD.MatchingApplicationTotalSourceCounts").Should().Be(matchingApplicationTotalSourceCounts);

0 commit comments

Comments
 (0)