Skip to content
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

Source connections from workspace/deployment #1414

Merged
merged 20 commits into from
Oct 18, 2023
Merged

Conversation

jeremybeard
Copy link
Contributor

@jeremybeard jeremybeard commented Oct 11, 2023

Description

This change enables the CLI to source connections from the Astro workspace or deployment, in addition to the connections sourced from the astro_settings.yaml file. Note that the feature to add connections to a workspace or deployment is not yet available in Astro.

When astro dev start or astro dev restart is run with the new flag --deployment-id <Astro deployment id> the connections will be retrieved for that deployment and added to the Airflow metadata DB in the same manner as for the astro_settings.yaml file. If the deployment connections are inaccessible the start/restart will proceed without them.

Similarly, if the new flag --workspace-id <Astro workspace id> is set, or otherwise the user has switched the CLI to an Astro workspace, the connections for that workspace will be loaded.

The local file will take precedence if a connection id is present in both sources.

🧪 Functional Testing

List the functional testing steps to confirm this feature or fix.

📋 Checklist

  • Rebased from the main (or release if patching) branch (before testing)
  • Ran make test before taking out of draft
  • Ran make lint before taking out of draft
  • Added/updated applicable tests
  • Tested against Astro-API (if necessary).
  • Tested against Houston-API and Astronomer (if necessary).
  • Communicated to/tagged owners of respective clients potentially impacted by these changes.
  • Updated any related documentation

@sunkickr
Copy link
Contributor

Looks good to me will need unit tests and a review from @jwitz for copy

@codecov
Copy link

codecov bot commented Oct 18, 2023

Codecov Report

Attention: 13 lines in your changes are missing coverage. Please review.

Comparison is base (89f3604) 86.94% compared to head (f10d5e7) 86.95%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1414   +/-   ##
=======================================
  Coverage   86.94%   86.95%           
=======================================
  Files         114      115    +1     
  Lines       13953    14033   +80     
=======================================
+ Hits        12132    12202   +70     
- Misses       1084     1092    +8     
- Partials      737      739    +2     
Files Coverage Δ
airflow/container.go 69.11% <ø> (ø)
airflow/docker.go 84.83% <100.00%> (ø)
cloud/organization/organization.go 80.15% <100.00%> (ø)
cloud/organization/organization_token.go 81.06% <100.00%> (ø)
cmd/root.go 91.42% <100.00%> (ø)
config/config.go 75.32% <ø> (ø)
config/types.go 77.77% <ø> (ø)
settings/settings.go 84.78% <89.65%> (+1.01%) ⬆️
cloud/environment/environment.go 88.88% <88.88%> (ø)
cmd/airflow.go 88.29% <77.77%> (-0.81%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kushalmalani kushalmalani marked this pull request as ready for review October 18, 2023 06:46
@sunkickr sunkickr merged commit 9c7beba into main Oct 18, 2023
@sunkickr sunkickr deleted the environment-connections branch October 18, 2023 19:04
kushalmalani added a commit that referenced this pull request Oct 31, 2023
* Source connections from workspace/deployment

* Working through unit tests

* More

* Temporarily comment out locally-broken test

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Test scenarios covered

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix lint issues

* Remove new gitignore file

* empty commit

* add remove to test

* fix lint

* empty commit

* put test back

* fix test

* Fixing test and cleanup test files

* Disable feature by default

* Enable feature for unit tests

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: David Koenitzer <davidkoenit@gmail.com>
Co-authored-by: Kushal Malani <kushal@astronomer.io>
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