2023-01-24
This commit is contained in:
parent
281fa939be
commit
a180f65069
172
.groovy
172
.groovy
@ -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()
|
||||
}
|
||||
}
|
||||
}
|
10
Adaptation/.vscode/launch.json
vendored
Normal file
10
Adaptation/.vscode/launch.json
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": ".NET Core Attach",
|
||||
"type": "coreclr",
|
||||
"request": "attach",
|
||||
"processId": 7156
|
||||
}
|
||||
]
|
||||
}
|
@ -33,40 +33,41 @@
|
||||
<DefineConstants>Linux</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="6.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.json" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
|
||||
<PackageReference Include="Microsoft.Win32.SystemEvents" Version="6.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.2" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.json" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
|
||||
<PackageReference Include="Microsoft.Win32.SystemEvents" Version="7.0.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
|
||||
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="System.Configuration.ConfigurationManager" Version="6.0.1" />
|
||||
<PackageReference Include="System.Data.OleDb" Version="6.0.0" />
|
||||
<PackageReference Include="System.Data.SqlClient" Version="4.8.4" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
|
||||
<PackageReference Include="System.Text.Json" Version="6.0.6" />
|
||||
<PackageReference Include="System.Configuration.ConfigurationManager" Version="7.0.0" />
|
||||
<PackageReference Include="System.Data.OleDb" Version="7.0.0" />
|
||||
<PackageReference Include="System.Data.SqlClient" Version="4.8.5" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="7.0.0" />
|
||||
<PackageReference Include="System.Text.Json" Version="7.0.1" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="coverlet.collector" Version="3.1.2">
|
||||
<PackageReference Include="coverlet.collector" Version="3.2.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="FFMpegCore" Version="4.8.0" />
|
||||
<PackageReference Include="Infineon.Yoda" Version="5.4.1" />
|
||||
<PackageReference Include="Instances" Version="2.0.0" />
|
||||
<PackageReference Include="RoboSharp" Version="1.2.8" />
|
||||
<PackageReference Include="Tesseract" Version="4.1.1" />
|
||||
<PackageReference Include="Tesseract" Version="5.2.0" />
|
||||
<ItemGroup>
|
||||
</ItemGroup>
|
||||
<PackageReference Include="Tibco.Rendezvous" Version="8.5.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -140,4 +140,6 @@ public class Description : IDescription, Properties.IDescription
|
||||
return result;
|
||||
}
|
||||
|
||||
internal static string GetDateFormat() => "MM/dd/yyyy hh:mm:ss tt";
|
||||
|
||||
}
|
@ -296,6 +296,7 @@ public class FileRead : Properties.IFileRead
|
||||
bool check;
|
||||
long preWait;
|
||||
string tupleFile;
|
||||
string tupleFileName = string.Empty;
|
||||
List<string> duplicateFiles = new();
|
||||
StringBuilder stringBuilder = new();
|
||||
List<int> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ public class Logistics : ILogistics
|
||||
_Logistics2 = new List<Logistics2>();
|
||||
}
|
||||
|
||||
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;
|
||||
|
@ -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;
|
||||
|
@ -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<string, object> GetKeyValuePairs(string cellInstanceName, string cellInstanceVersionName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, List<Tuple<string, string>> equipmentDictionaryIsAlwaysEnabledEvents)
|
||||
protected Dictionary<string, object> GetKeyValuePairs(string cellInstanceName, string cellInstanceVersionName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, List<Tuple<string, string>> equipmentDictionaryIsAlwaysEnabledEvents, int edaConnectionPortNumber)
|
||||
{
|
||||
Dictionary<string, object> 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<string, IList<ModelObjectParameterDefinition>> modelObjectParametersTuple = GetModelObjectParameters(equipmentTypeVersionTuple);
|
||||
Tuple<string, string, string, EquipmentDictionaryVersion> equipmentDictionaryVersionTuple = GetEquipmentDictionaryVersionTuple(cellInstanceVersionTuple.Item2, mbn.CellInstanceConnectionName, equipmentTypeVersionTuple.Item4);
|
||||
Tuple<string, List<Tuple<string, string>>> equipmentDictionaryIsAlwaysEnabledEventsTuple = GetEquipmentDictionaryIsAlwaysEnabledEventsTuple(equipmentDictionaryVersionTuple);
|
||||
Dictionary<string, object> objects = GetKeyValuePairs(mbn.CellInstanceName, mbn.CellInstanceVersionName, mbn.CellInstanceConnectionName, fileConnectorConfigurationTuple.Item2, equipmentTypeVersionTuple.Item2, parameterizedModelObjectDefinitionTypeTuple.Item2, modelObjectParametersTuple.Item2, equipmentDictionaryVersionTuple.Item2, equipmentDictionaryIsAlwaysEnabledEventsTuple.Item2);
|
||||
Dictionary<string, object> 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;
|
||||
|
88
Adaptation/_Tests/Static/EC.cs
Normal file
88
Adaptation/_Tests/Static/EC.cs
Normal file
@ -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"));
|
||||
}
|
||||
|
||||
}
|
172
Jenkinsfile
vendored
172
Jenkinsfile
vendored
@ -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()
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user