Repository navigation
hack/env: mount a volume for /tmp - #15770
Conversation
|
/assign @stevekuznetsov @smarterclayton |
|
/unassign @jhadvig @fabianofranz |
|
@stevekuznetsov grr, it looks like hack/build-rpm-release and other scripts run make clean before copying the tito artifacts over. |
|
TMPDIR is supposed to be set by the automation to wherever tmpdir content should go. Changing where it is in the image is not necessary. |
|
@stevekuznetsov latest update instead just updates the release image TMPDIR to be $WORKDIR/tmp Testing this now, but I am a bit worried that there may be some files left over that would cause problems with some of the verify tests. |
| git config --system user.email [email protected] | ||
|
|
||
| WORKDIR /go/src/github.com/openshift/origin | ||
| WORKDIR $WORKDIR |
There was a problem hiding this comment.
I'm not sure why you would parameterize workdir - that's not something that images expect to change, and we already have knobs for this.
I guess I'd ask - why are you changing the images?
There was a problem hiding this comment.
The main reason I did this was to put WORKDIR to avoid repetition with putting TMPDIR under WORKDIR, since WORKDIR is the directory where the volume is mounted.
There was a problem hiding this comment.
Currently, BASETMPDIR is set to "${TMPDIR:-/tmp}/openshift/${sub_dir}", which when using hack/env is currently being set by the release image as /openshifttmp.
Updating the images seemed like the path of least resistance without causing changes to users running the scripts locally that may not want their TMPDIR location overriden.
f2055c0 to
3e9a8bf
Compare
|
Users don't/shouldn't control the TMPDIR location, that's under control of
whoever is launching the image. The TMPDIR inside the container has
nothing to do with the TMPDIR outside the container, and hack/env controls
that mapping.
I don't think anything in the images needs to be changed, but hack/env
should probably be setting TMPDIR to a value that corresponds to wherever
it is mounting a volume that is supposed to be backed by tmp.
…On Mon, Aug 14, 2017 at 9:58 PM, OpenShift Merge Robot < ***@***.***> wrote:
Labelling this PR as size/M
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#15770 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABG_pyboQgc_JYzE1Hp7G3ud0GF8WSEGks5sYPs8gaJpZM4O2yOM>
.
|
|
@smarterclayton are you suggesting a second volume for the tmpdir or just removing the setting of TMPDIR from the release image and setting it in hack/lib/build/environment instead? |
|
@smarterclayton updated to set TMPDIR within hack/env rather than in the image, ptal. |
| tar -cf - "${excluded[@]}" . | docker cp - "${container}:${workingdir}" | ||
| fi | ||
|
|
||
| local tmpdir="$(docker inspect -f '{{ range .Config.Env }}{{ if eq (index (split . "=") 0) "TMPDIR" }}{{ index (split . "=") 1 }}{{ end }}{{end}}' ${container})" |
There was a problem hiding this comment.
Why does TMPDIR have to exist? I'm really confused here.
The original reason TMPDIR in the image is /openshifttmp is because old versions of docker set a 64mb limit on it, which is far too small for tmp output. If that's fixed in docker now, we can simply remove that setting and restore it to the default of /tmp.
If there is still a limit, then we want to mount a reasonable TMPDIR in, in which case we don't care where on the FS is inside the container or what the container thinks the dir is. We just want to create a volume and mount it to /tmp and set TMPDIR to /tmp. No need to do this reading, or to make it fall within _output.
There was a problem hiding this comment.
Why does TMPDIR have to exist? I'm really confused here.
In this case, simply because I am trying to set it under the existing volume that we create and mount at $workingdir
The original reason TMPDIR in the image is /openshifttmp is because old versions of docker set a 64mb limit on it, which is far too small for tmp output. If that's fixed in docker now, we can simply remove that setting and restore it to the default of /tmp.
It looks like this is no longer the case, but it appears that /tmp exists on the container fs, which would still have the potential of running out of disk space, since the default is 10G.
If there is still a limit, then we want to mount a reasonable TMPDIR in, in which case we don't care where on the FS is inside the container or what the container thinks the dir is. We just want to create a volume and mount it to /tmp and set TMPDIR to /tmp. No need to do this reading, or to make it fall within _output.
Sounds good, I'll go ahead and fix this up to just create a separate volume and bind mount it to /tmp
|
|
||
| # Create the volume for tmp | ||
| os::log::debug "Creating tmp volume ${OS_BUILD_ENV_VOLUME}-tmp" | ||
| docker volume create --name "${OS_BUILD_ENV_VOLUME}-tmp" > /dev/null |
There was a problem hiding this comment.
Do we care to reuse these so there isn't churn?
There was a problem hiding this comment.
yeah, reuse would be preferred
There was a problem hiding this comment.
Ok, I'll update to re-use
|
@stevekuznetsov @smarterclayton I think this should be ready to go now. |
| os::log::debug "Creating volume ${OS_BUILD_ENV_TMP_VOLUME}" | ||
| docker volume create --name "${OS_BUILD_ENV_TMP_VOLUME}" > /dev/null | ||
| fi | ||
| additional_context+=" -v ${OS_BUILD_ENV_TMP_VOLUME}:/tmp" |
There was a problem hiding this comment.
Indentation oopsie?
| } | ||
| readonly -f os::build::environment::withsource | ||
|
|
||
| function os::build::environment::volume_name(){ |
There was a problem hiding this comment.
we put spaces between () and {
|
|
||
| if docker volume inspect "${volume}" >/dev/null 2>&1; then | ||
| os::log::debug "Removing volume ${volume}" | ||
| docker volume rm "${volume}" |
There was a problem hiding this comment.
Is this going to spit out the volume name on success and if so >/dev/null
There was a problem hiding this comment.
Indeed and it looks like it did previously as well, fixed now.
| fi | ||
| volume="$( echo "${volume}" | tr '[:upper:]' '[:lower:]' )" | ||
| export OS_BUILD_ENV_VOLUME="${volume}" | ||
| export OS_BUILD_ENV_VOLUME="$( os::build::environment::volume_name "origin-build" "${commit}" "${OS_BUILD_ENV_REUSE_VOLUME:-}" )" |
There was a problem hiding this comment.
Don't mix scoping statements and subshells.
export VAR; VAR="$()"|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: detiber, stevekuznetsov The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
|
/test cmd |
|
Looks like cmd test flake is related to: #13944 |
|
/test all [submit-queue is verifying that this PR is safe to merge] |
|
Automatic merge from submit-queue (batch tested with PRs 13379, 15770, 15832, 15839, 15746) |
Somewhat related to: #15573
This change creates and mounts a volume to use for /tmp when running hack/env