Skip to content

Commit 644246f

Browse files
endpoint skip verification
1 parent e4d1706 commit 644246f

1 file changed

Lines changed: 11 additions & 12 deletions

File tree

runtime.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,12 @@ def build_pipeline_url() -> str:
7272
iam_headers = {'Content-Type': 'application/x-www-form-urlencoded'}
7373
iam_data = {"client_id": f"{CLIENT_ID}", "grant_type": "client_credentials", "client_secret": f"{CLIENT_KEY}"}
7474

75-
def build_skip_url(run_id: str):
76-
return f"{STACKSPOT_RUNTIME_MANAGER_URL}/v3/run/self-hosted/skip-deploy/{run_id}"
75+
def build_skip_url(run_id: str, can_skip: bool):
76+
return f"{STACKSPOT_RUNTIME_MANAGER_URL}/v3/run/self-hosted/skip-deploy/{run_id}?should-skip={can_skip}"
7777

78-
def check_if_is_skippable(run_id: str, token: str):
78+
def check_if_is_skippable(run_id: str, token: str, can_skip: bool):
7979
try:
80-
url = build_skip_url(run_id)
80+
url = build_skip_url(run_id, can_skip)
8181
deploy_headers = {"Authorization": f"Bearer {token}", "Content-Type": "application/json"}
8282
response = requests.patch(
8383
url=url,
@@ -234,14 +234,13 @@ def check_if_is_skippable(run_id: str, token: str):
234234

235235
print(f"✅ - RUN {runType} successfully started with ID: {runId}")
236236

237-
if SKIP_DEPLOY:
238-
print("Checking if run can be skipped...")
239-
was_skipped = check_if_is_skippable(run_id=runId, token=access_token)
240-
if was_skipped:
241-
print("✅ - Run was skipped because no changes were found.")
242-
tasks = []
243-
else:
244-
print("🔄 - Run was not skipped because changes were found.")
237+
print("Checking if run can be skipped...")
238+
was_skipped = check_if_is_skippable(run_id=runId, token=access_token, can_skip=SKIP_DEPLOY)
239+
if was_skipped:
240+
print("✅ - Run was skipped because no changes were found.")
241+
tasks = []
242+
else:
243+
print("🔄 - Run was not skipped because changes were found, or flagged as not skippable.")
245244

246245
save_output('tasks', tasks)
247246
save_output('run_id', runId)

0 commit comments

Comments
 (0)