From 3d4af78f015313b4be0b27f5172267fd8f40f375 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Fri, 8 Jul 2016 17:09:06 -0400 Subject: [PATCH] Fix label to never allow a space (which breaks Kubernetes) --- buildman/manager/executor.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/buildman/manager/executor.py b/buildman/manager/executor.py index f3b23b07f..9457f4591 100644 --- a/buildman/manager/executor.py +++ b/buildman/manager/executor.py @@ -325,6 +325,10 @@ class KubernetesExecutor(BuilderExecutor): 'cpu' : self.executor_config.get('CONTAINER_CPU_REQUEST', "2"), } + release_sha = release.GIT_HEAD or 'none' + if ' ' in release_sha: + release_sha = 'HEAD' + return { 'apiVersion': 'batch/v1', 'kind': 'Job', @@ -335,7 +339,7 @@ class KubernetesExecutor(BuilderExecutor): 'build': build_uuid, 'time': datetime.datetime.now().strftime('%Y-%m-%d-%H'), 'manager': socket.gethostname(), - 'quay-sha': release.GIT_HEAD or 'none', + 'quay-sha': release_sha, }, }, 'spec' : { @@ -346,7 +350,7 @@ class KubernetesExecutor(BuilderExecutor): 'build': build_uuid, 'time': datetime.datetime.now().strftime('%Y-%m-%d-%H'), 'manager': socket.gethostname(), - 'quay-sha': release.GIT_HEAD or 'none', + 'quay-sha': release_sha, }, }, 'spec': {