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

notifies :redeploy fails, but manually notifying :stop, :remove and :run works #198

Closed
rdsubhas opened this issue Jul 29, 2014 · 9 comments

Comments

@rdsubhas
Copy link

Reference: https://snap-ci.com/rapidftr/RapidFTR/branch/master/logs/defaultPipeline/74/DEV?back_to=build_history

notifies :redeploy, ..., :immediately

Fails randomly. Instead we have switched to:

notifies :stop, ..., :immediately
notifies :remove, ..., :immediately
notifies :run, ..., :immediately

And that works consistently well better. Any ideas what could be the issue?

EDIT: That doesn't work consistently well, it just works "better", and does fail occasionally.

@jschneiderhan
Copy link
Contributor

I think it may be due to the mixing of platform resources and in-line shellouts. When I change the cookbook to use platform resources only (#197) the :redepoly action works as described. I'm not sure if switching to using platform resources is possible for all of the shellouts, but I think that may be a possible solution.

@rdsubhas
Copy link
Author

@jschneiderhan By "in-line shellouts" you mean execute commands? (because we have only one execute and that is for cleaning up stale docker images, and I'm not sure if that could affect anything, excuse me if I misunderstood)

@jschneiderhan
Copy link
Contributor

Hi @rdsubhas,

By inline shellouts I mean calls to docker_cmd! which end up here and are executed immediately. I have a hunch that mixing those calls with platform resources, which are added to the resource collection and then processed, is causing issues. I don't think the platform resources are executed immediately, which in #194 leads to the docker rm command executing before the service resource's :stop command. I think this may be related.

What got me headed down this train of thought is a warning on the Chef Custom Resources docs:

It is recommended to not mix platform resources with custom resources in the same lightweight provider. This helps ensure the proper processing of platform resources that have been embedded into the resource collection during the chef-client run.

I'll admit though, this warning isn't completely clear to me. It isn't clearly stated what is meant by "custom resources". I think they mean using the approach shown in the "Lightweight Providers w/Custom Ruby" section which does a shellout. If that is the case, the warning reads to me that mixing shellouts (an example of a "custom resource") and platform resources is not recommended. That is just my interpretation though ... I could be way off base. Changing the shellouts to execute resources (except the call in the docker_containers method, which is called in load_current_resource method) seems to make everything execute in the order that the code reads, at least it does for the :redeploy action.

@rdsubhas
Copy link
Author

@jschneiderhan thanks for the explanation! let's see what the core committers have to say...

@djdefi
Copy link

djdefi commented Aug 20, 2014

We are experiencing something similar to this. Seems like the stop step just never happens on a redeploy

@rdsubhas
Copy link
Author

In case anybody is using Jenkins, we used the Naginator plugin to automatically re-trigger failed builds. Works like a charm when run the second time...

@djdefi
Copy link

djdefi commented Sep 17, 2014

+1

@caleb
Copy link
Contributor

caleb commented Apr 30, 2015

This is my experience as well. When using :redeploy I get an error about not being able to remove an running container. As a fix I'm using action [:stop, :remove, :run].

@someara someara added the bug label Jul 14, 2015
@someara
Copy link
Contributor

someara commented Aug 13, 2015

FIxed in master

@someara someara closed this as completed Aug 13, 2015
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

5 participants