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
feat: Add exit code as output variable #2111
feat: Add exit code as output variable #2111
Conversation
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.
Amazing work so far! This looks pretty thorough. I just have some initial comments and I'll ask you to write some tests for this
@@ -86,6 +89,37 @@ func (d *DockerExecutor) GetOutputStream(containerID string, combinedOutput bool | |||
return reader, nil | |||
} | |||
|
|||
func (d *DockerExecutor) GetExitCode(containerID string) (int32, error) { | |||
cmd := exec.Command("docker", "inspect", containerID, "--format='{{.State.ExitCode}}'") | |||
log.Info(cmd.Args) |
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 think this can be removed
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.
You mean logging the command args ?
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.
Either removing it or making it Debug
and adding context to it would work. Maybe something like
log.Info(cmd.Args) | |
log.Debug("Exit code docker command args", cmd.Args) |
Also seems like you need to run |
- update OpenAPI spec, Go Outputs model and TS Outputs model - add an "exit-code-output-variable" example - implement "GetExitCode(containerID string) (int32, error)" for all executors
159ac94
to
4711ef7
Compare
I see there is a generated class, a mock, that is not up to date with the interface it mocks. I edited it manually the first time, which is wrong. :) |
Hi @rdigiorgio nice catch! I have updated the mock for you, and will make a PR to make sure it gets updated with |
Codecov Report
@@ Coverage Diff @@
## master #2111 +/- ##
==========================================
- Coverage 11.62% 11.60% -0.02%
==========================================
Files 84 84
Lines 32871 32932 +61
==========================================
+ Hits 3820 3821 +1
- Misses 28525 28584 +59
- Partials 526 527 +1
Continue to review full report at Codecov.
|
Ok @simster7 thanks. Which part should be tested ?
|
Hi @rdigiorgio. So sorry for the delay in reviewing this. I tried to run this locally, but it didn't work. I think the issue is here: It seems that you are trying to compare the docker hash, which from the wait container logs is just a hashstring:
directly with a full container ID, which contains additional characters:
Perhaps change the line to use In light of this, could you please make sure that the exit code scrapers work with all executors?
The test could be a simple as an E2E test showing that the exit code gets saved to its corresponding location in Thanks so much for all this work! Looking forward to your changes |
@rdigiorgio Do you think you'll have time to finish this PR? We would love to get this merged! |
Very excited about this functionality @rdigiorgio. Great work! |
@rdigiorgio one more gentle ping 🙂. If anyone from the community is interested in taking this up, let me know. |
I am sorry, I am currently not able to spend time on this nor anything else than work for the moment. :( |
No worries at all @rdigiorgio, I can take over this PR for you. You will still get the commit credit for this work. All the best and stay safe! |
SonarCloud Quality Gate failed. 0 Bugs |
Closes #1773
Checklist:
"fix(controller): Updates such and such. Fixes #1234"
.