Skip to content
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

internal/scorecard/alpha: add parallelism support #3420

Closed

Conversation

joelanford
Copy link
Member

Description of the change:

  • Add support for stages and parallelism in scorecard
  • Some other improvements I noticed along the way (I can break these out into another PR if that's helpful for review)

Motivation for the change:
Give users more flexbility in scheduling their tests and having them complete faster when they can be run in parallel.

Checklist

If the pull request includes user-facing changes, extra documentation is required:

@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 14, 2020
@joelanford joelanford force-pushed the scorecard-parallel branch 5 times, most recently from ac7da05 to 9feca46 Compare July 14, 2020 15:53
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll remove this file once I know I no longer need to re-create the generated deep-copy files.

Comment on lines 30 to 31
// TODO: replace `gopkg.in/yaml.v2` with `sigs.k8s.io/yaml` once operator-registry has `json` tags in the
// annotations struct.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like my imports sorter clobbered this. I'll add it back.

@joelanford joelanford force-pushed the scorecard-parallel branch from a4706a9 to 447902a Compare July 14, 2020 18:34
@joelanford joelanford changed the title WIP: internal/scorecard/alpha: add parallelism support internal/scorecard/alpha: add parallelism support Jul 14, 2020
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 14, 2020
@joelanford joelanford force-pushed the scorecard-parallel branch 5 times, most recently from 71785e9 to dc3d55e Compare July 14, 2020 21:07
Copy link
Contributor

@jberkhahn jberkhahn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, you didn't change this is this PR but this seems as good a place as any to discuss it. Why do we fatally exit out in places like here instead of logging that something went wrong, and returning an error? This to me to not be very go-like behavior and is more similar to panicing, which I think should be more of a last resort. I ask because I've encountered a bunch of lines like this in my attempts to test out the cmd layer and it's difficult to test such behavior.

}

if hasFailingTest(scorecardTests) {
os.Exit(1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the operator-sdk process return a non-zero exit code if it ran successfully but a test failed? 🤔 The cli command executed successfully. In either case, this is different from the previous behavior.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

upon poking around some test frameworks, I guess this is the usual behavior. good catch, although I wonder if it would be more golike to simply return an error.

)

// TODO(joelanford): rewrite to use ginkgo/gomega
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah! I can answer any questions you might have about ginkgo/gomega.

- Validate RegistryPod struct fields and set defaults

- Verify pod creation using polling and ensuring pod status is Running

- Add logic to check if pod already exists and return existing pod

- Add *corev1.Pod as an unexported field to RegistryPod struct

- Make kubernetes client exported on RegistryPod so the caller can set it

- Add templating for container command

- Add logic to wrap pod logs inside error in case of failures

- Use k8sutil's TrimDNS1123Label func to construct pod name

- Add unit tests in ginkgo/gomega
@joelanford
Copy link
Member Author

@jberkhahn Typically, we try to distinguish between between a usage error (e.g. with invalid flags or arguments) versus an error that occurred during the actual execution of the command.

With cobra (at least as far as we've been able to ascertain), returning an error from RunE results in cobra printing the command usage. So we try to return errors for usage errors and log.Fatal for execution errors.

@joelanford
Copy link
Member Author

This PR got a bit bigger as I found other improvements to make, so I'm going to break this one up and update it to be just the parallelism feature.

@joelanford joelanford added this to the v1.0.0 milestone Jul 15, 2020
@joelanford joelanford mentioned this pull request Jul 15, 2020
92 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants