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

[DDO-3900] Add service banner bucket field to environments #713

Merged
merged 2 commits into from
Nov 19, 2024

Conversation

em-may
Copy link
Contributor

@em-may em-may commented Nov 19, 2024

What

Nicely outlined by Jack in DDO-3900.

TL;DR: Adds a service banner bucket field to environments to allow setting where their Terra UI banner bucket is so we can add more features to set/get/clear the bucket in Sherlock/Beehive later on, replacing the Jenkins banner set/clear jobs, which will allow us to deprecate/shut down Jenkins.

Details

All environments will have a service_banner_bucket field in the db, which can be be null or a string representing the name of the GCS bucket where the Terra UI banner files live. If a dynamic environment (BEE) is created from a template, one of the following things will happen:

  • If the BEE's template has a service banner bucket set, the BEE will inherit it. I plan to use subdirs within buckets to allow for per-BEE banner files within the same bucket.
  • If the BEE's template does not have a service banner bucket set, the BEE won't have a service banner bucket set.

You can change the banner bucket at any time, currently only with the APIs directly, but eventually Beehive will have a metadata field where you will be able to edit it.

Testing

More tests included in this PR cover the model and API functionality. I also manually did the following to test the new field and functionality:

  1. Spin up Sherlock + Postgres locally
  2. Create a BEE cluster
  3. Create a swatomation template with a default service banner bucket set
  4. Create a swatomation template without a default service banner bucket set
  5. Create a BEE from (4), the service banner bucket is set, as expected
  6. Create a BEE from (5), the service banner bucket is not set, as expected

@em-may em-may self-assigned this Nov 19, 2024
@em-may em-may requested a review from a team as a code owner November 19, 2024 16:01
Copy link

What's Changed


GET /api/environments/v3
Parameters:

Added: serviceBannerBucket in query

Return Type:

Changed response : 200 OK

OK

  • Changed content type : application/json

    Changed items (object):

    • Added property serviceBannerBucket (string)
POST /api/environments/v3
Request:

Changed content type : application/json

  • Added property serviceBannerBucket (string)
Return Type:

Changed response : 201 Created

Created

  • Changed content type : application/json

    • Added property serviceBannerBucket (string)
GET /api/environments/v3/{selector}
Return Type:

Changed response : 200 OK

OK

  • Changed content type : application/json

    • Added property serviceBannerBucket (string)
DELETE /api/environments/v3/{selector}
Return Type:

Changed response : 200 OK

OK

  • Changed content type : application/json

    • Added property serviceBannerBucket (string)
PATCH /api/environments/v3/{selector}
Request:

Changed content type : application/json

  • Added property serviceBannerBucket (string)
Return Type:

Changed response : 200 OK

OK

  • Changed content type : application/json

    • Added property serviceBannerBucket (string)
POST /api/changesets/procedures/v3/apply
Return Type:

Changed response : 200 OK

OK

  • Changed content type : application/json

    Changed items (object):

    • Changed property chartReleaseInfo (object)

      • Changed property environmentInfo (object)

        • Added property serviceBannerBucket (string)
GET /api/changesets/procedures/v3/chart-release-history/{chart-release}
Return Type:

Changed response : 200 OK

OK

  • Changed content type : application/json

    Changed items (object):

    • Changed property chartReleaseInfo (object)

      • Changed property environmentInfo (object)

        • Added property serviceBannerBucket (string)
POST /api/changesets/procedures/v3/plan
Return Type:

Changed response : 200 OK

OK

  • Changed content type : application/json

    Changed items (object):

    • Changed property chartReleaseInfo (object)

      • Changed property environmentInfo (object)

        • Added property serviceBannerBucket (string)

Changed response : 201 Created

Created

  • Changed content type : application/json

    Changed items (object):

    • Changed property chartReleaseInfo (object)

      • Changed property environmentInfo (object)

        • Added property serviceBannerBucket (string)
POST /api/changesets/procedures/v3/plan-and-apply
Return Type:

Changed response : 200 OK

OK

  • Changed content type : application/json

    Changed items (object):

    • Changed property chartReleaseInfo (object)

      • Changed property environmentInfo (object)

        • Added property serviceBannerBucket (string)

Changed response : 201 Created

Created

  • Changed content type : application/json

    Changed items (object):

    • Changed property chartReleaseInfo (object)

      • Changed property environmentInfo (object)

        • Added property serviceBannerBucket (string)
GET /api/changesets/procedures/v3/version-history/{version-type}/{chart}/{version}
Return Type:

Changed response : 200 OK

OK

  • Changed content type : application/json

    Changed items (object):

    • Changed property chartReleaseInfo (object)

      • Changed property environmentInfo (object)

        • Added property serviceBannerBucket (string)
GET /api/changesets/v3
Return Type:

Changed response : 200 OK

OK

  • Changed content type : application/json

    Changed items (object):

    • Changed property chartReleaseInfo (object)

      • Changed property environmentInfo (object)

        • Added property serviceBannerBucket (string)
GET /api/changesets/v3/{id}
Return Type:

Changed response : 200 OK

OK

  • Changed content type : application/json

    • Changed property chartReleaseInfo (object)

      • Changed property environmentInfo (object)

        • Added property serviceBannerBucket (string)
GET /api/chart-releases/v3
Return Type:

Changed response : 200 OK

OK

  • Changed content type : application/json

    Changed items (object):

    • Changed property environmentInfo (object)

      • Added property serviceBannerBucket (string)
POST /api/chart-releases/v3
Return Type:

Changed response : 201 Created

Created

  • Changed content type : application/json

    • Changed property environmentInfo (object)

      • Added property serviceBannerBucket (string)
GET /api/chart-releases/v3/{selector}
Return Type:

Changed response : 200 OK

OK

  • Changed content type : application/json

    • Changed property environmentInfo (object)

      • Added property serviceBannerBucket (string)
DELETE /api/chart-releases/v3/{selector}
Return Type:

Changed response : 200 OK

OK

  • Changed content type : application/json

    • Changed property environmentInfo (object)

      • Added property serviceBannerBucket (string)
PATCH /api/chart-releases/v3/{selector}
Return Type:

Changed response : 200 OK

OK

  • Changed content type : application/json

    • Changed property environmentInfo (object)

      • Added property serviceBannerBucket (string)
GET /api/database-instances/v3
Return Type:

Changed response : 200 OK

OK

  • Changed content type : application/json

    Changed items (object):

    • Changed property chartReleaseInfo (object)

      • Changed property environmentInfo (object)

        • Added property serviceBannerBucket (string)
PUT /api/database-instances/v3
Return Type:

Changed response : 200 OK

OK

  • Changed content type : application/json

    • Changed property chartReleaseInfo (object)

      • Changed property environmentInfo (object)

        • Added property serviceBannerBucket (string)

Changed response : 201 Created

Created

  • Changed content type : application/json

    • Changed property chartReleaseInfo (object)

      • Changed property environmentInfo (object)

        • Added property serviceBannerBucket (string)
POST /api/database-instances/v3
Return Type:

Changed response : 201 Created

Created

  • Changed content type : application/json

    • Changed property chartReleaseInfo (object)

      • Changed property environmentInfo (object)

        • Added property serviceBannerBucket (string)
GET /api/database-instances/v3/{selector}
Return Type:

Changed response : 200 OK

OK

  • Changed content type : application/json

    • Changed property chartReleaseInfo (object)

      • Changed property environmentInfo (object)

        • Added property serviceBannerBucket (string)
DELETE /api/database-instances/v3/{selector}
Return Type:

Changed response : 200 OK

OK

  • Changed content type : application/json

    • Changed property chartReleaseInfo (object)

      • Changed property environmentInfo (object)

        • Added property serviceBannerBucket (string)
PATCH /api/database-instances/v3/{selector}
Return Type:

Changed response : 200 OK

OK

  • Changed content type : application/json

    • Changed property chartReleaseInfo (object)

      • Changed property environmentInfo (object)

        • Added property serviceBannerBucket (string)

Copy link

github-actions bot commented Nov 19, 2024

Published image from d5b557e (merge 2cb1180):

us-central1-docker.pkg.dev/dsp-artifact-registry/sherlock/sherlock:v1.6.14-2cb1180
us-central1-docker.pkg.dev/dsp-devops-super-prod/sherlock/sherlock:v1.6.14-2cb1180

Copy link

codecov bot commented Nov 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 66.78%. Comparing base (18b20b4) to head (d5b557e).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #713      +/-   ##
==========================================
+ Coverage   66.76%   66.78%   +0.01%     
==========================================
  Files         292      292              
  Lines       16488    16497       +9     
==========================================
+ Hits        11008    11017       +9     
  Misses       4579     4579              
  Partials      901      901              
Files with missing lines Coverage Δ
sherlock/internal/api/sherlock/environments_v3.go 91.51% <100.00%> (+0.10%) ⬆️
sherlock/internal/models/environment.go 62.58% <100.00%> (+0.40%) ⬆️
sherlock/internal/models/test_data.go 98.31% <100.00%> (+<0.01%) ⬆️
---- 🚨 Try these New Features:

@em-may em-may force-pushed the emay-DDO-3900-add-bucket-env-field branch from dcd6dec to 860cd9f Compare November 19, 2024 16:50
Copy link
Contributor

@choover-broad choover-broad left a comment

Choose a reason for hiding this comment

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

LGTM. Nice work!

sherlock/docs/docs.go Outdated Show resolved Hide resolved
Copy link

sonarcloud bot commented Nov 19, 2024

Copy link
Contributor

@jyang-broad jyang-broad left a comment

Choose a reason for hiding this comment

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

Adds new text column to environments

not your problem, but still a nit: single letter e for Environment? I was confused for a bit thinking e == error.

@em-may
Copy link
Contributor Author

em-may commented Nov 19, 2024

@jyang-broad From what I can tell, usually e -> environment and err -> error, but still it could at least be env or something.

@em-may em-may merged commit 69e61d5 into main Nov 19, 2024
20 checks passed
@em-may em-may deleted the emay-DDO-3900-add-bucket-env-field branch November 19, 2024 18:52
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