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

ci: Shifting deploy and undeploy logic for IG to actions #2833

Merged

Conversation

pawarpranav83
Copy link
Contributor

@pawarpranav83 pawarpranav83 commented May 12, 2024

Shifting deploy and undeploy logic from integration_test_kubectl_gadget.go to .github/actions/run-integration-tests/action.yml.

This change is required since tests for image-based gadgets don't have a TestMain file.

Testing done

Passing of Integration Tests in the CI.

@pawarpranav83
Copy link
Contributor Author

pawarpranav83 commented May 12, 2024

In contributing/testing/integration tests for kubernetes section, we can specify minikube-deploy but this only works for docker, otherwise it gives the following error:

Exiting due to GUEST_IMAGE_LOAD: save to dir: caching images: caching image "/home/jinx83/.minikube/cache/images/amd64/ghcr.io/inspektor-gadget/inspektor-gadget_latest": write: unable to calculate manifest: blob sha256:b2ce0e0660777651a7a188ae1128acc61d01aca10a035a8b1faa2cdd8bbf0785 not found

Copy link
Member

@eiffel-fl eiffel-fl left a comment

Choose a reason for hiding this comment

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

Hi!

Thank you for working on this!
I am nonetheless not sure about the Makefile part, as we need to have Inspektor Gadget deployed before running the integration tests.
So, we should cope with this in this PR too.

Best regards.

.github/actions/run-integration-tests/action.yml Outdated Show resolved Hide resolved
@mqasimsarfraz
Copy link
Member

We would also need to change contributing/testing/integration tests for ig/kubernetes section, where instead of minikube-start we can specify minikube-deploy but this only works for docker, otherwise it gives the following error:

Exiting due to GUEST_IMAGE_LOAD: save to dir: caching images: caching image "/home/jinx83/.minikube/cache/images/amd64/ghcr.io/inspektor-gadget/inspektor-gadget_latest": write: unable to calculate manifest: blob sha256:b2ce0e0660777651a7a188ae1128acc61d01aca10a035a8b1faa2cdd8bbf0785 not found

I did some investigation and it seems this is coming from minikube and isn't related to changes in the PR. It works for docker runtime because we use docker-env when loading image for it and it fails with the same error on main:

$ make CONTAINER_RUNTIME=containerd minikube-deploy
...
❌  Exiting due to GUEST_IMAGE_LOAD: Failed to load image: save to dir: caching images: caching image "/home/qasim/.minikube/cache/images/amd64/ghcr.io/inspektor-gadget/inspektor-gadget_latest": write: unable to calculate manifest: blob sha256:b2ce0e0660777651a7a188ae1128acc61d01aca10a035a8b1faa2cdd8bbf0785 not found
...

Having said that we are using minikube v1.29.0 in the CI and it seems in minikube v1.31.0 docker-env will also be used for containerd so upgrading should fix it for containerd as well. Also, I see this issue kubernetes/minikube#18021 so perhaps we should upgrade to latest minikube and open a bug if it still happens. I will open a PR!

@mauriciovasquezbernal
Copy link
Member

I did some investigation and it seems this is coming from minikube and isn't related to changes in the PR.

I'm a bit lost. Is this only related to the "make minikube-deploy" target or also to the CI? I see we use in the CI minikube image load for the different runtimes and AFAIU it works fine. What am I missing?

Copy link
Member

@mauriciovasquezbernal mauriciovasquezbernal 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 nit. LGTM otherwise.

.github/actions/run-integration-tests/action.yml Outdated Show resolved Hide resolved
@mauriciovasquezbernal
Copy link
Member

I am nonetheless not sure about the Makefile part, as we need to have Inspektor Gadget deployed before running the integration tests.

I think we can require Inspektor Gadget to be deployed before running integration-tests. We could handle it in the Makefile but IMHO it becomes a mess because we'll need to take care of the undeploy step too. One idea is to have to different targets:

  • integration-tests-without-deploy: Just run the tests
  • integration-tests: deploy, run integration-tests-without-deploy and then undeploy.

But again, IMO it's not worth it.

@eiffel-fl
Copy link
Member

eiffel-fl commented May 14, 2024

I am nonetheless not sure about the Makefile part, as we need to have Inspektor Gadget deployed before running the integration tests.

I think we can require Inspektor Gadget to be deployed before running integration-tests. We could handle it in the Makefile but IMHO it becomes a mess because we'll need to take care of the undeploy step too. One idea is to have to different targets:

* integration-tests-without-deploy: Just run the tests

* integration-tests: deploy, run integration-tests-without-deploy and then undeploy.

But again, IMO it's not worth it.

I do not see the plus-value.
Before, we just ran the Makefile and everything was done, now we need to do it in two steps.

By the way, the following also have to be updated:

  1. @echo ' integration-tests - Run integration tests'
  2. https://github.com/inspektor-gadget/inspektor-gadget/blob/main/docs/devel/CONTRIBUTING.md#integration-tests

@mqasimsarfraz
Copy link
Member

mqasimsarfraz commented May 14, 2024

I did some investigation and it seems this is coming from minikube and isn't related to changes in the PR.

I'm a bit lost. Is this only related to the "make minikube-deploy" target or also to the CI? I see we use in the CI minikube image load for the different runtimes and AFAIU it works fine. What am I missing?

Good old version mismatch! It seems the issue only happens on Docker Version: 25 and CI seem to be running Docker Version: 24. I also confirmed I am running Docker Version: 25+ on my machine! So CI isn't broken yet!

@mauriciovasquezbernal
Copy link
Member

I do not see the plus-value.

We need this in order to implement tests for image-based gadgets like gadgets/trace_open/test/trace_open_test.go. In those ones we don't have a TestMain where we can put the logic to deploy Inspektor Gadget.

Before, we just ran the Makefile and everything was done, now we need to do it in two steps.

Are you really using this target in that way? I think the 99% of the times I use it I pass the no-deploy-ig flag.

@eiffel-fl
Copy link
Member

I do not see the plus-value.

We need this in order to implement tests for image-based gadgets like gadgets/trace_open/test/trace_open_test.go. In those ones we don't have a TestMain where we can put the logic to deploy Inspektor Gadget.

This should be highlighted in the commit message.

Before, we just ran the Makefile and everything was done, now we need to do it in two steps.

Are you really using this target in that way? I think the 99% of the times I use it I pass the no-deploy-ig flag.

Not that often, this is just for external users who may want to have something fully automatic.

Signed-off-by: pawarpranav83 <pawar.pranav83@gmail.com>
Copy link
Member

@mauriciovasquezbernal mauriciovasquezbernal left a comment

Choose a reason for hiding this comment

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

LGTM. I'll merge once the CI is green. Thanks for handling this.

@mauriciovasquezbernal
Copy link
Member

Failing test is another instance of #2358, merging this.

@mauriciovasquezbernal mauriciovasquezbernal merged commit da1a1ac into inspektor-gadget:main May 20, 2024
56 of 57 checks passed
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.

None yet

4 participants