Skip to content

Commit

Permalink
if release is failed, it return exit code and fail the CI (#158)
Browse files Browse the repository at this point in the history
  • Loading branch information
noklam authored Apr 17, 2023
1 parent 3b42fae commit 2db466a
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions tools/circleci/circleci_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"""

import os
import sys

import requests
from requests.structures import CaseInsensitiveDict
Expand Down Expand Up @@ -33,12 +34,6 @@ def circleci_release(project_slug, payload, circle_endpoint, circle_release_toke
headers["Circle-Token"] = circle_release_token

resp = requests.post(circle_endpoint, headers=headers, json=payload, timeout=10)
print(f"Status Code: {resp.status_code}")
if resp.status_code == 201:
print("Creating CircleCI Pipeline successfully")
print(resp.content)
else:
print("Failed to create CircleCI Pipeline")
return resp


Expand Down Expand Up @@ -70,6 +65,14 @@ def circleci_release(project_slug, payload, circle_endpoint, circle_release_toke

print(package_name, package_version)
if check_no_version_pypi(pypi_endpoint, package_name, package_version):
circleci_release(
res = circleci_release(
PROJECT_SLUG, payload, circleci_endpoint, CIRCLE_RELEASE_TOKEN
)
print(f"Status Code: {resp.status_code}")
if resp.status_code == 201:
print("Creating CircleCI Pipeline successfully")
else:
print("Failed to create CircleCI Pipeline")
print(resp.content)
if resp.status_code != 201:
sys.exit(1)

0 comments on commit 2db466a

Please sign in to comment.