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

Download virtctl tool #10372

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dahorak
Copy link
Contributor

@dahorak dahorak commented Aug 29, 2024

This PR is adding new fixture to get virtctl tool. It checks if this tool is available and if not, it firstly try to get it from the CNV if installed on the cluster and as a fall-back it downloads it from upstream github repository.

Also separating getting asset from github to separated function and use it in the new get_virtctl_tool function and also in get_opm_tool.

fixes: #10366

@dahorak dahorak added the team/ecosystem Ecosystem team related issues/PRs label Aug 29, 2024
@dahorak dahorak self-assigned this Aug 29, 2024
@pull-request-size pull-request-size bot added the size/L PR that changes 100-499 lines label Aug 29, 2024
Copy link

openshift-ci bot commented Aug 29, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: dahorak

The full list of commands accepted by this bot can be found 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

@dahorak dahorak force-pushed the get-virtctl-tool branch 2 times, most recently from e904304 to aab7f49 Compare August 29, 2024 11:56
@dahorak dahorak marked this pull request as ready for review August 29, 2024 11:56
@dahorak dahorak requested a review from a team as a code owner August 29, 2024 11:56
- separate getting asset from github to separated function

fixes: red-hat-storage#10366

Signed-off-by: Daniel Horak <[email protected]>
- as a fallback download it from github
- add fixture

Signed-off-by: Daniel Horak <[email protected]>
@dahorak
Copy link
Contributor Author

dahorak commented Oct 10, 2024

@yitzhak12 I've updated/enhanced this PR in the way, that it firstly try to get the virtctl tool from the CNV if installed on the cluster and if that fails, it will download it from the upstream github repository.

@dahorak
Copy link
Contributor Author

dahorak commented Oct 10, 2024

Verified locally with dummy tests:

08:54:29 - MainThread - ocs_ci.utility.utils - INFO  - Executing command: virtctl version -c
08:54:29 - MainThread - ocs_ci.helpers.virtctl - INFO  - virtctl tool is not available, installing it
08:54:29 - MainThread - ocs_ci.deployment.cnv - INFO  - Performing virtctl binary compatibility check...
08:54:29 - MainThread - ocs_ci.deployment.cnv - INFO  - Getting the virtctl download URL for Linux x86_64
08:54:29 - MainThread - ocs_ci.deployment.cnv - INFO  - Retrieving the specification links for the virtctl client
08:54:29 - MainThread - ocs_ci.utility.utils - INFO  - Executing command: oc --kubeconfig /home/dahorak/RedHat/OCS/clusters/dahorak-test/auth/kubeconfig -n openshift-cnv get ConsoleCLIDownload virtctl-clidownloads-kubevirt-hyperconverged -n openshift-cnv -o yaml
08:54:30 - MainThread - ocs_ci.utility.utils - WARNING  - Command stderr: Error from server (NotFound): consoleclidownloads.console.openshift.io "virtctl-clidownloads-kubevirt-hyperconverged" not found

08:54:30 - MainThread - ocs_ci.ocs.ocp - WARNING  - Failed to get resource: virtctl-clidownloads-kubevirt-hyperconverged of kind: ConsoleCLIDownload, selector: None, Error: Error during execution of command: oc --kubeconfig /home/dahorak/RedHat/OCS/clusters/dahorak-test/auth/kubeconfig -n openshift-cnv get ConsoleCLIDownload virtctl-clidownloads-kubevirt-hyperconverged -n openshift-cnv -o yaml.
Error is Error from server (NotFound): consoleclidownloads.console.openshift.io "virtctl-clidownloads-kubevirt-hyperconverged" not found

08:54:30 - MainThread - ocs_ci.ocs.ocp - WARNING  - Number of attempts to get resource reached!
08:54:30 - MainThread - ocs_ci.helpers.github - INFO  - Downloading tool from 'https://github.com/kubevirt/kubevirt/releases/download/v1.3.1/virtctl-v1.3.1-linux-amd64' to '/home/dahorak/RedHat/OCS/ocs-ci/bin'
08:54:35 - MainThread - ocs_ci.utility.utils - INFO  - Executing command: chmod +x /home/dahorak/RedHat/OCS/ocs-ci/bin/virtctl
08:54:35 - MainThread - ocs_ci.utility.utils - INFO  - Executing command: virtctl version -c
08:54:35 - MainThread - ocs_ci.helpers.virtctl - INFO  - virtctl tool is available: Client Version: version.Info{GitVersion:"v1.3.1", GitCommit:"ed1e7ae8548d319fa7aacf315ad198f7241287c5", GitTreeState:"clean", BuildDate:"2024-08-22T08:52:25Z", GoVersion:"go1.22.2 X:nocoverageredesign", Compiler:"gc", Platform:"linux/amd64"}

@dahorak dahorak added the Verified Mark when PR was verified and log provided label Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/L PR that changes 100-499 lines team/ecosystem Ecosystem team related issues/PRs Verified Mark when PR was verified and log provided
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Download and install the virtctl command line tool when running multi-cluster job
4 participants