knative-extensions / eventing-gitlab

GitLab integration with Knative Eventing.
Apache License 2.0
10 stars 26 forks source link

Add KinD test verifying the source deploys and becomes ready #496

Open Cali0707 opened 4 months ago

Cali0707 commented 4 months ago

Overview

We recently found that even though build and unit tests had been passing, the receive adapter panicked when it started when you actually deployed the gitlab source. To address this, we should add a KinD test job that will:

  1. Install eventing and the gitlab source
  2. Create a gitlab source
  3. Verify that the source becomes ready

More info

These resources will likely be helpful while working on this:

Cali0707 commented 4 months ago

/help

knative-prow[bot] commented 4 months ago

@Cali0707: This request has been marked as needing help from a contributor.

Please ensure the request meets the requirements listed here.

If this request no longer meets these requirements, the label can be removed by commenting with the /remove-help command.

In response to [this](https://github.com/knative-extensions/eventing-gitlab/issues/496): >/help Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.
github-actions[bot] commented 1 month ago

This issue is stale because it has been open for 90 days with no activity. It will automatically close after 30 more days of inactivity. Reopen the issue with /reopen. Mark the issue as fresh by adding the comment /remove-lifecycle stale.

Cali0707 commented 1 month ago

/remove-lifecycle stale /triage accepted

harsh098 commented 1 month ago

Hi @Cali0707 I am trying to take a knack on this issue. I am trying to implement this small test on my own repo. I went through

Is there a design document on how the eventing extensions are structured in general ? That would really speed up the process. I am having a little friction in understanding the moving parts of the repo. My only source of understanding things as of now is going through the knative.dev/pkg docs. Looking forward.

Cali0707 commented 1 month ago

cc @pierDipi @creydr

harsh098 commented 1 month ago

For the test should I deploy gitlab on the cluster on the test KiND cluster as the example shown in https://github.com/knative/eventing/blob/main/.github/workflows/kind-e2e.yaml or use an external repo ?

creydr commented 1 month ago

Hey @harsh098, thanks for checking on this. Yes, you need to deploy the needed knative-gitlab artifacts on top of an eventing installation. Therefor I see the following to do:

  1. Add the eventing nightly builds into this repo (e.g. into a third_party folder). In the eventing-kafka-broker repo we do the same. Therefor you need to update the update-nightlies job, which will take the nightlies and push them into this repo. Check for example, how this is done for eventing-kafka-broker here
  2. Add an e2e test which installs a Gitlab source and checks if it becomes ready (this can be verified locally already). Check out for example some e2e tests in the eventing repo, which installs a pingsourcesource and checks if it becomes ready: https://github.com/knative/eventing/blob/36e0721b385204978e4eeb9e2321613090a82346/test/rekt/features/pingsource/readyness.go#L28.
  3. Create a new Github workflow for the end to end tests which installs KinD, deploys the eventing-core artifacts (from the third_party directory), then checks out the eventing-gitlab sources and installs it into the cluster and finally runs the e2e tests. You can check for example

I hope this helps to get started, otherwise let us know

harsh098 commented 1 month ago

Thanks a lot progressing in this direction now.

harsh098 commented 1 month ago

/assign

creydr commented 1 month ago

One more addition: Many knative and knative-extension repos have some kind-e2e.yaml Github workflow defined, which runs some e2e tests on KinD. Maybe those help you too (e.g. for reconciler-test repo)

harsh098 commented 1 month ago

Yes I did look into it. Will be reporting soon on this.

harsh098 commented 1 month ago

Hey @harsh098, thanks for checking on this. Yes, you need to deploy the needed knative-gitlab artifacts on top of an eventing installation. Therefor I see the following to do:

  1. Add the eventing nightly builds into this repo (e.g. into a third_party folder). In the eventing-kafka-broker repo we do the same. Therefor you need to update the update-nightlies job, which will take the nightlies and push them into this repo. Check for example, how this is done for eventing-kafka-broker here
  2. Add an e2e test which installs a Gitlab source and checks if it becomes ready (this can be verified locally already). Check out for example some e2e tests in the eventing repo, which installs a pingsourcesource and checks if it becomes ready: https://github.com/knative/eventing/blob/36e0721b385204978e4eeb9e2321613090a82346/test/rekt/features/pingsource/readyness.go#L28.
  3. Create a new Github workflow for the end to end tests which installs KinD, deploys the eventing-core artifacts (from the third_party directory), then checks out the eventing-gitlab sources and installs it into the cluster and finally runs the e2e tests. You can check for example

I hope this helps to get started, otherwise let us know

Can you please elaborate more on pushing the eventing nighly builds ? Whose nightly builds are these knative-eventing ? or the eventing-gitlab charts ?

creydr commented 1 month ago

Can you please elaborate more on pushing the eventing nighly builds ? Whose nightly builds are these knative-eventing ? or the eventing-gitlab charts ?

The knative-eventing nightly builds come from eventing-core (knative/eventing) and represents the latest (nightly) builds. The yamls for those are in a Google Cloud Storage Bucket. As we often need the nightly builds in other repositories for tests, we have automated this and a job, which pushes the yamls into the different repos (check the config for this for example [here](https://github.com/knative-extensions/knobots/blob/6863df9c3a5504ea5522e21d307d2486c5c0ef8d/.github/workflows/update-nightlies.yaml#L83-L91. This results in PRs like this). You need those yamls, as you need to install first eventing-core on your KinD cluster, before you install the eventing-gitlab manifests. So I would do the following:

  1. Add a config like this for eventing-gitlab to get the latest eventing-core manifests pushed daily into a folder like third_party/eventing-latest
  2. Wait until you have at least one of those automated PRs merged (like this): https://github.com/knative-extensions/eventing-kafka-broker/pull/4081
  3. Setup you KinD cluster and install those manifests from third_party/eventing-latest before you install the eventing-gitlab manifests
harsh098 commented 1 month ago

Got it thanks !

harsh098 commented 1 month ago

Just made a PR here
https://github.com/knative-extensions/knobots/pull/402

creydr commented 3 weeks ago

@harsh098 you can add the "initial" version for the manifests then via

for x in eventing-crds.yaml eventing-core.yaml; do
  curl https://storage.googleapis.com/knative-nightly/eventing/latest/$x --create-dirs -o ./third_party/eventing-latest/$x
done
harsh098 commented 2 weeks ago

Sure. Let me take a look into it

harsh098 commented 1 week ago

I'm waiting for the PR to be merged. Any updates ?

creydr commented 6 days ago

https://github.com/knative-extensions/knobots/pull/402 will update them, after an "initial version" of eventing-crds.yaml eventing-core.yaml exists (I didn't know they need to exist before). So you can add them in your PR too / need to add an initial version of the files. You can do this for example as said in https://github.com/knative-extensions/eventing-gitlab/issues/496#issuecomment-2346396212. Does this help?