use bundled s2i by adding package to PATH

pull/12/head
Min RK 2017-05-24 09:49:23 -07:00
rodzic bba7582886
commit c158daab9d
3 zmienionych plików z 7 dodań i 4 usunięć

Wyświetl plik

@ -144,7 +144,7 @@ class Repo2Docker(Application):
sys.exit(1)
try:
for line in execute_cmd(['git', 'reset', '--hard', ref], checkout_path):
for line in execute_cmd(['git', 'reset', '--hard', ref], cwd=checkout_path):
self.log.info(line, extra=dict(phase='fetching'))
except subprocess.CalledProcessError:
self.log.error('Failed to check out ref %s', ref, extra=dict(phase='failed'))

Wyświetl plik

@ -12,6 +12,7 @@ from pythonjsonlogger import jsonlogger
from .utils import execute_cmd
here = os.path.abspath(os.path.dirname(__file__))
class BuildPack(LoggingConfigurable):
name = Unicode()
@ -73,8 +74,10 @@ class S2IBuildPack(BuildPack):
build_image,
output_image_spec,
]
env = os.environ.copy()
env['PATH'] = os.pathsep.join([here, env.get('PATH') or os.defpath])
try:
for line in execute_cmd(cmd, cwd=workdir):
for line in execute_cmd(cmd, cwd=workdir, env=env):
self.log.info(line, extra=dict(phase='building', builder=self.name))
except subprocess.CalledProcessError:
self.log.error('Failed to build image!', extra=dict(phase='failed'))

Wyświetl plik

@ -1,10 +1,10 @@
import subprocess
def execute_cmd(cmd, cwd=None):
def execute_cmd(cmd, **kwargs):
"""
Call given command, yielding output line by line
"""
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True, cwd=cwd)
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True, **kwargs)
try:
for line in iter(proc.stdout.readline, ''):