-
Notifications
You must be signed in to change notification settings - Fork 143
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
Test balena push with docker-compose using symlinks #2408
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
tests/test-data/projects/docker-compose/symbolic-links/.balena/balena.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
build-variables: | ||
global: | ||
- MY_VAR_1=This is a variable | ||
- MY_VAR_2=Also a variable | ||
services: | ||
service1: | ||
- SERVICE1_VAR=This is a service specific variable |
3 changes: 3 additions & 0 deletions
3
tests/test-data/projects/docker-compose/symbolic-links/.dockerignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
service1/test-ignore-from-actual-path.* | ||
service1-symlink/test-ignore-from-symlink-path.* | ||
**/.dockerignore |
16 changes: 16 additions & 0 deletions
16
tests/test-data/projects/docker-compose/symbolic-links/docker-compose.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
version: '2' | ||
volumes: | ||
resin-data: | ||
services: | ||
service1: | ||
volumes: | ||
- 'resin-data:/data' | ||
build: ./service1-symlink | ||
service2: | ||
volumes: | ||
- 'resin-data:/data' | ||
build: | ||
context: ./service2 | ||
dockerfile: Dockerfile-alt | ||
args: | ||
- 'COMPOSE_ARG=an argument defined in the docker-compose.yml file' |
1 change: 1 addition & 0 deletions
1
tests/test-data/projects/docker-compose/symbolic-links/service1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../symlink-fixtures/service1/ | ||
1 change: 1 addition & 0 deletions
1
tests/test-data/projects/docker-compose/symbolic-links/service2/.dockerignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
**/file1.sh |
1 change: 1 addition & 0 deletions
1
tests/test-data/projects/docker-compose/symbolic-links/service2/Dockerfile-alt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
FROM busybox |
2 changes: 2 additions & 0 deletions
2
tests/test-data/projects/docker-compose/symbolic-links/service2/src/file1.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
line1 | ||
line2 |
3 changes: 3 additions & 0 deletions
3
tests/test-data/projects/docker-compose/symlink-fixtures/service1/Dockerfile.template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM balenalib/%%BALENA_MACHINE_NAME%%-alpine | ||
COPY ./file1.sh / | ||
CMD i=1; while :; do echo "service1 $i $(uname -a)"; sleep 10; i=$((i+1)); done |
2 changes: 2 additions & 0 deletions
2
tests/test-data/projects/docker-compose/symlink-fixtures/service1/file1.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
line1 | ||
line2 |
1 change: 1 addition & 0 deletions
1
...t-data/projects/docker-compose/symlink-fixtures/service1/test-ignore-from-actual-path.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
test-ignore |
1 change: 1 addition & 0 deletions
1
...-data/projects/docker-compose/symlink-fixtures/service1/test-ignore-from-symlink-path.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
test-ignore |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Build is failing on Windows with:
It rings a bell that Windows doesn't play nicely with soft links, however out of the 5 existing tests that touch the
dockerignore2
test project that uses soft links, I think only one is currently being skipped on Windows:push
: https://github.com/balena-io/balena-cli/blob/v12.55.4/tests/commands/push.spec.ts#L355push
: https://github.com/balena-io/balena-cli/blob/v12.55.4/tests/commands/push.spec.ts#L412tarDirectory
: https://github.com/balena-io/balena-cli/blob/v12.55.4/tests/utils/tarDirectory.spec.ts#L92tarDirectory
: https://github.com/balena-io/balena-cli/blob/v12.55.4/tests/utils/tarDirectory.spec.ts#L147So maybe some investigation on how come that 4 other tests don't need to be skipped on Windows (maybe they don't really exercise the soft link aspect?) before skipping this test on Windows as well.
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.
tarDirectory
: https://github.com/balena-io/balena-cli/blob/v12.55.4/tests/utils/tarDirectory.spec.ts#L147This is the one that is completely skipped on Windows:
push
: https://github.com/balena-io/balena-cli/blob/v12.55.4/tests/commands/push.spec.ts#L355This test is not skipped but it cheats :-) with:
push
: https://github.com/balena-io/balena-cli/blob/v12.55.4/tests/commands/push.spec.ts#L412tarDirectory
: https://github.com/balena-io/balena-cli/blob/v12.55.4/tests/utils/tarDirectory.spec.ts#L92I think these 3 tests pass on Windows because
git clone
on Windows makes a real copy of the file that is pointed to by the symlink.So, I think it would be fair to skip this
test-data/projects/docker-compose/symbolic-links/service1
test case on Windows, for example with theitSkipWindows
trick.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.
Looks like it's related to symlinks to folders on windows 🤔
I will skip it for now since I don't have the bandwith to further investigate this, and it already adds value as is.
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.
Oh wait, this might actually be a balena-lint bug :)
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 don't think so, the balena-lint issue was caused by the commit that added the
itNoWin
call.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.
This might work, based on the comments in that issue of
glob
:See: balena-io-modules/node-balena-lint#82
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.
Agrrrrr. I now fails is the
test:source
step.Should I just drop the tests to get this fixed sooner than later?
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.
See: #2410
And I will leave this PR having only the test case, just in case someone has the patience to fix them for Windows...
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.
Before dropping the tests, how about:
service1
soft link to the git repo.fs.symlink
that you had suggested in Flowdock.itNoWin
to the test case so that the soft link is never created on Windows.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.
During my research I saw ppl facing such issues when creating symlinks as well, but at this point it sounds more promising than the committed one. I will add a reminder for later this week.
Note for self:
See: balanced-mt/serverless-plugin-typescript@0f57f0c