-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Major
-
Component/s: dotnet-sdk-plugin
-
None
I have a stage "Build", which contains a steps section.
The second dotnetPublish fails, due some coding error.
However, the build script just continues running the third dotnetPublish and the next "Deploy" stage.
Â
This doesn't seem right to me.
Â
Pipeline script:
pipeline {
  agent any  stages {
    stage ('Pull source from git') {
      steps {
        git credentialsId: '8de5b413-a0fb-473b-ae03-ae548b279649', url: 'http://blaat:3000/blaat/blaat.git'
      }
    }
    /*stage ('Code analyse') {
      steps {
        echo 'Run some lints'
      }
    }*/
    /*stage ('Unit test') {
      steps {
        echo 'Tests will back'
      }
    }*/
    stage ('Build') {
      steps {
        dotnetPublish configuration: 'Release', project: 'WebApi.csproj', sdk: '.NET 6.0', selfContained: false, workDirectory: 'Backend/WebApi'
        dotnetPublish configuration: 'Release', project: 'CMReportingService.csproj', sdk: '.NET 6.0', selfContained: false, workDirectory: 'Reporting/CMReportingService'
        dotnetPublish configuration: 'Release', project: 'OGOCM.csproj', sdk: '.NET 6.0', selfContained: false, workDirectory: 'Frontend/OGOCM'
      }
    }
    stage ('Deploy') {
      steps {
        sh 'ssh root@ogocm mkdir -p /var/webapps/temp_deploy_dev/'
        sh 'ssh root@ogocm mkdir -p /var/webapps/temp_backup_dev/'
        Â
        sh 'ssh root@ogocm systemctl stop kestrel-webapps-dev-webapi'
        sh 'ssh root@ogocm systemctl stop kestrel-webapps-dev-ogocm'
        sh 'ssh root@ogocm systemctl stop kestrel-webapps-dev-reporting-service'
        Â
        // How this works:
        // 1) Remove the temp folder on the production server (if it still exists)
        // 2) Copy the build result to the temp folder on the production server
        // 3) Remove the appsettings.Development.json file
        // 4) Copy the (correct) appsettings.json from the production folder to the temp folder
        // 5) Remove the backup folder on the production server (if it still exists)
        // 6) Move the production folder to the backup folder
        // 7) Move the temp folder to the production folder
        // 8) Restart the service
        // 9) Remove the backup folder on the production server
        Â
        sh 'ssh root@ogocm rm -rf /var/webapps/temp_deploy_dev/dev-webapi/'
        sh 'scp -r Backend/WebApi/bin/Release/net6.0/publish root@ogocm:/var/webapps/temp_deploy_dev/dev-webapi'
        sh 'ssh root@ogocm rm /var/webapps/temp_deploy_dev/dev-webapi/appsettings.Development.json'
        sh 'ssh root@ogocm cp /var/webapps/dev-webapi/appsettings.json /var/webapps/temp_deploy_dev/dev-webapi/'
        sh 'ssh root@ogocm rm -rf /var/webapps/temp_backup_dev/dev-webapi/'
        sh 'ssh root@ogocm mv /var/webapps/dev-webapi/ /var/webapps/temp_backup_dev/dev-webapi/'
        sh 'ssh root@ogocm mv /var/webapps/temp_deploy_dev/dev-webapi/ /var/webapps/dev-webapi/'
        sh 'ssh root@ogocm systemctl restart kestrel-webapps-dev-webapi.service'
        sh 'ssh root@ogocm rm -rf /var/webapps/temp_backup_dev/dev-webapi/'
        Â
        sh 'ssh root@ogocm rm -rf /var/webapps/temp_deploy_dev/dev-reporting-service/'
        sh 'scp -r Reporting/CMReportingService/bin/Release/net6.0/publish root@ogocm:/var/webapps/temp_deploy_dev/dev-reporting-service'
        sh 'ssh root@ogocm rm /var/webapps/temp_deploy_dev/dev-reporting-service/appsettings.Development.json'
        sh 'ssh root@ogocm cp /var/webapps/dev-reporting-service/appsettings.json /var/webapps/temp_deploy_dev/dev-reporting-service/'
        sh 'ssh root@ogocm rm -rf /var/webapps/temp_backup_dev/dev-reporting-service/'
        sh 'ssh root@ogocm mv /var/webapps/dev-reporting-service/ /var/webapps/temp_backup_dev/dev-reporting-service/'
        sh 'ssh root@ogocm mv /var/webapps/temp_deploy_dev/dev-reporting-service/ /var/webapps/dev-reporting-service/'
        sh 'ssh root@ogocm systemctl restart kestrel-webapps-dev-reporting-service.service'
        sh 'ssh root@ogocm rm -rf /var/webapps/temp_backup_dev/dev-reporting-service/'
        Â
        sh 'ssh root@ogocm rm -rf /var/webapps/temp_deploy_dev/dev-ogocm/'
        sh 'scp -r Frontend/OGOCM/bin/Release/net6.0/publish root@ogocm:/var/webapps/temp_deploy_dev/dev-ogocm'
        sh 'ssh root@ogocm rm /var/webapps/temp_deploy_dev/dev-ogocm/appsettings.Development.json'
        sh 'ssh root@ogocm cp /var/webapps/dev-ogocm/appsettings.json /var/webapps/temp_deploy_dev/dev-ogocm/'
        sh 'ssh root@ogocm rm -rf /var/webapps/temp_backup_dev/dev-ogocm/'
        sh 'ssh root@ogocm mv /var/webapps/dev-ogocm/ /var/webapps/temp_backup_dev/dev-ogocm/'
        sh 'ssh root@ogocm mv /var/webapps/temp_deploy_dev/dev-ogocm/ /var/webapps/dev-ogocm/'
        sh 'ssh root@ogocm systemctl restart kestrel-webapps-dev-ogocm.service'
        sh 'ssh root@ogocm rm -rf /var/webapps/temp_backup_dev/dev-ogocm/'
        Â
        sh 'ssh root@ogocm systemctl start kestrel-webapps-dev-webapi'
        sh 'ssh root@ogocm systemctl start kestrel-webapps-dev-ogocm'
        sh 'ssh root@ogocm systemctl start kestrel-webapps-dev-reporting-service'
        Â
        sh 'ssh root@ogocm rm -rf /var/webapps/temp_backup_dev/'
        sh 'ssh root@ogocm rm -rf /var/webapps/temp_deploy_dev/'
      }
    }
  }
  Â
  post {
    always {
      emailext body: '$DEFAULT_CONTENT', subject: '$DEFAULT_SUBJECT', attachLog: 'true', to: 'blaat@blaat.com'
    }
  }
}
Â
Build log:
Started by user blaat [Pipeline] Start of Pipeline [Pipeline] node Running on Jenkins in /var/lib/jenkins/workspace/Development OGO-CM [Pipeline] { [Pipeline] stage [Pipeline] { (Pull source from git) [Pipeline] git The recommended git tool is: NONE using credential 8de5b413-a0fb-473b-ae03-ae548b279649 > git rev-parse --resolve-git-dir /var/lib/jenkins/workspace/Development OGO-CM/.git # timeout=10 Fetching changes from the remote Git repository > git config remote.origin.url http://blaat:3000/blaat/blaat.git # timeout=10 Fetching upstream changes from http://blaat:3000/blaat/blaat.git > git --version # timeout=10 > git --version # 'git version 2.25.1' using GIT_ASKPASS to set credentials > git fetch --tags --force --progress -- http://blaat:3000/blaat/blaat.git +refs/heads/*:refs/remotes/origin/* # timeout=10 > git rev-parse refs/remotes/origin/master^{commit} # timeout=10 Checking out Revision 8ea6c960479eba91f601af8b13a68b6047e9b707 (refs/remotes/origin/master) > git config core.sparsecheckout # timeout=10 > git checkout -f 8ea6c960479eba91f601af8b13a68b6047e9b707 # timeout=10 > git branch -a -v --no-abbrev # timeout=10 > git branch -D master # timeout=10 > git checkout -b master 8ea6c960479eba91f601af8b13a68b6047e9b707 # timeout=10 Commit message: "Make build fail." > git rev-list --no-walk 8ea6c960479eba91f601af8b13a68b6047e9b707 # timeout=10 [Pipeline] } [Pipeline] // stage [Pipeline] stage [Pipeline] { (Build) [Pipeline] step [WebApi] $ /var/lib/jenkins/tools/io.jenkins.plugins.dotnet.DotNetSDK/.NET_6.0/dotnet publish WebApi.csproj -c:Release --self-contained false Microsoft (R) Build Engine version 17.1.0+ae57d105c for .NET Copyright (C) Microsoft Corporation. All rights reserved. Determining projects to restore... All projects are up-to-date for restore. WebApi -> /var/lib/jenkins/workspace/Development OGO-CM/Backend/WebApi/bin/Release/net6.0/WebApi.dll WebApi -> /var/lib/jenkins/workspace/Development OGO-CM/Backend/WebApi/bin/Release/net6.0/publish/ .NET Command Completed - Exit Code: 0 [Pipeline] step [CMReportingService] $ /var/lib/jenkins/tools/io.jenkins.plugins.dotnet.DotNetSDK/.NET_6.0/dotnet publish CMReportingService.csproj -c:Release --self-contained false Microsoft (R) Build Engine version 17.1.0+ae57d105c for .NET Copyright (C) Microsoft Corporation. All rights reserved. Determining projects to restore... All projects are up-to-date for restore. ReportingLib -> /var/lib/jenkins/workspace/Development OGO-CM/Reporting/ReportingLib/bin/Release/net6.0/ReportingLib.dll âš /var/lib/jenkins/workspace/Development OGO-CM/Reporting/CMReportingService/WebApiAccess.cs(23,29): warning CS8600: Converting null literal or possible null value to non-nullable type. [/var/lib/jenkins/workspace/Development OGO-CM/Reporting/CMReportingService/CMReportingService.csproj] âš /var/lib/jenkins/workspace/Development OGO-CM/Reporting/CMReportingService/WebApiAccess.cs(41,20): warning CS8603: Possible null reference return. [/var/lib/jenkins/workspace/Development OGO-CM/Reporting/CMReportingService/CMReportingService.csproj] âš /var/lib/jenkins/workspace/Development OGO-CM/Reporting/CMReportingService/WebApiAccess.cs(46,29): warning CS8600: Converting null literal or possible null value to non-nullable type. [/var/lib/jenkins/workspace/Development OGO-CM/Reporting/CMReportingService/CMReportingService.csproj] âš /var/lib/jenkins/workspace/Development OGO-CM/Reporting/CMReportingService/WebApiAccess.cs(64,20): warning CS8603: Possible null reference return. [/var/lib/jenkins/workspace/Development OGO-CM/Reporting/CMReportingService/CMReportingService.csproj] âš /var/lib/jenkins/workspace/Development OGO-CM/Reporting/CMReportingService/WebApiAccess.cs(69,42): warning CS8600: Converting null literal or possible null value to non-nullable type. [/var/lib/jenkins/workspace/Development OGO-CM/Reporting/CMReportingService/CMReportingService.csproj] âš /var/lib/jenkins/workspace/Development OGO-CM/Reporting/CMReportingService/WebApiAccess.cs(83,45): warning CS8600: Converting null literal or possible null value to non-nullable type. [/var/lib/jenkins/workspace/Development OGO-CM/Reporting/CMReportingService/CMReportingService.csproj] âš /var/lib/jenkins/workspace/Development OGO-CM/Reporting/CMReportingService/SharedContainer.cs(22,39): warning CS8601: Possible null reference assignment. [/var/lib/jenkins/workspace/Development OGO-CM/Reporting/CMReportingService/CMReportingService.csproj] âš /var/lib/jenkins/workspace/Development OGO-CM/Reporting/CMReportingService/SharedContainer.cs(37,55): warning CS8601: Possible null reference assignment. [/var/lib/jenkins/workspace/Development OGO-CM/Reporting/CMReportingService/CMReportingService.csproj] â›”/var/lib/jenkins/workspace/Development OGO-CM/Reporting/CMReportingService/CronJob.cs(22,25): error CS1061: 'ILogger<CronJob>' does not contain a definition for '_LogError' and no accessible extension method '_LogError' accepting a first argument of type 'ILogger<CronJob>' could be found (are you missing a using directive or an assembly reference?) [/var/lib/jenkins/workspace/Development OGO-CM/Reporting/CMReportingService/CMReportingService.csproj] âš /var/lib/jenkins/workspace/Development OGO-CM/Reporting/CMReportingService/CheckAPIForChangesWorker.cs(56,30): warning CS8602: Dereference of a possibly null reference. [/var/lib/jenkins/workspace/Development OGO-CM/Reporting/CMReportingService/CMReportingService.csproj] âš /var/lib/jenkins/workspace/Development OGO-CM/Reporting/CMReportingService/CheckAPIForChangesWorker.cs(56,48): warning CS8602: Dereference of a possibly null reference. [/var/lib/jenkins/workspace/Development OGO-CM/Reporting/CMReportingService/CMReportingService.csproj] âš /var/lib/jenkins/workspace/Development OGO-CM/Reporting/CMReportingService/CheckAPIForChangesWorker.cs(104,30): warning CS8602: Dereference of a possibly null reference. [/var/lib/jenkins/workspace/Development OGO-CM/Reporting/CMReportingService/CMReportingService.csproj] âš /var/lib/jenkins/workspace/Development OGO-CM/Reporting/CMReportingService/CheckAPIForChangesWorker.cs(104,48): warning CS8602: Dereference of a possibly null reference. [/var/lib/jenkins/workspace/Development OGO-CM/Reporting/CMReportingService/CMReportingService.csproj] .NET Command Completed - Exit Code: 1 [Pipeline] step [OGOCM] $ /var/lib/jenkins/tools/io.jenkins.plugins.dotnet.DotNetSDK/.NET_6.0/dotnet publish OGOCM.csproj -c:Release --self-contained false Microsoft (R) Build Engine version 17.1.0+ae57d105c for .NET Copyright (C) Microsoft Corporation. All rights reserved. Determining projects to restore... All projects are up-to-date for restore. ReportingLib -> /var/lib/jenkins/workspace/Development OGO-CM/Reporting/ReportingLib/bin/Release/net6.0/ReportingLib.dll OGOCM -> /var/lib/jenkins/workspace/Development OGO-CM/Frontend/OGOCM/bin/Release/net6.0/OGOCM.dll OGOCM -> /var/lib/jenkins/workspace/Development OGO-CM/Frontend/OGOCM/bin/Release/net6.0/publish/ .NET Command Completed - Exit Code: 0 [Pipeline] } [Pipeline] // stage [Pipeline] stage [Pipeline] { (Deploy) [Pipeline] sh + ssh root@ogocm mkdir -p /var/webapps/temp_deploy_dev/ [Pipeline] sh + ssh root@ogocm mkdir -p /var/webapps/temp_backup_dev/ [Pipeline] sh + ssh root@ogocm systemctl stop kestrel-webapps-dev-webapi [Pipeline] sh + ssh root@ogocm systemctl stop kestrel-webapps-dev-ogocm [Pipeline] sh + ssh root@ogocm systemctl stop kestrel-webapps-dev-reporting-service [Pipeline] sh + ssh root@ogocm rm -rf /var/webapps/temp_deploy_dev/dev-webapi/ [Pipeline] sh + scp -r Backend/WebApi/bin/Release/net6.0/publish root@ogocm:/var/webapps/temp_deploy_dev/dev-webapi [Pipeline] sh + ssh root@ogocm rm /var/webapps/temp_deploy_dev/dev-webapi/appsettings.Development.json [Pipeline] sh + ssh root@ogocm cp /var/webapps/dev-webapi/appsettings.json /var/webapps/temp_deploy_dev/dev-webapi/ [Pipeline] sh + ssh root@ogocm rm -rf /var/webapps/temp_backup_dev/dev-webapi/ [Pipeline] sh + ssh root@ogocm mv /var/webapps/dev-webapi/ /var/webapps/temp_backup_dev/dev-webapi/ [Pipeline] sh + ssh root@ogocm mv /var/webapps/temp_deploy_dev/dev-webapi/ /var/webapps/dev-webapi/ [Pipeline] sh + ssh root@ogocm systemctl restart kestrel-webapps-dev-webapi.service [Pipeline] sh + ssh root@ogocm rm -rf /var/webapps/temp_backup_dev/dev-webapi/ [Pipeline] sh + ssh root@ogocm rm -rf /var/webapps/temp_deploy_dev/dev-reporting-service/ [Pipeline] sh + scp -r Reporting/CMReportingService/bin/Release/net6.0/publish root@ogocm:/var/webapps/temp_deploy_dev/dev-reporting-service [Pipeline] sh + ssh root@ogocm rm /var/webapps/temp_deploy_dev/dev-reporting-service/appsettings.Development.json [Pipeline] sh + ssh root@ogocm cp /var/webapps/dev-reporting-service/appsettings.json /var/webapps/temp_deploy_dev/dev-reporting-service/ [Pipeline] sh + ssh root@ogocm rm -rf /var/webapps/temp_backup_dev/dev-reporting-service/ [Pipeline] sh + ssh root@ogocm mv /var/webapps/dev-reporting-service/ /var/webapps/temp_backup_dev/dev-reporting-service/ [Pipeline] sh + ssh root@ogocm mv /var/webapps/temp_deploy_dev/dev-reporting-service/ /var/webapps/dev-reporting-service/ [Pipeline] sh + ssh root@ogocm systemctl restart kestrel-webapps-dev-reporting-service.service [Pipeline] sh + ssh root@ogocm rm -rf /var/webapps/temp_backup_dev/dev-reporting-service/ [Pipeline] sh + ssh root@ogocm rm -rf /var/webapps/temp_deploy_dev/dev-ogocm/ [Pipeline] sh + scp -r Frontend/OGOCM/bin/Release/net6.0/publish root@ogocm:/var/webapps/temp_deploy_dev/dev-ogocm [Pipeline] sh + ssh root@ogocm rm /var/webapps/temp_deploy_dev/dev-ogocm/appsettings.Development.json [Pipeline] sh + ssh root@ogocm cp /var/webapps/dev-ogocm/appsettings.json /var/webapps/temp_deploy_dev/dev-ogocm/ [Pipeline] sh + ssh root@ogocm rm -rf /var/webapps/temp_backup_dev/dev-ogocm/ [Pipeline] sh + ssh root@ogocm mv /var/webapps/dev-ogocm/ /var/webapps/temp_backup_dev/dev-ogocm/ [Pipeline] sh + ssh root@ogocm mv /var/webapps/temp_deploy_dev/dev-ogocm/ /var/webapps/dev-ogocm/ [Pipeline] sh + ssh root@ogocm systemctl restart kestrel-webapps-dev-ogocm.service [Pipeline] sh + ssh root@ogocm rm -rf /var/webapps/temp_backup_dev/dev-ogocm/ [Pipeline] sh + ssh root@ogocm systemctl start kestrel-webapps-dev-webapi [Pipeline] sh + ssh root@ogocm systemctl start kestrel-webapps-dev-ogocm [Pipeline] sh + ssh root@ogocm systemctl start kestrel-webapps-dev-reporting-service [Pipeline] sh + ssh root@ogocm rm -rf /var/webapps/temp_backup_dev/ [Pipeline] sh + ssh root@ogocm rm -rf /var/webapps/temp_deploy_dev/ [Pipeline] } [Pipeline] // stage [Pipeline] stage [Pipeline] { (Declarative: Post Actions) [Pipeline] emailext Sending email to: blaat@blaat.com [Pipeline] } [Pipeline] // stage [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline Finished: FAILURE
Â
Â
Notice the:
Â
â›”/var/lib/jenkins/workspace/Development OGO-CM/Reporting/CMReportingService/CronJob.cs(22,25): error CS1061: 'ILogger<CronJob>' does not contain a definition for '_LogError' and no accessible extension method '_LogError' accepting a first argument of type 'ILogger<CronJob>' could be found (are you missing a using directive or an assembly reference?) [/var/lib/jenkins/workspace/Development OGO-CM/Reporting/CMReportingService/CMReportingService.csproj]Â
Â
and:
Â
.NET Command Completed - Exit Code: 1
Â
I have searched, but all I am finding is people that want to be able to skip such failing step, and continue the build. This leads me to thinking this is just a bug in the Jenkins (dotnet-sdk?) code.
Â
Jenkins version: 2.332.3
.NET SDK Support Version: 1.3.1Â
- links to