-
Notifications
You must be signed in to change notification settings - Fork 197
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(cli): Provide more details when scan job fails #328
Conversation
Codecov Report
@@ Coverage Diff @@
## main #328 +/- ##
==========================================
+ Coverage 65.70% 66.02% +0.32%
==========================================
Files 57 57
Lines 2799 2820 +21
==========================================
+ Hits 1839 1862 +23
+ Misses 720 718 -2
Partials 240 240
Continue to review full report at Codecov.
|
4853f1b
to
9df2360
Compare
Resolves: #70 Signed-off-by: Daniel Pacak <pacak.daniel@gmail.com>
9df2360
to
8fd54e5
Compare
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.
One tiny question but otherwise LGTM
pkg/kube/pod/manager.go
Outdated
@@ -159,7 +160,10 @@ func (pw *Manager) GetPodByJob(ctx context.Context, job *batch.Job) (*core.Pod, | |||
if err != nil { | |||
return nil, err | |||
} | |||
return &podList.Items[0], nil | |||
if len(podList.Items) > 0 { |
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.
Any chance podList can be nil?
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.
In theory if there's no error it won't be nil. However, we're practitioners so I added nil check to the podList 🤣
Signed-off-by: Daniel Pacak <pacak.daniel@gmail.com>
It might happen that a scan job cannot be created. In such cases Starboard CLI hangs forever because it watches the job's status to terminate (JobComplete or JobFailed). However, some failures are reported as Kubernetes events associated with the scan job.
This change adds the events informer to watch events associated with a scan job, and terminate the program when the event of type EventTypeWarning (= error for Kubernetes) is detected.
To reproduce you can delete the starboard service account in the starborad namespace:
Before
After
Resolves: #70
Signed-off-by: Daniel Pacak pacak.daniel@gmail.com