|
| 1 | +name: E2E GCP |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: [main] |
| 6 | + workflow_dispatch: {} |
| 7 | + |
| 8 | +concurrency: |
| 9 | + group: e2e-gcp |
| 10 | + cancel-in-progress: false |
| 11 | + |
| 12 | +permissions: |
| 13 | + contents: read |
| 14 | + id-token: write |
| 15 | + |
| 16 | +env: |
| 17 | + PULUMI_CONFIG_PASSPHRASE: "ci-ephemeral" |
| 18 | + |
| 19 | +jobs: |
| 20 | + changes: |
| 21 | + runs-on: ubuntu-latest |
| 22 | + outputs: |
| 23 | + should_run: ${{ steps.filter.outputs.gcp }} |
| 24 | + steps: |
| 25 | + - uses: actions/checkout@v4 |
| 26 | + - uses: dorny/paths-filter@v3 |
| 27 | + id: filter |
| 28 | + with: |
| 29 | + filters: | |
| 30 | + gcp: |
| 31 | + - 'pulumi_pinecone_byoc/gcp/**' |
| 32 | + - 'pulumi_pinecone_byoc/common/**' |
| 33 | + - 'config/gcp.py' |
| 34 | + - 'config/base.py' |
| 35 | + - 'config/__init__.py' |
| 36 | + - 'setup/wizard.py' |
| 37 | +
|
| 38 | + e2e: |
| 39 | + needs: changes |
| 40 | + if: needs.changes.outputs.should_run == 'true' || github.event_name == 'workflow_dispatch' |
| 41 | + runs-on: ubuntu-latest |
| 42 | + timeout-minutes: 90 |
| 43 | + environment: gcp-e2e |
| 44 | + steps: |
| 45 | + - uses: actions/checkout@v4 |
| 46 | + with: |
| 47 | + fetch-depth: 0 |
| 48 | + |
| 49 | + - name: Authenticate to GCP |
| 50 | + id: auth |
| 51 | + uses: google-github-actions/auth@v2 |
| 52 | + with: |
| 53 | + workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }} |
| 54 | + service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }} |
| 55 | + |
| 56 | + - name: Set up gcloud CLI |
| 57 | + uses: google-github-actions/setup-gcloud@v2 |
| 58 | + |
| 59 | + - uses: astral-sh/setup-uv@v5 |
| 60 | + |
| 61 | + - uses: actions/setup-python@v5 |
| 62 | + with: |
| 63 | + python-version: "3.12" |
| 64 | + |
| 65 | + - name: Install Pulumi CLI |
| 66 | + uses: pulumi/actions@v6 |
| 67 | + |
| 68 | + - name: Install kubectl |
| 69 | + uses: azure/setup-kubectl@v4 |
| 70 | + |
| 71 | + - name: Run wizard (headless) |
| 72 | + id: wizard |
| 73 | + env: |
| 74 | + PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }} |
| 75 | + GCP_PROJECT: staging-pinecone-byoc |
| 76 | + PINECONE_REGION: us-central1 |
| 77 | + PINECONE_AZS: "us-central1-a,us-central1-b" |
| 78 | + PINECONE_VPC_CIDR: "10.112.0.0/12" |
| 79 | + PINECONE_DELETION_PROTECTION: "false" |
| 80 | + PINECONE_PUBLIC_ACCESS: "false" |
| 81 | + PINECONE_PROJECT_NAME: "pinecone-byoc" |
| 82 | + run: | |
| 83 | + uv run --with rich --with pyyaml python setup/wizard.py \ |
| 84 | + --cloud gcp \ |
| 85 | + --headless \ |
| 86 | + --stack-name ci \ |
| 87 | + --skip-install \ |
| 88 | + --output-dir ./e2e-project |
| 89 | +
|
| 90 | + - name: Patch __main__.py with CI overrides |
| 91 | + working-directory: ./e2e-project |
| 92 | + run: | |
| 93 | + python3 << 'PATCH' |
| 94 | + path = "__main__.py" |
| 95 | + content = open(path).read() |
| 96 | + content = content.replace( |
| 97 | + " labels=config.get_object(\"labels\") or {},", |
| 98 | + """ labels=config.get_object("labels") or {}, |
| 99 | + global_env=config.require("global-env"), |
| 100 | + api_url=config.require("api-url"), |
| 101 | + auth0_domain=config.require("auth0-domain"), |
| 102 | + amp_aws_account_id=config.require("amp-aws-account-id"),""", |
| 103 | + ) |
| 104 | + open(path, "w").write(content) |
| 105 | + PATCH |
| 106 | +
|
| 107 | + - name: Replace PyPI dep with local source |
| 108 | + working-directory: ./e2e-project |
| 109 | + run: | |
| 110 | + sed -i 's|"pulumi-pinecone-byoc\[gcp\]"|"pulumi-pinecone-byoc[gcp] @ file://'"$GITHUB_WORKSPACE"'"|' pyproject.toml |
| 111 | +
|
| 112 | + - name: Install dependencies |
| 113 | + working-directory: ./e2e-project |
| 114 | + run: uv sync |
| 115 | + |
| 116 | + - name: Setup Pulumi stack |
| 117 | + working-directory: ./e2e-project |
| 118 | + run: | |
| 119 | + pulumi login --local |
| 120 | + pulumi stack select --create ci |
| 121 | +
|
| 122 | + - name: Set Pulumi config |
| 123 | + working-directory: ./e2e-project |
| 124 | + env: |
| 125 | + PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }} |
| 126 | + run: | |
| 127 | + pulumi config set --secret pinecone-api-key "$PINECONE_API_KEY" --stack ci |
| 128 | + pulumi config set global-env ci --stack ci |
| 129 | + pulumi config set api-url "https://api-staging.pinecone.io" --stack ci |
| 130 | + pulumi config set auth0-domain "internal-beta-pinecone-io.us.auth0.com" --stack ci |
| 131 | + pulumi config set amp-aws-account-id "115740606080" --stack ci |
| 132 | +
|
| 133 | + - name: Pulumi up |
| 134 | + id: up |
| 135 | + working-directory: ./e2e-project |
| 136 | + run: pulumi up --yes --stack ci |
| 137 | + |
| 138 | + - name: Pulumi destroy |
| 139 | + if: always() && steps.wizard.outcome == 'success' |
| 140 | + working-directory: ./e2e-project |
| 141 | + run: pulumi destroy --yes --stack ci |
| 142 | + |
| 143 | + - name: Pulumi stack rm |
| 144 | + if: always() && steps.wizard.outcome == 'success' |
| 145 | + working-directory: ./e2e-project |
| 146 | + run: pulumi stack rm ci --yes --force |
| 147 | + |
| 148 | + result: |
| 149 | + if: always() |
| 150 | + needs: [changes, e2e] |
| 151 | + runs-on: ubuntu-latest |
| 152 | + steps: |
| 153 | + - run: | |
| 154 | + if [ "${{ needs.e2e.result }}" = "failure" ] || [ "${{ needs.e2e.result }}" = "cancelled" ]; then |
| 155 | + echo "E2E failed or was cancelled" |
| 156 | + exit 1 |
| 157 | + fi |
| 158 | + echo "OK (e2e: ${{ needs.e2e.result }})" |
0 commit comments