No artifact Created during the CI in Azure DevOps - azure

I am trying to create an Azure pipeline for a .NET core project. The build appears to complete with no errors but there is no artifact generated:
Here you can the warnings as well
The YAML definition is below, can anyone see what I'm doing wrong here
trigger:
branches:
include:
- release/*
paths:
include:
- Reeft/Organization/OrganizationService/*
- Reeft/Organization/OrganizationServicePipelines/organization-service-test.yml
pool:
vmImage: 'windows-2022'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
projectName: '**/F11.Web.csproj'
runtime: 'win-x64'
steps:
- task: UseDotNet#2
displayName: 'Use .NET 5 SDK (preview)'
inputs:
packageType: 'sdk'
version: '5.0.100-rc.1.20452.10'
vsVersion: '16.8.0'
includePreviewVersions: true
- task: DotNetCoreCLI#2
inputs:
command: 'restore'
projects: '$(projectName)'
feedsToUse: 'select'
- task: DotNetCoreCLI#2
displayName: Build
inputs:
projects: '$(projectName)'
arguments: '--no-restore'
- task: DotNetCoreCLI#2
displayName: Test
inputs:
command: test
projects: '$(projectName)'
arguments: '-l "console;verbosity=detailed"'
- task: DotNetCoreCLI#2
displayName: 'Publish WebApi'
inputs:
command: publish
publishWebProjects: false
projects: '$(projectName)'
arguments: '--configuration $(BuildConfiguration) --output $(Build.ArtifactStagingDirectory) --runtime -r $(runtime)'
- task: CopyFiles#2
inputs:
Contents: '**'
TargetFolder: '$(Build.ArtifactStagingDirectory)'

To generate artifacts you need to add appropriate task Publish Build Artifacts task:
# Publish build artifacts
# Publish build artifacts to Azure Pipelines or a Windows file share
- task: PublishBuildArtifacts#1
inputs:
#pathToPublish: '$(Build.ArtifactStagingDirectory)'
#artifactName: 'drop'
#publishLocation: 'Container' # Options: container, filePath
#targetPath: # Required when publishLocation == FilePath
#parallel: false # Optional
#parallelCount: # Optional
#fileCopyOptions: #Optional
#storeAsTar: false # Optional

Related

how to use Devops Pipelines and Releases: Deploying One solution with 6 webjob console app as one zip file/package

My situation : I have 1 solution with 6 console apps.
My target : publish 6 console apps as 6 web jobs under 1 App service.
Summary :
6 consoleapps -->convert --> 6 dlls in 1 ZIP file --> Publish --> 6 webjobs in 1 App Service
How can I do that in Yaml?
azure-pipeline.yaml :
trigger:
- main
variables:
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
stages:
- stage: Build
displayName: 'Build stage'
pool:
vmImage: 'windows-latest'
jobs:
- job: BuildOrderShipmentJob
displayName: 'Build Order Shipment Job'
steps:
- checkout: self
displayName: 'checkout'
- task: NuGetToolInstaller#0
displayName: "NuGet use 6.3.0"
inputs:
versionSpec: 6.3.0
- task: NuGetCommand#2
displayName: 'nuget restore'
inputs:
command: 'restore'
restoreSolution: '**/*.sln'
feedsToUse: 'select'
- task: MSBuild#1
displayName: 'msbuild'
inputs:
solution: 'src/xxxxx/xxxxx.csproj'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
msbuildArguments: '/p:OutputPath=$(build.ArtifactStagingDirectory)/xxxxx-$(Build.BuildNumber)/App_Data/jobs/continuous/xxxxx'
- task: ArchiveFiles#2
displayName: 'package'
inputs:
rootFolderOrFile: '$(build.ArtifactStagingDirectory)/xxxxx-$(Build.BuildNumber)'
includeRootFolder: false
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/xxxxx-$(Build.BuildNumber).zip'
replaceExistingArchive: true
- task: PublishBuildArtifacts#1
displayName: 'publish'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)/xxxxx-$(Build.BuildNumber).zip'
ArtifactName: 'drop'
- stage: Test
displayName: 'Test stage'
pool:
vmImage: 'windows-latest'
jobs:
- job: TestOrderShipmentJob
displayName: 'Test Order Shipment Job'
steps:
- checkout: self
displayName: 'checkout'
- task: NuGetToolInstaller#0
displayName: "NuGet use 6.3.0"
inputs:
versionSpec: 6.3.0
- task: NuGetCommand#2
displayName: 'nuget restore'
inputs:
command: 'restore'
restoreSolution: '**/*.sln'
- task: VSBuild#1
displayName: 'vsbuild'
inputs:
solution: '**/*.sln'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
clean: true
- task: DotNetCoreCLI#2
displayName: 'dotnet test'
inputs:
command: test
arguments: '--collect:"XPlat Code Coverage" /p:CoverletOutputFormat=cobertura'
publishTestResults: true
workingDirectory: '$(System.DefaultWorkingDirectory)/src'
- task: PublishCodeCoverageResults#1
displayName: 'publish code coverage results'
inputs:
codeCoverageTool: 'Cobertura'
summaryFileLocation: '$(Agent.TempDirectory)/**/coverage.cobertura.xml'
- stage: Deploy_Test
displayName: 'Deploy test'
dependsOn: Test
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
pool:
name: 'bmersgtsteuw-app-eurotracs-pool'
jobs:
- deployment: BaukingOrderShipmentJob
displayName: 'Deploy Order Shipment Job'
environment: 'BME-CF-Test'
strategy:
runOnce:
deploy:
steps:
- download: current
artifact: drop
- task: AzureRMWebAppDeployment#4
inputs:
ConnectionType: AzureRM
azureSubscription: 'ARM-Con-BME-SUB-TST-EUW-APP'
appType: 'webApp'
WebAppName: 'xxxapptsteuw-app-tst'
package: '$(Pipeline.Workspace)/drop/xxxxx-$(Build.BuildNumber).zip'
removeAdditionalFilesFlag: true
- stage: Deploy_Prod
displayName: 'Deploy production'
dependsOn: Deploy_Test
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
pool:
name: 'xxxrsgprdeuw-app-tst-pool'
jobs:
- deployment: YYYYYOrderShipmentJob
displayName: 'Deploy Order Shipment Job'
environment: XXXX-CF-Prod
strategy:
runOnce:
deploy:
steps:
- download: current
artifact: drop
- task: AzureRMWebAppDeployment#4
inputs:
ConnectionType: AzureRM
azureSubscription: 'ARM-Con-XXXX-SUB-PRD-EUW-APP'
appType: 'webApp'
WebAppName: 'xxxappprdeuw-app-tst'
package: '$(Pipeline.Workspace)/drop/xxxxx-$(Build.BuildNumber).zip'
removeAdditionalFilesFlag: true
Based on your situation, you have 1 solution with 6 console apps.
6 consoleapps -->convert --> 6 dlls in 1 ZIP file --> Publish --> 6 webjobs in 1 App Service
To achieve your requirement, you can directly define the solution file and modify the msbuildArguments in Msbuild task.
For example:
- task: MSBuild#1
displayName: 'Build solution **/*.sln'
inputs:
solution: '**/*.sln'
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
msbuildArguments: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactstagingdirectory)\WebApp.zip" /p:DeployIisAppPath="Default Web Site"'
Then the 6 console apps in 1 solution file will be built and the output will be saved at one zip file. So you can remove the ArchiveFiles task in YAML sample

Azure DevOps Failed to update App Service configuration details

I am trying to deploy a WebApp in Azure DevOps and I am getting this error:
[warning]Failed to update App Service configuration details. Error: Error: Failed to update App service 'webapp' configuration. Error: BadRequest - Required parameter AccessKey is missing.
I can't figure out why this is happening, it was working originally and the error came about the other day. Nothing has changed with the WebApp code, no new settings were added. The artifact goes into place and the website works but I get this error, then on another run, the pipeline will fail, so I only have one successful run, then I have to go and delete the web app to have another successful run.
Here is my YAML Code:
trigger:
branches:
include:
- master
pr: none
pool:
vmImage: windows-latest
resources:
repositories:
- repository: Website
name: VALUE/Website
path:
- include: /Website
type: git
ref: VALUE
variables:
System.Debug: false
azureSubscription: VALUE
RG: rg_example
Location: UK South
containername: private
appconnectionname: VALUE
stages:
- stage: build_website_files
displayName: Building Main Website Files
jobs:
- job: job1
displayName: Create And Publish Artifact
steps:
- checkout: Website
- task: CmdLine#2
inputs:
script: 'mkdir Website'
workingDirectory: $(Build.ArtifactStagingDirectory)
- task: CmdLine#2
inputs:
script: 'echo $(Build.ArtifactStagingDirectory)/Website'
- task: DotNetCoreCLI#2
displayName: dotnet restore
inputs:
command: restore
projects: Website.csproj
- task: NodeTool#0
displayName: Install Node .js
inputs:
versionSpec: 14.17.3
force32bit: false
checkLatest: false
- script: |
npm install -g #angular/cli#12.1.3
npm install
ng build --prod
displayName: npm install and build
- task: DotNetCoreCLI#2
displayName: dotnet build
inputs:
projects: Website.csproj
arguments: '--configuration Release'
- task: DotNetCoreCLI#2
displayName: dotnet restore unit tests
inputs:
command: restore
projects: UnitTests/UnitTests.csproj
- task: DotNetCoreCLI#2
displayName: dotnet Test
inputs:
command: test
projects: UnitTests/UnitTests.csproj
arguments: '--configuration Release'
- task: DotNetCoreCLI#2
displayName: dotnet publish
inputs:
command: publish
projects: Website.csproj
arguments: --configuration Release --output $(Build.ArtifactStagingDirectory)/Website
zipAfterPublish: true
modifyOutputPath: false
- task: PublishPipelineArtifact#1
displayName: Publish Pipeline Artifact
inputs:
targetPath: $(Build.ArtifactStagingDirectory)/Website
artifact: Website
publishLocation: pipeline
- stage: put_website_files_into_place
displayName: website_files_into_place
dependsOn: build_website_files
jobs:
- job: job2
displayName: Create Web App
#dependsOn: job1
steps:
- download: none
- task: DownloadPipelineArtifact#2
displayName: Download Build Artifacts
inputs:
patterns: '**/*.zip'
path: $(Build.ArtifactStagingDirectory)/Website/
- task: AzureWebApp#1
displayName: 'Azure Web App Deploy: value'
inputs:
package: $(Build.ArtifactStagingDirectory)/**/*.zip
azureSubscription: $(azureSubscription)
ConnectedServiceName: $(appconnectionname)
appName: value
ResourceGroupName: $(RG)

Azure DevOps Pipeline create empty zip

I would like to ask you how to solve a problem which I encountered during a creation of Azure pipeline.
Problem description:
Probably, "brick" responsible for building a project not create a bin folder so I finally get empty zip.
Despite of the fact all test were successfully completed(passed).
My yaml file:
trigger:
- main
pool:
vmImage: 'windows-latest'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: NuGetToolInstaller#1
- task: UseDotNet#2
inputs:
packageType: 'sdk'
version: '3.1.x'
- task: NuGetCommand#2
inputs:
restoreSolution: '$(solution)'
- task: DotNetCoreCLI#2
inputs:
command: 'build'
projects: '**/XXX.EvaluateFunction.csproj'
- task: ArchiveFiles#2
inputs:
rootFolderOrFile: '$(Build.BinariesDirectory)'
includeRootFolder: true
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/Evaluate.zip'
replaceExistingArchive: true
- task: PublishBuildArtifacts#1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'PortalArtifact'
publishLocation: 'Container'
According to the document about predefined variables: Build.BinariesDirectory is the local path on the agent you can use as an output folder for compiled binaries. Your yaml file does not use it as an output folder so that this folder is empty. You can use Build.BinariesDirectory as an output folder in .NET Core task: arguments: '--output $(Build.BinariesDirectory)'
Here is my complete sample:
trigger:
- main
pool:
vmImage: 'windows-latest'
variables:
solution: '**/*.csproj'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
stages:
- stage: Build
jobs:
- job: Build
steps:
- task: DotNetCoreCLI#2
inputs:
command: 'restore'
projects: '**/*.csproj'
feedsToUse: 'select'
- task: DotNetCoreCLI#2
inputs:
command: 'build'
projects: '**/*.csproj'
arguments: '--configuration $(BuildConfiguration)'
- task: DotNetCoreCLI#2
inputs:
command: 'publish'
publishWebProjects: true
arguments: '--configuration $(BuildConfiguration) --output $(Build.BinariesDirectory)'
- task: ArchiveFiles#2
inputs:
rootFolderOrFile: '$(Build.BinariesDirectory)'
includeRootFolder: true
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/Evaluate.zip'
replaceExistingArchive: true
- task: PublishBuildArtifacts#1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'
You can also refer to the sample about create your first .NET Core pipeline.

azure devops build and deploy to app service

I have create an empty project on dev.azure.com
I have cloned the repository on my local computer.
I have run this command in the main folder:
$ dotnet new mvc
I have create this azure-pipelines.yml file:
trigger:
- master
pool:
vmImage: 'windows-latest'
steps:
- task: DotNetCoreCLI#2
inputs:
command: 'restore'
feedsToUse: 'select'
- task: DotNetCoreCLI#2
inputs:
command: 'build'
- task: DotNetCoreCLI#2
inputs:
command: 'publish'
publishWebProjects: true
- task: PublishBuildArtifacts#1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'artifact2'
I have add, commit and pushed files on dev.azure.com (on master branch)
I have this warning message:
##[warning]Directory 'd:\a\1\a' is empty. Nothing will be added to build artifact 'artifact2'.
I have create a release pipeline but i get an error:
##[error]Error: No package found with specified pattern: D:\a\r1\a\**\*.zip<br/>Check if the package mentioned in the task is published as an artifact in the build or a previous stage and downloaded in the current job.
I do not understand what is wrong in my azure-pipelines.yml for artifact production...
Thanks
It seems that there is an issue where the published dlls are placed. Try the yaml below, that I have explicitly set the output directory for the published dlls and zipped the files after publish(that would probably be your next issue). I have also explicitly set in which folder to look for the published folder in order to publish the artifact.
trigger:
- master
pool:
vmImage: 'windows-latest'
steps:
- task: DotNetCoreCLI#2
inputs:
command: 'restore'
feedsToUse: 'select'
- task: DotNetCoreCLI#2
inputs:
command: 'build'
- task: DotNetCoreCLI#2
inputs:
command: 'publish'
publishWebProjects: true
modifyOutputPath: true
arguments: '--configuration $(BuildConfiguration) --output "$(build.artifactstagingdirectory)"'
zipAfterPublish: true
- task: PublishBuildArtifacts#1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'artifact2'

Azure Pipeline (YAML) deploys an empty solution to my FunctionApp

I'm building a CI-CD azure pipeline with YAML to deploy an azure function app.
Everything works fine, I can even set some properties for the function app, but my function app remains empty.
I downloaded the zip artifact and it looks just fine.
trigger:
- master
variables:
variables:
buildConfiguration: 'Release'
Parameters.RestoreBuildProjects: '**/TestFunction.csproj'
stages:
- stage: Build
jobs:
- job:
pool:
vmImage: 'vs2017-win2016'
continueOnError: false
steps:
- task: DotNetCoreCLI#2
displayName: 'Restore'
inputs:
command: 'restore'
projects: '$(Parameters.RestoreBuildProjects)'
feedsToUse: 'select'
vstsFeed: '/0856b234-f3a6-4052-b5a6-ed9f6ec9c635'
- task: DotNetCoreCLI#2
displayName: Build
inputs:
projects: '$(Parameters.RestoreBuildProjects)'
arguments: '--configuration $(BuildConfiguration)'
- task: DotNetCoreCLI#2
displayName: 'Publish Build'
inputs:
command: publish
arguments: '--configuration $(BuildConfiguration)'
projects: '$(Parameters.RestoreBuildProjects)'
publishWebProjects: false
modifyOutputPath: true
zipAfterPublish: false
- task: ArchiveFiles#2
displayName: "Archive Files"
inputs:
rootFolderOrFile: "$(System.DefaultWorkingDirectory)"
includeRootFolder: false
archiveFile: "$(System.DefaultWorkingDirectory)/build$(Build.BuildId).zip"
- task: PublishBuildArtifacts#1
inputs:
PathtoPublish: '$(System.DefaultWorkingDirectory)/build$(Build.BuildId).zip'
ArtifactName: 'drop'
- stage: Deploy
jobs:
# track deployments on the environment
- deployment:
pool:
vmImage: 'vs2017-win2016'
# creates an environment if it doesn’t exist
environment: 'dev'
strategy:
# default deployment strategy
runOnce:
deploy:
steps:
- task: DownloadBuildArtifacts#0
displayName: 'Download Artifacts'
inputs:
buildType: 'current'
downloadType: 'specific'
downloadPath: '$(System.ArtifactsDirectory)'
- task: AzureFunctionApp#1
displayName: 'Azure Function App Deploy: ngproductionfetcherfuncref'
inputs:
azureSubscription: 'Agder Energi Sandbox (1aa9cf92-9d42-49a6-8d31-876ac2dff562)'
appType: functionApp
appName: myFunctionApp
package: '$(System.ArtifactsDirectory)/**/*.zip'
appSettings: '-name0 value0 -name1 value1'
The pipeline is all green:
Got service connection details for Azure App Service:'myFunctionApp'
Updating App Service Application settings. Data: {"WEBSITE_RUN_FROM_PACKAGE":"1"} {"WEBSITE_RUN_FROM_ZIP":{"value":""}}
Updated App Service Application settings and Kudu Application settings.
Package deployment using ZIP Deploy initiated.
Successfully deployed web package to App Service.
Updating App Service Application settings. Data: {"name0":"value0","name1":"value1"} undefined
Updated App Service Application settings and Kudu Application settings.

Resources