Skip to content
Snippets Groups Projects
Commit 0d2e5903 authored by Marcel Nellesen's avatar Marcel Nellesen
Browse files

Merge branch 'Product/1406-SPPageDeployer' into 'master'

Update: Add a flag to the SPPageDeployer that specifies the version/tag/branch...

See merge request !11
parents f545969a 99cfd76f
Branches Sprint/2022-01 dev master
Tags v1.2.0
1 merge request!11Update: Add a flag to the SPPageDeployer that specifies the version/tag/branch...
## Executing the SPPageDeployer
The SPPageDeployer uses one single input argument (`--ref` or `--r`) that is a GitLab reference string. This reference string can be a `tag`, `branch name` or a `commit id`.
Example:
```
...\Coscine.SPPageDeployer.exe --ref 'master'
```
Should the `--ref` input argument be omitted, then a default value `"master"` will be set.
## C# Template
This template includes:
......@@ -28,4 +38,4 @@ The project will be build and tested.
* [Commit convention](docs/ESLintConvention.md)
* [Everything possible with markup](docs/testdoc.md)
* [Adding NUnit tests](docs/nunit.md)
\ No newline at end of file
* [Adding NUnit tests](docs/nunit.md)
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<startup>
......
using Coscine.Action.Utils;
using Coscine.Action.Utils;
using Coscine.Configuration;
using Coscine.Database.Models;
using Coscine.Database.Settings;
using NDesk.Options;
using System.Collections.Generic;
using LinqToDB.Data;
using System;
......@@ -9,31 +11,69 @@ namespace Coscine.SPPageDeployer
{
public class Program
{
private static string branchName = "master";
public static void Main(string[] args)
{
var optionSet = new OptionSet() {
{ "r|ref=", "Branch or Tag name to grab the Templates from. It defaults to the master branch.",
x => branchName = x },
};
List<string> extra;
try
{
extra = optionSet.Parse(args);
}
catch (OptionException e)
{
Console.WriteLine(e.Message);
Console.WriteLine("Try '--help' for more information.");
}
var configuration = new ConsulConfiguration();
DataConnection.DefaultSettings = new CoscineSettings(configuration);
using (var pageUtil = new PageUtil(configuration))
var currentTemplateBranchForRedeploy = configuration.GetStringAndWait("coscine/scripts/SPPageDeployer/current_template_branch");
if (branchName != currentTemplateBranchForRedeploy)
{
Console.WriteLine("Deploying root pages!");
pageUtil.DeployRootPages();
Console.WriteLine("Deployed root pages!");
var projectModel = new ProjectModel();
foreach (var project in projectModel.GetAll())
Console.WriteLine($"Installing templates with git reference {branchName}");
try
{
Console.WriteLine($"Deploying pages for project {project.Slug}!");
try
if (configuration.Put("coscine/scripts/SPPageDeployer/current_template_branch", branchName) && configuration.Put("coscine/local/sharepoint/pagebranch", branchName))
{
pageUtil.DeployProjectPages(project);
Console.WriteLine($"Deployed pages for project {project.Slug}!");
}
catch (Exception e)
{
Console.WriteLine($"{e.Message}");
Console.WriteLine($"Error: Could not deploy pages for project {project.Slug}!");
Console.WriteLine("Added template key to Consul");
DataConnection.DefaultSettings = new CoscineSettings(configuration);
using (var pageUtil = new PageUtil(configuration))
{
pageUtil.DeployRootPages();
Console.WriteLine("Deployed root pages");
var projectModel = new ProjectModel();
foreach (var project in projectModel.GetAll())
{
try
{
pageUtil.DeployProjectPages(project);
Console.WriteLine($"Deployed pages for project {project.Slug}");
}
catch (Exception e)
{
Console.WriteLine($"{e.Message}");
Console.WriteLine($"Error: Could not deploy pages for project {project.Slug}");
}
}
}
}
// Not handling 'else' scenario
}
catch (Exception e)
{
Console.WriteLine($"{e.Message}");
Console.WriteLine($"Error: Could not add keys to Consul");
}
}
else
{
Console.WriteLine($"Deployment of templates skipped. Correct versions are installed already.");
}
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\EntityFramework.6.4.4\build\EntityFramework.props" Condition="Exists('..\packages\EntityFramework.6.4.4\build\EntityFramework.props')" />
<Import Project="..\packages\linq2db.t4models.2.6.4\build\linq2db.t4models.props" Condition="Exists('..\packages\linq2db.t4models.2.6.4\build\linq2db.t4models.props')" />
<Import Project="..\packages\linq2db.SqlServer.2.6.4\build\linq2db.SqlServer.props" Condition="Exists('..\packages\linq2db.SqlServer.2.6.4\build\linq2db.SqlServer.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
......@@ -38,67 +35,10 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Consul, Version=0.7.2.6, Culture=neutral, PublicKeyToken=20a6ad9a81df1d95, processorArchitecture=MSIL">
<HintPath>..\packages\Consul.0.7.2.6\lib\net45\Consul.dll</HintPath>
</Reference>
<Reference Include="Coscine.Action, Version=1.17.1.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\Coscine.Action.1.17.1\lib\net461\Coscine.Action.dll</HintPath>
</Reference>
<Reference Include="Coscine.Configuration, Version=1.5.0.0, Culture=neutral, PublicKeyToken=ce3d7a32d7dc1e5a, processorArchitecture=MSIL">
<HintPath>..\packages\Coscine.Configuration.1.5.0\lib\net461\Coscine.Configuration.dll</HintPath>
</Reference>
<Reference Include="Coscine.Database, Version=1.27.0.0, Culture=neutral, PublicKeyToken=767d77427707b70a, processorArchitecture=MSIL">
<HintPath>..\packages\Coscine.Database.1.27.0\lib\net461\Coscine.Database.dll</HintPath>
</Reference>
<Reference Include="Coscine.Database.T4, Version=1.27.0.0, Culture=neutral, PublicKeyToken=84b4c404a0696261, processorArchitecture=MSIL">
<HintPath>..\packages\Coscine.Database.1.27.0\lib\net461\Coscine.Database.T4.dll</HintPath>
</Reference>
<Reference Include="Coscine.ProxyApi, Version=1.3.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Coscine.ProxyApi.1.3.0\lib\net461\Coscine.ProxyApi.dll</HintPath>
</Reference>
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll</HintPath>
</Reference>
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.SqlServer.dll</HintPath>
</Reference>
<Reference Include="linq2db, Version=3.1.1.0, Culture=neutral, PublicKeyToken=e41013125f9e410a, processorArchitecture=MSIL">
<HintPath>..\packages\linq2db.3.1.1\lib\net46\linq2db.dll</HintPath>
</Reference>
<Reference Include="LinqKit, Version=1.1.17.0, Culture=neutral, PublicKeyToken=bc217f8844052a91, processorArchitecture=MSIL">
<HintPath>..\packages\LinqKit.1.1.17\lib\net45\LinqKit.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Data.Edm, Version=5.6.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Data.Edm.5.6.4\lib\net40\Microsoft.Data.Edm.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Data.OData, Version=5.6.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Data.OData.5.6.4\lib\net40\Microsoft.Data.OData.dll</HintPath>
</Reference>
<Reference Include="microsoft.identitymodel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.IdentityModel.7.0.0\lib\net35\microsoft.identitymodel.dll</HintPath>
</Reference>
<Reference Include="Microsoft.IdentityModel.JsonWebTokens, Version=5.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.IdentityModel.JsonWebTokens.5.6.0\lib\net461\Microsoft.IdentityModel.JsonWebTokens.dll</HintPath>
</Reference>
<Reference Include="Microsoft.IdentityModel.Logging, Version=5.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.IdentityModel.Logging.5.6.0\lib\net461\Microsoft.IdentityModel.Logging.dll</HintPath>
</Reference>
<Reference Include="Microsoft.IdentityModel.Tokens, Version=5.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.IdentityModel.Tokens.5.6.0\lib\net461\Microsoft.IdentityModel.Tokens.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" />
<Reference Include="System.IdentityModel.Tokens.Jwt, Version=5.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\System.IdentityModel.Tokens.Jwt.5.6.0\lib\net461\System.IdentityModel.Tokens.Jwt.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.WebRequest" />
<Reference Include="System.Spatial, Version=5.6.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\System.Spatial.5.6.4\lib\net40\System.Spatial.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
......@@ -112,17 +52,68 @@
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Consul">
<Version>0.7.2.6</Version>
</PackageReference>
<PackageReference Include="Coscine.Action">
<Version>1.17.1</Version>
</PackageReference>
<PackageReference Include="Coscine.Configuration">
<Version>1.5.0</Version>
</PackageReference>
<PackageReference Include="Coscine.Database">
<Version>1.27.0</Version>
</PackageReference>
<PackageReference Include="Coscine.ProxyApi">
<Version>1.3.0</Version>
</PackageReference>
<PackageReference Include="EntityFramework">
<Version>6.4.4</Version>
</PackageReference>
<PackageReference Include="linq2db">
<Version>3.1.1</Version>
</PackageReference>
<PackageReference Include="linq2db.SqlServer">
<Version>2.6.4</Version>
</PackageReference>
<PackageReference Include="linq2db.t4models">
<Version>2.6.4</Version>
</PackageReference>
<PackageReference Include="LinqKit">
<Version>1.1.17</Version>
</PackageReference>
<PackageReference Include="Microsoft.Data.Edm">
<Version>5.6.4</Version>
</PackageReference>
<PackageReference Include="Microsoft.Data.OData">
<Version>5.6.4</Version>
</PackageReference>
<PackageReference Include="Microsoft.IdentityModel">
<Version>7.0.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens">
<Version>5.6.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.IdentityModel.Logging">
<Version>5.6.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.IdentityModel.Tokens">
<Version>5.6.0</Version>
</PackageReference>
<PackageReference Include="NDesk.Options">
<Version>0.2.1</Version>
</PackageReference>
<PackageReference Include="Newtonsoft.Json">
<Version>12.0.3</Version>
</PackageReference>
<PackageReference Include="System.IdentityModel.Tokens.Jwt">
<Version>5.6.0</Version>
</PackageReference>
<PackageReference Include="System.Spatial">
<Version>5.6.4</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\linq2db.SqlServer.2.6.4\build\linq2db.SqlServer.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\linq2db.SqlServer.2.6.4\build\linq2db.SqlServer.props'))" />
<Error Condition="!Exists('..\packages\linq2db.t4models.2.6.4\build\linq2db.t4models.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\linq2db.t4models.2.6.4\build\linq2db.t4models.props'))" />
<Error Condition="!Exists('..\packages\EntityFramework.6.4.4\build\EntityFramework.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\EntityFramework.6.4.4\build\EntityFramework.props'))" />
<Error Condition="!Exists('..\packages\EntityFramework.6.4.4\build\EntityFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\EntityFramework.6.4.4\build\EntityFramework.targets'))" />
</Target>
<Import Project="..\packages\EntityFramework.6.4.4\build\EntityFramework.targets" Condition="Exists('..\packages\EntityFramework.6.4.4\build\EntityFramework.targets')" />
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Consul" version="0.7.2.6" targetFramework="net461" />
<package id="Coscine.Action" version="1.17.1" targetFramework="net461" />
<package id="Coscine.Configuration" version="1.5.0" targetFramework="net461" />
<package id="Coscine.Database" version="1.27.0" targetFramework="net461" />
<package id="Coscine.ProxyApi" version="1.3.0" targetFramework="net461" />
<package id="EntityFramework" version="6.4.4" targetFramework="net461" />
<package id="linq2db" version="3.1.1" targetFramework="net461" />
<package id="linq2db.SqlServer" version="2.6.4" targetFramework="net461" />
<package id="linq2db.t4models" version="2.6.4" targetFramework="net461" />
<package id="LinqKit" version="1.1.17" targetFramework="net461" />
<package id="Microsoft.Data.Edm" version="5.6.4" targetFramework="net461" />
<package id="Microsoft.Data.OData" version="5.6.4" targetFramework="net461" />
<package id="Microsoft.IdentityModel" version="7.0.0" targetFramework="net461" />
<package id="Microsoft.IdentityModel.JsonWebTokens" version="5.6.0" targetFramework="net461" />
<package id="Microsoft.IdentityModel.Logging" version="5.6.0" targetFramework="net461" />
<package id="Microsoft.IdentityModel.Tokens" version="5.6.0" targetFramework="net461" />
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net461" />
<package id="System.IdentityModel.Tokens.Jwt" version="5.6.0" targetFramework="net461" />
<package id="System.Spatial" version="5.6.4" targetFramework="net461" />
</packages>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment