Prevent added artifact to Release on Gated build - tfs

In order to save on the maintenance of build definition I create one build for Gated & Publish.
I also create a release that triger when my build run as deploy (As described in the link)
When build run as deploy (not Gated) there are another tasks that run during the build:
Publish Build Artifacts - upload artifacts
Update Build Name - change the build name to "Auditing [Version]" format
Add build tag - Use to triger release
When I am try to create release manuly I get list of artifacts, some of the artifact are resualt of gated build.
In the image bellow I market the gated build.
I'm interested in keeping a clean list, is there a way to prevent from tfs to add gated build to my articact list
I am working with TFS 2018.2 On-Prem.
Thanks In advance for all.

Related

Deploy promoted builds in Jenkins

I have two Jenkins tasks, one that builds and promotes the successful build, and another task that deploys those promoted builds. I'm using two plugins to accomplish this task, Copy Artifact Plugin and promoted builds.
The job that I have to build the code is a very standard one, I go to the git repository every minute to check for any changes, and if there are any changes I just Invoque Gradle Script on the Build step and select Use Gradle Wrapper box and everything builds without a problem. The only custom part of this build task is that I'm using promoted builds plugin, which works great and have a very standard configuration as well.
Build Configuration
I'm happy with my Build task, but I have a problem with my Deploy task. In my deploy task I want to select which promoted build I want to deploy, but I can't deploy the selected promoted build.
In my Deploy task I tick the This project is parameterised box and I selected the Promoted Build Parameter.
Promoted Build Parameter Configuration
The configuration looks ok, when I run the Deploy task I can select which build I want to deploy.
Select build to be deployed
The problem that I have is when I select Copy artifacts from another project. In Which build I select Specified by a build parameter and for the Parameter Name I selected the same name I gave to the Promoted Build Parameter
Copy artifacts from another project Configuration
But when I run this Deploy task I get this error: ERROR: Unable to find a build for artifact copy from: Aurora.
BUT if I change the Which build part to Copy from WORKSPACE of latest completed build everything works fine.
Working Configuration
What am I doing wrong in this configuration?
I was able to solve this problem, I don't think it was the cleanest way of doing it but at the end it worked. In the Build task I left everything as it was, I only added a Post-Build Action to Archive the artifacts.
Post Build Action
In the Deploy task I needed to change a bit more stuff. In my Deploy task I tick the This project is parameterised box and I selected the Promoted Build Parameter, the configuration for this step is a very standard one, I just selected the Build project and the rest is automatic. This step enables me to select which promoted build I want to deploy, but this is where the big problem resides. The value that this "step" returns is something like this https://site.name.com/job/ProjectName/137/.
The problem that this create is in Copy artifacts from another project. I need a build number, but I only have that URL, so the solution that I found was to get the build number from that URL, inject that number as a local variable and use that local variable in the next steps.
Build steps
With this solution I'm able to deploy only the promoted build.

Continuous Integration build over TFS2017

I would like to know what is the equivalent of "Continuous Integration - build each check-in" (XAML definition) in VNext definitions.
1- Is it "Run continuous integration triggers for commited changes" in Gated trigger?
2-Or it is a "Continuous Integration trigger with batch changes checked" in build definition.
I ask this question because I was not able to launch a CI build after successfully Gated Check-in. My CI build does different steps than Gated.
I'm over TFS 2017 (15.117.27414.0).
The equivalent of "Continuous Integration - build each check-in" (XAML definition) in VNext definitions is Continuous Integration trigger:
Enable CI trigger if you want the build to run whenever someone checks
in code.
Select Batch changes check box if you have a lot of team members
uploading changes often and you want to reduce the number of builds
you are running. If you select this option, when a build is running,
the system waits until the build is completed and then queues another
build of all changes that have not yet been built.
Select the version control paths you want to include and exclude. In
most cases, you should make sure that these filters are consistent
with your TFVC mappings on the Repository tab.
You can get more details in the link below:
https://learn.microsoft.com/en-us/vsts/build-release/concepts/definitions/build/triggers?view=vsts

Prevent Release Trigger on Gated Check-in build

How to stop the release trigger on Gated check-in build which doesn;t produce any artifact?
I have a build definition with Gated check-in enabled. In Publish and Publish Artifact Steps I have set the condition as following:
ne(variables['Build.Reason'],'CheckInShelveset')
which means - if the build was triggered by Gated check-in, do not run this step.
I do not see any files in drop folder of this build run but the release is being triggered as soon the gated build completes running.
I've added images for reference purposes.
Image 1 shows the configuration of build definition.
Image 2 shows the "publish" steps are not running as it's a gated build.
Image 3 shows the release being triggered from the same build even when there is nothing in drop (output) folder!
This is very surprising to me. Any help?
Thanks!
There is an option on the first environment where you can set an Artifact filter, enter Include TriggerRelease:
By tagging your build (in case it's not a gated check-in), you can prevent the release from triggering. You can run a small magic log command to set the tag in the build:
Write-Host "##vso[build.addbuildtag]TriggerRelease"
Or you can use a build task from the following extension to have a build tag itself:

TFS 2015.2 - (Jenkins) Linked artifact sources do not support triggers

After successfully linking a Jenkins build artifact source to Release Management vNext in TFS 2015 Update 2 RTM (adding a Jenkins endpoint, linking to the source through Artifacts tab, finding build artifacts through TFS that were published in Jenkins and verifying by selecting the Jenkins artifacts in the Copy release task), it looks like in the Triggers tab, when trying to select Continuous Deployment, a warning symbol appears and the message says:
Linked artifact sources do not support triggers.
Any idea if it is possible to link a Jenkins build artifact source to trigger releases in TFS 2015.2 in Continuous Deployment? Looks like it only works for TFS builds. I see this link that says "other sources" for builds by using the REST API for RM but when clicking on the link, the section says in the body, "Content not available."
I could reproduce your scenario if choose Jenkins type in Artifacts. But if choose Build type, this warning won't show up.
Continuous Deployment doesn't support Jenkins Artifacts, you can submit a UserVoice at website: https://visualstudio.uservoice.com/forums/121579-visual-studio-2015

Promote only a selected artifact file

We have a build project which always generates three files (artifacts). When promoted, these files will be used for a setup package. With the promoted builds plugin, it's only possible to promote all artifacts of a build. Is there a way to only promote selected files of a build? Currently I can only think of splitting up the build process into separate projects - but then we've the problem with different workspaces.
Thanks a lot.
The Promoted Builds plugin by itself does not "promote" the artifacts. It promotes a build run.
Part of the promotion process may be a Copy Artifacts step, and that is the step that takes the artifacts from promoted build run and does ... whatever you have configured for the promotion.
In the Copy Artifacts step, you can definitely specify a pattern for the files to copy.

Resources