Skip to content

Commit

Permalink
Enable prod and test flow deployments
Browse files Browse the repository at this point in the history
  • Loading branch information
BenGalewsky committed Dec 8, 2023
1 parent cd34dfb commit 6368e2c
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 27 deletions.
20 changes: 6 additions & 14 deletions .github/workflows/deploy_flow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,17 @@ jobs:

steps:
- uses: actions/checkout@v2
with:
ref: test

- name: Set Environment Variable
- name: Determine environment to release to
run: |
if [ "${{ github.event.release.prerelease }}" = "true" ]; then
echo "Setting MY_ENV_VAR for prerelease"
echo "MY_ENV_VAR=prerelease" >> $GITHUB_ENV
echo "Setting FLOW_ENVIRONMENT for prerelease"
echo "FLOW_ENVIRONMENT=test" >> $GITHUB_ENV
else
echo "Setting MY_ENV_VAR for regular release"
echo "MY_ENV_VAR=release" >> $GITHUB_ENV
echo "Setting FLOW_ENVIRONMENT for prod release"
echo "FLOW_ENVIRONMENT=prod" >> $GITHUB_ENV
fi
- name: Show Environment Variable
run: echo "MY_ENV_VAR is $MY_ENV_VAR"

- name: Set up Python
uses: actions/setup-python@v2
Expand All @@ -53,7 +48,4 @@ jobs:
SMTP_PASS: '${{ secrets.SMTP_PASS }}'
run: |
cd automate
PYTHONPATH=../aws/ echo "python deploy_mdf_flow.py ${{ env.RELEASE_VERSION }}"
# echo "python deploy_mdf_flow.py ${{ env.RELEASE_VERSION }}"


PYTHONPATH=../aws/ python deploy_mdf_flow.py ${{ env.FLOW_ENVIRONMENT }} ${{ env.RELEASE_VERSION }}
25 changes: 12 additions & 13 deletions automate/deploy_mdf_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@
}
}]

# Load other configuration variables
# Please set these in the configuration file, not in-line here
with open("mdf_flow_config.json") as f:
config = json.load(f)

conf_client = globus_sdk.ConfidentialAppAuthClient(
globus_secrets['API_CLIENT_ID'], globus_secrets['API_CLIENT_SECRET']
Expand All @@ -44,20 +40,23 @@

globus_auth = GlobusAuthManager(globus_secrets['API_CLIENT_ID'], globus_secrets['API_CLIENT_SECRET'])

if len(sys.argv) > 1:
description = f"MDF Connected deployed from GitHub release {sys.argv[2]}"
config_file = f"mdf_{sys.argv[1]}_flow_config.json"
flow_info_file = f'mdf{sys.argv[1]}_flow_info.json'
else:
description = "MDF Connect Flow deployed manually"
config_file = "mdf_flow_config.json"
flow_info_file = 'mdf_flow_info.json'

# Load other configuration variables
# Please set these in the configuration file, not in-line here
with open("mdf_flow_config.json") as f:
with open(config_file) as f:
config = json.load(f)

mdf_flow = GlobusAutomateFlow.from_existing_flow("mdf_flow_info.json",
mdf_flow = GlobusAutomateFlow.from_existing_flow(flow_info_file,
client=flows_client,
globus_auth=globus_auth)

if len(sys.argv) > 1:
description = f"MDF Connected deployed from GitHub release {sys.argv[1]}"
else:
description = "MDF Connect Flow deployed manually"

mdf_flow.update_flow(flow_def=minimus_mdf_flow.flow_def(
smtp_send_credentials=smtp_send_credentials,
sender_email=config['sender_email'],
Expand All @@ -67,7 +66,7 @@
'urn:globus:groups:id:5fc63928-3752-11e8-9c6f-0e00fd09bf20' # MDF Connect Admins
]))

mdf_flow.save_flow("mdf_flow_info.json")
mdf_flow.save_flow(flow_info_file)
print("scope = ", mdf_flow.get_scope_for_runAs_role('SubmittingUser')['scopes'][0]['id'])

print("MDF Flow deployed", mdf_flow)
Expand Down
10 changes: 10 additions & 0 deletions automate/mdf_prod_flow_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"flow_permissions": [
"urn:globus:groups:id:5fc63928-3752-11e8-9c6f-0e00fd09bf20"
],
"admin_permissions": [
"urn:globus:groups:id:5fc63928-3752-11e8-9c6f-0e00fd09bf20"
],

"sender_email": "[email protected]"
}
1 change: 1 addition & 0 deletions automate/mdf_prod_flow_info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"flow_id": "5b016e00-4518-4a94-b2f0-2724cab7ca08", "flow_scope": "https://auth.globus.org/scopes/5b016e00-4518-4a94-b2f0-2724cab7ca08/flow_5b016e00_4518_4a94_b2f0_2724cab7ca08_user"}
10 changes: 10 additions & 0 deletions automate/mdf_test_flow_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"flow_permissions": [
"urn:globus:groups:id:5fc63928-3752-11e8-9c6f-0e00fd09bf20"
],
"admin_permissions": [
"urn:globus:groups:id:5fc63928-3752-11e8-9c6f-0e00fd09bf20"
],

"sender_email": "[email protected]"
}
1 change: 1 addition & 0 deletions automate/mdf_test_flow_info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"flow_id": "0c7ee169-cefc-4a23-81e1-dc323307c863", "flow_scope": "https://auth.globus.org/scopes/0c7ee169-cefc-4a23-81e1-dc323307c863/flow_0c7ee169_cefc_4a23_81e1_dc323307c863_user"}

0 comments on commit 6368e2c

Please sign in to comment.