-
Notifications
You must be signed in to change notification settings - Fork 58
Default stable image stream from RELEASE_IMAGE_LATEST
#287
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,7 +21,15 @@ import ( | |
| const testSecretName = "test-secret" | ||
| const testSecretDefaultPath = "/usr/test-secrets" | ||
|
|
||
| // PodStepConfiguration allows other steps to reuse the pod launching and monitoring | ||
| // behavior without reimplementing function. It also enforces conventions like naming, | ||
| // directory structure, and input image format. More sophisticated reuse of launching | ||
| // pods should use RunPod which is more limited. | ||
| type PodStepConfiguration struct { | ||
| // SkipLogs instructs the step to omit informational logs, such as when the pod is | ||
| // part of a larger step like release creation where displaying pod specific info | ||
| // is confusing to an end user. Failure logs are still printed. | ||
| SkipLogs bool | ||
| As string | ||
| From api.ImageStreamTagReference | ||
| Commands string | ||
|
|
@@ -48,8 +56,9 @@ func (s *podStep) Inputs(ctx context.Context, dry bool) (api.InputDefinition, er | |
| } | ||
|
|
||
| func (s *podStep) Run(ctx context.Context, dry bool) error { | ||
| log.Printf("Executing %s %s", s.name, s.config.As) | ||
|
|
||
| if !s.config.SkipLogs { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This smells bad, why isn't this going to make for inscrutable logs that admins hate?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are pod steps called within jobs (where you want artifacts). The log output when you call these nested logs is more confusing - the step for "build release image" doesn't need to show
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The import from initial needs to run two pods, but the pods should never fail and the output of the nested pod within the import step is very confusing when reading it. Only the top most step matters in terms of you needing to understand what is happening.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added a long godoc on PodStepConfiguration to explain this, let me know if that helps clarify. |
||
| log.Printf("Executing %s %s", s.name, s.config.As) | ||
| } | ||
| containerResources, err := resourcesFor(s.resources.RequirementsForStep(s.config.As)) | ||
| if err != nil { | ||
| return fmt.Errorf("unable to calculate %s pod resources for %s: %s", s.name, s.config.As, err) | ||
|
|
@@ -107,8 +116,8 @@ func (s *podStep) Run(ctx context.Context, dry bool) error { | |
| s.subTests = testCaseNotifier.SubTests(s.Description() + " - ") | ||
| }() | ||
|
|
||
| if err := waitForPodCompletion(s.podClient.Pods(s.jobSpec.Namespace), pod.Name, testCaseNotifier); err != nil { | ||
| return fmt.Errorf("test %q failed: %v", pod.Name, err) | ||
| if err := waitForPodCompletion(s.podClient.Pods(s.jobSpec.Namespace), pod.Name, testCaseNotifier, s.config.SkipLogs); err != nil { | ||
| return fmt.Errorf("%s %q failed: %v", s.name, pod.Name, err) | ||
| } | ||
| return nil | ||
| } | ||
|
|
@@ -267,3 +276,15 @@ func getSecretVolumeMountFromSecret(secretMountPath string) []coreapi.VolumeMoun | |
| }, | ||
| } | ||
| } | ||
|
|
||
| // RunPod may be used to run a pod to completion. Provides a simpler interface than | ||
| // PodStep and is intended for other steps that may need to run transient actions. | ||
| // This pod will not be able to gather artifacts, nor will it report log messages | ||
| // unless it fails. | ||
| func RunPod(podClient PodClient, pod *coreapi.Pod) error { | ||
| pod, err := createOrRestartPod(podClient.Pods(pod.Namespace), pod) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| return waitForPodCompletion(podClient.Pods(pod.Namespace), pod.Name, nil, true) | ||
| } | ||
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.
Why? Document tpls
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.
Reduce pointless output. Will comment. The only reason to print it is when we upload lots of content and the job just sits there.