Closed
Description
Which area this feature is related to?
/kind bug
Which area this bug is related to?
/area library
What versions of software are you using?
Go project
Operating System and version:
Fedora 38
Go Pkg Version:
- using commit devfile/library@8185c3a
- Go 1.19.6
Bug Summary
Describe the bug:
To Reproduce:
$ mkdir -p /tmp/bug-devfile-parser/parent
$ touch /tmp/bug-devfile-parser/parent/some-additional-file.txt
$ cat << EOF > /tmp/bug-devfile-parser/child-devfile.yaml
schemaVersion: 2.1.0
metadata:
name: child
parent:
uri: "parent/parent-devfile.yaml"
EOF
$ cat << EOF > /tmp/bug-devfile-parser/parent/parent-devfile.yaml
components:
- container:
image: quay.io/devfile/golang:latest
name: runtime
metadata:
name: my-go-app
schemaVersion: 2.1.0
EOF
Initialize a local Git repo to easily see the issue:
$ git init /tmp/bug-devfile-parser
$ git -C /tmp/bug-devfile-parser add -A
$ git -C /tmp/bug-devfile-parser commit -m "initial commit"
When parsing the child Devfile, we can see that the whole content of /tmp/bug-devfile-parser/parent/
has been copied into /tmp/bug-devfile-parser/
. I tested this by running main.go
:
# clean working tree before running the parser
$ git -C /tmp/bug-devfile-parser/ status
On branch main
nothing to commit, working tree clean
# Parsing the child Devfile
$ go run . /tmp/bug-devfile-parser/child-devfile.yaml
parsing devfile from /tmp/bug-devfile-parser/child-devfile.yaml
[...]
# dirty working tree
$ git -C /tmp/bug-devfile-parser/ status
On branch main
Untracked files:
(use "git add <file>..." to include in what will be committed)
parent-devfile.yaml
some-additional-file.txt
nothing added to commit but untracked files present (use "git add" to track)
Expected behavior
Maybe I missed something, but I don't understand why the directory content of the parent Devfile is being copied into the child directory.
Any logs, error output, screenshots etc? Provide the devfile that sees this bug, if applicable
Additional context
We ran into this issue in the odo
tests, where our local Git repos started to have untracked files every time we run our unit tests - see redhat-developer/odo#6539
This behavior seems to have been introduced in devfile/library#139