Add dotnet-ef tool manifest and dev Jenkinsfile for CI
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
pipeline {
|
||||
agent { label 'appdev' }
|
||||
|
||||
environment {
|
||||
DOTNET_CLI_HOME = "C:\\Windows\\Temp"
|
||||
PUBLISH_DIR = "C:\\jenkins\\publish\\powdercoating"
|
||||
DEPLOY_DIR = "C:\\inetpub\\wwwroot"
|
||||
APP_POOL = "PCC"
|
||||
WEB_PROJECT = "src\\PowderCoating.Web\\PowderCoating.Web.csproj"
|
||||
INFRA_PROJECT = "src\\PowderCoating.Infrastructure\\PowderCoating.Infrastructure.csproj"
|
||||
CONNECTION_STRING = "Server=.\\SQLEXPRESS;Database=PowderCoatingDb;Trusted_Connection=true;MultipleActiveResultSets=true;TrustServerCertificate=true"
|
||||
}
|
||||
|
||||
stages {
|
||||
|
||||
stage('Checkout') {
|
||||
steps {
|
||||
checkout scm
|
||||
}
|
||||
}
|
||||
|
||||
stage('Restore') {
|
||||
steps {
|
||||
bat 'dotnet restore'
|
||||
}
|
||||
}
|
||||
|
||||
stage('Build') {
|
||||
steps {
|
||||
bat 'dotnet build --no-restore -c Release'
|
||||
}
|
||||
}
|
||||
|
||||
stage('Test') {
|
||||
steps {
|
||||
bat 'dotnet test --no-build -c Release --logger "trx;LogFileName=results.trx" --results-directory TestResults'
|
||||
}
|
||||
post {
|
||||
always {
|
||||
junit testResults: 'TestResults/*.trx', allowEmptyResults: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Publish') {
|
||||
steps {
|
||||
bat "dotnet publish %WEB_PROJECT% -c Release --no-build -o \"%PUBLISH_DIR%\""
|
||||
}
|
||||
}
|
||||
|
||||
stage('Migrate Database') {
|
||||
steps {
|
||||
bat """
|
||||
dotnet tool restore
|
||||
dotnet ef database update --project %INFRA_PROJECT% --startup-project %WEB_PROJECT% --connection "%CONNECTION_STRING%"
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
||||
stage('Deploy') {
|
||||
steps {
|
||||
// Stop app pool, copy files, restart app pool
|
||||
bat """
|
||||
C:\\Windows\\System32\\inetsrv\\appcmd stop apppool /apppool.name:%APP_POOL%
|
||||
xcopy /E /Y /I "%PUBLISH_DIR%\\*" "%DEPLOY_DIR%\\"
|
||||
C:\\Windows\\System32\\inetsrv\\appcmd start apppool /apppool.name:%APP_POOL%
|
||||
"""
|
||||
}
|
||||
post {
|
||||
failure {
|
||||
// Make sure app pool is restarted even if copy fails
|
||||
bat 'C:\\Windows\\System32\\inetsrv\\appcmd start apppool /apppool.name:%APP_POOL%'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
post {
|
||||
success {
|
||||
echo 'Dev deployment completed successfully.'
|
||||
}
|
||||
failure {
|
||||
echo 'Pipeline failed — check logs above.'
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"version": 1,
|
||||
"isRoot": true,
|
||||
"tools": {
|
||||
"dotnet-ef": {
|
||||
"version": "10.0.7",
|
||||
"commands": [
|
||||
"dotnet-ef"
|
||||
],
|
||||
"rollForward": false
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user