1
votes

I am going to create CI/CD pipeline in Azure DevOps for .Net core web app. I need to have below procedure: CI : Visual Studio -> Azure repo -> Build on hosted agent -> create a Docker image and push it to Azure container registry CD: Deploy created image to on-prem docker swarm cluster Now, I have 2 questions: 1- how can I deploy to docker swarm cluster 2- I have to deploy directly from build agent to swarm cluster without internet access.

I would appreciate if you can help me.

1
1. You can refer to this document and try to run docker stack deploy ... command to deploy your application to swarm in docker task 0.* version. I am not sure if it is feasible. 2. Hosted agents must have access to the Internet to connect to Azure Pipelines or Team Foundation Server. You can refer to this document.user12163310
Thank you for your comment. I have a question, is it possible to deploy to swarm directly from hosted agent? I tried hosted-agent so build is being run on my agent and then created Image pushed to Azure container registry correctly, now how can I deploy the created image to my swarm cluster ?Meraj Kashi
You can try to use self-hosted agent to deploy to on-prem docker swarm cluster.user12163310

1 Answers

0
votes

For your requirement, I'd suggest that you could setup a private agent for Release Pipeline (CD) to deploy created image to on-prem docker swarm cluster.

For CI pipeline, you could use Microsoft Hosted agent.

Regarding that private agent, it should able to connect to internet, but you could restrict it just can connect to Azure DevOps by adding white-list: Allowed address lists and network connections

Regarding deploy to on-prem docker swarm cluster, you could call command through Command Line task.

Deploy a stack to a swarm

Apply rolling updates to a service