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

feat(self-hosted): Add alpha-stage workstations command #69802

Merged
merged 5 commits into from May 1, 2024

Conversation

azaslavsky
Copy link
Contributor

@azaslavsky azaslavsky commented Apr 26, 2024

This allows users who opt into the alpha test (by contacting the self-hosted team) to utilize the remote self-hosted instances setup we've been working on.

This is alpha-stage and quite under-tested, but we'll expand the coverage as we get more feedback.

Related: getsentry/self-hosted#2968

@azaslavsky azaslavsky marked this pull request as ready for review April 26, 2024 19:58
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Apr 26, 2024
"""

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(("", 0))

Check warning

Code scanning / CodeQL

Binding a socket to all network interfaces Medium

'' binds a socket to all interfaces.
Copy link
Member

Choose a reason for hiding this comment

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

will this be a problem? potentially if a self-hosted user decides to execute this command for some reason

Copy link

codecov bot commented Apr 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.83%. Comparing base (9d09a5b) to head (fe324bf).
Report is 3 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master   #69802       +/-   ##
===========================================
+ Coverage   50.37%   79.83%   +29.46%     
===========================================
  Files        6461     6500       +39     
  Lines      287621   289071     +1450     
  Branches    49563    49777      +214     
===========================================
+ Hits       144881   230776    +85895     
+ Misses     142316    57870    -84446     
- Partials      424      425        +1     

see 2108 files with indirect coverage changes

@azaslavsky azaslavsky enabled auto-merge (squash) May 1, 2024 17:03
`workstations` command requires that the `gcloud` command line utility be installed and visible
from its `$PATH`.

The tool requires two configuration values: a `project` specifying the GCP project that owns the
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to provide a default GCP project for Sentry users to use here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, it's an alpha stage tool. We'd need to manually add them to the project anyway for now, so best to have anyone who wants to use this come to us.

localhost_port = _get_open_port()
subprocess.Popen(
[
GCLOUD,
Copy link
Member

Choose a reason for hiding this comment

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

nit: Would prefer "gcloud" over GCLOUD since it is more clear what this is doing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed it to GCLOUD_BIN.

permissions from the OSPO team to spin up a workstation. Please reach out to us on
#discuss-self-hosted - we'd be happy to get you set up! :)

This command is primarily intended for Sentry employees working on self-hosted. The
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps it would be useful to link to https://github.com/getsentry/self-hosted/blob/master/workstation/README.md somewhere in the help section for the command?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

"""
Create a bespoke Google Cloud Workstation instance.

NOTE: THIS IS CURRENTLY AN ALPHA STAGE COMMAND! If you are a Sentry dev, you'll need explicit
Copy link
Member

Choose a reason for hiding this comment

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

Would be nice to add a note along the lines of using a newer version of gcloud, I was on version 455.0 and the workstatations create command failed. After upgrading to 474.0 things started to go through.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a note further down.

@azaslavsky azaslavsky merged commit dd3ee9d into master May 1, 2024
48 checks passed
@azaslavsky azaslavsky deleted the azaslavsky/workstations-alpha branch May 1, 2024 23:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants