Verified Commit 58c54e0f authored by Sebastian Schüpbach's avatar Sebastian Schüpbach
Browse files

get project name from directory

parent b5aebd31
Pipeline #31993 passed with stages
in 1 minute and 48 seconds
......@@ -74,7 +74,7 @@ class AutoDeploy(Resource):
+ tag
+ '-chart'
)
msgs, status = installFromRepo(pullChartUri, projectName)
msgs, status = installFromRepo(pullChartUri)
output.extend(msgs)
# deploy on test
elif branch == 'master':
......@@ -149,13 +149,13 @@ def _upgrade_installation(chartsDir, projectName, filenameBase, filename=None):
return msg, 'failure'
def installFromRepo(pullChartUri, projectName):
def installFromRepo(pullChartUri):
output = []
status = ''
app.logger.debug('pulling helm charts')
try:
proc = subprocess.run(
'export HELM_EXPERIMENTAL_OCI=1 && helm chart pull ' + pullChartUri,
'helm chart pull ' + pullChartUri,
shell=True,
capture_output=True,
text=True,
......@@ -176,10 +176,7 @@ def installFromRepo(pullChartUri, projectName):
app.logger.debug('exporting helm charts')
try:
proc = subprocess.run(
'export HELM_EXPERIMENTAL_OCI=1 && helm chart export '
+ pullChartUri
+ ' -d '
+ pulledChartsDir,
'helm chart export ' + pullChartUri + ' -d ' + pulledChartsDir,
shell=True,
capture_output=True,
text=True,
......@@ -196,6 +193,7 @@ def installFromRepo(pullChartUri, projectName):
)
app.logger.warning(msg)
return output, 'failure'
projectName = listdir(pulledChartsDir)[0]
helmValuesDir = path.join(pulledChartsDir, projectName, "helm-values")
# TODO: Remove later
app.logger.info(helmValuesDir)
......
......@@ -3,10 +3,10 @@ from flask import send_from_directory, redirect
from flask.logging import default_handler
from flask_restful import Api
from kubernetes import config
import os
from os import path, environ
import logging
from autodeploy_service_app.app import app
from autodeploy_service_app.AutoDeploy import AutoDeploy
from autodeploy_service_app.autodeploy import AutoDeploy
# TODO : maybe take that to a configuration (development vs pod running in
......@@ -23,6 +23,8 @@ except BaseException:
app.logger.error('No kubernetes cluster defined')
environ['HELM_EXPERIMENTAL_OCI'] = '1'
# If app is started via gunicorn
if __name__ != '__main__':
gunicorn_logger = logging.getLogger('gunicorn.error')
......@@ -57,7 +59,7 @@ def home():
@app.route('/favicon.ico')
def favicon():
return send_from_directory(
os.path.join(app.root_path, 'assets'),
path.join(app.root_path, 'assets'),
'favicon.ico',
mimetype='image/vnd.microsoft.icon',
)
......
Markdown is supported
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