Skip to content
This repository was archived by the owner on Sep 4, 2024. It is now read-only.

Commit 4f3578a

Browse files
authoredOct 25, 2019
Merge pull request #125 from linosgian/fix-untar-dest-paths
Pass relative paths to Docker build context
2 parents 2b6c133 + 3f7ae76 commit 4f3578a

File tree

5 files changed

+34
-0
lines changed

5 files changed

+34
-0
lines changed
 

‎cmd/mistryd/end_to_end_test.go

+13
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,19 @@ func TestExitCode(t *testing.T) {
367367
assert(br.ExitCode, 77, t)
368368
}
369369

370+
func TestCopyDir(t *testing.T) {
371+
cmdout, cmderr, err := cliBuildJob("--json-result", "--project", "copy-folder")
372+
if err != nil {
373+
t.Fatalf("mistry-cli stdout: %s, stderr: %s, err: %#v", cmdout, cmderr, err)
374+
}
375+
br, err := parseClientJSON(cmdout)
376+
if err != nil {
377+
panic(err)
378+
}
379+
380+
assert(br.ExitCode, 0, t)
381+
}
382+
370383
func TestSameGroupDifferentParams(t *testing.T) {
371384
cmdout1, cmderr1, err := cliBuildJob("--project", "result-cache", "--group", "foo", "--", "--foo=bar")
372385
if err != nil {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM debian:stretch
2+
3+
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
4+
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
5+
6+
COPY koko/ /koko/
7+
WORKDIR /data
8+
9+
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
#HACK: mistry will attempt to copy all artifacts out of the container
3+
# Therefore we need to leave something behind. This might or might not be
4+
# the intented behaviour. Revisit in the future.
5+
touch /data/artifacts/foo
6+
stat /koko/lala.txt

‎cmd/mistryd/testdata/projects/copy-folder/koko/lala.txt

Whitespace-only changes.

‎pkg/utils/utils.go

+6
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ func Tar(root string) ([]byte, error) {
7474
return err
7575
}
7676

77+
// Preserve directory structure when docker "untars" the build context
78+
hdr.Name, err = filepath.Rel(root, path)
79+
if err != nil {
80+
return err
81+
}
82+
7783
err = tw.WriteHeader(hdr)
7884
if err != nil {
7985
return err

0 commit comments

Comments
 (0)
This repository has been archived.