Skip to content

Commit 7663872

Browse files
committed
Updated Changes
1 parent 7496272 commit 7663872

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

Invoke_AzureDevOpsPipeline/Invoke_Azure_DevOps_Pipeline.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,18 @@
77
PIPELINE_ID = "3"
88
REPO_NAME = "AzureDemoPipelineAutomation"
99
BRANCH_NAME = "main"
10-
PAT = "<YOUR PAT TOKEN>"
10+
PAT = "<Your PAT>"
1111
PARAMETERS = {
1212
"environment": "prod",
1313
"buildVersion": "2.1.0"
1414
}
15-
# Azure DevOps REST API URL for triggering a pipeline
16-
URL = f"https://dev.azure.com/{ORG_NAME}/{PROJECT_NAME}/_apis/pipelines/{PIPELINE_ID}/runs?api-version=6.0-preview.1"
15+
1716

1817
def trigger_pipeline(branch_name, repo_name, parameters):
18+
19+
# Azure DevOps REST API URL for triggering a pipeline
20+
URL = f"https://dev.azure.com/{ORG_NAME}/{PROJECT_NAME}/_apis/pipelines/{PIPELINE_ID}/runs?api-version=7.1"
21+
1922
headers = {
2023
"Content-Type": "application/json"
2124
}
@@ -56,7 +59,7 @@ def trigger_pipeline(branch_name, repo_name, parameters):
5659

5760
def check_pipeline_status(run_id):
5861
# Azure DevOps REST API URL for checking the pipeline run status
59-
status_url = f"https://dev.azure.com/{ORG_NAME}/{PROJECT_NAME}/_apis/pipelines/{PIPELINE_ID}/runs/{run_id}?api-version=6.0-preview.1"
62+
status_url = f"https://dev.azure.com/{ORG_NAME}/{PROJECT_NAME}/_apis/pipelines/{PIPELINE_ID}/runs/{run_id}?api-version=7.1"
6063

6164
# Send the GET request to retrieve the pipeline run status
6265
response = requests.get(
@@ -79,6 +82,7 @@ def check_pipeline_status(run_id):
7982
print("Response Text:", response.text)
8083

8184
#run_id = trigger_pipeline(BRANCH_NAME, REPO_NAME, PARAMETERS) # Replace with actual branch and repository name
85+
#print(run_id)
8286

83-
check_pipeline_status(11)
87+
check_pipeline_status(25)
8488

0 commit comments

Comments
 (0)