Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Rock-ons] Image tag is ignored if image already exists #2017

Closed
FroggyFlox opened this issue Feb 9, 2019 · 1 comment
Closed

[Rock-ons] Image tag is ignored if image already exists #2017

FroggyFlox opened this issue Feb 9, 2019 · 1 comment

Comments

@FroggyFlox
Copy link
Member

This issue was identified while reviewing #2016

Currently, references to docker images defined in rock-ons' json files are stored in the storageadmin_dimage table under the DImage model.
When parsing the json file, the "image" object fed to the DImage model, along with the associated tag, but only the image name and not its tag is used. As a result, if the same image is used in the same or different rock-ons but with a different tag, it will not be updated and only the first set will be registered and thus used for all.

The code in question is from rockon.py:

            io, created = DImage.objects.get_or_create(name=c_d['image'],
                                                       defaults=defaults)

As stated above, we are feeding the DImage model filtering by image name, for each container in the json, so this does not allow to have the same image with different tags in the same rock-on, such as in the following test json:

		"containers": {
			"alpine36": {
				"image": "alpine",
				"tag": "3.6",
				"launch_order": 1,
				"ports": {},
				"volumes": {},
				"environment": {}
			},
  			"alpine_edge": {
				"image": "alpine",
				"tag": "edge",
				"launch_order": 2,
				"ports": {},
				"volumes": {},
				"environment": {}
			},
			"alpine3": {
				"image": "alpine",
				"tag": "3",
				"launch_order": 3,
				"ports": {},
				"volumes": {},
				"environment": {}
			}

The situation above may not happen, but the case of two different rock-ons using the same image but with a different tag is more likely to arise.

We should thus take the "tag" object from the json file when feeding and updating the DImage model.

Either one of these problematic situations is not very likely to happen, however (and hasn't been reported yet), so addressing this shortcoming may be considered for a future enhancement.
Up to you @schakrava and @phillxnet to set priority on this one.

@FroggyFlox
Copy link
Member Author

This issue has now been reported as blocking a newly-proposed rock-on:
rockstor/rockon-registry#190 (comment)

A proposed fix can be found at the following branch:
https://github.com/FroggyFlox/rockstor-core/tree/Issue2017_Rock-on_parse_Image_Tag

PR submission will soon follow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant