Azure DevOps how YAML build path should be defined - azure-devops

I have defined mysoft-ci.yml file in the repo and committed it in. Now I am trying to create a build pipeline with that file but it looks that I cannot get any path working with that.
I have tried with same path I use in the build configuration or the path that is in git but none of those work. Am I missing something?

the problem went away on its own. but in general you need to make sure the file exists in the branch you are targeting and supply the path to the file relative to the repo root.

Related

Azure devops build pipeline

I have created a sample Website project with a single page having HellowWord.aspx and HellowWord.aspx.cs. I am trying to create an Azure DevOps build pipeline for this project. The following are the tasks I have added to my build package.
But the publish artifacts always contains the aspx and aspx.cs file. Not sure which tasks I am supposed to add to make the proper publish package. Which will create proper dlls for .aspx file instead of aspx.cs.
Publish build artifacts task has an argument Path to publish, which defines 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). By default, this argument uses variable $(Build.ArtifactStagingDirectory).
So you need to check your Copy files task, to see what you have copied to $(Build.ArtifactStagingDirectory), and copy the correct files in this task.
https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/copy-files?view=azure-devops&tabs=yaml

What does "Package or folder" refer to in the File transform task in a release pipeline?

I'm completely new to Azure DevOps Pipelines so if I'm doing something incorrectly I'd appreciate a nod in the right direction... I setup a build pipeline and that seems to be working, now I'm trying to setup a release pipeline in order to run tests, it's mostly based on Microsoft's documentation:
https://learn.microsoft.com/en-us/azure/devops/test/run-automated-tests-from-test-hub?view=azure-devops
Before running tests I need to transform a config file to replace some variables like access keys, usernames, etc. What I setup is what I have below but for the life of me I can't figure out what text box Package or folder refers to. The documentation is super helpful as you can imagine:
File path to the package or a folder
but what package or what folder is this referring to??? I've tried several different things but everything errors with
##[error]Error: Nopackagefoundwithspecifiedpattern D:\a\r1\a\**\*.zip
or pretty much whatever I specify for a value.
The File Transform task supports the .zip files.
Test with the default File Transform task settings, I could reproduce this issue.
In Release pipeline, the file path could has one more node for the build artifacts .zip file.
The format example:
$(System.DefaultWorkingDirectory)\{Source alias name}\{Artifacts name}\*.zip
So you could try to set the $(System.DefaultWorkingDirectory)/**/**/*.zip in Package Or folder field
For example:
On the other hand, you can check the specific path in the Release log -> Download Artifacts Step.
$(System.DefaultWorkingDirectory): D:\a\r1\a
You could aslo use this specific path in the task.
Update:
If your file is Project Folder, you refer to the following sample:
File structure:
Task Settings:
Note:You only need to assign to the folder node.
You could also select the folder path via ... option.

How does Nuget Restore task work? Does nuget.config in the solution have to match that of in the build server?

I am new to Nuget and have added a Nuget restore step to install dependencies on the build server. When I looked up the Nuget restore, we need the Nuget.config file under the solution folder as well as in the local build machine where the build will be running. %Appdata%/Nuget/Nuget.config
My question is do the two nuget.config files need to match? Does the nuget.config file in the source repository replace the nuget.config in the build server during the build?
Do the two nuget.config files need to match?
For this question, the answer is No, they do not need be matched. As the doc defined:
While you enable this checkbox and execute this restore task, the server will just get the config file which has been under the repository source control. The config file which exists in your local build agent will not has any affect about this file. So, they don't need be matched.
Does the nuget.config file in the source repository replace the
nuget.config in the build server during the build?
Yes, if the local config file has the same argument configuration with the one in repos, while the build running, the local one will be override by the file which in repos because of proximity principle.
For example, if you configured some about feed in the config file which in repos, but the local file does not. While the build running, the local file need use this value since the build server will take the local file.
So, for this question, the nuget.config file in the repository will override the nuget.config in the build server during the build. And also, the precondition about this is these two config file has the same argument configuration.

How to copy a VSTS artifact to a Azure Storage account container folder?

I have a VSTS release pipeline in which I need to copy the build artifact to a storage account blob container.
This is pretty easy with the Azure File Copy task, but the difficulty seems in the need to specify a folder in the container to copy the file to.
I tried extending the container name, but that (obviously) doesn't work. Rewriting the destination in the "additional arguments" section neither. Looking at the source of the task I cannot find anything in that direction, so I'm wondering whether it is even possible.
Any idea on how to do this using the build task?
Or do I need to use Powershell for this?
You can put the folder (e.g. A) in another folder (R), then specify R folder path in Source box of Azure File Copy task, then the folder A will be in container.

TeamCity, how to get names of the files edited

I am using TeamCity and I am new to it. I have added a Build Configuration to the TeamCity and I created one VCS root to attach to it.
However, my project have a special requirement to detect a particular file that was changed in the VCS root location and use that file in build step. I am sure this could be done in TeamCity, I am not able to figure out how.
Any help? Thanks,
To get the names of the files changed this is what I did. Thanks to Sam Jones.
I used System.TeamCity.build.changedFiles.file variable as follows.
Add a command line build step
Select Run as Custom Script
Add the script copy "%system.teamcity.build.changedFiles.file%" changelog.txt in script box.
You will get the changes in changelog.txt file in the format specified on this link.
NOTE: teamcity.build.changedFiles.file does not work. You need to use system.teamcity.build.changedFiles.file
It sounds like you want a VCS Trigger that specifies VCS Trigger Rules, so that a build configuration will run when someone makes a change to a particular file. The documentation has some nice examples of how to do this. If you're trying to trigger a build on one particular file, try this:
+:foo/bar.txt
This excludes all files from the trigger rule and then includes bar.txt in the foo directory. Paths are relative to the root of the repository (do not include a preceding slash). If someone modifies foo/bar.txt, the build configuration will be triggered to run.
VCS Trigger Rules also support pattern matching and all sorts of other options. Check out the documentation.