|
| 1 | +name: E2E AWS |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: {} |
| 5 | + |
| 6 | +permissions: |
| 7 | + contents: read |
| 8 | + id-token: write |
| 9 | + |
| 10 | +jobs: |
| 11 | + up: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + timeout-minutes: 60 |
| 14 | + environment: aws-e2e |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v4 |
| 17 | + with: |
| 18 | + fetch-depth: 0 |
| 19 | + |
| 20 | + - name: Set stack name |
| 21 | + run: | |
| 22 | + if [ -n "$PR_NUMBER" ]; then |
| 23 | + echo "STACK_NAME=ci-aws-pr${PR_NUMBER}-${GITHUB_SHA::7}" >> "$GITHUB_ENV" |
| 24 | + else |
| 25 | + echo "STACK_NAME=ci-aws-${GITHUB_SHA::7}" >> "$GITHUB_ENV" |
| 26 | + fi |
| 27 | + env: |
| 28 | + PR_NUMBER: ${{ github.event.pull_request.number }} |
| 29 | + |
| 30 | + - name: Configure AWS credentials (OIDC) |
| 31 | + uses: aws-actions/configure-aws-credentials@v4 |
| 32 | + with: |
| 33 | + role-to-assume: ${{ secrets.AWS_E2E_ROLE_ARN }} |
| 34 | + aws-region: us-east-1 |
| 35 | + role-duration-seconds: 43200 |
| 36 | + |
| 37 | + - uses: astral-sh/setup-uv@v5 |
| 38 | + |
| 39 | + - uses: actions/setup-python@v5 |
| 40 | + with: |
| 41 | + python-version: "3.12" |
| 42 | + |
| 43 | + - name: Install Pulumi CLI |
| 44 | + uses: pulumi/actions@v6 |
| 45 | + |
| 46 | + - name: Install kubectl |
| 47 | + uses: azure/setup-kubectl@v4 |
| 48 | + |
| 49 | + - name: Run wizard (headless) |
| 50 | + id: wizard |
| 51 | + env: |
| 52 | + PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }} |
| 53 | + PINECONE_REGION: us-east-1 |
| 54 | + PINECONE_AZS: "us-east-1a,us-east-1b" |
| 55 | + PINECONE_VPC_CIDR: "10.0.0.0/16" |
| 56 | + PINECONE_DELETION_PROTECTION: "false" |
| 57 | + PINECONE_PUBLIC_ACCESS: "false" |
| 58 | + PINECONE_PROJECT_NAME: "pinecone-byoc" |
| 59 | + run: | |
| 60 | + uv run --with rich --with pyyaml python setup/wizard.py \ |
| 61 | + --cloud aws \ |
| 62 | + --headless \ |
| 63 | + --stack-name "$STACK_NAME" \ |
| 64 | + --skip-install \ |
| 65 | + --output-dir ./e2e-project |
| 66 | +
|
| 67 | + - name: Patch __main__.py with CI overrides |
| 68 | + working-directory: ./e2e-project |
| 69 | + run: | |
| 70 | + python3 << 'PATCH' |
| 71 | + path = "__main__.py" |
| 72 | + content = open(path).read() |
| 73 | + content = content.replace( |
| 74 | + " tags=config.get_object(\"tags\"),", |
| 75 | + """ tags=config.get_object("tags"), |
| 76 | + global_env=config.require("global-env"), |
| 77 | + api_url=config.require("api-url"), |
| 78 | + auth0_domain=config.require("auth0-domain"), |
| 79 | + gcp_project=config.require("gcp-project"),""", |
| 80 | + ) |
| 81 | + open(path, "w").write(content) |
| 82 | + PATCH |
| 83 | +
|
| 84 | + - name: Replace PyPI dep with local source |
| 85 | + working-directory: ./e2e-project |
| 86 | + run: | |
| 87 | + sed -i 's|"pulumi-pinecone-byoc\[aws\]"|"pulumi-pinecone-byoc[aws] @ file://'"$GITHUB_WORKSPACE"'"|' pyproject.toml |
| 88 | +
|
| 89 | + - name: Install dependencies |
| 90 | + working-directory: ./e2e-project |
| 91 | + run: uv sync |
| 92 | + |
| 93 | + - name: Setup Pulumi stack |
| 94 | + working-directory: ./e2e-project |
| 95 | + env: |
| 96 | + PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }} |
| 97 | + run: | |
| 98 | + pulumi stack select --create "$STACK_NAME" |
| 99 | +
|
| 100 | + - name: Set Pulumi config |
| 101 | + working-directory: ./e2e-project |
| 102 | + env: |
| 103 | + PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }} |
| 104 | + PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }} |
| 105 | + run: | |
| 106 | + pulumi config set --secret pinecone-api-key "$PINECONE_API_KEY" --stack "$STACK_NAME" |
| 107 | + pulumi config set global-env ci --stack "$STACK_NAME" |
| 108 | + pulumi config set api-url "https://api-staging.pinecone.io" --stack "$STACK_NAME" |
| 109 | + pulumi config set auth0-domain "https://internal-beta-pinecone-io.us.auth0.com" --stack "$STACK_NAME" |
| 110 | + pulumi config set gcp-project "development-pinecone" --stack "$STACK_NAME" |
| 111 | +
|
| 112 | + - name: Pulumi up |
| 113 | + working-directory: ./e2e-project |
| 114 | + env: |
| 115 | + PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }} |
| 116 | + run: pulumi up --yes --stack "$STACK_NAME" |
| 117 | + |
| 118 | + down: |
| 119 | + needs: up |
| 120 | + if: always() && needs.up.result != 'skipped' |
| 121 | + runs-on: ubuntu-latest |
| 122 | + timeout-minutes: 60 |
| 123 | + environment: aws-e2e |
| 124 | + steps: |
| 125 | + - uses: actions/checkout@v4 |
| 126 | + with: |
| 127 | + fetch-depth: 0 |
| 128 | + |
| 129 | + - name: Set stack name |
| 130 | + run: | |
| 131 | + if [ -n "$PR_NUMBER" ]; then |
| 132 | + echo "STACK_NAME=ci-aws-pr${PR_NUMBER}-${GITHUB_SHA::7}" >> "$GITHUB_ENV" |
| 133 | + else |
| 134 | + echo "STACK_NAME=ci-aws-${GITHUB_SHA::7}" >> "$GITHUB_ENV" |
| 135 | + fi |
| 136 | + env: |
| 137 | + PR_NUMBER: ${{ github.event.pull_request.number }} |
| 138 | + |
| 139 | + - name: Configure AWS credentials (OIDC) |
| 140 | + uses: aws-actions/configure-aws-credentials@v4 |
| 141 | + with: |
| 142 | + role-to-assume: ${{ secrets.AWS_E2E_ROLE_ARN }} |
| 143 | + aws-region: us-east-1 |
| 144 | + role-duration-seconds: 43200 |
| 145 | + |
| 146 | + - uses: astral-sh/setup-uv@v5 |
| 147 | + |
| 148 | + - uses: actions/setup-python@v5 |
| 149 | + with: |
| 150 | + python-version: "3.12" |
| 151 | + |
| 152 | + - name: Install Pulumi CLI |
| 153 | + uses: pulumi/actions@v6 |
| 154 | + |
| 155 | + - name: Run wizard (headless) |
| 156 | + env: |
| 157 | + PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }} |
| 158 | + PINECONE_REGION: us-east-1 |
| 159 | + PINECONE_AZS: "us-east-1a,us-east-1b" |
| 160 | + PINECONE_VPC_CIDR: "10.0.0.0/16" |
| 161 | + PINECONE_DELETION_PROTECTION: "false" |
| 162 | + PINECONE_PUBLIC_ACCESS: "false" |
| 163 | + PINECONE_PROJECT_NAME: "pinecone-byoc" |
| 164 | + run: | |
| 165 | + uv run --with rich --with pyyaml python setup/wizard.py \ |
| 166 | + --cloud aws \ |
| 167 | + --headless \ |
| 168 | + --stack-name "$STACK_NAME" \ |
| 169 | + --skip-install \ |
| 170 | + --output-dir ./e2e-project |
| 171 | +
|
| 172 | + - name: Replace PyPI dep with local source |
| 173 | + working-directory: ./e2e-project |
| 174 | + run: | |
| 175 | + sed -i 's|"pulumi-pinecone-byoc\[aws\]"|"pulumi-pinecone-byoc[aws] @ file://'"$GITHUB_WORKSPACE"'"|' pyproject.toml |
| 176 | +
|
| 177 | + - name: Install dependencies |
| 178 | + working-directory: ./e2e-project |
| 179 | + run: uv sync |
| 180 | + |
| 181 | + - name: Cancel stale locks |
| 182 | + working-directory: ./e2e-project |
| 183 | + env: |
| 184 | + PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }} |
| 185 | + run: pulumi cancel --yes --stack "$STACK_NAME" 2>/dev/null || true |
| 186 | + |
| 187 | + - name: Pulumi destroy |
| 188 | + working-directory: ./e2e-project |
| 189 | + env: |
| 190 | + PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }} |
| 191 | + run: pulumi destroy --yes --stack "$STACK_NAME" |
| 192 | + |
| 193 | + - name: Pulumi stack rm |
| 194 | + working-directory: ./e2e-project |
| 195 | + env: |
| 196 | + PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }} |
| 197 | + run: pulumi stack rm "$STACK_NAME" --yes --force |
0 commit comments