diff --git a/.groovy b/.groovy
deleted file mode 100644
index f2dfb90..0000000
--- a/.groovy
+++ /dev/null
@@ -1,172 +0,0 @@
-#!/usr/bin/env groovy
-/* groovylint-disable CompileStatic, ConsecutiveStringConcatenation, DuplicateNumberLiteral, DuplicateStringLiteral, LineLength, NestedBlockDepth, NoDef, VariableTypeRequired */
-import groovy.transform.Field
-
-@Field String _DDrive = 'D:/'
-@Field String _GitName = 'EC'
-@Field String _AssemblyName = '...'
-@Field String _TargetLocation = '...'
-@Field String _GitCommitSeven = '...'
-@Field String _TestProjectDirectory = 'Adaptation'
-@Field String _AgentStaging = 'mestsa07ec-ecmeseaf'
-@Field String _DDriveNet = "${_DDrive}Framework4.8"
-@Field String _AgentProduction = 'messa08ec-ecmeseaf'
-@Field String _AgentDevelopment = 'mestsa003-mesedasvc'
-@Field String _ProgramFilesDotnet = 'C:/Program Files/dotnet/dotnet.exe'
-@Field String _ProgramFilesMSBuild = 'C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe'
-
-pipeline {
- agent {
- label env.JENKINS_ENVIRONMENT == 'Development' ? _AgentDevelopment : env.JENKINS_ENVIRONMENT == 'Staging' ? _AgentStaging : env.JENKINS_ENVIRONMENT == 'Production' ? _AgentProduction : 'Else'
- }
- parameters {
- string(name: 'GIT_SERVER', defaultValue: env.JENKINS_ENVIRONMENT == 'Development' ? 'mestsa003.infineon.com' : 'mestsa07ec.ec.local', description: 'git server')
- string(name: 'DEFAULT_FILE_SERVER', defaultValue: env.JENKINS_ENVIRONMENT == 'Development' ? 'messv02ecc1_ec_local' : 'messv02ecc1.ec.local', description: 'Default file server...')
- }
- stages {
- stage('Git') {
- steps {
- bat(returnStatus: true, script: 'git init')
- bat(returnStatus: true, script: 'git remote add origin \\\\' + params.GIT_SERVER + '\\Git\\' + _GitName + '.git')
- bat(returnStatus: true, script: 'git pull origin master')
- }
- }
- stage('Setup') {
- steps {
- script {
- _AssemblyName = "${env.JOB_NAME}"
- _GitCommitSeven = '1234567'
- // _GitCommitSeven = env.GIT_COMMIT.substring(0, 7)
- def files = findFiles(glob: '*.csproj')
- if (files.length != 1) {
- error("Build failed because couldn't find a *.csproj file")
- }
- echo """
- ${files[0].name}
- ${files[0].path}
- ${files[0].directory}
- ${files[0].length}
- ${files[0].lastModified}
- """
- _AssemblyName = files[0].name.split('[.]csproj')[0]
- _TargetLocation = "\\\\${params.DEFAULT_FILE_SERVER}\\EC_EAFRepository\\${env.JENKINS_ENVIRONMENT}\\DeploymentStorage\\Adaptation_${_AssemblyName}"
- }
- }
- }
- stage('Info') {
- steps {
- echo "_AssemblyName ${_AssemblyName}" // ...
- echo "BUILD_NUMBER ${env.BUILD_NUMBER}" // 11
- echo "DEFAULT_FILE_SERVER ${params.DEFAULT_FILE_SERVER}" // 11
- echo "GIT_BRANCH ${env.GIT_BRANCH}" // origin/master
- echo "GIT_COMMIT ${env.GIT_COMMIT}" // 73b814069f2cf0173a62a8228815a9bc9ba93c41
- echo "GIT_SERVER ${params.GIT_SERVER}" // ...
- echo "GIT_URL ${env.GIT_URL}" // D:\ProgramData\Git\....git
- echo "JENKINS_ENVIRONMENT ${env.JENKINS_ENVIRONMENT}" // 11
- echo "JENKINS_URL ${env.JENKINS_URL}" // http://localhost:8080/
- echo "JOB_NAME ${env.JOB_NAME}" // ...
- echo "WORKSPACE ${env.WORKSPACE}" // D:\.jenkins\_\...
- }
- }
- // stage('Restore') {
- // steps {
- // bat(returnStatus: true, script: 'dotnet --info')
- // }
- // }
- stage('Safe storage of app secrets') {
- steps {
- dir(_TestProjectDirectory) {
- bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' +
- 'user-secrets init')
- bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' +
- 'user-secrets set "BuildNumber" "' + env.BUILD_NUMBER + '"')
- bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' +
- 'user-secrets set "GitCommitSeven" "' + _GitCommitSeven + '"')
- bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' +
- 'user-secrets set "Server" "' + params.DEFAULT_FILE_SERVER + '"')
- }
- }
- }
- stage('Core Build') {
- steps {
- echo "Build number is ${currentBuild.number}"
- dir(_TestProjectDirectory) {
- bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' +
- 'build --runtime win-x64 --self-contained --verbosity quiet')
- }
- }
- }
- // stage('Test') {
- // options {
- // timeout(time: 10, unit: 'MINUTES')
- // }
- // steps {
- // dir(_TestProjectDirectory) {
- // bat('dotnet --info')
- // }
- // }
- // }
- stage('Framework Build') {
- steps {
- echo "Build number is ${currentBuild.number}"
- bat(returnStatus: true, script: '"' + _ProgramFilesMSBuild + '" ' +
- '/target:Restore ' +
- '/detailedsummary ' +
- '/consoleloggerparameters:PerformanceSummary;ErrorsOnly; ' +
- '/property:Configuration=Debug;TargetFrameworkVersion=v4.8 ' +
- _AssemblyName + '.csproj')
- bat(returnStatus: true, script: '"' + _ProgramFilesMSBuild + '" ' +
- '/target:Build ' +
- '/detailedsummary ' +
- '/consoleloggerparameters:PerformanceSummary;ErrorsOnly; ' +
- '/property:Configuration=Debug;TargetFrameworkVersion=v4.8 ' +
- _AssemblyName + '.csproj')
- }
- }
- stage('Commit Id') {
- steps {
- dir('bin/Debug') {
- writeFile file: "${_AssemblyName}.txt", text: "${env.GIT_COMMIT}-${env.BUILD_NUMBER}-${env.GIT_URL}"
- }
- }
- }
- stage('Package') {
- steps {
- fileOperations([fileZipOperation(folderPath: 'bin/Debug', outputFolderPath: "${_DDriveNet}/${_GitCommitSeven}-${env.BUILD_NUMBER}-${env.JOB_NAME}-Debug")])
- fileOperations([fileCopyOperation(excludes: '', flattenFiles: true, includes: "${_AssemblyName}*", renameFiles: false, sourceCaptureExpression: '', targetLocation: "${_DDriveNet}/${_GitCommitSeven}-${env.BUILD_NUMBER}-${env.JOB_NAME}-Debug", targetNameExpression: '')])
- }
- }
- // stage('Force Fail') {
- // steps {
- // error("Build failed because of this and that..")
- // }
- // }
- stage('Copy Files to: file-share') {
- steps {
- dir('bin/Debug') {
- fileOperations([fileCopyOperation(excludes: '', flattenFiles: true, includes: "${_AssemblyName}*.txt", renameFiles: false, sourceCaptureExpression: '', targetLocation: _TargetLocation, targetNameExpression: '')])
- fileOperations([fileCopyOperation(excludes: '', flattenFiles: true, includes: "${_AssemblyName}*.dll", renameFiles: false, sourceCaptureExpression: '', targetLocation: _TargetLocation, targetNameExpression: '')])
- fileOperations([fileCopyOperation(excludes: '', flattenFiles: true, includes: "${_AssemblyName}*.exe", renameFiles: false, sourceCaptureExpression: '', targetLocation: _TargetLocation, targetNameExpression: '')])
- fileOperations([fileCopyOperation(excludes: '', flattenFiles: true, includes: "${_AssemblyName}*.pdb", renameFiles: false, sourceCaptureExpression: '', targetLocation: _TargetLocation, targetNameExpression: '')])
- }
- }
- }
- }
- post {
- always {
- dir('bin') {
- deleteDir()
- }
- dir('obj') {
- deleteDir()
- }
- dir(_TestProjectDirectory + '/bin') {
- deleteDir()
- }
- dir(_TestProjectDirectory + '/obj') {
- deleteDir()
- }
- // cleanWs()
- }
- }
-}
diff --git a/Adaptation/.vscode/launch.json b/Adaptation/.vscode/launch.json
new file mode 100644
index 0000000..10d7d65
--- /dev/null
+++ b/Adaptation/.vscode/launch.json
@@ -0,0 +1,10 @@
+{
+ "configurations": [
+ {
+ "name": ".NET Core Attach",
+ "type": "coreclr",
+ "request": "attach",
+ "processId": 7156
+ }
+ ]
+}
diff --git a/Adaptation/EC.Tests.csproj b/Adaptation/EC.Tests.csproj
index 0943596..bdc8a48 100644
--- a/Adaptation/EC.Tests.csproj
+++ b/Adaptation/EC.Tests.csproj
@@ -33,40 +33,41 @@
Linux
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
+
+
+
diff --git a/Adaptation/Shared/Duplicator/Description.cs b/Adaptation/Shared/Duplicator/Description.cs
index b48872b..ee456bf 100644
--- a/Adaptation/Shared/Duplicator/Description.cs
+++ b/Adaptation/Shared/Duplicator/Description.cs
@@ -140,4 +140,6 @@ public class Description : IDescription, Properties.IDescription
return result;
}
+ internal static string GetDateFormat() => "MM/dd/yyyy hh:mm:ss tt";
+
}
\ No newline at end of file
diff --git a/Adaptation/Shared/FileRead.cs b/Adaptation/Shared/FileRead.cs
index 56776b3..48122f8 100644
--- a/Adaptation/Shared/FileRead.cs
+++ b/Adaptation/Shared/FileRead.cs
@@ -296,6 +296,7 @@ public class FileRead : Properties.IFileRead
bool check;
long preWait;
string tupleFile;
+ string tupleFileName = string.Empty;
List duplicateFiles = new();
StringBuilder stringBuilder = new();
List consumedFileIndices = new();
@@ -317,6 +318,7 @@ public class FileRead : Properties.IFileRead
tupleFile = string.Concat(duplicateDirectory, @"\", fileName, "_", scopeInfo.FileNameWithoutExtension, ".pdsfc");
else
tupleFile = GetTupleFile(logistics, descriptions, scopeInfo, duplicateDirectory);
+ tupleFileName = Path.GetFileNameWithoutExtension(tupleFile).Split('.')[0];
duplicateFiles.Add(tupleFile);
if (_IsEAFHosted)
File.WriteAllText(tupleFile, text);
@@ -325,7 +327,7 @@ public class FileRead : Properties.IFileRead
{
if (DateTime.Now.Ticks > preWait)
break;
- Thread.Sleep(500);
+ Thread.Sleep(100);
}
if (!moreThanAnHour)
{
@@ -340,7 +342,17 @@ public class FileRead : Properties.IFileRead
for (int i = 0; i < duplicateFiles.Count; i++)
{
if (!File.Exists(duplicateFiles[i]))
- consumedFileIndices.Add(i);
+ {
+ if (string.IsNullOrEmpty(tupleFileName))
+ consumedFileIndices.Add(i);
+ else if (duplicateFiles.All(l => Path.GetFileNameWithoutExtension(l).Split('.')[0] == tupleFileName))
+ {
+ for (int j = 0; j < duplicateFiles.Count; j++)
+ consumedFileIndices.Add(j);
+ }
+ else
+ consumedFileIndices.Add(i);
+ }
}
if (consumedFileIndices.Count == duplicateFiles.Count)
break;
@@ -361,7 +373,7 @@ public class FileRead : Properties.IFileRead
}
throw new Exception(string.Concat("After {", _BreakAfterSeconds, "} seconds, right side of {", sourceDirectoryCloaking, "} didn't consume file(s) ", stringBuilder));
}
- Thread.Sleep(500);
+ Thread.Sleep(250);
}
}
}
diff --git a/Adaptation/Shared/Logistics.cs b/Adaptation/Shared/Logistics.cs
index 38ed83c..a6ca882 100644
--- a/Adaptation/Shared/Logistics.cs
+++ b/Adaptation/Shared/Logistics.cs
@@ -51,7 +51,7 @@ public class Logistics : ILogistics
_Logistics2 = new List();
}
- public Logistics(IFileRead fileRead, string reportFullPath, bool useSplitForMID, int? fileInfoLength = null)
+ public Logistics(IFileRead fileRead, long tickOffset, string reportFullPath, bool useSplitForMID, int? fileInfoLength = null)
{
if (string.IsNullOrEmpty(fileRead.CellInstanceName))
throw new Exception();
@@ -59,7 +59,7 @@ public class Logistics : ILogistics
throw new Exception();
_NullData = fileRead.NullData;
_FileInfo = new(reportFullPath);
- DateTime dateTime = _FileInfo.LastWriteTime;
+ DateTime dateTime = new(_FileInfo.LastWriteTime.Ticks + tickOffset);
if (fileInfoLength.HasValue && _FileInfo.Length < fileInfoLength.Value)
dateTime = dateTime.AddTicks(-1);
_JobID = fileRead.CellInstanceName;
diff --git a/Adaptation/Shared/Metrology/ScopeInfo.cs b/Adaptation/Shared/Metrology/ScopeInfo.cs
index 2de909e..539bd09 100644
--- a/Adaptation/Shared/Metrology/ScopeInfo.cs
+++ b/Adaptation/Shared/Metrology/ScopeInfo.cs
@@ -16,7 +16,7 @@ public class ScopeInfo : Properties.IScopeInfo
public string QueryFilter { get; private set; }
public string FileNameWithoutExtension { get; private set; }
- public ScopeInfo(Test test, string fileName, string queryFilter = "", string title = "", string html = "")
+ public ScopeInfo(Test test, string fileName, string queryFilter = "", string title = "", string html = "", string extraExtension = "")
{
Enum = test;
Test = test;
diff --git a/Adaptation/_Tests/Shared/AdaptationTesting.cs b/Adaptation/_Tests/Shared/AdaptationTesting.cs
index c011f8e..5741fc3 100644
--- a/Adaptation/_Tests/Shared/AdaptationTesting.cs
+++ b/Adaptation/_Tests/Shared/AdaptationTesting.cs
@@ -343,7 +343,7 @@ public class AdaptationTesting : ISMTP
return result as T;
}
- protected static CellInstanceVersion GetCellInstanceVersion(string url)
+ public static CellInstanceVersion GetCellInstanceVersion(string url)
{
CellInstanceVersion result;
byte[] byteArray;
@@ -874,7 +874,7 @@ public class AdaptationTesting : ISMTP
return result;
}
- protected Dictionary GetKeyValuePairs(string cellInstanceName, string cellInstanceVersionName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList modelObjectParameters, string equipmentDictionaryName, List> equipmentDictionaryIsAlwaysEnabledEvents)
+ protected Dictionary GetKeyValuePairs(string cellInstanceName, string cellInstanceVersionName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList modelObjectParameters, string equipmentDictionaryName, List> equipmentDictionaryIsAlwaysEnabledEvents, int edaConnectionPortNumber)
{
Dictionary results = new()
{
@@ -883,6 +883,7 @@ public class AdaptationTesting : ISMTP
{ nameof(cellInstanceName), cellInstanceName },
{ nameof(equipmentTypeName), equipmentTypeName },
{ nameof(cellInstanceVersionName), cellInstanceVersionName },
+ { nameof(edaConnectionPortNumber), edaConnectionPortNumber },
{ nameof(equipmentDictionaryName), equipmentDictionaryName },
{ nameof(cellInstanceConnectionName), cellInstanceConnectionName },
{ nameof(FileConnectorConfiguration), fileConnectorConfiguration },
@@ -930,7 +931,7 @@ public class AdaptationTesting : ISMTP
Tuple> modelObjectParametersTuple = GetModelObjectParameters(equipmentTypeVersionTuple);
Tuple equipmentDictionaryVersionTuple = GetEquipmentDictionaryVersionTuple(cellInstanceVersionTuple.Item2, mbn.CellInstanceConnectionName, equipmentTypeVersionTuple.Item4);
Tuple>> equipmentDictionaryIsAlwaysEnabledEventsTuple = GetEquipmentDictionaryIsAlwaysEnabledEventsTuple(equipmentDictionaryVersionTuple);
- Dictionary objects = GetKeyValuePairs(mbn.CellInstanceName, mbn.CellInstanceVersionName, mbn.CellInstanceConnectionName, fileConnectorConfigurationTuple.Item2, equipmentTypeVersionTuple.Item2, parameterizedModelObjectDefinitionTypeTuple.Item2, modelObjectParametersTuple.Item2, equipmentDictionaryVersionTuple.Item2, equipmentDictionaryIsAlwaysEnabledEventsTuple.Item2);
+ Dictionary objects = GetKeyValuePairs(mbn.CellInstanceName, mbn.CellInstanceVersionName, mbn.CellInstanceConnectionName, fileConnectorConfigurationTuple.Item2, equipmentTypeVersionTuple.Item2, parameterizedModelObjectDefinitionTypeTuple.Item2, modelObjectParametersTuple.Item2, equipmentDictionaryVersionTuple.Item2, equipmentDictionaryIsAlwaysEnabledEventsTuple.Item2, cellInstanceVersionTuple.Item2.EdaConnection.PortNumber);
string json = JsonSerializer.Serialize(objects, new JsonSerializerOptions { WriteIndented = true });
results = new string[] { fileInfo.FullName, json };
return results;
diff --git a/Adaptation/_Tests/Static/EC.cs b/Adaptation/_Tests/Static/EC.cs
new file mode 100644
index 0000000..f54be9e
--- /dev/null
+++ b/Adaptation/_Tests/Static/EC.cs
@@ -0,0 +1,88 @@
+using Adaptation._Tests.Shared;
+using Microsoft.Extensions.Logging;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using System;
+using System.Diagnostics;
+using System.IO;
+using System.Reflection;
+using System.Text;
+
+namespace Adaptation._Tests.Static;
+
+[TestClass]
+public class EC : LoggingUnitTesting, IDisposable
+{
+
+#pragma warning disable CA2254
+#pragma warning disable IDE0060
+
+ internal static EC LoggingUnitTesting { get; private set; }
+
+ public EC() : base(testContext: null, declaringType: null)
+ {
+ if (LoggingUnitTesting is null)
+ throw new Exception();
+ }
+
+ public EC(TestContext testContext) : base(testContext, new StackFrame().GetMethod().DeclaringType)
+ {
+ }
+
+ [ClassInitialize]
+ public static void ClassInitialize(TestContext testContext) => LoggingUnitTesting ??= new EC(testContext);
+
+ [ClassCleanup()]
+ public static void ClassCleanup()
+ {
+ LoggingUnitTesting.Logger?.LogInformation("Cleanup");
+ LoggingUnitTesting?.Dispose();
+ }
+
+ [TestMethod]
+ public void TestDateTime()
+ {
+ DateTime dateTime = DateTime.Now;
+ Assert.IsTrue(dateTime.ToString("M/d/yyyy h:mm:ss tt") == dateTime.ToString());
+ }
+
+#if true
+ [Ignore]
+#endif
+ [TestMethod]
+ public void Staging()
+ {
+ MethodBase methodBase = new StackFrame().GetMethod();
+ StringBuilder results = new();
+ (string cellInstanceName, string cellInstanceVersionName)[] collection = new (string, string)[]
+ {
+ new("EC", "v2.43.0"),
+ };
+ string staging = "http://mestsa07ec.ec.local:9003/CellInstanceServiceV2";
+ Shared.PasteSpecialXml.EAF.XML.API.CellInstance.CellInstanceVersion cellInstanceVersion;
+ LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
+ foreach ((string cellInstanceName, string cellInstanceVersionName) in collection)
+ {
+ cellInstanceVersion = AdaptationTesting.GetCellInstanceVersion($"{staging}/{cellInstanceName}/{cellInstanceVersionName}/configuration");
+ _ = results.AppendLine($"{cellInstanceName}\t{cellInstanceVersionName}\t{cellInstanceVersion.EdaConnection.PortNumber}");
+ }
+ File.WriteAllText($"D:/Tmp/{methodBase.Module.Name}-{methodBase.ReflectedType.Name}-{methodBase.Name}.tsv", results.ToString());
+ LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
+ }
+
+#if true
+ [Ignore]
+#endif
+ [TestMethod]
+ public void CellInstanceVersionEdaConnectionPortNumber()
+ {
+ MethodBase methodBase = new StackFrame().GetMethod();
+ StringBuilder results = new();
+ LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
+ string[] files = Directory.GetFiles("D:/Tmp", "*.tsv", SearchOption.TopDirectoryOnly);
+ foreach (string file in files)
+ _ = results.Append(File.ReadAllText(file));
+ File.WriteAllText($"D:/Tmp/all.tsv", results.ToString());
+ LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
+ }
+
+}
\ No newline at end of file
diff --git a/Jenkinsfile b/Jenkinsfile
deleted file mode 100644
index 91adb37..0000000
--- a/Jenkinsfile
+++ /dev/null
@@ -1,172 +0,0 @@
-#!/usr/bin/env groovy
-/* groovylint-disable CompileStatic, ConsecutiveStringConcatenation, DuplicateNumberLiteral, DuplicateStringLiteral, LineLength, NestedBlockDepth, NoDef, VariableTypeRequired */
-import groovy.transform.Field
-
-@Field String _DDrive = 'D:/'
-@Field String _GitName = 'EC'
-@Field String _AssemblyName = '...'
-@Field String _TargetLocation = '...'
-@Field String _GitCommitSeven = '...'
-@Field String _TestProjectDirectory = 'Adaptation'
-@Field String _AgentStaging = 'mestsa07ec-ecmeseaf'
-@Field String _DDriveNet = "${_DDrive}Framework4.8"
-@Field String _AgentProduction = 'messa08ec-ecmeseaf'
-@Field String _AgentDevelopment = 'mestsa003-mesedasvc'
-@Field String _ProgramFilesDotnet = 'C:/Program Files/dotnet/dotnet.exe'
-@Field String _ProgramFilesMSBuild = 'C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe'
-
-pipeline {
- agent {
- label env.JENKINS_ENVIRONMENT == 'Development' ? _AgentDevelopment : env.JENKINS_ENVIRONMENT == 'Staging' ? _AgentStaging : env.JENKINS_ENVIRONMENT == 'Production' ? _AgentProduction : 'Else'
- }
- parameters {
- string(name: 'GIT_SERVER', defaultValue: env.JENKINS_ENVIRONMENT == 'Development' ? 'mestsa003.infineon.com' : 'mestsa07ec.ec.local', description: 'git server')
- string(name: 'DEFAULT_FILE_SERVER', defaultValue: env.JENKINS_ENVIRONMENT == 'Development' ? 'messv02ecc1_ec_local' : 'messv02ecc1.ec.local', description: 'Default file server...')
- }
- stages {
- // stage('Git') {
- // steps {
- // bat(returnStatus: true, script: 'git init')
- // bat(returnStatus: true, script: 'git remote add origin \\\\' + params.GIT_SERVER + '\\Git\\' + _GitName + '.git')
- // bat(returnStatus: true, script: 'git pull origin master')
- // }
- // }
- stage('Setup') {
- steps {
- script {
- _AssemblyName = "${env.JOB_NAME}"
- // _GitCommitSeven = '1234567'
- _GitCommitSeven = env.GIT_COMMIT.substring(0, 7)
- def files = findFiles(glob: '*.csproj')
- if (files.length != 1) {
- error("Build failed because couldn't find a *.csproj file")
- }
- echo """
- ${files[0].name}
- ${files[0].path}
- ${files[0].directory}
- ${files[0].length}
- ${files[0].lastModified}
- """
- _AssemblyName = files[0].name.split('[.]csproj')[0]
- _TargetLocation = "\\\\${params.DEFAULT_FILE_SERVER}\\EC_EAFRepository\\${env.JENKINS_ENVIRONMENT}\\DeploymentStorage\\Adaptation_${_AssemblyName}"
- }
- }
- }
- stage('Info') {
- steps {
- echo "_AssemblyName ${_AssemblyName}" // ...
- echo "BUILD_NUMBER ${env.BUILD_NUMBER}" // 11
- echo "DEFAULT_FILE_SERVER ${params.DEFAULT_FILE_SERVER}" // 11
- echo "GIT_BRANCH ${env.GIT_BRANCH}" // origin/master
- echo "GIT_COMMIT ${env.GIT_COMMIT}" // 73b814069f2cf0173a62a8228815a9bc9ba93c41
- echo "GIT_SERVER ${params.GIT_SERVER}" // ...
- echo "GIT_URL ${env.GIT_URL}" // D:\ProgramData\Git\....git
- echo "JENKINS_ENVIRONMENT ${env.JENKINS_ENVIRONMENT}" // 11
- echo "JENKINS_URL ${env.JENKINS_URL}" // http://localhost:8080/
- echo "JOB_NAME ${env.JOB_NAME}" // ...
- echo "WORKSPACE ${env.WORKSPACE}" // D:\.jenkins\_\...
- }
- }
- // stage('Restore') {
- // steps {
- // bat(returnStatus: true, script: 'dotnet --info')
- // }
- // }
- stage('Safe storage of app secrets') {
- steps {
- dir(_TestProjectDirectory) {
- bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' +
- 'user-secrets init')
- bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' +
- 'user-secrets set "BuildNumber" "' + env.BUILD_NUMBER + '"')
- bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' +
- 'user-secrets set "GitCommitSeven" "' + _GitCommitSeven + '"')
- bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' +
- 'user-secrets set "Server" "' + params.DEFAULT_FILE_SERVER + '"')
- }
- }
- }
- stage('Core Build') {
- steps {
- echo "Build number is ${currentBuild.number}"
- dir(_TestProjectDirectory) {
- bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' +
- 'build --runtime win-x64 --self-contained --verbosity quiet')
- }
- }
- }
- // stage('Test') {
- // options {
- // timeout(time: 10, unit: 'MINUTES')
- // }
- // steps {
- // dir(_TestProjectDirectory) {
- // bat('dotnet --info')
- // }
- // }
- // }
- stage('Framework Build') {
- steps {
- echo "Build number is ${currentBuild.number}"
- bat(returnStatus: true, script: '"' + _ProgramFilesMSBuild + '" ' +
- '/target:Restore ' +
- '/detailedsummary ' +
- '/consoleloggerparameters:PerformanceSummary;ErrorsOnly; ' +
- '/property:Configuration=Debug;TargetFrameworkVersion=v4.8 ' +
- _AssemblyName + '.csproj')
- bat(returnStatus: true, script: '"' + _ProgramFilesMSBuild + '" ' +
- '/target:Build ' +
- '/detailedsummary ' +
- '/consoleloggerparameters:PerformanceSummary;ErrorsOnly; ' +
- '/property:Configuration=Debug;TargetFrameworkVersion=v4.8 ' +
- _AssemblyName + '.csproj')
- }
- }
- stage('Commit Id') {
- steps {
- dir('bin/Debug') {
- writeFile file: "${_AssemblyName}.txt", text: "${env.GIT_COMMIT}-${env.BUILD_NUMBER}-${env.GIT_URL}"
- }
- }
- }
- stage('Package') {
- steps {
- fileOperations([fileZipOperation(folderPath: 'bin/Debug', outputFolderPath: "${_DDriveNet}/${_GitCommitSeven}-${env.BUILD_NUMBER}-${env.JOB_NAME}-Debug")])
- fileOperations([fileCopyOperation(excludes: '', flattenFiles: true, includes: "${_AssemblyName}*", renameFiles: false, sourceCaptureExpression: '', targetLocation: "${_DDriveNet}/${_GitCommitSeven}-${env.BUILD_NUMBER}-${env.JOB_NAME}-Debug", targetNameExpression: '')])
- }
- }
- // stage('Force Fail') {
- // steps {
- // error("Build failed because of this and that..")
- // }
- // }
- stage('Copy Files to: file-share') {
- steps {
- dir('bin/Debug') {
- fileOperations([fileCopyOperation(excludes: '', flattenFiles: true, includes: "${_AssemblyName}*.txt", renameFiles: false, sourceCaptureExpression: '', targetLocation: _TargetLocation, targetNameExpression: '')])
- fileOperations([fileCopyOperation(excludes: '', flattenFiles: true, includes: "${_AssemblyName}*.dll", renameFiles: false, sourceCaptureExpression: '', targetLocation: _TargetLocation, targetNameExpression: '')])
- fileOperations([fileCopyOperation(excludes: '', flattenFiles: true, includes: "${_AssemblyName}*.exe", renameFiles: false, sourceCaptureExpression: '', targetLocation: _TargetLocation, targetNameExpression: '')])
- fileOperations([fileCopyOperation(excludes: '', flattenFiles: true, includes: "${_AssemblyName}*.pdb", renameFiles: false, sourceCaptureExpression: '', targetLocation: _TargetLocation, targetNameExpression: '')])
- }
- }
- }
- }
- post {
- always {
- dir('bin') {
- deleteDir()
- }
- dir('obj') {
- deleteDir()
- }
- dir(_TestProjectDirectory + '/bin') {
- deleteDir()
- }
- dir(_TestProjectDirectory + '/obj') {
- deleteDir()
- }
- cleanWs()
- }
- }
-}