I am working on a maven project, on building the project an ear file is generated in the target folder.
I want to setup a build pipeline where on running the pipeline, I want to publish the entire target folder. But only partial target folder is getting published without the ear file. How to publish the ear file inside target folder
How to do it?
Azure Pipeline command I am using:
- task: PublishBuildArtifacts#1
displayName: 'Publish Artifact: drop'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)'
condition: succeededOrFailed()
Related
On my pipeline I use node to install and build a NextJS app, then I proceed to create a .zip with ArchiveFiles task in order to later use it on release on a web app service.
The only problem is that ArchiveFiles is ignoring build folders such as .next and .bin which I need to serve the site on production.
This is part of the pipeline, as output of the process I receive a zip that is a copy of the folder I want, excluding build folders which I need like .next or node_modules/.bin.
I need said folders to run my app properly on the app service.
- task: Npm#1
inputs:
command: 'install'
workingDir: '$(Build.SourcesDirectory)/roam-web-app-ssr'
verbose: true
- task: Npm#1
inputs:
command: 'custom'
workingDir: '$(Build.SourcesDirectory)/roam-web-app-ssr'
customCommand: 'run build'
verbose: true
- task: ArchiveFiles#2
inputs:
rootFolder: '$(Build.SourcesDirectory)/roam-web-app-ssr'
includeRootFolder: false
archiveType: 'default'
archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
replaceExistingArchive: false
- task: PublishBuildArtifacts#1
inputs:
PathtoPublish: "$(Build.ArtifactStagingDirectory)"
ArtifactName: "drop"
publishLocation: "Container"
As I mentioned I tried making a zip with ArchiveFiles#2 task, and expected to zip all the folders on the rootFolder, but it actually ignores the needed build folders.
As a minor test to check if the problem were the install and build steps I used the copy files task to copy all of the files on a folder in the artifact directory, and confirmed the existence of .next and .bin folders.
Is there another means to create the .zip without ignoring said folders ?
Forgot linux hidden files dont show up, apparently the bug is not because of this.
I want to publish a java jar file to azure devops artifacts section in azure devops. Once it is there, I want to be able to setup my gradle so it can download jars from that location. I think I understand how to do the second step, but how to do the first step is not clear to me. I can use an azure pipelines task to build the jar and publish the artifact. However the published artifact does not end up in the location I want. It ends up in an artifacts section of the pipeline run, it does not end up in the artifacts section of ADO. Here is the code:
steps:
- checkout: self
path: 'my-repo/'
- task: Gradle#2
displayName: Test and build jar
inputs:
gradleWrapperFile: 'gradlew'
tasks: 'build'
publishJUnitResults: false
javaHomeOption: 'JDKVersion'
- task: PublishBuildArtifacts#1
inputs:
pathToPublish: '$(System.DefaultWorkingDirectory)/build/libs/commons.jar'
You can see in this image. The green arrow points to where the artifact ends up after successful execution of the above code. However when I click on the artifacts section indicated by the blue arrow it is not there. How do I get it to publish over there so it can be consumed by my build process on my local machine? Thanks in advance.
PublishBuildArtifacts#1 publishes 'Build artifacts' which are later available to be downloaded by DownloadBuildArtifacts#0 in later pipeline stages or in another pipelines. (And it will be only accessible where your green arrow points)
'Build artifact' is not the same thing as 'Artifacts Feed'
'Artifacts Feed' serves as source of packages which can be downloaded for example by NuGet if you configure in nuget.exe as a source your 'Artifacts Feed'
For example you can add NuGet package there using NuGet push(with firstly configured Source)
https://learn.microsoft.com/en-us/azure/devops/artifacts/get-started-nuget?view=azure-devops&tabs=windows#publish-a-nuget-package-by-using-the-command-line
To publish Universal Packages there is already task UniversalPackages#0
https://learn.microsoft.com/en-us/azure/devops/pipelines/artifacts/universal-packages?toc=%2Fazure%2Fdevops%2Fartifacts%2Ftoc.json&bc=%2Fazure%2Fdevops%2Fartifacts%2Fbreadcrumb%2Ftoc.json&view=azure-devops&tabs=yaml
I have a publish task in Azure Devops pipeline which should publish an excel file with extension .xlsx .
am using this below command but its not working. can someone help me with the wildcards?
this excel file is dynamic and date,month parameters keeps on changing.
format: SonarQube Issue Extract_2020-08-04.xlsx
task: PublishBuildArtifacts#1
inputs:
PathtoPublish: 'C:\Users\320066547\agent\_work\3\s\SonarFetchIssues\target\*.xlsx'
ArtifactName: 'IssuesOutput'
publishLocation: 'Container'
If using a YAML pipeline look at using the PublishPipelineArtifact task
- task: PublishPipelineArtifact#1
displayName: 'Publish Artifact: drop'
inputs:
artifact: drop
targetPath: $(Build.ArtifactStagingDirectory)
This will publish all the artifacts in the pipeline. From there can narrow down the exact path that is being published.
Alternatively too can do run a Powershell task before your publish to see exactly what your folder structure looks like on the agent:
-powershell: Get-ChildItem -Path 'Insert root path' -recurse
This is clearly stated in the task:
Path to publish: The folder or file path to publish. This can be a
fully-qualified path or a path relative to the root of the repository.
Wildcards are not supported. Variables are supported. Example: $(Build.ArtifactStagingDirectory)
I have a successful running build in Azure Pipelines that uses Wix Toolset to create an installer .msi file. I'm using the msbuild task to produce installer file.
As you may already know the build agent places it buried in work folder as shown below:
C:\agent\_work\2\s\SetupProject1\bin\Release\SetupProject.msi
What is the next step to move this setup file to a target server (Dev, QA, or Prod servers)?
What is the next step to move this setup file to a target server (Dev, QA, or Prod servers)?
You need to add a Publish artifacts task (e.g. Publish build artifacts
and Publish Pipeline Artifacts) after the msbuild step.
For example:
- task: MSBuild#1
.....
- task: PublishBuildArtifacts#1
displayName: 'Publish Artifact'
inputs:
PathtoPublish: 'setup file Path'
ArtifactName: 'artifact name'
condition: succeededOrFailed()
The publish artifacts task could publish the build files as artifacts. Then you could use the artifacts in Release Pipeline.
I have implemented a C# function in the Azure Portal.
I downloaded the content of the Function App as a Visual Studio project.
I now want to deploy it with Azure DevOps release pipeline.
The deployment works fine but my function is not deployed. Sounds like the .csx file is not taken into account.
I tried to change the Build Action of the csx file to C# Compiler but it failed during the compilation with missing dependencies. Not sure it is the right way to proceed.
What are the steps to deploy the Azure functions?
It seems a little bit overkill to deploy csx functions with AzureDevOps. We could simply zip those files in the same folder structure as they were downloaded, go to https://<functionappname>.scm.azurewebsites.net/ZipDeployUI and drag the zip file to deploy. If you prefer command line instead of manual deployment, check Azure CLI command.
If you have to work with AzureDevOps, have a look at Build pipeline YAML below(Release pipeline is the default template Deploy a function app to Azure Functions).
resources:
- repo: self
queue:
name: Hosted VS2017
steps:
- task: ArchiveFiles#2
displayName: 'Archive $(system.defaultworkingdirectory)'
inputs:
rootFolderOrFile: '$(system.defaultworkingdirectory)'
includeRootFolder: false
- task: PublishBuildArtifacts#1
displayName: 'Publish Artifact: drop'
Note that the <functionName>.csproj file downloaded is useless and shouldn't be commited to repo. But if we have installed some extensions and see extensions.csproj file, add Net Core build task before ArchiveFiles#2.
- task: DotNetCoreCLI#2
displayName: Build
inputs:
projects: '$(Parameters.RestoreBuildProjects)'
arguments: '--configuration release -o bin --no-incremental'