-
Notifications
You must be signed in to change notification settings - Fork 5
Implement globbing for script_dirs #17
base: main
Are you sure you want to change the base?
Conversation
327bd04
to
36b7efc
Compare
@@ -35,7 +36,8 @@ def __init__(self, name, image_resource={"type": "registry-image", "source": {"r | |||
self.init_dirs[os.path.basename(dir)] = dir | |||
else: | |||
for key, script in script_dirs.items(): | |||
self.init_dirs[key] = os.path.abspath(os.path.join(dirname, script)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it a bit confusing that glob only work if you do not a use a list? Is there a reason?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right. I should implement that as well. But I didn't implement it because we haven't decided if we want to go with the globbing approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can go that way. AFAIK, I was the only one promoting the other way, right :) The only think is, that this approach is not compatible, so we would have to change our pipelines. Otherwise, we might end up with binaries in the pipeline, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If implemented globbing for script_dirs list in 36b7efc.
As there is no option for the user to specify a key, the key will be created by:
- using the dirname if no specific/direct file is specified (e.g. glob or directory)
- Example:
test
fortest/*.yaml
ortest
fortest/
- Example:
- using the specified file as key (e.g.
test.yaml
)- Example:
test.yaml
fortest.yaml
ortest/test.yaml' for
test/test.yaml`
- Example:
@@ -109,8 +107,13 @@ def filter(tarinfo): | |||
return tarinfo | |||
|
|||
for dir_concourse, dir_local in init_dirs: | |||
dir_local = os.path.abspath(dir_local) | |||
tar.add(dir_local, arcname=dir_concourse, filter=filter) | |||
if isinstance(dir_local, list): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
globed
is a list?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, because it can contain multiple files.
@Haegi Did I get it right - if you want several files, you need something like |
@c0d1ngm0nk3y Unfortunately, the python |
I've found out that
@c0d1ngm0nk3y What's your opinion on how we should continue? |
Sounds good to me. I doubt that it will be a problem. But if, we can tackle it then… |
Co-authored-by: Benjamin Haegenlaeuer <[email protected]>
Is this PR mixing two concerns?
Why do it in one PR? If we do it in one PR, we should transform the list into an object instead of having multiple Lets sort this out in a call. |
Fixes #15
This would be a globbing approach to make the
script_dirs
parameter more configurable.Example
Pipeline
Output