Azure devops for CI/CD→
Create a new organization, project→
-
Create new organization in Azure DevOps. You can use existing organization if you have one.
-
Go to
https://dev.azure.com/
and click onNew Organization
from left navigation pane. -
Mention name of the organization, region for hosting the project and click on
Continue
. - Next screen will show progress message.
-
-
Create new project under the organization. You can use the existing project if you have one.
-
Mention name of the project, visibility and click on
Create
.Click on
Create project
button. -
After project is created, you will be redirected to project home page.
-
Create agent pool for staging→
- Navigate to the organization settings.
- Click on
Organization settings
from bottom left corner. - Click on
Agent pools
underPipelines
section. - Right pane will show existing agent pools including
Default
,Azure pipelines
. - Click on
Add pool
button. Mention the details in create agent pool form.Click on
Create
button. - Mention name of the pool and click on
Create
. - List of available agent pools will be shown after agent pool is created.
- Click on the newly created agent pool to add agent to the pool. Click on the agent tab. Click on
New agent
button. - Steps for agent configuration will be displayed.
- Click on
Configuring agent for the staging agent pool→
-
Obtain a PAT (personal access token) with a long enough duration to turn a VM into an agent. Store it somewhere. You will need it later on. It is unclear if the PAT is for once time registration or if the PAT has to be valid through the lifetime of the agent.
-
Note: You would need sudo permissions with privilage to run
systemctl
commands for configuring agents on the VM. - SSH to staging machine.
- Refer to the steps given in the agent configuration steps.
- Download the agent package.
- Change to the directory where you want to install the agent.
- Extract the agent package from the location where it is downloaded.
Default location given in the instructions might have to be changed
from
~/Downloads
to the actual location. - Run the
config.sh
script. - Enter the details as asked in the script.
- Enter the server URL.:https://dev.azure.com/organization_name
- Enter the PAT token.
- Enter the agent pool name.:staging
- Enter the agent name.:staging
- Start the agent.
- Install agent service using
- Start agent as a service.
- Check the status of the agent.
-
Verify the agent is running in the agent pool.
- Go to the agent pool in Azure DevOps.
- Click on the agent pool.
- Click on the agents tab.
- Newly added agent will be shown in the list of agents.
-
We are running the self-hosted agent on the staging machine. This agent will be used to deploy the application to the staging environment. Required scripts to deploy, upgrade the application are already available on the staging VM.
Create agent pool for production→
- Process is similar to creating agent pool for staging. As mentioned in Create agent pool for staging section
- Use following values while creating agent pool for production.
- Name: production
- Description: Production agent pool
- Click on
Create
button.
- SSH to production machine for configuring agent.
- Use following values while configuring agent for the production agent pool.
- agent name: production
- pool: production
Creating deployment pipeline→
- Make sure you have admin privilage for the git repo to connect the git repo to the Azure DevOps.
- Go to the project home page.
- Click on
Pipelines
from left navigation pane. - It will show list of existing pipelines. Click on
Create pipeline
button. - Select the source of the code. Click on
GitHub
. - It will display list of available github repos. Search for the desired repo which contains the source code for the yaml spec for the pipeline.
If desired repo is not listed, click on
Connection
link. From you may use specific connection message at the end of the list. - Use existing connection if desired account/organization is listed in the connection. Else click on
Install github app
button. - You will be redirected to github to install ADO app. Click on
Configure
button. - Select repo permissions and click
update access
button. - You will be redirected to the Azure sign-in
- Selected repos from github will be listed in ADO.
- Select the repo containing the yaml spec for the pipeline.
- ADO will auto-detect the yaml spec azure-pipelines.yml file in the repo. Click on
Save and run
button. - Pipeline will be available under Pipelines for this project.
Running the deployment pipeline→
- Go the project home page.
- Click on
Pipelines
from left navigation pane. - Click on the deployment which you want to run.
- Click on the
Run pipeline
button. - It will ask for parameter for target environment.
- Select the target environment and click on
Run
button. - Run details are displayed in the pipeline run page.
- Logs for the pipeline run are displayed in the pipeline run page.