Appveyor uploading web deploy artifact - appveyor

I'm having some troubles setting up appveyor. I'd like to publish the generated web deploy packages to the Appveyor artifact feed. I've selected to build web deploy packages in appveyor.yml:
build:
project: Apps/MyProject.sln
publish_wap: true
I can see from the logs that the 2 webdeploy packages get produced:
[00:00:24] Package "Backend.zip" is successfully created as single file at the following location:
[00:00:24] file:///C:/Users/appveyor/AppData/Local/Temp/1/cul57h0ak9
I can push these packages to github releases by simply referring to them by filename:
deploy:
- provider: GitHub
tag: v$(appveyor_build_version)
auth_token:
secure: stuff
artifact: api.zip, backend.zip
force_update: false
on:
DEPLOY: true
However, I'm unable to publish these packages to Appveyor artifact feed, because unlike "deployments", it seems that I'm required to know the exact path of the artifact(s). Appveyour seems to use a temp folder when it generates these, so it's pretty hopeless to know the path. I cold traverse the build agent's user's temp file directory looking for them, but that seems a bit hacky to me.
So, my question is: How do I reliably tell appveyor to send my generated zips to the artifact feed?
(Note that I know that I can configure a "publish target" in visual studio and use that instead, but as far as I can understand the whole idea behind the "publish_wap" option is to not have to do that for every project. I'm trying to achieve a clear separation of code so that no build-specific config has to be included inside my msbuild projects).

Turns out Appveoyr auto-posts any artifacts, and now I feel stupid.

Related

Azure pipeline yml: publish or file copy?

At the end of my pipeline I want to copy the bin directly to a network share from which it can be used to deploy.
I see there are two possible task typed that could do this:
copy files that makes a task: CopyPublishBuildArtifacts#1; or
_ copy and publish build artefacts_ that makes a CopyPublishBuildArtifacts#1.
And this publish is different to dotnet publish?
Which one should I pick and why?
They appear to have identical parameters.
What is the # for?
Azure pipeline yml: publish or file copy?
The task CopyPublishBuildArtifacts is deprecated. If you're using Team Foundation Server 2017 or newer, we recommend that you use Pipeline Artifacts.
And if you want to know the different between publishbuildartifacts vs publishpipelineartifact, you could check below thread for the details:
What is the difference between Build Artifact and Pipeline Artifact tasks?
And this publish is different to dotnet publish?
The answer is yes. The dotnet publish task is to serve the specific project. Its function is similar to that we choose the Publish option for net core project in Visual Studio.
But we could specify the folder or files to publish for the publishbuildartifacts or publishpipelineartifact task.
Which one should I pick and why?
We recommend to use the publishpipelineartifact task if you just want to copy the bin directly to a network share.
You could check the reason from here:
For build artifacts, it's common to copy files to $(Build.ArtifactStagingDirectory) and then use the Publish Build Artifacts task to publish this folder. With the Publish Pipeline Artifact task, you can just publish directly from the path containing the files.
By default, the Download Pipeline Artifact task downloads files to $(Pipeline.Workspace). This is the default and recommended path for all types of artifacts.
File matching patterns for the Download Build Artifacts task are expected to start with (or match) the artifact name, regardless if a specific artifact was specified or not. In the Download Pipeline Artifact task, patterns should not include the artifact name when an artifact name has already been specified. For more information, see single artifact selection.
What is the # for?
The role of # is to specify the version of the task. For example, #1 is to use the version 1.0 of the task.

Set working directory of a project in mono repo in Azure Devops

My project is using microservices and in one repos we have multiple applications in Azure DevOps.
For Example, we have Repos named Microservice, where we have .NetProject, AngularUI Project, and Java Project code.The structure looks like this:
While setting up the CI pipeline, I have included the path like the below:
variables:
- name: working-dir
value: 'MicroserviceProject/AngularUI/ClientApp/'
trigger:
branches:
include:
- master
paths:
include:
- 'MicroserviceProject/AngularUI/ClientApp/*'
I don't see the code of AngularUI project being checkout properly and encountering the error, that they cannot locate the package.json file.
How can I set the working directory for different projects in a repo?
Update:
I am able to locate the file but the build isnot giving me any output files.
How I fixed this issue:
Initially I was not sure if the working directory was set properly.Even if it was , I was not sure whether the package.json file was read properly. To check that, I added the below script to the Azure CI pipeline, for example:
inputs:
targetType: 'inline'
script: dir
$(Build.ArtifactStagingDirectory)
displayName: 'Check'
This showed me that after building , the artifacts are not stored anywhere. hence I had to explicitly mention the outputpath. For that I ran the below command for build:
run-script build -- --output-path=$(Build.ArtifactStagingDirectory
This fixed the issue I was facing.

Azure Devops - Build Automation

I have a Azure DevOps Git Repo with many solutions in it, and are starting down the path of build, test, deploy automation.
I figured out how to run a rebuild if any file changes in the repo.
However, since the repo has many solutions in it, I only want to run a given rebuild of a solution if a specific subfolder changes.
Is that possible, and if so, how do I accomplish this?
you can use path based trigger filters (i'm fairly certain they are only supported in yaml builds). example:
trigger:
paths:
include:
- folder1/*
- folder2/somefile
- etc
Reading:
https://learn.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema
https://learn.microsoft.com/en-us/azure/devops/pipelines/create-first-pipeline?view=azure-devops&tabs=tfs-2018-2

Why are there no files in my release artifacts directory?

I created a .netcore 2.1 api project and set up Azure DevOps to deploy it to an On-Prem computer using the Windows Agent.
The folder agent_work\r1\a was created on the machine running the agent, however there are no files in it.
I can see that a build did occur and that there is an artifact in my release
What did I miss doing?
[Update]
I can see in the agent job, there is a section which is about downloading an artifact.
It has the error message
There is no build available or the source is not accessible. You can select all artifacts or specify the list of artifacts to be downloaded below.
[Update]
Looks like I need to add a task to the job that is in a stage of my release.
And that task needs to copy the files I want to deploy.
Now the problem is knowing how to specify the source folder.
The strange thing is that it allows me to select a location and then rejects the selected location
There is help that says that if I leave the source folder empty, that will indicate the root of the repo. If I do this the deploy does not error but no files are deployed.
[Update]
I can see in the Get Sources of the Build the message "YOu are in 'detached Head' state. Maybe this has something to do with the problem.
[Update]
In the build pipeline I have
[Update]
When I try to create a new build pipeline I get the following
I select the location to be Azure Repos and the Repository to be vste
then I the azure-pipelines.yml auto-generates as
# ASP.NET Core
# Build and test ASP.NET Core web applications targeting .NET Core.
# Add steps that run tests, create a NuGet package, deploy, and more:
# https://learn.microsoft.com/vsts/pipelines/languages/dotnet-core
pool:
vmImage: 'Ubuntu 16.04'
variables:
buildConfiguration: 'Release'
steps:
- script: dotnet build --configuration $(buildConfiguration)
displayName: 'dotnet build $(buildConfiguration)'
[Update]
Looks like I might need to select Use The Visual Designer
[Update]
From ollifant's comment I have found the Publish Artifact task.
Now to figure out how to populate it
[Update]
Uh Uh not looking great
I had not used the ASP NET Core (.NET framework) template when creating the agent job in the build template, so the project was not building correctly.
New build pipeline -> Use the visual designer -> Continue -> ASP.NET Core (.Net Framework)

CI_VSTS publish different web Artifact for each project in single solution

I have a CI pipeline(VSTS) in which I am able to build whole solution which has two website projects in it in a single artifact. What I want to do it build whole solution and then create publish artifact for each project.
e.g.
One artifact for Project_website1
One artifact for Project_website2
thanks. I tried similar topic in StackOverflow but didnt work for me
You can use two publish artifacts tasks and may be copy files multiple tasks to achieve any number of artifact in VSTS build. For example, say you have your current artifacts for a single project, comprising of _PublishedWebsites\MVS5WebApp (XCopy deployable website) and _PublishedWebsites\MVS5WebApp_Package (web deploy package).
If you want to separate these two, into two artifacts, you can use two Publish Artifact tasks as shown below, each one specifying exact path to publish (this path does not support wildcards, you just have to specify the folder you need to publish).
Result would be two artifacts
You can get more idea from the post here.
Also this post might be useful for you to understand more possibilities.
To publish the two websites projects’ artifacts separately, you just need to use two VS build tasks and two Publish Build Artifacts tasks to build and publish the two websites separately.
Such as the first VS build task and Publish Build Artifacts task are for website1, and the second VS build task and Publish Build Artifacts task are for website2. The detail configurations for each task as below:
VS build task for website1 (store the package for website1 in $(build.artifactstagingdirectory)\web1):
Publish Build Artifacts for website1 (publish website1’s artifacts from $(build.artifactstagingdirectory)\web1 to artifact web1):
VS build for website2 (store the package for website2 in $(build.artifactstagingdirectory)\web2):
Publish Build Artifacts for website2 (publish website2’s artifacts from $(build.artifactstagingdirectory)\web2 to web2):
Then you can get build artifacts for the two projects separately:
This is what I have done
As I am using my own agent
So the web projects are published in agent’s each project published directory.
That is directory a.
Solution:
All i did was after builidng the whole solution once vsts put all website in publish directory a.
I wrote powershell script to get each file for project and put it under subdirectory in published folder a.
E.g
Publish folder a will look like this after building solution
Website1.......xml
Website1.......zip
.
.
.
Website2........xml
Website2........zip
.
.
.
Etc
When solution is build the files will be in above folder togeter.
In order to build artifact for each project i wrote powershell script to put each project file in sub directory
E.g
a\website1
Website1.......xml
Website1.......zip
a\website2
Website2.......xml
Website2.......zip
Etc and so on
After that select each publish artifact for each directory and you can have artifact for each project.
Thanks