MET08RESIMAPCDE - v2.43.0 -
Force EquipId to CellInstanceName and Jenkinsfile
This commit is contained in:
153
Jenkinsfile
vendored
Normal file
153
Jenkinsfile
vendored
Normal file
@ -0,0 +1,153 @@
|
||||
#!/usr/bin/env groovy
|
||||
import groovy.transform.Field
|
||||
|
||||
@Field def _DDrive = 'D:/'
|
||||
@Field def _AssemblyName = '...'
|
||||
@Field def _NetVersion = 'net6.0'
|
||||
@Field def _TargetLocation = '...'
|
||||
@Field def _GitCommitSeven = '...'
|
||||
@Field def _TestProjectDirectory = 'Adaptation'
|
||||
@Field def _DDriveNet = "${_DDrive}${_NetVersion}"
|
||||
@Field def _ProgramFilesDotnet = 'C:/Program Files/dotnet/dotnet.exe'
|
||||
@Field def _ProgramFilesMSBuild = 'C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe'
|
||||
|
||||
pipeline {
|
||||
agent any
|
||||
parameters {
|
||||
string(name: 'EAF_ENVIRONMENT', defaultValue: 'Staging', description: 'Environment for file-share')
|
||||
string(name: 'DEFAULT_FILE_SERVER', defaultValue: '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 \\\\mestsa07ec.ec.local\\Git\\MET08RESIMAPCDE.git')
|
||||
// bat(returnStatus: true, script: 'git pull origin master')
|
||||
// }
|
||||
// }
|
||||
stage('Setup') {
|
||||
steps {
|
||||
script {
|
||||
_AssemblyName = "${env.JOB_NAME}"
|
||||
_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\\${params.EAF_ENVIRONMENT}\\DeploymentStorage\\Adaptation_${_AssemblyName}"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Info') {
|
||||
steps {
|
||||
echo "BUILD_NUMBER ${env.BUILD_NUMBER}" // 11
|
||||
echo "JOB_NAME ${env.JOB_NAME}" // MET08RESIMAPCDE
|
||||
echo "_AssemblyName ${_AssemblyName}" // YODA Viewer
|
||||
echo "GIT_BRANCH ${env.GIT_BRANCH}" // origin/master
|
||||
echo "WORKSPACE ${env.WORKSPACE}" // D:\.jenkins\_\MET08RESIMAPCDE
|
||||
echo "JENKINS_URL ${env.JENKINS_URL}" // http://localhost:8080/
|
||||
echo "GIT_URL ${env.GIT_URL}" // D:\ProgramData\Git\MET08RESIMAPCDE.git
|
||||
echo "GIT_COMMIT ${env.GIT_COMMIT}" // 73b814069f2cf0173a62a8228815a9bc9ba93c41
|
||||
}
|
||||
}
|
||||
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('Publish') {
|
||||
// steps {
|
||||
// bat(returnStatus: true, script: '"' + "${_ProgramFilesDotnet}" + '" ' +
|
||||
// 'remove reference "../Client/' + "${env.JOB_NAME}" + '.Client.csproj"')
|
||||
// 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}-${env.JOB_NAME}" + '"')
|
||||
// }
|
||||
// }
|
||||
// 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()
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user