Skip to content
This repository has been archived by the owner on Jan 18, 2020. It is now read-only.

[JENKINS-53304] Mount volume on the whole /evergreen #207

Merged
merged 1 commit into from
Aug 29, 2018

Conversation

batmat
Copy link
Collaborator

@batmat batmat commented Aug 29, 2018

JENKINS-53304: Data loss when running on newly pulled version of the evergreen image

Without this, we lose data outside of /evergreen/jenkins/home when running a new container, because we were mounting only this directory. We now mount the whole /evergreen.

Reported originally by @jglick in the chat. Only took time to confirm it yesterday.

Without this, we lose data outside of /evergreen/jenkins/home
when running a new container.
docker run --name evergreen \
--restart=always \
-ti \
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is nice to allow 'ctrl-C' ing the docker run. (Though I think we'll want a -d after the alpha/beta testing phase).

Copy link
Contributor

Choose a reason for hiding this comment

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

Is it --tty or --interactive which handles SIGINT?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Generally, -t should be enough, but if you read moby/moby#2838 you'll see there're many possible combinations and the only way to have it (almost? :)) always working is using both.

Basically, if you just run, then ctrl-c, -t is enough. If you like it to work also when using docker attach, it wouldn't... 🤷‍♂️

docker run --name evergreen \
--restart=always \
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Nice to have so that Evergreen restarts with the host if restarted. A bit easier for our users, which I guess is the goal :)

Copy link
Contributor

Choose a reason for hiding this comment

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

What about --rm for people playing with Evergreen but who do not necessarily want it running constantly?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good question. I think using --rm would be a good practice for Docker usage in general, but unsure we should do it here. Users that are not Docker experts might be surprised to see their container go away when they shut it down. But well, we have the volume, so...

@@ -41,12 +41,13 @@ restarted if necessary.
.Starting Jenkins Evergreen
[source,bash]
----
mkdir $PWD/jenkins-home && \
docker volume create jenkins-evergreen-data && \
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Switching to using a volume as generally recommended to avoid all sorts of permission issues.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed.

Is there a simple way to move a jenkins-home predating this?

Copy link
Collaborator Author

@batmat batmat Aug 29, 2018

Choose a reason for hiding this comment

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

Depends on your definition of simple. Yes, there would be a way, though not sure we're at a stage where we should spend time of this.

I would probably basically run an evergreen container with bash (to get the right perms), just to move data around.
Something like, untested:

docker volume create jenkins-evergreen-data
docker run -v jenkins-evergreen-data:/evergreen -v $PWD/jenkins-home:/jenkins-home:ro  -ti jenkins/evergreen:docker-cloud bash

Then, initiate a copy from inside the container from /jenkin-home to /evergreen/jenkins/home. But again, not worth it's worth the hassle at this stage. I can help more if you're still willing to do it.

And for the /evergreen/jenkins/var part, you could probably docker cp the content...

@rtyler rtyler merged commit 2777610 into jenkins-infra:master Aug 29, 2018
@batmat batmat deleted the JENKINS-53304-data-loss branch August 29, 2018 14:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants