-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Framework for Nebari deployment via pytest for extensive testing (#1867)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
63b613a
commit 006bbd4
Showing
20 changed files
with
285 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: "Deploy on Digital Ocean" | ||
|
||
on: | ||
schedule: | ||
- cron: "0 0 * * MON" | ||
workflow_dispatch: | ||
|
||
jobs: | ||
test-integration: | ||
name: "Pytest Integration" | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write | ||
contents: read | ||
steps: | ||
- name: "Checkout Infrastructure" | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.11 | ||
|
||
- name: Retrieve secret from Vault | ||
uses: hashicorp/vault-action@v2.5.0 | ||
with: | ||
method: jwt | ||
url: "https://quansight-vault-public-vault-b2379fa7.d415e30e.z1.hashicorp.cloud:8200" | ||
namespace: "admin/quansight" | ||
role: "repository-nebari-dev-nebari-role" | ||
secrets: | | ||
kv/data/repository/nebari-dev/nebari/amazon_web_services/nebari-dev-ci role_name | AWS_ROLE_ARN; | ||
kv/data/repository/nebari-dev/nebari/google_cloud_platform/nebari-dev-ci/github-nebari-dev-repo-ci project_id | PROJECT_ID; | ||
kv/data/repository/nebari-dev/nebari/google_cloud_platform/nebari-dev-ci/github-nebari-dev-repo-ci workload_identity_provider | GCP_WORKFLOW_PROVIDER; | ||
kv/data/repository/nebari-dev/nebari/google_cloud_platform/nebari-dev-ci/github-nebari-dev-repo-ci service_account_name | GCP_SERVICE_ACCOUNT; | ||
kv/data/repository/nebari-dev/nebari/shared_secrets DIGITALOCEAN_TOKEN | DIGITALOCEAN_TOKEN; | ||
kv/data/repository/nebari-dev/nebari/cloudflare/internal-devops@quansight.com/nebari-dev-ci token | CLOUDFLARE_TOKEN; | ||
- name: Install Nebari | ||
run: | | ||
pip install .[dev] | ||
conda install --quiet --yes conda-build | ||
- name: Integration Tests | ||
run: | | ||
pytest --version | ||
pytest tests_integration/ -vvv -s | ||
env: | ||
NEBARI_K8S_VERSION: 1.25.12-do.0 | ||
SPACES_ACCESS_KEY_ID: ${{ secrets.SPACES_ACCESS_KEY_ID }} | ||
SPACES_SECRET_ACCESS_KEY: ${{ secrets.SPACES_SECRET_ACCESS_KEY }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,3 +52,6 @@ nebari-config.yaml | |
.ipynb_checkpoints | ||
.DS_Store | ||
/.ruff_cache | ||
|
||
# Integration tests deployments | ||
_test_deploy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from functools import partial | ||
|
||
from _nebari.initialize import render_config | ||
|
||
DEFAULT_TERRAFORM_STATE = "remote" | ||
|
||
DEFAULT_GH_REPO = "github.com/test/test" | ||
render_config_partial = partial( | ||
render_config, | ||
repository=DEFAULT_GH_REPO, | ||
repository_auto_provision=False, | ||
auth_auto_provision=False, | ||
terraform_state=DEFAULT_TERRAFORM_STATE, | ||
disable_prompt=True, | ||
) | ||
INIT_INPUTS = [ | ||
# project, namespace, domain, cloud_provider, ci_provider, auth_provider | ||
("pytestdo", "dev", "do.nebari.dev", "do", "github-actions", "github"), | ||
("pytestaws", "dev", "aws.nebari.dev", "aws", "github-actions", "github"), | ||
("pytestgcp", "dev", "gcp.nebari.dev", "gcp", "github-actions", "github"), | ||
("pytestazure", "dev", "azure.nebari.dev", "azure", "github-actions", "github"), | ||
] | ||
|
||
NEBARI_CONFIG_FN = "nebari-config.yaml" | ||
PRESERVED_DIR = "preserved_dir" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Integration Testing via Pytest | ||
|
||
These tests are designed to test things on Nebari deployed | ||
on cloud. At the moment it only deploys on DigitalOcean. | ||
|
||
You need the following environment variables to run these. | ||
|
||
```bash | ||
DIGITALOCEAN_TOKEN | ||
NEBARI_K8S_VERSION | ||
SPACES_ACCESS_KEY_ID | ||
SPACES_SECRET_ACCESS_KEY | ||
CLOUDFLARE_TOKEN | ||
``` | ||
|
||
For instructions on how to get these variables check the documentation | ||
for DigitalOcean deployment. | ||
|
||
Running Tests: | ||
|
||
```bash | ||
pytest tests_integration -vvv -s | ||
``` | ||
|
||
This would deploy on digitalocean, run tests on the deployment | ||
and then teardown the cluster. |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pytest_plugins = ["tests_integration.deployment_fixtures"] |
Oops, something went wrong.