-
Notifications
You must be signed in to change notification settings - Fork 94
[Testing] Create a new project for each test run #506
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or 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
0a3b29e
to
099f571
Compare
rohanshah18
added a commit
that referenced
this pull request
Jun 17, 2025
## Problem When I tried releasing to prod, the workflow failed with the following error: ``` [Invalid workflow file: .github/workflows/release-prod.yaml#L26](https://github.com/pinecone-io/pinecone-python-client/actions/runs/15689847725/workflow) The workflow is not valid. .github/workflows/release-prod.yaml (Line: 26, Col: 11): Input python_versions_json is required, but not provided while calling. ``` ## Solution Recently, the unit and integration tests workflows were updated in this pr for creating a new project for each test run. These workflows are used in release-prod.yaml but the corresponding changes were not made. As a part of this PR, I have: 1. added `python_versions_json` for running unit-tests (required by [test-unit.yaml](https://github.com/pinecone-io/pinecone-python-client/pull/506/files#diff-470b33906ddc2d9d1d4ef14595bfb97dabdc66146282122f5f8109e77a00f1eaR5)) 2. added `encrypted_project_api_key` and `python_versions_json` for running integration tests (required by [test-integration.yaml](https://github.com/pinecone-io/pinecone-python-client/pull/506/files#diff-3aae3c6c7bf80d1ee8f43fe2844445abb98c3792ed1da99ef5fff84ce330e549R5)) 3. Added create-project and cleanup-project as extra steps (based on [this pr](#506)) ## Type of Change - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update - [X] Infrastructure change (CI configs, etc) - [ ] Non-code change (docs, etc) - [ ] None of the above: (explain here) ## Test Plan NA
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Since all integration tests currently run in a shared project, we have to make use of randomness to avoid collisions on user-assigned names. I have a goal to remove this randomness and make tests more deterministic in order to unblock testing tools such as VCR, but before I can do that I need to isolate each test run into its own Pinecone project.
Solution
project-create
. I ended up wrapping this into a reusable workflowproject-setup.yaml
to encapsulate some of the setup and make it easier to use inon-pr.yaml
andon-merge.yaml
andon-pre-dep-changes.yaml
.project-delete
. I ended up wrapping this into a reusable workflowproject-cleanup.yaml
to make it easier to use inon-pr.yaml
andon-merge.yaml
andon-pre-dep-changes.yaml
. Deleting is actually a lot more complicated than creating the project and API key because all the resources must be cleared out of a project before it can be deleted, there are several resources types (indexes, collections, backups), and a lot of different ways that a delete can fail due to precondition failed / other pending operations. I implemented a deletion queue withdeque
that does a lot, but not unlimited, amounts of retrying. Anything that still fails after retries are exhausted will be tried again during the nightly cleanup.secret-encrypt
andsecret-decrypt
(see below)project-setup.yaml
project-cleanup.yaml
. Cleanup is set to runalways()
so it should trigger even if upstream jobs are failed or canceled. I learned the hard way thatalways()
jobs should always be used in combination with atimeout-minutes
setting because if you make a mistake (such as implementing a bug that will never succeed with infinite retries), the job will not respond to normal workflow cancel requests issued from the Github UI. If you get into this state, the only ways to recover are to call the Github REST API to force cancel or to wait for the default timeout of 6 hours (FML!!) to elapse.cleanup-nightly.yaml
project-create
into various other jobs, but github will not set job outputs that it thinks contain secrets so I was unable to directly pass the API key. I discovered that I needed to also implementsecret-encrypt
andsecret-decrypt
so that I could transmit the api key between different parts of the workflow in an encrypted form. These were implemented with symmetric encryption using Fernet from thecryptography
package.PINECONE_SERVICE_ACCOUNT_CLIENT_ID
andPINECONE_SERVICE_ACCOUNT_CLIENT_SECRET
came from the web consoleFERNET_ENCRYPTION_KEY
was generated randomly.testing-integration.yaml
to use API key passed through inputstesting-dependency.yaml
to use API key passed through inputson-pr.yaml
to create and delete the project, passing the API key to the integration testing step as a workflow input.on-merge.yaml
to create and delete the project, passing the API key to the integration and dependency testing step as a workflow input.cleanup-nightly.yaml
to also clean up generated projects and the resources they contain.While doing all this surgery on CI stuff I also made the following changes:
scripts/
into the directory of the github action using them to make that relationship more clear. I wantscripts/
to be for stuff that is mostly manually run in development.<noun>-<verb>
format so that related actions would be grouped by resource when sorted alphabetically. For example,create-index
anddelete-index
becameindex-create
andindex-delete
.tests/
to a minimum for this diff.These changes do not affect how tests are run locally. The
PINECONE_API_KEY
environment variable is still loaded from .env usingdotenv
.Type of Change