Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • Fix/xxxx-oldSchool
  • Hotfix/2352-onlyChanged
  • Hotfix/2615-graphDeployerLag
  • Hotfix/790-orgDeploy
  • Hotfix/953-fileNameWithSpace
  • Hotfix/999-fixGraphdeployer
  • Hotfix/xxxx-directoryDependency
  • Hotfix/xxxx-fastDeployment
  • Issue/2518-docs
  • Issue/2568-betterLogging
  • Issue/2668-graphDeployer
  • Issue/2880-gd
  • Issue/2906-containerCron
  • Issue/2915-migrateSql2Linked
  • Issue/2944-gdShenanigans
  • Issue/2967-fixGD
  • Issue/2980-fixContainerBuild
  • Issue/3109-onboarding
  • Issue/3130-onboardingUzK
  • Issue/xxxx-fixDevcontainer
  • Issue/xxxx-generateLatestTag
  • Product/483-organizations
  • Product/871-generalDeployment
  • Sprint/2020-07
  • Sprint/2020-11
  • Sprint/2020-12
  • Sprint/2022-01
  • Topic/711-organizations
  • Topic/713-rwthOrgState
  • Topic/886-generalDeployment
  • dev
  • gitkeep
  • master
  • petar.hristov-master-patch-9e49
  • test_ci
  • v1.1.0
  • v1.1.1
  • v1.2.0
  • v1.2.1
  • v1.2.10
  • v1.2.11
  • v1.2.2
  • v1.2.3
  • v1.2.4
  • v1.2.5
  • v1.2.6
  • v1.2.7
  • v1.2.8
  • v1.2.9
  • v2.0.0
  • v2.0.1
  • v2.1.0
  • v2.1.1
  • v2.1.10
  • v2.1.11
  • v2.1.2
  • v2.1.3
  • v2.1.4
  • v2.1.5
  • v2.1.6
  • v2.1.7
  • v2.1.8
  • v2.1.9
63 results

Target

Select target project
  • coscine/backend/scripts/graphdeployer
1 result
Select Git revision
  • Fix/xxxx-oldSchool
  • Hotfix/2352-onlyChanged
  • Hotfix/2615-graphDeployerLag
  • Hotfix/790-orgDeploy
  • Hotfix/953-fileNameWithSpace
  • Hotfix/999-fixGraphdeployer
  • Hotfix/xxxx-directoryDependency
  • Hotfix/xxxx-fastDeployment
  • Issue/2518-docs
  • Issue/2568-betterLogging
  • Issue/2668-graphDeployer
  • Issue/2880-gd
  • Issue/2906-containerCron
  • Issue/2915-migrateSql2Linked
  • Issue/2944-gdShenanigans
  • Issue/2967-fixGD
  • Issue/2980-fixContainerBuild
  • Issue/3109-onboarding
  • Issue/3130-onboardingUzK
  • Issue/xxxx-fixDevcontainer
  • Issue/xxxx-generateLatestTag
  • Product/483-organizations
  • Product/871-generalDeployment
  • Sprint/2020-07
  • Sprint/2020-11
  • Sprint/2020-12
  • Sprint/2022-01
  • Topic/711-organizations
  • Topic/713-rwthOrgState
  • Topic/886-generalDeployment
  • dev
  • gitkeep
  • master
  • petar.hristov-master-patch-9e49
  • test_ci
  • v1.1.0
  • v1.1.1
  • v1.2.0
  • v1.2.1
  • v1.2.10
  • v1.2.11
  • v1.2.2
  • v1.2.3
  • v1.2.4
  • v1.2.5
  • v1.2.6
  • v1.2.7
  • v1.2.8
  • v1.2.9
  • v2.0.0
  • v2.0.1
  • v2.1.0
  • v2.1.1
  • v2.1.10
  • v2.1.11
  • v2.1.2
  • v2.1.3
  • v2.1.4
  • v2.1.5
  • v2.1.6
  • v2.1.7
  • v2.1.8
  • v2.1.9
63 results
Show changes
Commits on Source (3)
......@@ -19,6 +19,15 @@ public class Deployer
private readonly GraphDeployerConfiguration _graphDeployerConfiguration;
private readonly AdminApi _adminApi;
// Define ANSI escape codes for colors
private const string _esc = "\u001b"; // ANSI escape character
private const string _r = $"{_esc}[91m";
private const string _gb = $"{_esc}[1;92m";
private const string _y = $"{_esc}[93m";
private const string _bb = $"{_esc}[1;94m";
private const string _c = $"{_esc}[96m";
private const string _0 = $"{_esc}[0m";
public Deployer(ILogger<Deployer> logger, IOptionsMonitor<GraphDeployerConfiguration> graphDeployerConfiguration)
{
_logger = logger;
......@@ -35,7 +44,7 @@ public class Deployer
// Check if the graph deployer has to skip SSL checks when connecting to the API
if (_graphDeployerConfiguration.SkipSslCheck)
{
_logger.LogInformation("Skipping SSL certificate validation...");
_logger.LogInformation("{y}Skipping SSL certificate validation...{res}", _y, _0);
// Skip SSL certificate validation
apiClientConfig.RemoteCertificateValidationCallback = (_, _, _, _) => true;
}
......@@ -62,9 +71,12 @@ public class Deployer
// Log the current application execution mode
if (opts.DummyMode)
{
_logger.LogInformation("Running in Dummy Mode. No changes will be made.");
_logger.LogInformation("{y}Running in Dummy Mode. No changes will be made.{r}", _y, _0);
}
if (opts.Redeploy)
{
_logger.LogInformation("{y}Redeploying all graphs.{r}", _y, _0);
}
_logger.LogDebug("Redeploy: {redeploy}", opts.Redeploy);
// Override the working folder if specified in the configuration
if (!string.IsNullOrWhiteSpace(_graphDeployerConfiguration.WorkingFolder))
......@@ -79,7 +91,7 @@ public class Deployer
// Iterate over the repositories and deploy the graphs
foreach (var graphRepo in _graphDeployerConfiguration.GitLab.Repositories)
{
_logger.LogInformation("Working with {repoName}", graphRepo.Name);
_logger.LogInformation("Working with {bb}{repoName}{res}...", _bb, graphRepo.Name, _0);
// Clone the repository inside the Working Folder
var success = CloneRepo(graphRepo.Url, WorkingFolder, _graphDeployerConfiguration.GitLab.Token, graphRepo.Ref);
......@@ -111,10 +123,10 @@ public class Deployer
}
catch (Exception e)
{
_logger.LogError("Failed to load and process Turtle file: \"{file}\". Error: {errorMessage}", file, e.Message);
_logger.LogError("Failed to load and process Turtle file: \"{r}{file}{res}\". Error: {errorMessage}", _r, file, _0, e.Message);
}
});
_logger.LogDebug("Accumulated {count} graphs for possible deployment.", graphAccumulation.Count);
_logger.LogDebug("Accumulated {c}{count}{res} graphs for possible deployment.", _c, graphAccumulation.Count, _0);
// Iterate over the accumulated graphs and deploy them
foreach (var kv in graphAccumulation)
......@@ -124,7 +136,7 @@ public class Deployer
var graphId = kv.Key.ToString();
var currentRun = new Dictionary<string, string>();
_logger.LogDebug("Deploying graph: {graphName}", graphId);
_logger.LogDebug("Deploying graph: {c}{graphName}{res}", _c, graphId, _0);
// Get the hash of the currently deployed graph and compare it with the hash of the graph to be deployed
files.ForEach((path) => currentRun.TryAdd(graphId, HashUtil.GetFileHash(path)));
......@@ -134,10 +146,10 @@ public class Deployer
if (hasChanged)
{
_logger.LogDebug("The graph has changed");
_logger.LogDebug("The graph has changed.");
} else
{
_logger.LogDebug("The graph has not changed");
_logger.LogDebug("The graph has not changed.");
}
if(deployedGraph is null)
......@@ -177,12 +189,12 @@ public class Deployer
});
}
_logger.LogInformation("Deployed {graphName} successfully.", graphId);
_logger.LogInformation("Deployed {c}{graphName}{res} {gb}successfully{res}.", _c, graphId, _0, _gb, _0);
DeployedGraphs.Add(graphId);
}
else
{
_logger.LogDebug("Skipped {graphName} as it has not changed.", graphId);
_logger.LogDebug("Skipped {c}{graphName}{res} as it has not changed.", _c, graphId, _0);
SkippedGraphs.Add(graphId);
continue;
}
......@@ -230,7 +242,7 @@ public class Deployer
// Retrieve the reference of the repository, either the branch name or the commit hash
var repoRef = localRepo.Head.IsTracking ? localRepo.Head.FriendlyName : localRepo.Head.Tip.Sha;
_logger.LogInformation("Repository successfully cloned and switched on ref \"{ref}\".", repoRef);
_logger.LogInformation("Repository successfully cloned and switched on ref \"{c}{ref}{res}\".", _c, repoRef, _0);
return true;
}
......
......@@ -7,7 +7,7 @@
<AssemblyName>Coscine.GraphDeployer</AssemblyName>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>2.1.5</Version>
<Version>2.1.6</Version>
</PropertyGroup>
<PropertyGroup>
......
......@@ -5,7 +5,7 @@
"IsEnabled": true,
"WorkingFolder": "./Output/",
"Logger": {
"LogLevel": "Debug",
"LogLevel": "Information",
"LogHome": "./Logs"
},
"GitLab": {
......@@ -13,7 +13,7 @@
"Token": null,
"Repositories": [
{
"Name": "Application Profiles",
"Name": "Metadata Profiles",
"Url": "https://git.rwth-aachen.de/coscine/graphs/applicationprofiles.git"
},
{
......
......@@ -8,8 +8,11 @@
<variable name="logHome" value="${basedir}/Logs" />
<variable name="logLevel" value="Warn" />
<!-- This variable is used to remove ANSI escape codes from the log message. -->
<variable name="message_raw" value="${replace:inner=${message}:searchFor=\x1B\[[0-9;]*[A-Za-z]:replaceWith=:regex=true}" />
<!--Possible aspnet- variables: https://nlog-project.org/config/?tab=layout-renderers&search=package:nlog.web-->
<variable name="layout" value="${longdate} | [${level:uppercase=true}] ${message} ${exception:format=tostring}" />
<variable name="layout" value="${longdate} | [${level:uppercase=true}] ${message_raw} ${exception:format=tostring}" />
<targets>
<!-- Write logs to File -->
......