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

Add docker-push-latest rule #47

Merged
merged 1 commit into from
Jan 4, 2018
Merged

Add docker-push-latest rule #47

merged 1 commit into from
Jan 4, 2018

Conversation

smacker
Copy link
Contributor

@smacker smacker commented Dec 21, 2017

Same as #44 but separate rule

Makefile.main Outdated
@@ -115,6 +115,40 @@ docker-push:
echo "Successfully uploaded image."; \
done; \

# this rule must be run only after tagged image was created by `docker-push`
docker-push-latest:
@if [ "$(BRANCH)" == "master" ]; then \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we move this to a function?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good call! thanks! fixed!

Makefile.main Outdated
@@ -115,6 +98,25 @@ docker-push:
echo "Successfully uploaded image."; \
done; \

# this rule must be run only after tagged image was created by `docker-push`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then fail if the current image wasn't tagged.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it will fail during docker tag. With error like:

Error response from daemon: No such image: bla:v1
Can't tag image.

then script stops and doesn't try to upload.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this new rule should depend on the original :docker-push; that way, the dependency of the previous one will be programmatically ensured

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea! Thanks! Fixed.

Makefile.main Outdated
@@ -115,6 +98,25 @@ docker-push:
echo "Successfully uploaded image."; \
done; \

# this rule must be run only after tagged image was created by `docker-push`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this new rule should depend on the original :docker-push; that way, the dependency of the previous one will be programmatically ensured

Copy link
Contributor

@dpordomingo dpordomingo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

Only one thing. I don't know pretty well about what the .PHONY is, but I think it should include the new docker-push-latest target, shouln't it?

Anyhow, I think it shouldn't block the PR.

Signed-off-by: Maxim Sukharev <maxim@sourced.tech>
@smacker
Copy link
Contributor Author

smacker commented Dec 22, 2017

Oh! Thanks! According to documentation make will associate Makefile targets with files first. So if we occasionally create file docker-push-latest, make won't execute the rule. That's why it should be in PHONY. I added it there. Thanks again!

Copy link
Contributor

@dpordomingo dpordomingo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be strange to create a file with that name, but yes, let's avoid errors.

@smacker
Copy link
Contributor Author

smacker commented Jan 4, 2018

All comments are addressed. Does it look fine for you now @mcuadros ?

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

Successfully merging this pull request may close these issues.

3 participants