-
Notifications
You must be signed in to change notification settings - Fork 311
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
Partial implementation of artifacts for test command #4302
Conversation
Code changes LGTM. About the failing build I have no suggestions yet, but I've done some initial tests, so far so good, only one odd behaviour perhaps with the following scenario, I think due to cache, when exporting artifacts, it also includes previous ones. For example: test:
unit:
context: unit
artifacts:
- /
commands:
- name: Run unit tests
command: mkdir report && echo hola > report/hola.txt && echo ciao > report/ciao.txt okteto test
# i Using ******@ ***** as context
# i 'go-getting-started' was already deployed. To redeploy run 'okteto deploy'
# i Executing 'unit'
ls -la .okteto-output
drwx------ 4 andrea staff 128 20 May 22:31 .
drwxr-xr-x 19 andrea staff 608 20 May 22:31 ..
-rw-r--r-- 1 andrea staff 5 20 May 09:26 hola.txt
drwxr-xr-x 4 andrea staff 128 20 May 22:28 report
ls -la .okteto-output/report
drwxr-xr-x 4 andrea staff 128 20 May 22:28 .
drwx------ 4 andrea staff 128 20 May 22:31 ..
-rw-r--r-- 1 andrea staff 5 20 May 22:28 ciao.txt
-rw-r--r-- 1 andrea staff 5 20 May 22:28 hola.txt then modify test:
unit:
context: unit
artifacts:
- /
commands:
- name: Run unit tests
command: mkdir report && echo hola > report/hola2.txt && echo ciao > report/ciao2.txt Run again and observe the duplicates: okteto test
# i Using ******@ ***** as context
# i 'go-getting-started' was already deployed. To redeploy run 'okteto deploy'
# i Executing 'unit'
ls -la .okteto-output
drwx------ 4 andrea staff 128 20 May 22:38 .
drwxr-xr-x 19 andrea staff 608 20 May 22:37 ..
-rw-r--r-- 1 andrea staff 5 20 May 09:26 hola.txt
drwxr-xr-x 6 andrea staff 192 20 May 22:38 report
ls -la .okteto-output/report
drwxr-xr-x 6 andrea staff 192 20 May 22:38 .
drwx------ 4 andrea staff 128 20 May 22:38 ..
-rw-r--r-- 1 andrea staff 5 20 May 22:28 ciao.txt
-rw-r--r-- 1 andrea staff 5 20 May 22:38 ciao2.txt
-rw-r--r-- 1 andrea staff 5 20 May 22:28 hola.txt
-rw-r--r-- 1 andrea staff 5 20 May 22:38 hola2.txt If I use this to export test reports, especially for HTML based reports, it's very likely that this could be an issue. WDYT? |
I think exporting only on success is okay for this iteration. I don't think buildkit will help, we would need to always return success at the buildkit level and manage the error on our side. |
Should we support something like what CircleCI does to export it to a custom local path:
I think it's ok to have a default destination but I think the user could want to export to a specific file that is already in the |
Tested and working correctly. Also tested removing a file and checked if the cache would regenerate the file. So despite of the question that I asked I think the code and behaviour is ok |
If we want to have buildkit and the concept of containerization abstracted away from the user, path/destination doesn't really mean anything. I think it makes sense if we want to expose (conceptually) that the execution context is not the user's filesystem. Given that we already have "context" in the test manifest and that we do document how tests and remote deploy works, we are already in the path of not hiding it away so I would add it 👌 |
Yeah, agree that's the way to go. It will have an impact on buildkit metrics tho since once we change this all builds will succeed |
@andreafalzetti Looking at it in more detail, I think that's the expected behavior. If you add an I think the "issue" is that when files are exported, buildkit is smart enough to merge the local filesystem with the exported files. I think it's acceptable, if user don't want this they can nuke the folder before running |
54e2ebb
to
d4b084c
Compare
PR is good to go. New changes:
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4302 +/- ##
==========================================
+ Coverage 43.07% 43.11% +0.04%
==========================================
Files 370 371 +1
Lines 30020 30045 +25
==========================================
+ Hits 12931 12954 +23
+ Misses 15966 15964 -2
- Partials 1123 1127 +4 |
@maroshii we don't rely on buildkit for metrics, the build status is reported by the Okteto CLI. We would also have control on the metrics generated by failed builds |
@maroshii could you explain the new syntax with a few samples if needed? |
as discussed offline, with the latest changes in this PR, the logs of the test commands are not visibile. Example
With
With this build:
|
@pchico83 will do. We still need to update the docs with everything new we added besides this and the latest changes. PRs are in place but postponing until we are feature complete |
b8761e2
to
88b88e1
Compare
88b88e1
to
a98bce5
Compare
@andreafalzetti thanks for report this. It was indeed a regression. The error was that when no artifacts were defined, there were no Now, we save the cachekey value in a file and include it no the final image if no artifacts are defined, which ensures the runner image is always considered in builds. Fixed here: a98bce5 |
Proposed changes
Adds
artifacts
to test command that allows to export files to the local file system after buildkit execution:The above manifest will export the following the local filesystem:
Open Questions
.okteto-output
or do we rather just right relative to the cwd?This was marked as a partial implementation because it only works for successful builds. If the build fails nothing will get written. I'm not sure if buildkit has a way to export regardless of failure but this is still a big unknown for this feature. The docs for local export has no info on this and assumes that the build succeeds. I'll keep investigating cc @pchico83