Skip to content

Commit

Permalink
Add some debug logging in case of CICD Issue (#39)
Browse files Browse the repository at this point in the history
* Add some logging in case of CICD errors

Co-authored-by: Samuel Dumont <samuel@dataroots.io>
  • Loading branch information
sam-dumont and Samuel Dumont authored Feb 8, 2022
1 parent 73d84bf commit 625ac18
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ bin/RunPowerWorkout.prg.debug.xml
.DS_Store
setup_env.sh
upload_to_garmin_prev.py
*.ipynb
17 changes: 12 additions & 5 deletions cicd/upload_to_garmin.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
BETA_APP = os.getenv("BETA_APP")
DEV_EMAIL = os.getenv("DEV_EMAIL")

if GARMIN_USERNAME is None or GARMIN_PASSWORD is None:
print("Issue getting Garmin credentials")
exit(1)

try:
release_notes = requests.get(
f"https://api.github.com/repos/{'samueldumont' if BETA_APP == 'true' else 'tommyvdz'}/RunPowerWorkout/releases/tags/{TAG_NAME}"
Expand Down Expand Up @@ -135,6 +139,11 @@
response = scraper.post(url, data=payload, headers=headers, params=querystring)
print(f"Login result: {response.status_code}")

if response.status_code != 200:
print(f"{len(GARMIN_USERNAME)} {len(GARMIN_PASSWORD)}")
print(f"{response.text}")
exit(1)

### UPLOAD FILE

url = f"https://apps.garmin.com/en-US/developer/{DEV_ID}/apps/{STORE_ID}/update"
Expand All @@ -156,8 +165,7 @@
"application/octet-stream",
),
},
boundary="----WebKitFormBoundary"
+ "".join(random.sample(string.ascii_letters + string.digits, 16)),
boundary="----WebKitFormBoundary" + "".join(random.sample(string.ascii_letters + string.digits, 16)),
)

headers = {
Expand Down Expand Up @@ -562,8 +570,7 @@
("betaApp", BETA_APP),
("submit", ""),
],
boundary="----WebKitFormBoundary"
+ "".join(random.sample(string.ascii_letters + string.digits, 16)),
boundary="----WebKitFormBoundary" + "".join(random.sample(string.ascii_letters + string.digits, 16)),
)

headers = {
Expand All @@ -580,4 +587,4 @@
}

response = scraper.post(url, headers=headers, data=m, allow_redirects=True)
print(f"What's new update result : {response.status_code}")
print(f"What's new update result : {response.status_code}")

0 comments on commit 625ac18

Please sign in to comment.