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

Merge branch 'Product/871-generalDeployment' into 'Sprint/2020-12'

Product/871 general deployment

See merge request coscine/cs/graphdeployer!3
parents aae87228 16e89734
No related branches found
No related tags found
2 merge requests!3Product/871 general deployment,!2Sprint/2020 12
## C# Template
# GraphDeployer
This template includes:
This repository handles the deployment of every static graph which gets included into the CoScInE environment.
* Automatic building using cake
* Automatic testing with NUnit
* Automatic linting with Resharper
* Automatic documentation publishing using Gitlab CI / CD and a self written script which puts the docs in the docs folder to the wiki
* Automatic releases using semantic-release ([ESLint Code Convention](docs/ESLintConvention)), cake and Gitlab CI / CD
## Usage
## What you need to do
For every deployable graph repository, an entry is expected in the configuration path: `coscine/local/graphs/`.
Place you C# project solution file in .src/.
Make sure Create directory for solution is unticked.
![alt text](docs/images/create_project.png "Create a new Project")
Delete unused docs and update this README.
Add [NUnit](docs/nunit.md) tests to your solution.
## Building
Build this project by running either the build.ps1 or the build<span></span>.sh script.
The project will be build and tested.
### Links
* [Commit convention](docs/ESLintConvention.md)
* [Everything possible with markup](docs/testdoc.md)
* [Adding NUnit tests](docs/nunit.md)
\ No newline at end of file
Every repository MUST include the key `coscine/local/graphs/{graphname}/repositoryurl` for specifying the url (e.g. `git.rwth-aachen.de/coscine/applicationprofiles.git`) and CAN include the key `coscine/local/graphs/{graphname}/branch` which specifies the state of the repository being imported (e.g. `master`).
......@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29102.190
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OrganizationDeployer", "OrganizationDeployer\OrganizationDeployer.csproj", "{341EB0C4-6882-4281-9310-4213AEAFB65A}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GraphDeployer", "GraphDeployer\GraphDeployer.csproj", "{341EB0C4-6882-4281-9310-4213AEAFB65A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
......
File moved
......@@ -8,8 +8,8 @@
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{341EB0C4-6882-4281-9310-4213AEAFB65A}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>Coscine.OrganizationDeployer</RootNamespace>
<AssemblyName>Coscine.OrganizationDeployer</AssemblyName>
<RootNamespace>Coscine.GraphDeployer</RootNamespace>
<AssemblyName>Coscine.GraphDeployer</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
......@@ -99,7 +99,7 @@
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="getOrganizations.ps1">
<None Include="getRepository.ps1">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="packages.config" />
......
......@@ -8,17 +8,12 @@ using System.Linq;
using VDS.RDF;
using VDS.RDF.Storage;
namespace Coscine.OrganizationDeployer
namespace Coscine.GraphDeployer
{
public class Program
{
public static void Main(string[] args)
{
ExecuteCommand(
"powershell.exe",
$@"& '{ Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "getOrganizations.ps1") }'"
);
var configuration = new ConsulConfiguration();
var virtuosoServer = configuration.GetString("coscine/local/virtuoso/additional/url");
......@@ -34,6 +29,31 @@ namespace Coscine.OrganizationDeployer
"coscine/local/virtuoso/isql",
"C:/Programs/Virtuoso/bin/isql.exe"
);
var graphKeys = configuration.Keys("coscine/local/graphs/");
graphKeys = graphKeys.Where((entry) => entry.Contains("repositoryurl"))
.Select((entry) => entry.Substring(0, entry.LastIndexOf("/") + 1))
.ToArray();
foreach (var graphKey in graphKeys)
{
// Example: {gitHost}/{groupName}/{repository}.git
var repositoryUrl = configuration.GetString(graphKey + "repositoryurl");
Console.WriteLine("Working with: " + repositoryUrl);
var branch = configuration.GetString(graphKey + "branch", "master");
var repositoryFolder = repositoryUrl.Substring(0, repositoryUrl.LastIndexOf("."));
repositoryFolder = repositoryFolder.Substring(repositoryFolder.LastIndexOf("/") + 1);
ExecuteCommand(
"powershell.exe",
$@"& '{ Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "getRepository.ps1") }' "
+ $"'{repositoryUrl}' '{branch}' '{repositoryFolder}'"
);
var queries = new List<string>();
foreach (var file in GetFiles(folder).Where((file) => file.Contains(".ttl")))
{
......@@ -60,6 +80,7 @@ namespace Coscine.OrganizationDeployer
$"\"\\\"{query}\\\" | {virtuosoISQLLocation}\""
);
}
}
Console.WriteLine("Done");
}
......
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by Cake.
// </auto-generated>
//------------------------------------------------------------------------------
using System.Reflection;
[assembly: AssemblyTitle("GraphDeployer")]
[assembly: AssemblyDescription("GraphDeployer is a part of the CoScInE group.")]
[assembly: AssemblyCompany("IT Center, RWTH Aachen University")]
[assembly: AssemblyProduct("GraphDeployer")]
[assembly: AssemblyVersion("1.1.1")]
[assembly: AssemblyFileVersion("1.1.1")]
[assembly: AssemblyInformationalVersion("1.1.1")]
[assembly: AssemblyCopyright("2020 IT Center, RWTH Aachen University")]
$extractPath = "C:\Programs\Consul\"
param (
[Parameter(Mandatory=$true, Position=0)]
[string] $repositoryUrl,
[Parameter(Mandatory=$true, Position=1)]
[string] $branch,
[Parameter(Mandatory=$true, Position=2)]
[string] $repositoryFolder
)
$extractPath = "C:\Programs\Consul\"
$fileName = "Consul.exe"
$fullPath = ($extractPath + $fileName)
......@@ -6,19 +15,16 @@ $gitlab_token = & $fullPath kv get "coscine/global/gitlabtoken"
Push-Location $PSScriptRoot
$organizationsPath = 'organizations'
# Twice remove, because of: https://stackoverflow.com/questions/7909167/how-to-quietly-remove-a-directory-with-content-in-powershell#comment10316056_7909195
If(Test-Path $organizationsPath) { Remove-Item -LiteralPath $organizationsPath -Force -Recurse }
If(Test-Path $organizationsPath) { Remove-Item -LiteralPath $organizationsPath -Force -Recurse }
If(Test-Path $repositoryFolder) { Remove-Item -LiteralPath $repositoryFolder -Force -Recurse }
If(Test-Path $repositoryFolder) { Remove-Item -LiteralPath $repositoryFolder -Force -Recurse }
git clone https://gitlab-ci-token:$gitlab_token@git.rwth-aachen.de/coscine/organizations.git
git clone https://gitlab-ci-token:$gitlab_token@$repositoryUrl
cd organizations
cd $repositoryFolder
$pagebranch = & $fullPath kv get 'coscine/local/organizationdeployer/branch'
if ($pagebranch -And $pagebranch -ne 'master' ) {
git checkout $pagebranch
if ($branch -And $branch -ne 'master' ) {
git checkout $branch
git pull
}
......@@ -32,6 +38,6 @@ If(Test-Path $path) { Remove-Item -LiteralPath $path -Force -Recurse }
New-Item -ItemType Directory -Force -Path $path
Copy-Item './organizations/*' $path -Recurse;
Copy-Item "./$repositoryFolder/*" $path -Recurse;
Pop-Location
\ No newline at end of file
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("OrganizationDeployer")]
[assembly: AssemblyDescription("OrganizationDeployer is a part of the CoScInE group.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("IT Center, RWTH Aachen University")]
[assembly: AssemblyProduct("OrganizationDeployer")]
[assembly: AssemblyCopyright("2020 IT Center, RWTH Aachen University")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("341eb0c4-6882-4281-9310-4213aeafb65a")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment