Skip to content

Commit

Permalink
review startBitriseBuild script to avoid token to leak ; configure ru…
Browse files Browse the repository at this point in the history
…ltor
  • Loading branch information
RoRoche committed May 3, 2020
1 parent cbce60d commit 6afc812
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 21 deletions.
3 changes: 1 addition & 2 deletions .rultor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@ decrypt:
release:
script: |
git commit --allow-empty -am "${tag}"
TOKEN=$(cat /home/r/bitrise.txt)
python3 repo/scripts/startBitriseBuild.py --token ${TOKEN} --appSlug 4b269ce2e4a54a10 --workflowId deploy --gitTag ${tag}
python3 /home/r/repo/scripts/startBitriseBuild.py --tokenFilePath /home/r/bitrise.txt --appSlug 4b269ce2e4a54a10 --workflowId deploy --gitTag ${tag}
16 changes: 11 additions & 5 deletions scripts/startBitriseBuild.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import sys
import argparse
import json
import requests

parser = argparse.ArgumentParser()
parser.add_argument(
"--token",
help="Bitrise Access Token"
"--tokenFilePath",
help="Path to txt file that contains Bitrise Access Token"
)
parser.add_argument(
"--appSlug",
Expand All @@ -22,8 +21,11 @@
)
args = parser.parse_args()

tokenFile = open(args.tokenFilePath, 'r')
token = tokenFile.read()
tokenFile.close()
url = 'https://api.bitrise.io/v0.1/apps/' + args.appSlug + '/builds'
headers = 'Authorization: ' + args.token
headers = 'Authorization: ' + token
data = {
"hook_info": {
"type": "bitrise",
Expand All @@ -46,4 +48,8 @@
headers = headers
)

assert response.status_code == 200, "Bitrise API returns a not OK status"
if response.status_code != 200:
print >> sys.stderr, "Bitrise API returns a not OK status"
sys.exit(1)
else:
print("Bitrise job started successfully")
28 changes: 14 additions & 14 deletions secrets/bitrise.txt.asc
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
-----BEGIN PGP MESSAGE-----

hQEMA5qETcGag5w6AQgAsHdRD00aAv5aMnWaGB32cLeVh428FcfFMe2Qt7TwNehv
n2RhhHBa/Ahf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6Y1znWdnuuC1harcIK9LAgwEudL/poyf1plqBtbQe
OIOp0h90fiuS4I1ec1TiDw+4E72gM2GcWb4tggTKpHDchCv6giod4zTayoa258ah
SmuyuMIRIt3G6fh9/AQWbrvU8uDYC21LHms6t4Ybg6TUx2u4reuTi8qGqyMSJZIf
PqPk6/mOsXYd9uB6rM/Kk62VwjXuYOqjRXmopT+mj6dt/TP1dE3aC91vMescgY9R
QUtCKdYEbHtF5eCm5yWqtdXXTHxhiUvKeEtCcNLAyGQUVaQo9aOLhKQ/HT/FiAaz
IfHj9YxVduh5ojLtKAu59wLNy3E/6fX01JQhPoU7H+EugIuHbIc14QElWTs7UwJn
tVceljfvstfznwN+1XHMSOlC38XMhggmUt2mdyK1dvoZ/OPCRWmKiRpwi0yTRy2N
kVJmxoxBn5NCMPvYlyUArkVzvHCQ
=i6uF
-----END PGP MESSAGE-----

0 comments on commit 6afc812

Please sign in to comment.