Skip to content
This repository has been archived by the owner on Jul 17, 2023. It is now read-only.

oci: Fix multiple srcs, hardlink accros device #75

Merged
merged 3 commits into from
Jun 4, 2021

Conversation

elthariel
Copy link
Contributor

@elthariel elthariel commented Jun 3, 2021

This PR enables having multiple files in the srcs param. Without it, the whole list is treated as a single argument to mv and it fails with a file not found error.

Also, if you ever happen to have you code on a different fs than /tmp (tmpfs anyone?), the oci build breaks when using a base image, because of the usage of hardlinks. This PR makes this specific tmp folder location configurable.

@elthariel elthariel changed the title oci: Fix multiple srcs support oci: Fix multiple srcs, hardlink accros device Jun 3, 2021
@tobyfielding1
Copy link
Contributor

tobyfielding1 commented Jun 4, 2021

Thanks for these fixes @elthariel !. @Tatskaari do you think the tempdir config belongs in [buildenv] or should it be [buildconfig] with a CONFIG.get(), or doesn't it really matter?

@Tatskaari
Copy link
Member

I think it would make more sense to do:

[BuildConfig]
oci-tmpdir = ...

And handle this in the build language rather than bash.

@elthariel
Copy link
Contributor Author

So this is really a specific edge case and it's only used for one tmpdir, so that's why I haven't spent too much time there, but I'll do as you suggest

@elthariel
Copy link
Contributor Author

I've added it both the build rule argument with a default from the config, as it seems to be the common way to do this

@@ -1,7 +1,8 @@
def container_image(
name:str, base_image='', transitive_base_images=[], srcs=[],image='', version='', dockerfile='',
containerfile='', entrypoint=[], cmd=[], repo=CONFIG.get('DEFAULT_DOCKER_REPO', ''),
labels=[], run_args:str='', push_args:str='', test_only=False, visibility:list=None
oci_tmpdir=CONFIG.get('OCI_TMPDIR', '/tmp'), labels=[], run_args:str='', push_args:str='',
Copy link
Contributor

@tobyfielding1 tobyfielding1 Jun 4, 2021

Choose a reason for hiding this comment

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

I see why you've done it but I would avoid having this in the arguments. It belongs in plzconfig only I think, as its to do with the platform, people with different tempdirs should ALWAYS be able to pull someone else's code and use the same rule in the same way, instead of relying on that field not being set in the build rule.

Copy link
Contributor Author

@elthariel elthariel Jun 4, 2021

Choose a reason for hiding this comment

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

I hear you, I thought about it afterward but got lazy. thanks for keeping me on the right path :)

@tobyfielding1
Copy link
Contributor

Thanks, lgtm, over to you @Tatskaari

Copy link
Member

@Tatskaari Tatskaari left a comment

Choose a reason for hiding this comment

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

Sweet thanks for that :)

@Tatskaari Tatskaari merged commit 40bdc23 into thought-machine:master Jun 4, 2021
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