Skip to content
Snippets Groups Projects
Commit 8bc01ae7 authored by Petar Hristov's avatar Petar Hristov :speech_balloon:
Browse files

Added Pipeline definition (coscine/issues#1781)

parent 307772a8
No related branches found
No related tags found
1 merge request!1New: SQL2Linked Application for migrating the structural to linked data
Pipeline #714455 skipped
include:
- project: coscine/tools/gitlab-ci-templates
file:
- /dotnet.yml
stages:
- build
- publish
- commands
variables:
DOTNET_MAIN_PROJECT_FOLDER: "SQL2Linked"
build-branch:
extends: .build-branch
build-nuget-release:
extends: .build-nuget-release
publish-gitlab-release:
extends: .publish-gitlab-release
publish:
extends: .publish-artifact-release
migration:
rules:
- if: $CI_PIPELINE_SOURCE != "schedule"
when: manual
stage: commands
script:
- dotnet run --project .\src\$DOTNET_MAIN_PROJECT_FOLDER -- --noDryRun
when: manual
\ No newline at end of file
using SQL2Linked.Implementations; using SQL2Linked.Implementations;
Console.WriteLine("Begin SQL 2 Linked Data migration"); var dummyMode = !(args.Length > 0 && args[0] == "--noDryRun");
if (dummyMode)
{
Console.WriteLine("\n DUMMY MODE \n");
Console.WriteLine(" To exit dummy mode, execute with the \"--noDryRun\" argument");
}
Console.WriteLine("\nBegin SQL 2 Linked Data migration");
var roleStructuralData = new RoleStructuralData(); var roleStructuralData = new RoleStructuralData();
roleStructuralData.Migrate(); roleStructuralData.Migrate(dummyMode);
var userStructuralData = new UserStructuralData(); var userStructuralData = new UserStructuralData();
userStructuralData.Migrate(); userStructuralData.Migrate(dummyMode);
var projectStructuralData = new ProjectStructuralData(); var projectStructuralData = new ProjectStructuralData();
projectStructuralData.Migrate(); projectStructuralData.Migrate(dummyMode);
var resourceStructuralData = new ResourceStructuralData(); var resourceStructuralData = new ResourceStructuralData();
resourceStructuralData.Migrate(); resourceStructuralData.Migrate(dummyMode);
Console.WriteLine("\n Finished."); Console.WriteLine("\n Finished.");
...@@ -20,13 +20,16 @@ namespace SQL2Linked ...@@ -20,13 +20,16 @@ namespace SQL2Linked
public abstract IEnumerable<IGraph> ConvertToLinkedData(IEnumerable<S> entries); public abstract IEnumerable<IGraph> ConvertToLinkedData(IEnumerable<S> entries);
public void Migrate() public void Migrate(bool dummyMode)
{ {
var spacer = new string('-', 35); var spacer = new string('-', 35);
Console.WriteLine($"\n{spacer}\n{typeof(T).Name}\n{spacer}"); Console.WriteLine($"\n{spacer}\n{typeof(T).Name}\n{spacer}");
var graphs = ConvertToLinkedData(Model.GetAll()); var graphs = ConvertToLinkedData(Model.GetAll());
if (!dummyMode)
{
StoreGraphs(graphs); StoreGraphs(graphs);
} }
}
private void StoreGraphs(IEnumerable<IGraph> graphs) private void StoreGraphs(IEnumerable<IGraph> graphs)
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment