GoogleContainerTools / skaffold

Easy and Repeatable Kubernetes Development

Home Page:https://skaffold.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Strip multiple strings or, ideally, regex or glob from manual sync destination

simonstratmann opened this issue · comments

I have this sync configuration in my skaffold.yml:

      sync:
        hooks:
          before:
            - container:
                command: ["mkdir", "/test"]
        manual:
          - src: "*/target/classes/**/*.class"
            dest: "/test/"

A file moduleA/target/classes/A.class is copied to /test/moduleA/target/classes/A.class and a file moduleB/target/classes/B.class is copied to /test/moduleB/target/classes/B.class.

To keep the package structure for java intact they would need to be copied to /test/classes/A.class and /test/classes/B.class.

This seems to be impossible without adding an entry to the list for each submodule. It would be great if the strip value could be a regex or glob. That way the sync definition could be the same no matter in which project it's used and wouldn't need to be adapted if new modules are added.

It could look like this:

      sync:
        hooks:
          before:
            - container:
                command: ["mkdir", "/test"]
        manual:
          - src: "*/target/classes/**/*.class"
            dest: "/test/"
            strip: ".*/target/classes/"