Skip to content

Commit 509b12e

Browse files
author
Matthew Fisher
committed
Merge pull request #1325 from johanneswuerbach/moving-registry
fix(controller): Determine registry address during start
2 parents 8a4935c + f79a955 commit 509b12e

3 files changed

Lines changed: 6 additions & 7 deletions

File tree

api/models.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -469,8 +469,7 @@ def new(self, user, config=None, build=None, summary=None, source_version='lates
469469
new_version = self.version + 1
470470
tag = 'v{}'.format(new_version)
471471
release_image = '{}:{}'.format(self.app.id, tag)
472-
target_image = '{}:{}/{}'.format(
473-
settings.REGISTRY_HOST, settings.REGISTRY_PORT, self.app.id)
472+
target_image = '{}'.format(self.app.id)
474473
# create new release and auto-increment version
475474
release = Release.objects.create(
476475
owner=user, app=self.app, config=config,

api/tests/test_hooks.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def test_build_hook(self):
116116
url = '/api/hooks/builds'.format(**locals())
117117
body = {'receive_user': 'autotest',
118118
'receive_repo': app_id,
119-
'image': 'registry.local:5000/{app_id}:v2'.format(**locals())}
119+
'image': '{app_id}:v2'.format(**locals())}
120120
# post the build without a session
121121
self.assertIsNone(self.client.logout())
122122
response = self.client.post(url, json.dumps(body), content_type='application/json')
@@ -142,7 +142,7 @@ def test_build_hook_procfile(self):
142142
SHA = 'ecdff91c57a0b9ab82e89634df87e293d259a3aa'
143143
body = {'receive_user': 'autotest',
144144
'receive_repo': app_id,
145-
'image': 'registry.local:5000/{app_id}:v2'.format(**locals()),
145+
'image': '{app_id}:v2'.format(**locals()),
146146
'sha': SHA,
147147
'procfile': PROCFILE}
148148
# post the build without a session
@@ -191,7 +191,7 @@ def test_build_hook_dockerfile(self):
191191
"""
192192
body = {'receive_user': 'autotest',
193193
'receive_repo': app_id,
194-
'image': 'registry.local:5000/{app_id}:v2'.format(**locals()),
194+
'image': '{app_id}:v2'.format(**locals()),
195195
'sha': SHA,
196196
'dockerfile': DOCKERFILE}
197197
# post the build without a session

scheduler/coreos.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,9 @@ def attach(self, name):
222222
Description={name}
223223
224224
[Service]
225-
ExecStartPre=/usr/bin/docker pull {image}
225+
ExecStartPre=/bin/sh -c "IMAGE=`/run/deis/bin/determine_registry {image}`; docker pull $IMAGE"
226226
ExecStartPre=/bin/sh -c "docker inspect {name} >/dev/null 2>&1 && docker rm -f {name} || true"
227-
ExecStart=/bin/sh -c "port=$(docker inspect -f '{{{{range $k, $v := .ContainerConfig.ExposedPorts }}}}{{{{$k}}}}{{{{end}}}}' {image} | cut -d/ -f1) ; docker run --name {name} -P -e PORT=$port {image} {command}"
227+
ExecStart=/bin/sh -c "IMAGE=`/run/deis/bin/determine_registry {image}`; port=$(docker inspect -f '{{{{range $k, $v := .ContainerConfig.ExposedPorts }}}}{{{{$k}}}}{{{{end}}}}' $IMAGE | cut -d/ -f1) ; docker run --name {name} -P -e PORT=$port $IMAGE {command}"
228228
ExecStop=/usr/bin/docker rm -f {name}
229229
TimeoutStartSec=20m
230230
"""

0 commit comments

Comments
 (0)