-
Notifications
You must be signed in to change notification settings - Fork 10
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
Update authentication structure and decouple from GitHub Environments #32
Merged
jlantz
merged 62 commits into
cumulusci-next-snapshots-copilot
from
jlantz/update-auth-structure
Oct 31, 2024
Merged
Update authentication structure and decouple from GitHub Environments #32
jlantz
merged 62 commits into
cumulusci-next-snapshots-copilot
from
jlantz/update-auth-structure
Oct 31, 2024
Conversation
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
--- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/muselab-d2x/d2x/tree/cumulusci-next-snapshots-copilot?shareId=XXXX-XXXX-XXXX-XXXX).
…rets and import models from `d2x/auth/sf/models.py` * **Refactor**: Remove data structures and import them from `d2x/auth/sf/models.py` * **Environment Variables**: Update token exchange logic to use environment variables for secrets Add test cases for `d2x/auth/sf/auth_url.py` and `d2x/auth/sf/login_url.py` * **Test Cases**: Add test cases for token exchange and authentication flow in `tests/test_auth_url.py` and `tests/test_login_url.py` Add a workflow to run tests on push and pull request * **GitHub Actions**: Add `.github/workflows/test.yml` to run tests on push and pull request
* **pyproject.toml** - Add `requests` dependency with version "^2.28.1" - Ensure the project builds using poetry * **requirements.txt** - Add `requests` dependency with version "2.28.1"
* **`pyproject.toml`** - Add necessary dependencies for the project using poetry - Ensure the project builds using poetry * **`requirements_dev.in`** - Add a requirements_dev.in file for development dependencies - Include pytest as a development dependency
* **Dependencies** - Add `rich`, `pydantic`, `cookiecutter`, and `requests` to production dependencies. - Add `pytest` to development dependencies. * **Pip-compile** - Configure pip-compile to generate hashes and manage requirements. Update `.github/workflows/test.yml` to install development dependencies * Change the installation command to use `requirements_dev.txt`. Update `requirements.txt` to include pip-compile instructions * Add comments for pip-compile usage. * List production dependencies.
* **.github/workflows/test.yml** - Correct pip install command to install both requirements and the local checked out package. * **requirements_dev.in** - Add `-e .` to install the local package in development mode.
* Install poetry and use it to install dependencies * Ensure pip installs the local package in editable mode
* **pyproject.toml** - Remove old requirements and add poetry configuration - Add generate-hashes and requirements for production and development * **.github/workflows/test.yml** - Change dependency installation to use requirements.txt and requirements_dev.txt - Remove poetry installation and usage
* Install poetry and use it to install dependencies * Remove pip install commands for requirements.txt and requirements_dev.txt
* **Pydantic Core**: - Update version to 2.23.4 - Update hash values for various platforms * **Poetry**: - Update version to 1.8.4
* Change Python version to 3.10 * Add caching for Poetry and pip dependencies using actions/cache@v2
* **d2x/api**: Create an empty `__init__.py` file. * **d2x/auth/sf**: Add a comment to the `__init__.py` file. * **d2x/base**: Create an empty `__init__.py` file. * **d2x/env**: Replace existing code with an empty `__init__.py` file. * **d2x/models**: Add a comment to the `__init__.py` file. * **d2x/models/sf**: Add a comment to the `__init__.py` file. * **d2x/ux**: Create an empty `__init__.py` file. * **d2x/ux/gh**: Create an empty `__init__.py` file.
* **d2x/auth/sf/login_url.py** - Add import for `get_environment_variable` from `d2x.api.gh`. * **tests/test_auth_url.py** - Add import for `json` module.
…nction in `d2x/auth/sf/auth_url.py` * Add a check for `debug_info` being not None before setting the error message in the exception block * Add functions to set and get environment variables and secrets in `d2x/api/gh.py`
…Hub Environments * **Environment Variables** - Implement `set_environment_variable` to set a variable in a GitHub Environment - Implement `get_environment_variable` to get a variable from a GitHub Environment * **Environment Secrets** - Implement `set_environment_secret` to set a secret in a GitHub Environment - Implement `get_environment_secret` to get a secret from a GitHub Environment
* **Get GitHub Access Token**: Retrieve GitHub Access Token from the specified environment and store it in the GitHub environment variable. * **Delete Org Session**: Delete the org session from the specified environment using the retrieved GitHub Access Token. * **Add Job Summary**: Add a job summary to the GitHub step summary, including the environment name and status of the org session deletion.
Refactor `d2x.gen` and `d2x.parse` functions into Pydantic models and update all callers. * **Add Pydantic Models:** - Add `LoginUrlModel` to `d2x/models/sf/auth.py` to replace `get_login_url_and_token` function. - Add `SfdxAuthUrlModel` to `d2x/models/sf/auth.py` to replace `parse_sfdx_auth_url` function. * **Update Callers:** - Update `d2x/auth/sf/auth_url.py` to use `SfdxAuthUrlModel` for parsing SFDX auth URL. - Update `d2x/auth/sf/login_url.py` to use `LoginUrlModel` for generating login URL. - Update `d2x/cli/main.py` to import `LoginUrlModel` and `SfdxAuthUrlModel`. * **Remove Deprecated Files:** - Delete `d2x/gen/sf/login_url.py`. - Delete `d2x/parse/sf/auth_url.py`. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/muselab-d2x/d2x/tree/jlantz/update-auth-structure?shareId=XXXX-XXXX-XXXX-XXXX).
* **LoginUrlModel tests** - Test successful instantiation and method call - Test instantiation with missing access token - Test instantiation with missing login URL * **SfdxAuthUrlModel tests** - Test successful instantiation and method call - Test instantiation with invalid URL
* **Fix `requests.put` call** - Update the `requests.put` call to use the correct `json` parameter. * **Remove duplicate imports** - Remove duplicate imports to clean up the file. * **Import `json` module in `tests/test_login_url.py`** - Import the `json` module at the beginning of the file.
* Set `DEMO` to "demo" in the `OrgType` Enum
* Import the `re` module at the top of the file
* Import the `re` module at the top of the file
* Import the `re` module at the top of the file
…empty `ret_url` parameter * Encode `ret_url` parameter as "%2F" if it is empty
* Define a new GitHub Actions workflow for running Python tests * Trigger the workflow on push and pull request events to the main and releases branches * Use the starter workflow for Python tests with Python version 3.10
* Set up Python environment and install dependencies * Run tests and generate coverage report * Upload coverage report to Codecov * Generate and upload test report * Post test summary to GitHub step summary
* Add a reusable workflow for Python tests in `.github/workflows/python-test.yml` * Update branches to include 'main' and 'releases/**' * Remove `branches` section from `pull_request` block * Add a `jobs` section with a `test` job that runs on `ubuntu-latest`
…d2x/d2x into jlantz/implement-two-stage-auth
Implement two-stage auth model with GitHub Environments
Refactor d2x.gen and d2x.parse as Pydantic models
jlantz
merged commit Oct 31, 2024
c255f44
into
cumulusci-next-snapshots-copilot
1 of 2 checks passed
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.
For more details, open the Copilot Workspace session.