Selenium Webdriver test's after deploy Azure Devops Pipelines - azure-devops

I'm trying to run my Selenium Webdriver test's after I do a deployment to my staging environment.
But I run into this error.
"The stage refers to resources like queue 'Azure Pipelines', that have been protected with checks. Protected resources can only be used in YAML pipelines. For more details, refer to https://aka.ms/pipelinechecks."
The deploy agent is hosted on-prem.

Here is some troubleshooting advices:
If you use a variable when setting the agent pool and agent in release pipeline, try replacing the variable with the specific value.
If you are using some resources or if your agent has set up Approval & Check, try to refresh the run page and manually pass the approval. Click this document for detailed information.

Related

ADO YAML pipeline: deploy nightly OR when manual approval is given

We are currently switching over from Classic (UI) Azure Pipelines to YAML pipelines.
We would like to deploy a branch every night to an environment (when changes have occurred) and also be able to deploy to this environment manually. With the Classic pipelines it was easy to setup a scheduled deploy to an environment that could also be triggered manually when desired.
In the new YAML pipelines we currently use the "Business hours"
check to make sure the nightly deploy takes place, but we are unable to override the check when a manual deployment is needed.
Is there a way to setup a YAML pipeline where a deploy waits for either a manual approval or a scheduled trigger to occur?

Extend template validation at build queue time

I know that we can verify extend template used or not at deployment stage on targeted azure devops environment using extend template check.
I have a requirement to verify or run this check at run time before any of the build task starts i.e. when user run the build . I've asked similar question here Azure pipeline build Stage verification but as a centralized compliance team we want to block user from running the build if they are not extending certain template.
You can achieve above requirement by setting a template check for the agent pools. If a agent pool is configured approvals and checks, then all the jobs that targeting this agent pools will need to validate the approvals and checks before running.
You can follow below steps to set approvals and checks for agent pools.
Go to Project settings --> Agent pools under Pipelines-->Select the agent pools(eg. Azure Pipelines).
Click the 3dots on the top right corner--> Click Approvals and checks--> Click the plus sign to Add a template check.
Then all the jobs that targeting an agent in this agent pool will have to pass the template checks before running on the agent.
Note: Please make sure the Multi-stage pipelines experience is turned on. Check the document here here to turn on or off the Preview features.

Run azure devops pipeline on every available pool

I'm evaluating Azure Devops and want to have following workflow: I want to have a pipeline build and run it on our self-hosted build agent, but if non them is available I want to fall back on hosted agent and vice versa. According to documentation https://learn.microsoft.com/en-us/azure/devops/pipelines/agents/agents?view=azure-devops in the yaml file you need to define in which pool will job run.
Can I have a pipeline build without having to define a pool/define many pools as fallback?

deploy app to on-prem environments with azure dev ops

I'm building an Azure DevOps pipeline to deploy a custom-build powershell application to several on-prem environments that we support. I configured the required agent pools and installed them as a service on the on-prem environment.
Next, I have set up my pipeline in Azure DevOps, selecting a GitRepo:
Build (with the steps: Use Nuget, Nuget Restore, Build solution, Update version, Copy Files, and Publish build Artifact)
Release (with step: Publish Build Artifact)
Some things are unclear for me:
Do I need the Publish Build Artifacts twice? Can the Build pipeline
end with Copy Files step, and that the Release pipeline picks up this
artifact?
It is my understanding that the release publishes the app to the
on-prem environment (in my case). Where can I set a custom path (ie:
C:\deployed_apps) where the app needs to be deployed? When I tested
this pipeline, I got errors that the path I created using an variable
was not found.
What am I missing in my setup to get this pipeline working?
As #Shayki Abramczyk
pointed out this task is not for deployment, it just upload your Build Artifacts to azure devops server where your release pipeline can download directly.
In your case, if you want deploy your application to several on-prem environments, You need to create a deployment group first, A deployment group is a logical set of deployment target machines that have agents installed on each one. You application will be deployed to those machines in a deployment group in release pipeline. Check here for more details about deployment group.
After the deployment group is created, you can add a deployment group job by click the 3 dots, and then specify your deployment group as below pic shows, You can then simply add a copy file task or other deployment tasks to deploy your application to your on-prem machine.
In the release pipeline you shouldn't use the Publish Build Artifact. in the end of the build you put this step, what this step does? upload your artifacts to the Azure DevOps or to a file share. now in the release pipeline you choose the build artifact (in the left pane). the first thing that the agent does when the release pipeline started is to download the build artifacts to the agent. now you need to take them and deploy it to your environments. how? it depends which kind of application is (it can be just copy files, it can be deploy to IIS, etc.).
You can put the path in the variables tab and use this variable when you deploy the app (with copy files task, for example).

Configure VSTS local build agent for deploys

I have a local VM that has successfully been running builds from VSTS.
After the builds are completed I have a deployment job that pushes my artifacts to a number of servers. This has been working fine for the past few months.
This morning, I received a message that I was out of "deployment minutes" and my deployments failed, however my builds completed.
Obviously it was building locally, but deploying in the cloud.
Is there a way I can configure my agent or my deployment job within VSTS to use my local agent?
You should just be able to switch your release definition to use the same agent queue as your builds. In each environment, click on each phase and change the agent queue it uses from "Hosted" to whatever you named your local agent queue.
You may need to install additional software (Azure PowerShell, if you're deploying to Azure, for example), but it will work the same -- the build and release agents are exactly the same software and use exactly the same tasks.
You should be able to add your agent to the pool (it requires some software installed there of course) and then select it instead of a hosted environment in the deployment step configuration:
Agent pools
At the bottom you can find:
The hosted pool provides all VSTS accounts with a single hosted build agent and a limited number of free build minutes each month. If you need more hosted build resources, or need to run more than one build concurrently, then you can either:
- Deploy your own on-premises build agents
- Buy additional hosted pipelines
Here is where I finally found the option to specify which agent the release should run on: