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

⚠️ Migrate scaffolding of v3 / v4-alpha to ginkgo v2 #2939

Conversation

jakobmoellerdev
Copy link
Contributor

@jakobmoellerdev jakobmoellerdev commented Sep 13, 2022

This PR is updating the v3 and v4-alpha plugins to use ginkgo v2. It purposefully does not introduce ginkgo cli as most options can be added onto go test instead. It is a follow up for #2532

Currently it does not use the NewLineReporter from the old scaffolding, but it can be manually added back (it is not recommended to do so by Ginkgo but possible with a custom hook into the rpeorting lifecycle). If this is wanted we can add docs on how to do that.

Currently the scaffolding does not automatically do this and people can manually add it.

@k8s-ci-robot k8s-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 Sep 13, 2022
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Sep 13, 2022
@k8s-ci-robot
Copy link
Contributor

Hi @jakobmoellersap. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 13, 2022
@camilamacedo86
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Sep 13, 2022
@jakobmoellerdev jakobmoellerdev marked this pull request as ready for review September 13, 2022 11:54
@k8s-ci-robot k8s-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 Sep 13, 2022
@jakobmoellerdev
Copy link
Contributor Author

@camilamacedo86

In the upstream controller-runtime PR, there is also a junit-aggregation logic in https://github.com/kubernetes-sigs/controller-runtime/pull/1977/files#diff-ab3c2c731b5083def78d27378838304f494f0ae5dec7bcf2339e1da30a9bf6d0R28 . we could achieve the same with a script that aggregates all junit-report.xml files generated with the -ginkgo.junit-report=junit-report.xml flag into a folder called artifacts. I was not sure if we want to include a script for this into the scaffolding for this purpose:

In Makefile we would need to modify the test target:

.PHONY: test
test: manifests generate fmt vet envtest ## Run tests.
	KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test ./... -coverprofile cover.out -ginkgo.junit-report=junit-report.xml
	ARTIFACTS="./artifacts" hack/aggregate-junit-reports.sh

Then in hack/aggregate-junit-reports.sh we would create a small script for the aggregation:

#!/usr/bin/env bash

set -e

if [[ -n ${ARTIFACTS:-} ]]; then
  mkdir -p "${ARTIFACTS}"
fi

find . -name '*junit-report.xml' -print0 | while IFS= read -r -d '' file
do
  ((count++))
  new_file=${file#./}
  new_file=${new_file%/junit-report.xml}
  new_file=${new_file//"/"/"-"}
  mv "$file" "$ARTIFACTS/junit_${new_file}.xml"
  echo "aggregated $file to $ARTIFACTS/junit_${new_file}.xml"
done

Copy link
Member

@camilamacedo86 camilamacedo86 left a comment

Choose a reason for hiding this comment

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

The changes show fine.
Great work 🥇

I am looking on your comments.

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 13, 2022
@camilamacedo86 camilamacedo86 removed the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 13, 2022
@camilamacedo86
Copy link
Member

Hi @jakobmoellersap,

Regaads #2939 (comment) it seems out of the scope right? I think we do not need this aggregation by default either.

Also, I am not sure about we add another sh hack/aggregate-junit-reports.sh scaffolded for that.
we might could doc this option as helper for those that would like to have that. WDYT?
What about we add the steps/options in : https://book.kubebuilder.io/reference/makefile-helpers.html ?

Regards the changes on this PR all show fine for we move forward.

/approved

@camilamacedo86 camilamacedo86 added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 13, 2022
Copy link
Contributor

@everettraven everettraven left a comment

Choose a reason for hiding this comment

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

Just a minor typo in the docs. Other than that looks great! Once the typo is fixed I'll approve and LGTM.

docs/book/src/migration/manually_migration_guide_v2_v3.md Outdated Show resolved Hide resolved
Co-authored-by: Bryce Palmer <everettraven@gmail.com>
@everettraven
Copy link
Contributor

/label tide/merge-method-squash

@k8s-ci-robot k8s-ci-robot added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Sep 13, 2022
Copy link
Contributor

@everettraven everettraven left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 13, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: camilamacedo86, everettraven, jakobmoellersap

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit d674739 into kubernetes-sigs:master Sep 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants