Commit b9154bff authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

RF: Trigger downstream passes/fails based on downstream builds

parent 52c5978c
......@@ -8,6 +8,7 @@
import os
import sys
from fsl_ci_utils.conda import (load_meta_yaml,
......@@ -60,8 +61,14 @@ def trigger_pipeline_on_packages(upstream, packages, server, token, staging):
pipelines.append((recipe_path, trigger_pipeline(
recipe_path, 'master', server, token, variables)))
passed = True
for recipe_path, pipeline in pipelines:
wait_on_pipeline(recipe_path, pipeline['id'], server, token)
status = wait_on_pipeline(
recipe_path, pipeline['id'], server, token)
passed = passed and (status == 'success')
return passed
def main():
......@@ -93,8 +100,10 @@ def main():
if len(downstream) == 0:
print(f'{pkgname} nas no downstream dependants - nothing to do!')
result = trigger_pipeline_on_packages(
upstream, downstream, gitlab_url, token, staging)
sys.exit(0 if result else 1)
if __name__ == '__main__':
......@@ -34,7 +34,7 @@ def http_request(url, token=None, data=None, method=None):
headers['Content-Type'] = 'application/json'
data = json.dumps(data).encode('utf-8')
print(f' {data}')
print(f' payload: {data}')
request = urlrequest.Request(
url, headers=headers, data=data, method=method)
......@@ -347,6 +347,7 @@ def wait_on_pipeline(project_path, pipeline_id, server, token):
if status not in ('created', 'waiting_for_resource',
'preparing', 'pending', 'running'):
print(f'Pipeline has stopped - final status: {status}')
print(f'Pipeline status: {status}')
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment