-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Add 'MissingSecret' reason for pending builds #8792
Conversation
@bparees @smarterclayton PTAL |
// When build is in pending state due to missing pull secrets for the image | ||
// indicate this condition in reason. | ||
if secret := build.Spec.Output.PushSecret; secret != nil { | ||
if bc.SecretClient.Secrets(build.Namespace).Get(secret.Name); err != nil && errors.IsNotFound(err) { |
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.
how often is this going to get called? you should probably not fetch the secrets if the reason is already set to status missing secret.
// StatusReasonMissingSecret indicates that the build is missing required | ||
// secret for pushing the output image. The build will stay in the pending | ||
// state until the secret is not created or the build timeout. | ||
StatusReasonMissingSecret = "MissingSecret" |
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.
MissingPushSecret unless we're going to reuse this for missing source secrets and missing pull secrets.
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.
@bparees it would be nice to re-use it, do you want to create special reason for each secret or have one generic?
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.
it's more informative to the user if it's specific to which secret is missing.
@smarterclayton @bparees fixed && rebased PTAL [test] |
@bparees @smarterclayton updated. |
|
||
// StatusReasonMissingPushSecret indicates that the build is missing required | ||
// secret for pushing the output image. The build will stay in the pending | ||
// state until the secret is not created or the build timeout. |
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.
"The build will stay in the pending state until the secret is created, or the build times out."
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.
fixed.
42cb57b
to
e9670ec
Compare
@bparees ptal |
nextStatus = buildapi.BuildPhaseRunning | ||
case kapi.PodPending: | ||
nextStatus = buildapi.BuildPhasePending |
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.
needs to set build.Status.Reason="" first, to ensure the old reason (if any) is cleared, if we change the state to pending and do not have a pushsecret issue.
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.
yeah, but it will also interfere with the check of the reason is StatusReasonMissingPushSecret to skip the secret fetching... I cached the original reason, so it should be fine now.
Evaluated for origin test up to ba73984 |
continuous-integration/openshift-jenkins/test FAILURE (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/5539/) |
lgtm but you appear to have some test issues. |
[merge] |
continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/5649/) (Image: devenv-rhel7_4495) |
[merge] |
Evaluated for origin merge up to ba73984 |
Fixes: #6781
When you have a build configuration and you pushing to a private repository in external registry and you set the push secret but the push secret does not exists, we should set the reason for the build to be in the pending state.
This PR will add 'MissingSecret' reason for such build. This will be displayed next to 'Pending'.