nebari-dev / nebari

🪴 Nebari - your open source data science platform
https://nebari.dev
BSD 3-Clause "New" or "Revised" License
274 stars 88 forks source link

[ENH] - Create a Nebari Makefile for Local deployment and CI #2489

Open viniciusdc opened 3 months ago

viniciusdc commented 3 months ago

Feature description

Currently, our Cypress and Playwright installations rely on GitHub Actions. Transitioning these installation workflows to a Makefile could alleviate some of the maintainers' burdens by simplifying the process of running tests locally. This move would streamline testing and potentially improve efficiency.

Value and/or benefit

Anything else?

No response

### Tasks
- [ ] `make init`: Initial of Makefile for initilization and first Use in CI.
- [ ] `make deploy`: Deploy nebari including all CI sub-steps like creating example user.
- [ ] `make clean`: Delete deployment.
- [ ] `make run-unit-tests`: Pytests
- [ ] `make run-cypress-tests`: Run cypress tests.
- [ ] `make run-playwright-tests`: Playwright tests.
- [ ] `make test: run-unit-tests run-cypress-tests run-playwright-tests`: Run all tests.
pt247 commented 3 months ago

To ensure that the Makefile is always up-to-date, @dcmcand suggested using it in CI. Creating Makefile with steps followed in .github/workflows/test_local_integration.yaml would be an excellent place to start. We can initially introduce the following make commands:

  1. make init: This defaults to local deployment. a. If the OS is Mac, it verifies that the docker-mac-net-connect service is running. b. Install Nebari and playwright - link. c. Initilizes Nebari like in CI for local deployment link
  2. make deploy: a. Deploy Nebari link. b. Basic kubectl checks after deployment - link. c. Check nebari url resolves - like. d. Curl jupyterhub login page - link e. Create example-user - link.
  3. make test: a. setup-node - link b. make run-cypress-tests - link. c. make run-playwright-tests link. d. make run-unit-tests link.
  4. make clean: a. Cleanup nebari deployment - link. b. kind delete clusters test-cluster

In later PRs, we can extend the same for other providers like GCP, DO, and AWS. For example: make init --provider=AWS Other commands can remain the same, except they will run against cloud instances determined by local environment variables. This should let us run cloud-based integration tests.

viniciusdc commented 3 months ago

good point, @pt247; I was only considering including the playwright/cypress installation and test execution commands. But its a really neat idea to also incorporate the deploy/init structures.

pt247 commented 3 months ago

Let's use this issue as a super issue to track progress on Nebari Makefile sub-issues/tasks. Renaming the issue to Nebari Makefile.

viniciusdc commented 3 months ago

Thanks @pt247, I was about to assign you to this as well 😄

pt247 commented 2 months ago

Update: The following Git Gist contains the Makefile and the Nebari config I am using to create the Nebari cluster locally.

https://gist.github.com/pt247/b17e3bec1dd25421082d109328a938b4

pt247 commented 2 months ago

Update

With the above git gist, we can now spin up a local cluster for testing using the Makefile. It still uses Cloudflare for the DNS-01 challenge so that Letsencrypt can generate trusted certificates.

The main issue with this setup is that it needs Cloudflare setup for usable certificates.

There are requirements:

  1. UI: Ability to log in and create environments and notebooks. (<-- this needs certificates)
  2. Run integration tests locally. (<-- this does not need certificates)

Some links worth exploring to find alternatives for Cloudflare:

  1. https://cert-manager.io/docs/configuration/selfsigned/
  2. https://skarlso.github.io/2023/10/25/self-signed-locally-trusted-certificates-with-cert-manager/
pt247 commented 2 months ago

Limiting the scope of this ticket

We should focus on local certificates while we are working on #2238. In this ticket, we will focus on replace CI tests in Makefile.

pt247 commented 2 months ago

Updated gist with the latest Makefile with playwright tests.