VSTS Publish Artifacts error when executing 2 times - build

I have a build set up in VSTS and at the end I want to Publish my Artifacts to VSTS for releasemanagement and I want to Publish my Artifacts to a file share for other purposes. So I have 2 Publish Artifacts tasks.
To VSTS
To FileShare
I get this error
It doesn't matter in which order I put the tasks. When I put file share first then to VSTS will fail and when I put VSTS first the publish to file share fails.
When I do a commit and a build is started automatically it sometimes works. When I manually start a second build I get the error.
Here is the complete build log: Build log

It's telling you the error: Artifact 0.1.0-unstable.18 already exists.
You can't publish two artifacts with the same name. You will have to uniquely identify each artifact.

Related

Is there a Jenkins pipeline equivalent of "Only show latest build status"?

We're in the process of migrating to Jenkins pipeline. We use Jenkins to update the build status of our branches/PRs in Bitbucket.
One of our merge checks in Bitbucket is "Check the last commit for at least 1 successful build and no failed builds". This means that we can't merge unless there is 1 successful build of the latest commit on Jenkins, and no failed builds of the latest commit.
Sometimes, Jenkins builds fail for reasons unrelated to the code and the build is fine next time you run it. However, this means that the branch can't be merged as there has been at least one failed build.
To get around this, we were previously able to tick the box in the build status notifier plugin configuration that said "Only show latest build status". As of yet, we're unable to find any equivalent way to configure this in a Jenkinsfile. Does anyone know if it's possible, and if so how?
This question is a duplicate of Multi branch pipeline with bitbucket build status notifier plugin in jenkins, but that question was never really answered.
It seems that your use case it's covered by the Build REST API of Bitbucket, and there is even a step-by-step example of your exact case, being last build failed for external reasons, and a new build succeeds
In order to overwrite the status of an already reported build, you will need to use the same commit sha and the same key
Regarding the Bitbucket Build Status Notifier, it allows you to specify a buildKey as an optional parameter. You should make sure to specify this parameter, and that the parameter is always the same for all builds of the same job.
That way, a new build of the same last-commit will overwrite the last one, as it will be using the same sha and the same key.
See the API section of the plugin documentation for additional parameters.

How to use the last branch build status in pull requests at Azure DevOps?

I created a new build pipeline for my latest project at Azure DevOps Server 2019. I use the provided Git repository with branch policies to protect master and develop from changes without pull request.
Each pull request requires a successful build.Unfortunately, Azure DevOps Server always creates a new build for each pull request (highlighted red in the image below).
I don’t need that build. The last build status of the assigned branch is enough.Is there any way to disable the pull request build and use the last branch status instead?
No, the new build is required, because it should verify whether the build works fine after migrating the code from source branch to target branch (master/develop).
Regarding the build for assigned branch, it just verifies the current branch instead of the migrated code. (maybe there are some bugs/issues after migrating code)

Teamcity chain multiple build promotions

Im trying to figure out how to chain multiple 'promotions' (by a user clicking) whilst ensuring that ever build in the chain is not queued. By current setup is as follows, NOTE as my application is a white label the configuration described below is repeated for every site.
Build & Test - Creates zipped artifact
Deploy to Testing - Has artifact and snapshot dependency
Deploy to Staging - Has artifact and snapshot dependency
Deploy to Production Has artifact dependency
When promoting to production i want to do this across all websites (without having to manually click promote on each build).
I am currently trying the following strategy, to set the 'deploy to production' build to have a Artifact dependency, without a snapshot dependency so it doesn't queue down the chain. I have set the artifact to depend on the 'Build & Test' configuration to gain access to the zipped project and i have set it to build with a specific build number referencing a parameter in the production build.
After doing some googleing i found out that i am able to get the stagings build number using the rest api as follows:
http://teamcity_url/httpAuth/app/rest/builds/buildType:build_configuration_id/resulting-properties/build.number
And this works great, however i don't understand how i can get this value into the parameter?
Also i dont know if my approach is correct? is there a better way?
Set up the artifact dependencies chronologically (Build -> Test -> Staging -> Production) and all your snapshot dependencies to Build & Test. Depending on exact needs you might have a snapshot dependency on both Build and the one your artifact dependency is on.
Also make sure you enable "Do not run new build if there is a suitable one. This should keep it from queuing down the chain without intention.
Using the build chain tab will be important because the main project page only shows the last build ran. So clicking run from there will que the chain because you are asking for a new build, even though to you it might feel like your asking for the next step to be ran. The build chain tab helps keep things clear.

VSTS online storage access after performing a build

I use VSTS to build a project once changes are checked in from a git repository. That build gets stored in vsts storage. Now is there any way to easily access any retained build and copy it out for some other purpose? that is, say i've done 5 build versions.. all retained in the history of vsts. I need a copy of the 2nd build for something. Can i get to that build folder and copy it?
currently in one of the build steps it gets copied to an area called
$(Build.ArtifactStagingDirectory)\xxxxx.zip
how can i get a copy of that? trying to avoid having to remote into the build agent and dig up the files.
Use the Publish Build Artifacts task. That will upload it as a linked artifact to the build, which you can then download either via clicking on the "Download" link or via the VSTS REST API.

How do I setup TFS build definition when my localPC, source, build agent, and deployment are all on seperate servers

I'm trying to set up a build definition in TFS 2010. The options for this seem very limited, for instance I have 5 solution files in my source control and I don't seem to be able to specifiy which one to use. I've selected a workspace from my deployment server (which does a TF get every 10 minutes so I know it's a valid workspace), but when the build runs it gives me an error complaining about the mapping - and it seems to have made it's own mapping up from somewhere.
Mapping I set: $/InteractV4/Dev/IV4ProductionSR/
Error: There is no working folder mapping for $/InteractV4/Dev/IV4Support/iv4ProductionSR.sln.
There are 2 issues with this error. 1: it's not the workspace I was trying to use. 2: It's wrong and there is a working folder mapping for this source, both on my local PC and on the deployment pc, but NOT on the build server. Do I need to set up a load of folders and mappings on the build agent server? Or on the main TFS (source) server?
Thanks.
TFS-Builds operate on private Workspaces that get generated during the build process, so using a custom-Workspace is without tweaking impossible.It's possible to keep TFS from regenerating a new Workspace with each Buid, by going to Build Definition edit "Process":"2.Basic":"Clean Workspace" and changing default value All into either Outputs or None.The mappings are set for each Build Defition where various pairs exist:
Source Control Folder | Build Agent Folder
$/foo/bar | $(SourceDir)\somewhere
The $(SourceDir) is substituted during Build and it gets its value from the Build Agent Settings. If you go to the TFS Admin Console & select "Build Configuration", you 'll be presented with a list of Build Agents running on the Server (there might be additional Agents in other Servers). Clicking on "Properties" of an Agent, pops up a Window like that: This entry "Working directory" is the one that resolves & substitutes $(SourceDir) during build.For example, an entry $(SystemDrive)\Builds\$(BuildAgentId) could resolve into something like C:\Builds\88.So, for a TFS Build running on this Agent, you should expect all Sources that stand in source control under $/foo/bar to be found under C:\Builds\88\somewhere
EDITAccording to your comments you have now a mapping like this:
$\InteractV4\Dev\IV4ProductionSR | $(SourceDir)
Your build fails, as "There is no working folder mapping for $/InteractV4/Dev/IV4Support/iv4ProductionSR.sln".
Is this source control directory $/InteractV4/Dev/IV4Support mapped in your Build Definition?