Skip to content

feat(oracle): allow for specifiying config and key file from env vars #465

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 2 commits into from
Feb 7, 2025

Conversation

a-dubs
Copy link
Contributor

@a-dubs a-dubs commented Feb 4, 2025

PR Checklist

To ease the process of reviewing your PR, do make sure to complete the following checklist before submitting a pull
request.

  • I have added unit tests to cover the new behavior under ``tests/unit_tests/```
  • I have run tox -e format locally to automatically format my code before submitting
  • I have run tox locally ensuring that it passes before submitting
  • (if applicable) I have added a reference to issues that this PR relates to in the PR message (Refs GH-1234, Fixes GH-1234)

Otherwise, please leave the PR as a draft to indicate that it is still a work in progress.

Proposed Commit Message

N/A

Description and Relevant Issues

This will allow for testing OCI on jenkins 🎉

Since the config file and the oci pem key file are stored in credentials bindings on jenkins, we need to be able to reference their paths using just environment variables, and more importantly, pycloudlib needs to be able to insert the key file path into the oci config at runtime using the key file path given to it via the new env var.

Additional Context

Test Steps

I added new unit tests for both the helper function itself and also to end-to-end test the OCI cloud constructor when environment variables are used. I generated html coverage report and ensured 100% coverage of newly added code.

Manual Testing

Ran the oracle example file using the following command and ensured via the logs that my new oci config was being read correctly:

PYCLOUDLIB_OCI_KEY_FILE_PATH="..." \                                                                                                                                     
PYCLOUDLIB_OCI_CONFIG_FILE_PATH="..." \
python examples/oracle.py

Merge type

  • Squash merge using "Proposed Commit Message"
  • Rebase and merge unique commits.

@a-dubs a-dubs force-pushed the CPC-6371-add-oci-config-file-env-vars branch 4 times, most recently from 3d996a1 to 00f6f61 Compare February 5, 2025 17:37
@a-dubs a-dubs requested a review from mstpn February 5, 2025 20:12
@a-dubs
Copy link
Contributor Author

a-dubs commented Feb 5, 2025

@mstpn ignore the first class/suite of tests in test_util.py (TestGetSubnetId) since all i did was indent and convert existing tests to be in one common class instead of individual ungrouped tests.

@a-dubs a-dubs force-pushed the CPC-6371-add-oci-config-file-env-vars branch from 00f6f61 to 0045378 Compare February 5, 2025 21:42
Copy link
Member

@mstpn mstpn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you can fix the pylint errors everything else looks good to me.

Thanks for cleaning up the tests for readability.

@a-dubs a-dubs force-pushed the CPC-6371-add-oci-config-file-env-vars branch 2 times, most recently from 84bf252 to 7942fbd Compare February 5, 2025 22:26
@a-dubs a-dubs marked this pull request as draft February 5, 2025 22:49
@uhryniuk
Copy link
Contributor

uhryniuk commented Feb 5, 2025

After linter errors are sorted then you're g2g

@a-dubs a-dubs force-pushed the CPC-6371-add-oci-config-file-env-vars branch from 7942fbd to ede4adc Compare February 6, 2025 14:15
@a-dubs a-dubs marked this pull request as ready for review February 6, 2025 14:58
@a-dubs
Copy link
Contributor Author

a-dubs commented Feb 6, 2025

@mstpn @uhryniuk ready for final re-review now that I fixed everything

Copy link
Member

@mstpn mstpn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work here @a-dubs.

@a-dubs a-dubs merged commit 566de5d into canonical:main Feb 7, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants