Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7218004f2f | ||
|
|
75fd57391d |
+11
-3
@@ -62,7 +62,7 @@ def handle_event(request: GiteaRequest):
|
|||||||
runner_script = load_runner_script(path=runner_script_path)
|
runner_script = load_runner_script(path=runner_script_path)
|
||||||
# determine pipeline to run
|
# determine pipeline to run
|
||||||
if branch_name not in runner_script.pipelines.keys():
|
if branch_name not in runner_script.pipelines.keys():
|
||||||
# run default
|
# get default pipeline
|
||||||
if 'default' not in runner_script.pipelines.keys():
|
if 'default' not in runner_script.pipelines.keys():
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=404,
|
status_code=404,
|
||||||
@@ -70,15 +70,23 @@ def handle_event(request: GiteaRequest):
|
|||||||
)
|
)
|
||||||
pipeline = runner_script.pipelines['default']
|
pipeline = runner_script.pipelines['default']
|
||||||
else:
|
else:
|
||||||
# run custom
|
# get custom pipeline
|
||||||
pipeline = runner_script.pipelines[branch_name]
|
pipeline = runner_script.pipelines[branch_name]
|
||||||
print(pipeline)
|
logging.info(f'running pipeline {pipeline.name}')
|
||||||
|
# TODO: create virtualenv?
|
||||||
|
# install requirements
|
||||||
|
assert pipeline.requirements is not None
|
||||||
|
requirements_path = local_repo_dir / pipeline.requirements
|
||||||
|
os.system(f'pip install -r {requirements_path}')
|
||||||
|
for cmd in pipeline.script:
|
||||||
|
print(cmd)
|
||||||
|
|
||||||
# send response
|
# send response
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=202,
|
status_code=202,
|
||||||
detail='received task'
|
detail='received task'
|
||||||
)
|
)
|
||||||
|
# consider to include link to page that show progress
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
load_dotenv('dev.env')
|
load_dotenv('dev.env')
|
||||||
|
|||||||
+1
-2
@@ -4,8 +4,7 @@ definitions:
|
|||||||
name: test
|
name: test
|
||||||
requirements: req-prod.txt
|
requirements: req-prod.txt
|
||||||
script:
|
script:
|
||||||
- command arg1 arg2
|
- echo nvidia-smi
|
||||||
- command2 arg1 arg2
|
|
||||||
|
|
||||||
pipelines:
|
pipelines:
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user