ashb commented on a change in pull request #20:
URL: https://github.com/apache/airflow-ci-infra/pull/20#discussion_r625701834



##########
File path: lambdas/scale_out_runner/app.py
##########
@@ -101,12 +107,38 @@ def index():
     return payload
 
 
-def commiters(ssm_repo_name: str = os.getenv('SSM_REPO_NAME', 
'apache/airflow')):
[email protected](Rate(1, unit=Rate.DAYS))
+def sync_committers(_):
+    app.log.info("Parsing committers list from %s", GITHUB_CI_YML)
+    resp = requests.get(GITHUB_CI_YML)
+    ci_yml = yaml.load(resp.text, yaml.SafeLoader)
+    runs_on = ci_yml['jobs']['build-info']['runs-on'].replace("\n", '')
+    committers = re.findall(r"fromJSON\('(\[.*\])'\)", runs_on)[0]
+
+    client = boto3.client('ssm')
+    param_path = get_ssm_param_path(SSM_REPO_NAME)
+
+    app.log.info("Updating config overlay for %s", param_path)
+    ssm_value = {"pullRequestSecurity": {"allowedAuthors": committers}}
+    client.put_parameter(
+        Name=param_path,
+        Value=json.dumps(ssm_value),

Review comment:
       There could be other things in there -- we should merge in to the 
existing value rather than just overwriting everything.

##########
File path: lambdas/scale_out_runner/app.py
##########
@@ -101,12 +107,38 @@ def index():
     return payload
 
 
-def commiters(ssm_repo_name: str = os.getenv('SSM_REPO_NAME', 
'apache/airflow')):
[email protected](Rate(1, unit=Rate.DAYS))
+def sync_committers(_):
+    app.log.info("Parsing committers list from %s", GITHUB_CI_YML)
+    resp = requests.get(GITHUB_CI_YML)

Review comment:
       ```suggestion
       resp = requests.get(GITHUB_CI_YML)
       resp.raise_for_status()
   ```

##########
File path: lambdas/scale_out_runner/app.py
##########
@@ -101,12 +107,38 @@ def index():
     return payload
 
 
-def commiters(ssm_repo_name: str = os.getenv('SSM_REPO_NAME', 
'apache/airflow')):
[email protected](Rate(1, unit=Rate.DAYS))
+def sync_committers(_):
+    app.log.info("Parsing committers list from %s", GITHUB_CI_YML)
+    resp = requests.get(GITHUB_CI_YML)
+    ci_yml = yaml.load(resp.text, yaml.SafeLoader)
+    runs_on = ci_yml['jobs']['build-info']['runs-on'].replace("\n", '')
+    committers = re.findall(r"fromJSON\('(\[.*\])'\)", runs_on)[0]
+
+    client = boto3.client('ssm')
+    param_path = get_ssm_param_path(SSM_REPO_NAME)
+
+    app.log.info("Updating config overlay for %s", param_path)
+    ssm_value = {"pullRequestSecurity": {"allowedAuthors": committers}}

Review comment:
       Yes, this is the right value.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to