Skip to content

Commit 75aeb67

Browse files
author
Matthew Fisher
committed
fix(registry): store apps as appname
Storing the image in the registry as user/appname introduces a couple of confusing ideas: - images are implied to be unique across accounts - images are owned by one user and one only Point 1 is incorrect. App names are completely unique across the entire cluster[1]. Point 2 is incorrect as well because apps can be shared with the `deis perms` command. Changing the name of the image in the registry from `user/appname` to `appname` makes the image names unique across the entire cluster as well as making the images more easily sharable between users. fixes #729 [1]: https://github.com/deis/deis/blob/d1e14a6f76789a86f1959ba7bf6057b3abe3b960/controller/api/models.py#L109 BREAKING CHANGES: because this changes the way that applications are stored in the registry, this is a backwards-incompatible change with applications prior to this commit. To migrate over to this change, you'll have to destroy and re-create your apps with the same name as it was before. The docker layers from previous builds will still exist in the registry, but the repository names will be changed to reflect this change.
1 parent c205210 commit 75aeb67

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

builder/templates/builder

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ if __name__ == '__main__':
3636
user, repo, app = parse_args()
3737
# define image names
3838
_id = uuid.uuid4().hex[:8]
39-
tmp_image = "{user}/{app}:temp_{_id}".format(**locals())
40-
target_image = "{{ .deis_registry_host }}:{{ .deis_registry_port }}/{user}/{app}".format(**locals())
39+
tmp_image = "{app}:temp_{_id}".format(**locals())
40+
target_image = "{{ .deis_registry_host }}:{{ .deis_registry_port }}/{app}".format(**locals())
4141
# create required directories
4242
repo_dir = os.path.join(os.getcwd(), repo)
4343
build_dir = os.path.join(repo_dir, 'build')

controller/api/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ def new(self, user, config=None, build=None, summary=None):
428428
owner=user, app=self.app, config=config,
429429
build=build, version=new_version, image=image, summary=summary)
430430
# publish release to registry as new docker image
431-
repository_path = "{}/{}".format(user.username, self.app.id)
431+
repository_path = self.app.id
432432
publish_release(repository_path, config.values, tag)
433433
return release
434434

controller/api/tests/test_hooks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def test_build_hook(self):
106106
url = '/api/hooks/builds'.format(**locals())
107107
body = {'receive_user': 'autotest',
108108
'receive_repo': app_id,
109-
'image': 'registry.local:5000/autotest/{app_id}:v2'.format(**locals())}
109+
'image': 'registry.local:5000/{app_id}:v2'.format(**locals())}
110110
# post the build without a session
111111
self.assertIsNone(self.client.logout())
112112
response = self.client.post(url, json.dumps(body), content_type='application/json')

0 commit comments

Comments
 (0)