22 lines
525 B
Python
22 lines
525 B
Python
#!/usr/bin/env python3
|
|
|
|
from flask import Flask, request
|
|
from functools import cache
|
|
from subprocess import check_output
|
|
import json
|
|
|
|
|
|
app = Flask(__name__)
|
|
app.secret_key = environ.get("FLASK_SECRET_KEY", default='test')
|
|
|
|
|
|
@app.route('/', methods = ['GET'])
|
|
def build():
|
|
strategy = request.args.get('strategy')
|
|
hook_data = request.get_json()
|
|
print(hook_data)
|
|
return check_output([f'/opt/build_server/strategies/{strategy}', json.dumps(hook_data)])
|
|
|
|
|
|
if __name__ =='__main__':
|
|
app.run(host='0.0.0.0')
|