Enable prompt for user input during Azure release pipeline - azure-devops

As a part of Azure pre-deployment condition I need to include a pause which should prompt for user input variable which can be used inside the task.

I need to update the variable in the Azure release task dynamically during run time. For that Is there a way to implement user prompt so that the variable will be overided.
I am afraid this is impossible to update the variable in the Azure release task dynamically during run time.
First, Azure devops does not support prompt for user input.
Second, when we queue a build/release pipeline, all the related data like variables, settings are loaded into the compiler, even if we modify the variable, the modified variable will not be reloaded into the compiler. We have to restart the compiler to recompile the modified variables.
So, it is impossible to update the variable in the Azure release task dynamically during run time.
To resolve this issue, we have to find other workarounds to solve this issue. For example, Usig Settable at release time:
In this case, we could update the variable when you queue the release pipeline.
Or we could use the Logging Command during the release pipeline to update the variable.
If above not resolve your question, please share the reason and situation why you want to update the variable in the Azure release task dynamically during run time, we can try other solutions.

Related

what should I put in name value pair of update environment variable in power devops tool of pipeline?

I am a little bit confused what should I put in the update environment variable?
How can I update the environment variable of the solution in Azure pipeline?
Steps that I followed
Created solution in power app.
Created canvas app within solution and set allow to "Automatically add environment variables when adding data sources" from General Setting.
Added SharePoint Data Source list in canvas app
Created Build and Release Pipeline using PowerDevops tools
Used Update environment variable agent job within release pipeline
how do I use update environment variable or is there any way to update environment variable?

Azure DevOps Pipelines: How to run only impacted tests only when Reason is Check in without duplicating?

I have a build process in which I have a couple of Tests Tasks. Some of them may become quite time consuming when they all run and most of the time, most tests are not expected.
Still, I would like to have ALL these tests run on a scheduled trigger.
I know I could simply clone the pipeline and use one for gating with impacted tests only and the other one for schedule with all tests but as an OO developer, I don't like this.
I already tried linking the checkbox parameter to a process variable and modifying it using PowerShell but failed to have it work (How can I modify a process variable using Powershell in a Azure build pipeline).
Isn't there any other way of doing this?
You may be able to do this by setting the following condition on the test tasks that you'd only like to run during the scheduled build:
eq(variables['Build.Reason'], 'Schedule')
See here for a list of predefined variables (search for 'Build.Reason'):
https://learn.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml
See here for more information on expressions:
https://learn.microsoft.com/en-us/azure/devops/pipelines/process/expressions?view=azure-devops
It looks like functionality for this is now built in. According to the docs a variable can be set which will cause all tests to be run:
By setting a build variable. Even after TIA has been enabled in the VSTest task, it can be disabled for a specific build by setting the variable DisableTestImpactAnalysis to true. This override will force TIA to run all tests for that build. In subsequent builds, TIA will go back to optimized test selection

Run custom script in `Initialize Job` task

I have problem when build a C++ project in azure-pipeline, some dll files was access denied.
So I need to run a batch script to stop services which using these dll
I was try to run my script at pre-build event in Visual Studio but it execute after Initialize Job task, so not work
Are there any way to run script in Initialize Job?
Are there any way to run script in Initialize Job?
I am afraid there is no such way to run script in Initialize Job at this moment. The Prepare job/Initialize Job are some of the predefined work built into the pipeline. We could not add our custom script in or before those jobs.
So, to resolve this issue, we have to find the reason for this error and resolve it.
Generally, this error will most likely make an appearance if your Build and Release Agent goes offline or a build is interrupted due to an issue on the machine itself, and where specific files have been created mid-flight within the Azure Devops directory. When Azure Devops/TFS then re-attempts a new build and to write to/recreate the files that already exist, it fails, and the above error is displayed.
The best resolution is to log in to the agent machine manually, navigate to the affected directory/file (in this example, C:\VSTS\_work\xxx\xx\.tmp) and delete the file/folder in question. Removing the offending items will effectively "clean slate" the next Build definition execution, which should then complete without issue.
Hope this helps.
I had to solve this exact same problem. The solution is not ideal, but it works.
I created two pipelines. The first pipeline does any required pre-build steps, like stopping services. The second pipeline is the actual build pipeline, and it gets triggered when the first pipeline finishes. (See the build triggers section in pipeline #2.)

Updating the a text file during a vsts release

We have a requirement to update a text file during the release phase in VSTS depending on which environment the solution is being deployed too. I am a complete beginner to this.
I've looked at variables but I'm not clear on whether this will solve this particular problem.
There are many tasks that can update the file during the release, such as RegexReplace Build task (As rickjerrity mentioned), Replace Tokens etc…, you also can do it programming (e.g. PowerShell) during release.
Steps:
Add the environments with same name for each environment (Set Scope)
Using that variable in task.

Powershell script running in vsts release not recognizing environment variables

I've created a VSTS build with an Azure PowerShell script that works perfectly. The issue comes when I try to call the exact same script (exact same file in a git repo) from my VSTS release. When the script runs I get no errors but the environment variable, $Env:BUILD_SOURCESDIRECTORY, is empty. Like I've said before the VSTS build executes perfectly but I'm unable to run the exact same code in a VSTS release.
Your problem is that you are using a Build variable inside a Release. This just isn't going to work, it's empty because it simply doesn't exist in a release context.
Even if you could do this, I wouldn't suggest you do this. Your release should rely solely on artifacts, not build variables when the artifact was generated. You could certainly define this variable in your artifact, and access from the release, but I would highly suggest you not go down this path, as it's a really bad practice.
You didn't mention it, but if you stated why you think you need access to a build variable, perhaps we could help you find a better solution here.
Not all variables that are available in Build are available in Release. The Sources directory is available during the build. If you want to keep it available during Release, you should create an artefact in the Build, name it Sources. That way the artefact will be available in Release through its respective variables.
Overview of variables available in:
Release
Build