Skip to content

ROX-14082: Create test files and symlinks from code #1039

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

Merged
merged 1 commit into from
Dec 22, 2022

Conversation

msugakov
Copy link
Contributor

@msugakov msugakov commented Dec 21, 2022

Create test files and symlinks from code instead of static files.

One of them being an absolute link breaks Cachito with the following error:

Image build failed. Error in plugin resolve_remote_source: Cachito request is in "failed" state, reason: The destination of 'pkg/analyzer/nodes/testdata/rootfs-rhcos/etc/redhat-release' is outside of cloned repository. Request 576595 (https://cachito.engineering.redhat.com/api/v1/requests/576595/logs) tried to get repo 'https://github.com/stackrox/scanner.git' at reference '3432ef813ebc20a007d185a ..

Testing

I compared the contents of former testdata

Details
$ pwd
~/go/src/github.com/stackrox/scanner/pkg/analyzer/nodes/testdata

$ find . -ls
15663909 4 drwxrwxr-x 5 misha misha 4096 Dez 7 16:47 .
15680130 4 drwxrwxr-x 3 misha misha 4096 Dez 7 16:47 ./rootfs-rhcos-rel-symlink
15607600 4 -rw-rw-r-- 1 misha misha 5 Dez 7 16:47 ./rootfs-rhcos-rel-symlink/release
15607429 4 -rw-rw-r-- 1 misha misha 356 Dez 7 16:47 ./rootfs-rhcos-rel-symlink/README.md
15680131 4 drwxrwxr-x 2 misha misha 4096 Dez 7 16:47 ./rootfs-rhcos-rel-symlink/etc
15607447 0 lrwxrwxrwx 1 misha misha 10 Dez 7 16:47 ./rootfs-rhcos-rel-symlink/etc/redhat-release -> ../release
15680132 4 drwxrwxr-x 4 misha misha 4096 Dez 7 16:47 ./rootfs-rhcos
15607609 4 -rw-rw-r-- 1 misha misha 366 Dez 7 16:47 ./rootfs-rhcos/README.md
15680134 4 drwxrwxr-x 3 misha misha 4096 Dez 7 16:47 ./rootfs-rhcos/usr
15680135 4 drwxrwxr-x 2 misha misha 4096 Dez 7 16:47 ./rootfs-rhcos/usr/lib
15607617 4 -rw-rw-r-- 1 misha misha 45 Dez 7 16:47 ./rootfs-rhcos/usr/lib/system-release
15680133 4 drwxrwxr-x 2 misha misha 4096 Dez 7 16:47 ./rootfs-rhcos/etc
15607615 0 lrwxrwxrwx 1 misha misha 23 Dez 7 16:47 ./rootfs-rhcos/etc/redhat-release -> /usr/lib/system-release
15663910 4 drwxrwxr-x 3 misha misha 4096 Nov 16 10:04 ./rootfs-foo
15663911 4 drwxrwxr-x 2 misha misha 4096 Nov 16 10:04 ./rootfs-foo/etc
15611049 4 -rw-rw-r-- 1 misha misha 64 Nov 16 10:04 ./rootfs-foo/etc/redhat-release

with the content in the temporary directory

Details
$ cd /tmp/Test_filesMap_Get2979970761/001
$ find . -ls
 14524458      4 drwxrwxr-x   5 misha    misha        4096 Dez 21 22:04 .
 14524484      4 drwxr-xr-x   3 misha    misha        4096 Dez 21 22:04 ./rootfs-rhcos-rel-symlink
 14418556      4 -rw-r--r--   1 misha    misha           5 Dez 21 22:04 ./rootfs-rhcos-rel-symlink/release
 14524527      4 drwxr-xr-x   2 misha    misha        4096 Dez 21 22:04 ./rootfs-rhcos-rel-symlink/etc
 14418545      0 lrwxrwxrwx   1 misha    misha          10 Dez 21 22:04 ./rootfs-rhcos-rel-symlink/etc/redhat-release -> ../release
 14524469      4 drwxr-xr-x   4 misha    misha        4096 Dez 21 22:04 ./rootfs-rhcos
 14524471      4 drwxr-xr-x   3 misha    misha        4096 Dez 21 22:04 ./rootfs-rhcos/usr
 14524476      4 drwxr-xr-x   2 misha    misha        4096 Dez 21 22:04 ./rootfs-rhcos/usr/lib
 14418504      4 -rw-r--r--   1 misha    misha          45 Dez 21 22:04 ./rootfs-rhcos/usr/lib/system-release
 14524470      4 drwxr-xr-x   2 misha    misha        4096 Dez 21 22:04 ./rootfs-rhcos/etc
 14418503      0 lrwxrwxrwx   1 misha    misha          23 Dez 21 22:04 ./rootfs-rhcos/etc/redhat-release -> /usr/lib/system-release
 14524467      4 drwxr-xr-x   3 misha    misha        4096 Dez 21 22:04 ./rootfs-foo
 14524468      4 drwxr-xr-x   2 misha    misha        4096 Dez 21 22:04 ./rootfs-foo/etc
 14418449      4 -rw-r--r--   1 misha    misha          64 Dez 21 22:04 ./rootfs-foo/etc/redhat-release

and found that symlinks look right.

instead of static files. One of them being an absolute link breaks
Cachito with the following error:

```
Image build failed. Error in plugin resolve_remote_source: Cachito request is in "failed" state, reason: The destination of 'pkg/analyzer/nodes/testdata/rootfs-rhcos/etc/redhat-release' is outside of cloned repository. Request 576595 (https://cachito.engineering.redhat.com/api/v1/requests/576595/logs) tried to get repo 'https://github.com/stackrox/scanner.git' at reference '3432ef813ebc20a007d185a ..
```
@msugakov msugakov requested a review from RTann December 21, 2022 21:14
@ghost
Copy link

ghost commented Dec 21, 2022

Images are ready for the commit at 63bc8a3.

To use the images, use the tag 2.27.x-13-g63bc8a3775.

@msugakov msugakov merged commit a0e7c00 into master Dec 22, 2022
@msugakov msugakov deleted the misha/ROX-14083-insource-symlinks branch December 22, 2022 10:23
msugakov added a commit to stackrox/stackrox that referenced this pull request Dec 22, 2022
This is to make stackrox/scanner#1039 change
visible by Cachito so that it stops erroring out our downstream
builds.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants