Skip to content

Commit 33cd963

Browse files
authored
Merge pull request #886 from Inxton/troubleshooting-cicd
Troubleshooting cicd
2 parents b10f04a + 4d3095a commit 33cd963

File tree

3 files changed

+36
-8
lines changed

3 files changed

+36
-8
lines changed

cake/ApaxCmd.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,21 @@
2727

2828
public static class ApaxCmd
2929
{
30+
31+
public static void ApaxSelfUpdate(this BuildContext context, string version)
32+
{
33+
var apaxArguments = $"self-update {version}";
34+
35+
context.Log.Information($"apax self-update to version '{version}'");
36+
context.ProcessRunner.Start(Helpers.GetApaxCommand(), new ProcessSettings()
37+
{
38+
Arguments = apaxArguments,
39+
RedirectStandardOutput = false,
40+
RedirectStandardError = false,
41+
Silent = false
42+
}).WaitForExit();
43+
}
44+
3045
public static void ApaxInstall(this BuildContext context, IEnumerable<string> folders)
3146
{
3247
foreach (var folder in folders)

cake/Program.cs

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@ public override void Run(BuildContext context)
122122
{
123123
context.CopyFiles(Path.Combine(context.RootDir, "traversals", "traversalBuilds", "**/*.*"), Path.Combine(context.RootDir, library.folder));
124124
}
125+
126+
// with this we will enforce use of specific apax version at least temporarily
127+
// due to issues with apax versions in some environments.
128+
context.ApaxSelfUpdate("4.0.0");
125129
}
126130

127131
private static void ProvisionTools(BuildContext context)
@@ -172,11 +176,13 @@ public override void Run(BuildContext context)
172176

173177
if (context.BuildParameters.DoPack)
174178
{
179+
var apaxFiles = new List<string>();
180+
context.Log.Information("Collecting .apax files.");
181+
ApaxTraversal.CollectApaxFileInfoRecursively(context.RootDir, new List<string>() { ".apax", "traversals" }, apaxFiles);
182+
175183
context.Libraries.ToList().ForEach(lib =>
176184
{
177-
//foreach (var apaxfile in context.GetApaxFiles(lib))
178-
var apaxFiles = new List<string>();
179-
ApaxTraversal.CollectApaxFileInfoRecursively(context.RootDir, new List<string>() { ".apax", "traversals" }, apaxFiles);
185+
//foreach (var apaxfile in context.GetApaxFiles(lib))
180186
foreach (var apaxfile in apaxFiles)
181187
{
182188
context.UpdateApaxVersion(apaxfile, GitVersionInformation.SemVer);
@@ -188,9 +194,10 @@ public override void Run(BuildContext context)
188194
// context.DotnetIxr(context.Libraries.Where(p => p.pack && Directory.Exists(Path.Combine(context.RootDir, p.folder, "ctrl", "src"))).Select(p => Path.Combine(context.RootDir, p.folder, "ctrl")));
189195

190196
var traversalProjectFolder = Path.Combine(context.RootDir, "traversals", "apax");
191-
if (!context.BuildParameters.NoBuild)
197+
if (!context.BuildParameters.NoBuild || context.BuildParameters.DoPack)
192198
{
193199
var traversalProject = Path.Combine(traversalProjectFolder, "apax.yml");
200+
context.Log.Information("Creating apax traversal.");
194201
context.CreateApaxTraversal(context.RootDir, traversalProject);
195202
context.ApaxInstall(new[] { traversalProjectFolder });
196203
context.DotnetIxc(new[] { traversalProjectFolder });
@@ -205,10 +212,16 @@ public override void Run(BuildContext context)
205212

206213
if (!context.BuildParameters.NoBuild && !context.BuildParameters.DoTest && !context.BuildParameters.DoPack)
207214
{
215+
context.Log.Information("Creating apax traversal.");
208216
context.ApaxBuild(new[] { traversalProjectFolder });
209217
}
210218

211219

220+
// Clean up travversal files after build remove apax.yml and .apax folder
221+
context.DeleteFile(Path.Combine(traversalProjectFolder, "apax.yml"));
222+
223+
//System.IO.Directory.Delete(Path.Combine(traversalProjectFolder, ".apax"), true);
224+
212225
}
213226
}
214227

@@ -480,8 +493,7 @@ private static void PackApax(BuildContext context)
480493
context.ApaxInstall(context.GetLibraryAxFolders(lib));
481494
context.ApaxBuild(context.GetLibraryAxFolders(lib));
482495
context.ApaxPack(lib);
483-
context.ApaxCopyArtifacts(lib);
484-
System.Threading.Thread.Sleep(10000);
496+
context.ApaxCopyArtifacts(lib);
485497
});
486498

487499
}
@@ -496,8 +508,7 @@ private static void PackApax(BuildContext context)
496508
context.ApaxInstall(context.GetLibraryAxFolders(lib));
497509
context.ApaxBuild(context.GetLibraryAxFolders(lib));
498510
context.ApaxPack(lib);
499-
context.ApaxCopyArtifacts(lib);
500-
System.Threading.Thread.Sleep(10000);
511+
context.ApaxCopyArtifacts(lib);
501512
});
502513
}
503514
}

src/core/ctrl/apax.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ files:
1010
# APAX_BUILD_ARGS: [ -d ]
1111
registries:
1212
"@inxton": "https://npm.pkg.github.com/"
13+
catalogs:
14+
"@inxton/ax.catalog": 0.0.40
1315
devDependencies:
1416
"@inxton/ax-sdk": '0.0.0-dev.0'
1517
dependencies:

0 commit comments

Comments
 (0)