Here is my configuration I use to build and deploy my pipeline:
stages:
- stage: BuildAndPush
displayName: Build Docker Image
pool:
vmImage: 'ubuntu-latest'
[...]
- stage: Deployment
displayName: Deployment
condition: succeeded()
jobs:
- deployment:
displayName: Deploy on ${{variables.environment}} environment
environment: ${{variables.environment}}
strategy:
runOnce:
deploy:
steps:
- task: Bash@3
displayName: List Artifacts
inputs:
targetType: 'inline'
script: echo "HOSTNAME= $HOSTNAME"
Regarding my Environment, my resource gets never deployed:
I expect my Deploymment
stage to run on my onprem VM directly however it doesn’t.
How can I change this behavior? As today all deployment pipeline are running on a hosted Azure VM instead.
3
Answers
Thanks to both to putting me on the good tracks.
Solution was actually simpler than I thought, simply precise on which resource name you want to deploy by extending the
environment
part:Maybe you are looking for the below solution,
If the stage need to run in an on premise PC first of all need to add the Self-Hosted Agents (These are created and managed by the Customer) in Azure DevOps, The instruction in the below link,
https://learn.microsoft.com/en-us/azure/devops/pipelines/agents/v2-windows?view=azure-devops
After add the Self-Hosted Agents define the pool in stage,
Creating self-hosted agents(Windows or Linux) in Azure DevOps would be best. Self-hosted agents basically are build machines you use to run the pipeline.
Specify the self-hosted agent in the YAML pipeline.
Note: If you’re building a docker image, you need to install docker on the agent.
STEPS:
create a self-hosted agent pool.
agent.(Choose Windows, Linux or Mac).
pipeline