Need to populate GetAwaitingDispositionApi.json

This commit is contained in:
2023-01-13 21:52:38 -07:00
parent a697dd31c3
commit b445f7e680
10 changed files with 61 additions and 577 deletions

266
.groovy
View File

@ -1,266 +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 _ExePath = '...'
@Field String _NGINXFile = '...'
@Field String _PortNumber = '...'
@Field String _AssemblyName = '...'
@Field String _AgentDevelopment = ''
@Field String _NetVersion = 'net6.0'
@Field String _GitCommitSeven = '...'
@Field String _TargetLocation = '...'
@Field String _FirstBeforePlus = '5000'
@Field String _GitName = 'OI-Metrology'
@Field String _MonARessource = 'OI_Metrology'
@Field String _WorkingDirectoryName = 'IFXApps'
@Field String _DDriveNet = "${_DDrive}${_NetVersion}"
@Field String _AgentStaging = 'messa010ec-ecfisysadmin'
@Field String _AgentProduction = 'messa010ec-ecfisysadmin'
@Field String _CredentialsId = 'Metrology-Username-Password'
@Field String _Company = 'Infineon Technologies Americas Corp.'
@Field String _ProgramFilesDotnet = 'C:/program files/dotnet/dotnet.exe'
pipeline {
agent {
label env.JENKINS_ENVIRONMENT == 'Development' ? _AgentDevelopment : env.JENKINS_ENVIRONMENT == 'Staging' ? _AgentStaging : env.JENKINS_ENVIRONMENT == 'Production' ? _AgentProduction : 'Else'
}
parameters {
string(name: 'MONA_SUFFIX', defaultValue: env.JENKINS_ENVIRONMENT == 'Development' ? '_IFX' : '_EC', description: 'MonA Suffix')
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...')
string(name: 'PROJECT_DIRECTORY', defaultValue: 'Archive', description: 'Archive|Viewer')
}
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}-${env.PROJECT_DIRECTORY}"
_GitCommitSeven = '1234567'
// _GitCommitSeven = env.GIT_COMMIT.substring(0, 7)
dir(env.PROJECT_DIRECTORY) {
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}"
withCredentials([usernamePassword(credentialsId: _CredentialsId, passwordVariable: 'password', usernameVariable: 'username')]) {
dir("C:/Users/${username}/AppData/Local/IFXApps/nginx-1.20.1/conf/includes") {
_NGINXFile = "C:/Users/${username}/AppData/Local/IFXApps/nginx-1.20.1/conf/includes/${_AssemblyName}.conf"
def files = findFiles(glob: "${_AssemblyName}.conf")
if (files.length != 1) {
writeFile(file: _NGINXFile, text: "location / { proxy_pass http://localhost:${_FirstBeforePlus}; }")
}
}
}
}
}
}
stage('Read NGINX') {
steps {
script {
String text = readFile(file: _NGINXFile)
String check = text == null ? _FirstBeforePlus : text.split(';')[0]
String[] segments = check.split(':')
if (segments.length != 3) {
_PortNumber = check
}
else {
_PortNumber = (segments[2].toInteger() + 2).toString()
}
_ExePath = "${_DDriveNet}/${_GitCommitSeven}-${env.BUILD_NUMBER}-${_PortNumber}-${env.JOB_NAME}-${env.PROJECT_DIRECTORY}/${_AssemblyName}.exe"
}
}
}
stage('Info') {
steps {
// echo "GIT_URL_N - ${env.GIT_URL_N}"
// echo "BRANCH_NAME ${env.BRANCH_NAME}"
// echo "DEPLOY_VERSION ${env.DEPLOY_VERSION}"
// echo "GIT_AUTHOR_NAME ${env.GIT_AUTHOR_NAME}"
// echo "GIT_LOCAL_BRANCH ${env.GIT_LOCAL_BRANCH}"
// echo "GIT_COMMITTER_EMAIL ${env.GIT_COMMITTER_EMAIL}"
// echo "GIT_PREVIOUS_COMMIT ${env.GIT_PREVIOUS_COMMIT}"
// echo "GIT_PREVIOUS_SUCCESSFUL_COMMIT ${env.GIT_PREVIOUS_SUCCESSFUL_COMMIT}"
echo "_AssemblyName ${_AssemblyName}" // ...
echo "_ExePath ${_ExePath}" // ...
echo "_PortNumber ${_PortNumber}" // ...
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 "PROJECT_DIRECTORY ${env.PROJECT_DIRECTORY}" // ...
echo "WORKSPACE ${env.WORKSPACE}" // D:\.jenkins\_\...
}
}
// stage('Restore') {
// steps {
// bat(returnStatus: true, script: 'dotnet --info')
// }
// }
stage('Safe storage of app secrets') {
steps {
withCredentials([usernamePassword(credentialsId: _CredentialsId, passwordVariable: 'password', usernameVariable: 'username')]) {
dir(env.PROJECT_DIRECTORY) {
bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' +
'user-secrets init')
bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' +
'user-secrets set "Company" "' + _Company + '"')
bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' +
'user-secrets set "ServiceUser" "' + username + '"')
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 + '"')
bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' +
'user-secrets set "URLs" "' + 'http://localhost:' + _PortNumber)
bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' +
'user-secrets set "WorkingDirectoryName" "' + _WorkingDirectoryName + '"')
bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' +
'user-secrets set "MonARessource" "' + _MonARessource + '_' + env.PROJECT_DIRECTORY + env.MONA_SUFFIX + '"')
}
}
}
}
// stage('Core Build (packagemanagement.eu.infineon.com)') {
// steps {
// echo "Build number is ${currentBuild.number}"
// dir(env.PROJECT_DIRECTORY) {
// bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' +
// 'build --runtime win-x64 --self-contained --verbosity quiet --source ' +
// 'https://packagemanagement.eu.infineon.com:4430/api/v2/')
// }
// }
// }
stage('Core Build') {
steps {
echo "Build number is ${currentBuild.number}"
dir(env.PROJECT_DIRECTORY) {
bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' +
'build --runtime win-x64 --self-contained --verbosity quiet')
}
}
}
stage('Commit Id') {
steps {
dir(env.PROJECT_DIRECTORY) {
writeFile(file: 'bin/Debug/' + _NetVersion + "/win-x64/${env.GIT_COMMIT}-${env.BUILD_NUMBER}.txt", text: "${env.GIT_URL}")
}
}
}
// stage('Test') {
// options {
// timeout(time: 10, unit: 'MINUTES')
// }
// steps {
// dir(env.PROJECT_DIRECTORY) {
// bat('dotnet --info')
// }
// }
// }
// stage('Version') {
// steps {
// bat('dotnet --info')
// }
// }
stage('Package') {
steps {
dir(env.PROJECT_DIRECTORY) {
fileOperations([fileZipOperation(folderPath: 'bin/Debug/' + _NetVersion + '/win-x64', outputFolderPath: "${_DDriveNet}/${_GitCommitSeven}-${env.BUILD_NUMBER}-${_PortNumber}-${env.JOB_NAME}-${env.PROJECT_DIRECTORY}-Debug")])
fileOperations([fileCopyOperation(excludes: '', flattenFiles: true, includes: "${_AssemblyName}*", renameFiles: false, sourceCaptureExpression: '', targetLocation: "${_DDriveNet}/${_GitCommitSeven}-${env.BUILD_NUMBER}-${_PortNumber}-${env.JOB_NAME}-${env.PROJECT_DIRECTORY}-Debug", targetNameExpression: '')])
}
}
}
stage('Publish') {
steps {
dir(env.PROJECT_DIRECTORY) {
bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' +
'publish --configuration Release --runtime win-x64 --verbosity quiet ' +
"--self-contained true --p:Version=6.0.202-${_GitCommitSeven}-${env.BUILD_NUMBER} -o " +
'"' + "${_DDriveNet}/${_GitCommitSeven}-${env.BUILD_NUMBER}-${_PortNumber}-${env.JOB_NAME}-${env.PROJECT_DIRECTORY}" + '"')
}
}
}
stage('Service') {
steps {
withCredentials([usernamePassword(credentialsId: _CredentialsId, passwordVariable: 'password', usernameVariable: 'username')]) {
bat(returnStatus: true, script: 'sc create "' + "${env.JOB_NAME}-${env.PROJECT_DIRECTORY}-${_PortNumber}" + '" ' +
'start= delayed-auto DisplayName="' + "${env.JOB_NAME}-${env.PROJECT_DIRECTORY}-${_PortNumber}" + '" ' +
'binPath= "' + _ExePath + '" ' +
'obj= "' + "${env.USERDOMAIN}\\${username}" + '" password= "' + password + '"')
bat(returnStatus: true, script: 'sc start "' + "${env.JOB_NAME}-${env.PROJECT_DIRECTORY}-${_PortNumber}" + '"')
}
}
}
stage('Upadate NGINX') {
steps {
writeFile(file: _NGINXFile, text: "location / { proxy_pass http://localhost:${_PortNumber}; }")
}
}
stage('NGINX Test and Reload') {
steps {
withCredentials([usernamePassword(credentialsId: _CredentialsId, passwordVariable: 'password', usernameVariable: 'username')]) {
dir("C:/Users/${username}/AppData/Local/IFXApps/nginx-1.20.1") {
script {
int returnStatus = bat(returnStatus: true, script: 'nginx.exe -t')
println("returnStatus ################ ${returnStatus} ####################")
if (returnStatus == 0) {
bat(returnStatus: true, script: 'nginx.exe -s reload')
}
}
}
}
}
}
// stage('Force Fail') {
// steps {
// error("Build failed because of this and that..")
// }
// }
// stage('Copy Files to: file-share') {
// steps {
// dir(env.PROJECT_DIRECTORY + '/bin/Debug/' + _NetVersion + '/win-x64') {
// 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(env.PROJECT_DIRECTORY + '/bin') {
deleteDir()
}
dir(env.PROJECT_DIRECTORY + '/obj') {
deleteDir()
}
// cleanWs()
}
}
}

23
.vscode/launch.json vendored
View File

@ -10,9 +10,9 @@
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/Archive/bin/Debug/net6.0/win-x64/Archive.dll",
"program": "${workspaceFolder}/Server/bin/Debug/net7.0/win-x64/OI.Metrology.Server.dll",
"args": [],
"cwd": "${workspaceFolder}",
"cwd": "${workspaceFolder}/Server",
"stopAtEntry": false,
// Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser
"serverReadyAction": {
@ -23,13 +23,24 @@
"ASPNETCORE_ENVIRONMENT": "Development"
},
"sourceFileMap": {
"/Views": "${workspaceFolder}/Archive/Views"
"/Views": "${workspaceFolder}/Server/Views"
}
},
{
"name": ".NET Core Attach",
"name": "Watch Server",
"type": "coreclr",
"request": "attach"
}
"request": "launch",
"preLaunchTask": "build",
"cwd": "${workspaceFolder}",
"program": "dotnet",
"args": [
"watch",
"--launch-profile",
"Phares-Development",
"--project",
"Server",
"--verbose"
]
},
]
}

6
.vscode/tasks.json vendored
View File

@ -7,7 +7,7 @@
"type": "process",
"args": [
"build",
"${workspaceFolder}/Archive/Archive.csproj",
"${workspaceFolder}/Server/OI.Metrology.Server.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
@ -19,7 +19,7 @@
"type": "process",
"args": [
"publish",
"${workspaceFolder}/Archive/Archive.csproj",
"${workspaceFolder}/Server/OI.Metrology.Server.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
@ -33,7 +33,7 @@
"watch",
"run",
"--project",
"${workspaceFolder}/Archive/Archive.csproj"
"${workspaceFolder}/Server/OI.Metrology.Server.csproj"
],
"problemMatcher": "$msCompile"
}

View File

@ -2,7 +2,7 @@
"version": "0.2.0",
"configurations": [
{
"name": "Launch",
"name": "Launch", // opens a edge window, navigates and click debugs on mine
"type": "blazorwasm",
"request": "launch",
"cwd": "${workspaceFolder}",
@ -11,7 +11,7 @@
"timeout": 120000, // Allows time for the site to launch
},
{
"name": "Watch",
"name": "Watch", // Hot reload works on mine no debug
"type": "coreclr",
"request": "launch",
"cwd": "${workspaceFolder}",
@ -25,24 +25,11 @@
"--verbose" // Let's us confirm browser connects with hot reload capabilities
],
"preLaunchTask": "build" // Ensure we don't watch an unbuilt site
},
{
"name": "Attach",
"type": "blazorwasm",
"request": "attach",
"cwd": "${workspaceFolder}",
"browser": "edge",
"url": "https://localhost:7022", // Tell launch where to find site
"timeout": 120000, // Allows time for the site to launch
}
],
"compounds": [
{
"name": "Hot Reload with Debug - Attach",
"configurations": [ "Watch", "Attach" ]
},
{
"name": "Hot Reload with Debug - Launch",
"name": "* Hot Reload with Debug - Launch",
"configurations": [ "Watch", "Launch" ]
}
]

266
Jenkinsfile vendored
View File

@ -1,266 +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 _ExePath = '...'
@Field String _NGINXFile = '...'
@Field String _PortNumber = '...'
@Field String _AssemblyName = '...'
@Field String _AgentDevelopment = ''
@Field String _NetVersion = 'net6.0'
@Field String _GitCommitSeven = '...'
@Field String _TargetLocation = '...'
@Field String _FirstBeforePlus = '5000'
@Field String _GitName = 'OI-Metrology'
@Field String _MonARessource = 'OI_Metrology'
@Field String _WorkingDirectoryName = 'IFXApps'
@Field String _DDriveNet = "${_DDrive}${_NetVersion}"
@Field String _AgentStaging = 'messa010ec-ecfisysadmin'
@Field String _AgentProduction = 'messa010ec-ecfisysadmin'
@Field String _CredentialsId = 'Metrology-Username-Password'
@Field String _Company = 'Infineon Technologies Americas Corp.'
@Field String _ProgramFilesDotnet = 'C:/program files/dotnet/dotnet.exe'
pipeline {
agent {
label env.JENKINS_ENVIRONMENT == 'Development' ? _AgentDevelopment : env.JENKINS_ENVIRONMENT == 'Staging' ? _AgentStaging : env.JENKINS_ENVIRONMENT == 'Production' ? _AgentProduction : 'Else'
}
parameters {
string(name: 'MONA_SUFFIX', defaultValue: env.JENKINS_ENVIRONMENT == 'Development' ? '_IFX' : '_EC', description: 'MonA Suffix')
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...')
string(name: 'PROJECT_DIRECTORY', defaultValue: 'Archive', description: 'Archive|Viewer')
}
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}-${env.PROJECT_DIRECTORY}"
// _GitCommitSeven = '1234567'
_GitCommitSeven = env.GIT_COMMIT.substring(0, 7)
dir(env.PROJECT_DIRECTORY) {
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}"
withCredentials([usernamePassword(credentialsId: _CredentialsId, passwordVariable: 'password', usernameVariable: 'username')]) {
dir("C:/Users/${username}/AppData/Local/IFXApps/nginx-1.20.1/conf/includes") {
_NGINXFile = "C:/Users/${username}/AppData/Local/IFXApps/nginx-1.20.1/conf/includes/${_AssemblyName}.conf"
def files = findFiles(glob: "${_AssemblyName}.conf")
if (files.length != 1) {
writeFile(file: _NGINXFile, text: "location / { proxy_pass http://localhost:${_FirstBeforePlus}; }")
}
}
}
}
}
}
stage('Read NGINX') {
steps {
script {
String text = readFile(file: _NGINXFile)
String check = text == null ? _FirstBeforePlus : text.split(';')[0]
String[] segments = check.split(':')
if (segments.length != 3) {
_PortNumber = check
}
else {
_PortNumber = (segments[2].toInteger() + 2).toString()
}
_ExePath = "${_DDriveNet}/${_GitCommitSeven}-${env.BUILD_NUMBER}-${_PortNumber}-${env.JOB_NAME}-${env.PROJECT_DIRECTORY}/${_AssemblyName}.exe"
}
}
}
stage('Info') {
steps {
// echo "GIT_URL_N - ${env.GIT_URL_N}"
// echo "BRANCH_NAME ${env.BRANCH_NAME}"
// echo "DEPLOY_VERSION ${env.DEPLOY_VERSION}"
// echo "GIT_AUTHOR_NAME ${env.GIT_AUTHOR_NAME}"
// echo "GIT_LOCAL_BRANCH ${env.GIT_LOCAL_BRANCH}"
// echo "GIT_COMMITTER_EMAIL ${env.GIT_COMMITTER_EMAIL}"
// echo "GIT_PREVIOUS_COMMIT ${env.GIT_PREVIOUS_COMMIT}"
// echo "GIT_PREVIOUS_SUCCESSFUL_COMMIT ${env.GIT_PREVIOUS_SUCCESSFUL_COMMIT}"
echo "_AssemblyName ${_AssemblyName}" // ...
echo "_ExePath ${_ExePath}" // ...
echo "_PortNumber ${_PortNumber}" // ...
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 "PROJECT_DIRECTORY ${env.PROJECT_DIRECTORY}" // ...
echo "WORKSPACE ${env.WORKSPACE}" // D:\.jenkins\_\...
}
}
// stage('Restore') {
// steps {
// bat(returnStatus: true, script: 'dotnet --info')
// }
// }
stage('Safe storage of app secrets') {
steps {
withCredentials([usernamePassword(credentialsId: _CredentialsId, passwordVariable: 'password', usernameVariable: 'username')]) {
dir(env.PROJECT_DIRECTORY) {
bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' +
'user-secrets init')
bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' +
'user-secrets set "Company" "' + _Company + '"')
bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' +
'user-secrets set "ServiceUser" "' + username + '"')
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 + '"')
bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' +
'user-secrets set "URLs" "' + 'http://localhost:' + _PortNumber)
bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' +
'user-secrets set "WorkingDirectoryName" "' + _WorkingDirectoryName + '"')
bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' +
'user-secrets set "MonARessource" "' + _MonARessource + '_' + env.PROJECT_DIRECTORY + env.MONA_SUFFIX + '"')
}
}
}
}
// stage('Core Build (packagemanagement.eu.infineon.com)') {
// steps {
// echo "Build number is ${currentBuild.number}"
// dir(env.PROJECT_DIRECTORY) {
// bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' +
// 'build --runtime win-x64 --self-contained --verbosity quiet --source ' +
// 'https://packagemanagement.eu.infineon.com:4430/api/v2/')
// }
// }
// }
stage('Core Build') {
steps {
echo "Build number is ${currentBuild.number}"
dir(env.PROJECT_DIRECTORY) {
bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' +
'build --runtime win-x64 --self-contained --verbosity quiet')
}
}
}
stage('Commit Id') {
steps {
dir(env.PROJECT_DIRECTORY) {
writeFile(file: 'bin/Debug/' + _NetVersion + "/win-x64/${env.GIT_COMMIT}-${env.BUILD_NUMBER}.txt", text: "${env.GIT_URL}")
}
}
}
// stage('Test') {
// options {
// timeout(time: 10, unit: 'MINUTES')
// }
// steps {
// dir(env.PROJECT_DIRECTORY) {
// bat('dotnet --info')
// }
// }
// }
// stage('Version') {
// steps {
// bat('dotnet --info')
// }
// }
stage('Package') {
steps {
dir(env.PROJECT_DIRECTORY) {
fileOperations([fileZipOperation(folderPath: 'bin/Debug/' + _NetVersion + '/win-x64', outputFolderPath: "${_DDriveNet}/${_GitCommitSeven}-${env.BUILD_NUMBER}-${_PortNumber}-${env.JOB_NAME}-${env.PROJECT_DIRECTORY}-Debug")])
fileOperations([fileCopyOperation(excludes: '', flattenFiles: true, includes: "${_AssemblyName}*", renameFiles: false, sourceCaptureExpression: '', targetLocation: "${_DDriveNet}/${_GitCommitSeven}-${env.BUILD_NUMBER}-${_PortNumber}-${env.JOB_NAME}-${env.PROJECT_DIRECTORY}-Debug", targetNameExpression: '')])
}
}
}
stage('Publish') {
steps {
dir(env.PROJECT_DIRECTORY) {
bat(returnStatus: true, script: '"' + _ProgramFilesDotnet + '" ' +
'publish --configuration Release --runtime win-x64 --verbosity quiet ' +
"--self-contained true --p:Version=6.0.202-${_GitCommitSeven}-${env.BUILD_NUMBER} -o " +
'"' + "${_DDriveNet}/${_GitCommitSeven}-${env.BUILD_NUMBER}-${_PortNumber}-${env.JOB_NAME}-${env.PROJECT_DIRECTORY}" + '"')
}
}
}
stage('Service') {
steps {
withCredentials([usernamePassword(credentialsId: _CredentialsId, passwordVariable: 'password', usernameVariable: 'username')]) {
bat(returnStatus: true, script: 'sc create "' + "${env.JOB_NAME}-${env.PROJECT_DIRECTORY}-${_PortNumber}" + '" ' +
'start= delayed-auto DisplayName="' + "${env.JOB_NAME}-${env.PROJECT_DIRECTORY}-${_PortNumber}" + '" ' +
'binPath= "' + _ExePath + '" ' +
'obj= "' + "${env.USERDOMAIN}\\${username}" + '" password= "' + password + '"')
bat(returnStatus: true, script: 'sc start "' + "${env.JOB_NAME}-${env.PROJECT_DIRECTORY}-${_PortNumber}" + '"')
}
}
}
stage('Upadate NGINX') {
steps {
writeFile(file: _NGINXFile, text: "location / { proxy_pass http://localhost:${_PortNumber}; }")
}
}
stage('NGINX Test and Reload') {
steps {
withCredentials([usernamePassword(credentialsId: _CredentialsId, passwordVariable: 'password', usernameVariable: 'username')]) {
dir("C:/Users/${username}/AppData/Local/IFXApps/nginx-1.20.1") {
script {
int returnStatus = bat(returnStatus: true, script: 'nginx.exe -t')
println("returnStatus ################ ${returnStatus} ####################")
if (returnStatus == 0) {
bat(returnStatus: true, script: 'nginx.exe -s reload')
}
}
}
}
}
}
// stage('Force Fail') {
// steps {
// error("Build failed because of this and that..")
// }
// }
// stage('Copy Files to: file-share') {
// steps {
// dir(env.PROJECT_DIRECTORY + '/bin/Debug/' + _NetVersion + '/win-x64') {
// 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(env.PROJECT_DIRECTORY + '/bin') {
deleteDir()
}
dir(env.PROJECT_DIRECTORY + '/obj') {
deleteDir()
}
cleanWs()
}
}
}

View File

@ -0,0 +1 @@
[]

View File

@ -67,7 +67,16 @@
<None Include="Data\Tests\GetAllServiceShopOrdersApi.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Data\Tests\GetToolTypeMetadataApi.json">
<None Include="Data\Tests\GetAppSettingsApi.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Data\Tests\GetAwaitingDispositionApi.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Data\Tests\GetBuildNumberAndGitCommitSevenApi.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Data\Tests\GetClientSettingsApi.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Data\Tests\GetDataApi.json">
@ -82,20 +91,14 @@
<None Include="Data\Tests\GetHeaderTitlesApi.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Data\Tests\GetAppSettingsApi.json">
<None Include="Data\Tests\GetIpAddressApi.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Data\Tests\GetToolTypeMetadataApi.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Data\Tests\IndexApi.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Data\Tests\GetClientSettingsApi.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Data\Tests\GetBuildNumberAndGitCommitSevenApi.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Data\Tests\GetIpAddressApi.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

View File

@ -58,21 +58,19 @@ public class Program
{
_ = webApplicationBuilder.Services.Configure<ApiBehaviorOptions>(options => options.SuppressModelStateInvalidFilter = true);
_ = webApplicationBuilder.Services.AddControllersWithViews();
#pragma warning disable CS8600, CS8602, CS8603, CS8604, CS8625
_ = new MetrologyRepository(new SQLDbConnectionFactory(appSettings), null);
#pragma warning restore
_ = webApplicationBuilder.Services.AddDistributedMemoryCache();
_ = webApplicationBuilder.Services.AddMemoryCache();
AppSettingsRepository appSettingsRepository = new(appSettings);
SQLDbConnectionFactory sqlDbConnectionFactory = new(appSettings);
ClientSettingsRepository clientSettingsRepository = new(appSettings);
_ = webApplicationBuilder.Services.AddSingleton(_ => appSettings);
_ = webApplicationBuilder.Services.AddSingleton<IInboundRepository, InboundRepository>();
_ = webApplicationBuilder.Services.AddSingleton<IDbConnectionFactory, SQLDbConnectionFactory>();
_ = webApplicationBuilder.Services.AddSingleton<IAppSettingsRepository>(_ => appSettingsRepository);
_ = webApplicationBuilder.Services.AddSingleton<IClientSettingsRepository>(_ => clientSettingsRepository);
_ = webApplicationBuilder.Services.AddSingleton<IServiceShopOrderRepository, ServiceShopOrderRepository>();
_ = webApplicationBuilder.Services.AddSingleton<IDbConnectionFactory, SQLDbConnectionFactory>(_ => sqlDbConnectionFactory);
_ = webApplicationBuilder.Services.AddSingleton<IToolTypesRepository, ToolTypesRepository>(_ => new(appSettings.MockRoot));
_ = webApplicationBuilder.Services.AddScoped<IAttachmentsService, AttachmentsService>();

View File

@ -1,6 +1,7 @@
using Dapper;
using Microsoft.Extensions.Caching.Memory;
using Newtonsoft.Json.Linq;
using OI.Metrology.Server.Models;
using OI.Metrology.Shared.DataModels;
using OI.Metrology.Shared.Models.Stateless;
using OI.Metrology.Shared.Repositories;
@ -14,12 +15,14 @@ namespace OI.Metrology.Server.Repositories;
public class MetrologyRepository : IMetrologyRepository
{
private readonly string _MockRoot;
private readonly IMemoryCache _Cache;
private readonly IDbConnectionFactory _DBConnectionFactory;
public MetrologyRepository(IDbConnectionFactory dbConnectionFactory, IMemoryCache memoryCache)
public MetrologyRepository(AppSettings appSettings, IDbConnectionFactory dbConnectionFactory, IMemoryCache memoryCache)
{
_Cache = memoryCache;
_MockRoot = appSettings.MockRoot;
_DBConnectionFactory = dbConnectionFactory;
}
@ -693,8 +696,20 @@ public class MetrologyRepository : IMetrologyRepository
public IEnumerable<AwaitingDisposition> GetAwaitingDisposition()
{
using DbConnection conn = GetDbConnection();
return conn.Query<AwaitingDisposition>("GetAwaitingDispo", commandType: CommandType.StoredProcedure);
IEnumerable<AwaitingDisposition>? r;
if (!string.IsNullOrEmpty(_MockRoot))
{
string json = File.ReadAllText(Path.Combine(string.Concat(AppContext.BaseDirectory, _MockRoot), "GetAwaitingDispositionApi.json"));
r = System.Text.Json.JsonSerializer.Deserialize<IEnumerable<AwaitingDisposition>>(json);
if (r is null)
throw new NullReferenceException(nameof(r));
}
else
{
using DbConnection conn = GetDbConnection();
r = conn.Query<AwaitingDisposition>("GetAwaitingDispo", commandType: CommandType.StoredProcedure);
}
return r;
}
public int UpdateReviewDate(int toolTypeId, long headerId, bool clearDate)

View File

@ -53,7 +53,8 @@ public class UnitAwaitingDispoController
{
HttpClient httpClient = _WebApplicationFactory.CreateClient();
_Logger.Information("Starting Web Application");
_ = await httpClient.PostAsync($"api/{_ControllerName}", null);
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}");
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{nameof(IMetrologyRepository.GetAwaitingDisposition)}Api.json"), json);
_Logger.Information($"{_TestContext?.TestName} completed");
}