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

Cannot remove artifact of job #14

Closed
deinspanjer opened this issue Sep 23, 2016 · 6 comments
Closed

Cannot remove artifact of job #14

deinspanjer opened this issue Sep 23, 2016 · 6 comments

Comments

@deinspanjer
Copy link

When running the examples/minimal-docker-image project, I wasn't able to follow the instructions as currently written in the README.md. I submitted a quick fix/workaround PR there, but it seems there are a couple of underlying bugs I'll also raise.

In that example, there is a job task with the name "binary". It uses the builder image and produces the artifact dist/bin/hello.

If you try to run dobi binary:rm, it fails with the following warning:

[WARN] [run:rm binary] ./dist/bin/hello container=example-hello-dre-binary Failed to remove container: No such container: example-hello-dre-binary
(where "dre" is my $HOST_USER)

Looks like it is mistakenly trying to target a container rather than the artifact. If I look into this and fix it, I'm assuming that the binary:rm shouldn't cascade down to the builder image and rm that as well, right?

@deinspanjer
Copy link
Author

Also, trying to run dobi run-dist:rm fails in a similar way. What should the appropriate action be since there is no artifact? A no op?

Do we maybe need an :rm-all job task that does recurse into images used by the job and removes them?

@deinspanjer
Copy link
Author

Hm. Looks like https://github.com/dnephin/dobi/blob/master/tasks/job/remove.go#L14 answers part of my previous question. The intent of JOB:rm is to remove both the use container and any artifacts.

What about dependencies?

@dnephin dnephin mentioned this issue Sep 23, 2016
@dnephin
Copy link
Owner

dnephin commented Sep 23, 2016

Looks like it is mistakenly trying to target a container rather than the artifact. If I look into this and fix it,

It should remove both the artifact and the container. The warning on the missing container should be fixed by #15. Can you confirm if the artifact (the files) were removed correctly?

I'm assuming that the binary:rm shouldn't cascade down to the builder image and rm that as well, right?

Correct, it would be good to add builder:rm to that example I think.

What should the appropriate action be since there is no artifact? A no op?

Correct, and with #15 that should be the case.

Do we maybe need an :rm-all job task that does recurse into images used by the job and removes them?

I've been thinking about something like that. One idea I had was to create a built-in task called auto-clean which would would run rm on every resource, but that might be too aggresive in some cases.

alias:rm will run :rm for all the resources it has listed, so it could be used to run the a bunch of cleanup from a single command.

I think I'd like to avoid having :rm remove dependencies by default. I've found it useful to be able to run job:rm to cleanup a stray container, or the artifact, without losing the image.

For now, I hope that alias:rm works to cleanup batches of resources, and I've opened #16 to document the existing options and list the potential additions.

@deinspanjer
Copy link
Author

I'm trying to verify this, but unfortunately I'm still having trouble with building dobi. :/

The docker command got past the part that was failing before, but then died on this:

[run deps] glide install -> vendor/ Done
[run binary] script/build -> ./dist/bin/ Start
fatal: Not a git repository: ../.git/modules/dobi
[ERROR] Failed to execute task "binary:run": Exited with non-zero status code 128

One other odd thing I noted is after attempting to run that docker command, the image left in my docker has an unusual tag name:

dobi-dev dobi- 2a12bc7c711f 40 seconds ago 330.9 MB

So, I tried to run the released version of dobi in this cloned dobi repo to build the test branch you offered. That fails in the linter with this error:

[image:build linter] dobi-linter Created
[run lint] Start
An error has occurred: FatalError: git failed. Is it installed, and are you in a Git repository directory?
Check the log at ~/.pre-commit/pre-commit.log
[ERROR] Failed to execute task "lint:run": Exited with non-zero status code 1

I copied the pre-commit.log file out of the container, and it had this:

An error has occurred: FatalError: git failed. Is it installed, and are you in a Git repository directory?
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/pre_commit/error_handler.py", line 47, in error_handler
yield
File "/usr/lib/python2.7/site-packages/pre_commit/main.py", line 143, in main
runner = Runner.create()
File "/usr/lib/python2.7/site-packages/pre_commit/runner.py", line 29, in create
root = git.get_root()
File "/usr/lib/python2.7/site-packages/pre_commit/git.py", line 23, in get_root
'git failed. Is it installed, and are you in a Git repository '
FatalError: git failed. Is it installed, and are you in a Git repository directory?

Unfortunately, I'm not sure at all where to go from here. I don't suppose there is any chance you use gitter.im or slack or hangouts or something and would be able to chat real quick to try to get me over this hump?

@dnephin
Copy link
Owner

dnephin commented Sep 23, 2016

I just created https://gitter.im/dnephin-dobi/Lobby

@deinspanjer
Copy link
Author

This problem was related to having my dobi repo as a submodule of another repo. The self building logic doesn't like that as it can't see the actual .git definition which is in the parent outside the build context.

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

2 participants