-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check GitLab status, instead of GitHub, in release.sh (#1641)
* Check GitLab status during release, not GitHub
- Loading branch information
Showing
4 changed files
with
43 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env python | ||
""" | ||
This script outputs GitLab pipeline status. | ||
The GitLab API is expected to be stored in AWS secretsmanager with secret id "dcp/dss/gitlab-api" | ||
The GitLab Token is expected to be stored in AWS secretsmanager with secret id "dcp/dss/gitlab-token" | ||
Usage: `scripts/status.py owner repo branch` | ||
Example: `scripts/status.py HumanCellAtlas data-store master` | ||
""" | ||
import json | ||
import boto3 | ||
import requests | ||
import argparse | ||
import urllib.parse | ||
|
||
parser = argparse.ArgumentParser() | ||
parser.add_argument("owner", help="The group or owner of the repository") | ||
parser.add_argument("repo", help="The repository name") | ||
parser.add_argument("branch", help="Branch to return most recent CI pipeline status") | ||
args = parser.parse_args() | ||
|
||
sm = boto3.client("secretsmanager") | ||
|
||
gitlab_api = sm.get_secret_value(SecretId="dcp/dss/gitlab-api")['SecretString'] | ||
gitlab_token = sm.get_secret_value(SecretId="dcp/dss/gitlab-token")['SecretString'] | ||
slug = urllib.parse.quote_plus(f"{args.owner}/{args.repo}") | ||
r = requests.get( | ||
f"https://{gitlab_api}/projects/{slug}/pipelines", | ||
params={"ref": args.branch}, | ||
headers={"Private-Token": gitlab_token}, | ||
) | ||
print(json.loads(r.text)[0]['status']) |
This file was deleted.
Oops, something went wrong.