Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sharing files from containers as Gitlab artifacts #3691

Closed
vladimir1980 opened this issue Aug 31, 2021 · 3 comments
Closed

Sharing files from containers as Gitlab artifacts #3691

vladimir1980 opened this issue Aug 31, 2021 · 3 comments

Comments

@vladimir1980
Copy link

Is there some best practice to expose for example junit.xml?

@distorhead
Copy link
Member

Hi! There are several methods.

  1. werf run command

    werf run --docker-options="-v $(pwd)/out:/out" -- cp /some/file /out
    
  2. Use --report-path option with werf build or werf converge command to get built docker image name. Then use docker cp command to copy target file into host:

    werf build --repo ... --report-path images.json
    id=$(docker create $(cat images.json  | jq -r .Images.worker.DockerImageName))
    docker cp $id:/some/file ./out/file
    docker rm $id
    
  3. Use werf stage image command to get built docker image name. Then use docker cp command to copy target file into host:

    id=$(docker create $(werf stage image worker))
    docker cp $id:/some/file ./out/file
    docker rm $id
    
  4. Use werf export command to create a final image with arbitrary name. Then use docker cp command to copy target file into host:

    werf export  --repo ... worker --tag "myregistry.org/project/worker:latest"
    id=$(docker create myregistry.org/project/worker:latest)
    docker cp $id:/some/file ./out/file
    docker rm $id
    

@ilya-lesikov
Copy link
Member

There is also werf kube-run with options for this:

      --copy-from=[]
            Copy file/dir from container to local machine after user command execution. Example: "/from/file:to". Can be specified multiple times. Can also be defined with "$WERF_COPY_FROM_*", e.g. "WERF_COPY_FROM_1=from:to".
      --copy-to=[]
            Copy file/dir from local machine to container before user command execution. Example: "from:/to/file". Can be specified multiple times. Can also be defined with "$WERF_COPY_TO_*", e.g. "WERF_COPY_TO_1=from:to".

@ilya-lesikov
Copy link
Member

ilya-lesikov commented May 31, 2024

We could've added something like --copy-from/to to werf converge as well. I'll open a new issue for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants