nebari icon indicating copy to clipboard operation
nebari copied to clipboard

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

Open viniciusdc opened this issue 1 year ago • 9 comments

Feature description

Currently, our tests 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

  • Better docs on this approach
  • More control on tracking testing versions
  • More testing

Anything else?

No response

### Tasks
- [ ] `make init`: Install Local copy Nebari and any dependencies
- [ ] `make deploy-local`: Deploy local version of nebari and create an example user.
- [ ] `make clean`: Delete deployment.
- [ ] `make test-unit`: Pytests
- [ ] `make test-playwright`: Playwright tests.
- [ ] `make test-integration`: run integration tests
- [ ] `make test-all`: run all tests

viniciusdc avatar May 28 '24 14:05 viniciusdc

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.

pt247 avatar May 29 '24 12:05 pt247

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.

viniciusdc avatar May 29 '24 13:05 viniciusdc

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

pt247 avatar May 29 '24 15:05 pt247

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

viniciusdc avatar May 30 '24 15:05 viniciusdc

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 avatar Jun 21 '24 09:06 pt247

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 avatar Jun 22 '24 13:06 pt247

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 avatar Jun 22 '24 14:06 pt247

Updated gist with the latest Makefile with playwright tests.

pt247 avatar Jun 25 '24 18:06 pt247

This issue is still up for grabs. #2554 was closed as it had gotten stale, but can serve as a reference for future work

dcmcand avatar Oct 23 '24 09:10 dcmcand