Skip to content

Use the compiled kubernetes binaries in the e2e tests in CI #893

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

Merged

Conversation

mauriciopoppe
Copy link
Member

What type of PR is this?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespaces from that line:

/kind bug

What this PR does / why we need it:

When the kubetest2 flags are created it'll detect if we're trying to run the e2e test from master, if so then it'll assume that the cluster was created by compiling a kubernetes release or kubernetes master and that the binaries to use in the e2e tests should be the ones generated during the compilation.

Which issue(s) this PR fixes:

Might help #892

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

/cc @mattcary @jingxu97

@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. release-note-none Denotes a PR that doesn't merit a release note. labels Jan 12, 2022
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 12, 2022
// the kubernetes binaries should've already been built above
// or by the user if --localK8sDir was set, these binaries should be copied to the
// path sent to kubetest2 through its --artifacts path
klog.Infof("Copying kubernetes binaries to path=%s to run the tests", kubetestDumpDir)
Copy link
Contributor

Choose a reason for hiding this comment

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

kubetestdumpDir may be empty, in that case maybe it would be better to set it to ./? (and will it work in this case, or have we implicitly assumed an artifactsDir if we're testing master?)

Copy link
Member Author

Choose a reason for hiding this comment

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

thanks for catching this, I saw that if we don't set --artifacts then kubetest2 assumes that it's ./_artifacts, from its help:

Flags:
      --artifacts string         top-level directory to put artifacts under for each kubetest2 run, defaulting to "${ARTIFACTS:-./_artifacts}". If using the ginkgo tester, this must be an absolute path. (default "/usr/local/google/home/mauriciopoppe/go/src/sigs.k8s.io/gcp-compute-persistent-disk-csi-driver/_artifacts")

I modified it to be that path if kubetestdumpDir is empty

@mattcary
Copy link
Contributor

Looks like something is awry with the directories or copying? The relevant integration test error I think is this:

W0112 01:36:19.231] I0112 01:36:19.053936   91423 app.go:61] RunDir for this run: "/workspace/_artifacts/sc-standard/ba403430-7343-11ec-94ac-7eb5bc905a97"
W0112 01:36:19.231] I0112 01:36:19.058854   91423 app.go:120] ID for this run: "ba403430-7343-11ec-94ac-7eb5bc905a97"
W0112 01:36:19.232] I0112 01:36:19.107699   91437 ginkgo.go:120] Using kubeconfig at /root/.kube/config
W0112 01:36:19.232] F0112 01:36:19.107813   91437 ginkgo.go:205] failed to run ginkgo tester: failed to validate kubectl:stat /workspace/_artifacts/sc-standard/ba403430-7343-11ec-94ac-7eb5bc905a97/kubectl: no such file or directory
W0112 01:36:19.232] Error: exit status 255

@mauriciopoppe
Copy link
Member Author

I see that the problem is that kubetest2 appends a run id, so while the binaries are copied to W0112 01:36:17.362] I0112 01:36:17.361583 6663 main.go:736] copying /tmp/gcp-pd-driver-tmp2296392321/kubernetes/_output/dockerized/bin/linux/amd64/kubectl to /workspace/_artifacts/sc-standard/kubectl the binary that it runs is /workspace/_artifacts/sc-standard/ba403430-7343-11ec-94ac-7eb5bc905a97/kubectl

@mauriciopoppe
Copy link
Member Author

@mattcary I'm using the --run-id flag that is now set from PD CSI if it's not already set by the CI job, with it I could also write the test binaries to the right location

@mattcary
Copy link
Contributor

@mattcary I'm using the --run-id flag that is now set from PD CSI if it's not already set by the CI job, with it I could also write the test binaries to the right location

When in doubt of kubetest2 add more flags I guess... :-P

/lgtm
/approve

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mattcary, mauriciopoppe

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 added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 13, 2022
@k8s-ci-robot k8s-ci-robot merged commit f9774f6 into kubernetes-sigs:master Jan 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. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants