GCP Deployment #66
Workflow file for this run
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
name: GCP Deployment | |
on: | |
schedule: | |
- cron: "0 0 * * MON" | |
workflow_dispatch: | |
inputs: | |
branch: | |
description: 'Nebari branch to deploy, test, destroy' | |
required: true | |
default: develop | |
type: string | |
image-tag: | |
description: 'Nebari image tag created by the nebari-docker-images repo' | |
required: true | |
default: main | |
type: string | |
tf-log-level: | |
description: 'Change Terraform log levels' | |
required: false | |
default: info | |
type: choice | |
options: | |
- info | |
- warn | |
- debug | |
- trace | |
- error | |
env: | |
NEBARI_GH_BRANCH: ${{ github.event.inputs.branch || 'develop' }} | |
NEBARI_IMAGE_TAG: ${{ github.event.inputs.image-tag || 'main' }} | |
TF_LOG: ${{ github.event.inputs.tf-log-level || 'info' }} | |
NO_PROVIDER_CREDENTIALS_gcp: false | |
jobs: | |
# Used to skip cloud provider checks due to "jobs" not supporting {{ env }} variables contexts | |
check-for-credentials: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
outputs: | |
provider_credentials_gcp: ${{ steps.flag-check.outputs.provider_credentials_gcp }} | |
steps: | |
- name: Check if user wants to run GCP integration based on credentials | |
id: flag-check | |
run: | | |
if [ "${{ env.NO_PROVIDER_CREDENTIALS_gcp }}" == "true" ]; then | |
echo "::set-output name=provider_credentials_gcp::0" | |
else | |
echo "::set-output name=provider_credentials_gcp::1" | |
fi | |
test-gcp-integration: | |
runs-on: ubuntu-latest | |
needs: check-for-credentials | |
if: ${{ needs.check-for-credentials.outputs.provider_credentials_gcp == '1' }} | |
permissions: | |
id-token: write | |
contents: read | |
pull-requests: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ env.NEBARI_GH_BRANCH }} | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
- name: Install Nebari | |
run: | | |
pip install .[dev] | |
playwright install | |
- name: Retrieve secret from Vault | |
uses: hashicorp/[email protected] | |
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/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/cloudflare/[email protected]/nebari-dev-ci token | CLOUDFLARE_TOKEN; | |
- name: 'Authenticate to GCP' | |
uses: 'google-github-actions/auth@v1' | |
with: | |
token_format: access_token | |
project_id: ${{ env.PROJECT_ID }} | |
workload_identity_provider: ${{ env.GCP_WORKFLOW_PROVIDER }} | |
service_account: ${{ env.GCP_SERVICE_ACCOUNT }} | |
- name: Set required environment variables | |
run: | | |
echo "GOOGLE_CREDENTIALS=${{ env.GOOGLE_APPLICATION_CREDENTIALS }}" >> $GITHUB_ENV | |
- name: Integration Tests | |
run: | | |
pytest --version | |
pytest tests/tests_integration/ -vvv -s --cloud gcp | |
env: | |
NEBARI_SECRET__default_images__jupyterhub: "quay.io/nebari/nebari-jupyterhub:${{ env.NEBARI_IMAGE_TAG }}" | |
NEBARI_SECRET__default_images__jupyterlab: "quay.io/nebari/nebari-jupyterlab:${{ env.NEBARI_IMAGE_TAG }}" | |
NEBARI_SECRET__default_images__dask_worker: "quay.io/nebari/nebari-dask-worker:${{ env.NEBARI_IMAGE_TAG }}" |