Skip to content

Commit

Permalink
[ci] add support for invoking internal CI with a datetime (#1124)
Browse files Browse the repository at this point in the history
  • Loading branch information
tobrun authored Feb 8, 2022
1 parent 952832b commit e8c017a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion scripts/ci-circleci-start-pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import os
import requests
import sys
import datetime

MAIN_BRANCH_NAME = "main"

Expand Down Expand Up @@ -53,18 +54,24 @@ def Main():
help="Build a specific branch, otherwise it will build the default branch.")
parser.add_argument("--current-branch",
help="Current branch name.")
parser.add_argument('--created', help="Provide a date string in ISO 8601 format (eg. 2030-12-30T09:10:20.304050)")

args = parser.parse_args()

if not args.token:
print("CircleCI token not set. Use --token or set CIRCLE_API_TOKEN.")
sys.exit(1)

created = args.created
if not created:
created = datetime.datetime.utcnow().isoformat()

params = {
"mapbox_android_upstream": True,
"mapbox_slug": args.origin_slug,
"mapbox_android_hash": args.hash,
"mapbox_merge_main": args.current_branch == MAIN_BRANCH_NAME
"mapbox_merge_main": args.current_branch == MAIN_BRANCH_NAME,
"benchmark_date": created
}

TriggerPipeline(args.target_slug, args.token, args.branch, params)
Expand Down

0 comments on commit e8c017a

Please sign in to comment.