Skip to content

[public api] Add gpctl api workspace ownertoken command #9983

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 1 commit into from
May 13, 2022

Conversation

andrew-farries
Copy link
Contributor

@andrew-farries andrew-farries commented May 12, 2022

Description

Add a gpctl api workspace ownertoken command to get the ownertoken from a given workspace id.

This builds on #9966 and #9970.

Related Issue(s)

Part of #9923

How to test

  1. Start the public API server (talking to the existing API from the preview environment for this branch):
go run . --gitpod-api-url wss://af-add-ownbe4c0ee3bb.preview.gitpod-dev.com/api/v1
  1. Run gpctl against the public API:
go run . api workspaces ownertoken --id $GITPOD_WORKSPACE_ID --token $TOKEN --insecure --address localhost:9501

(the value of $GITPOD_WORKSPACE_ID or $TOKEN don't matter as the gRPC endpoint returns a canned response)

The output of gpctl should be:

INFO[0000] Establishing gRPC connection against localhost:9501
{"token":"some-owner-token"}⏎

Release Notes

NONE

Documentation

None

/hold

@andrew-farries
Copy link
Contributor Author

andrew-farries commented May 13, 2022

/werft run without-vm=true

👍 started the job as gitpod-build-af-add-ownertoken-to-gpctl.4
(with .werft/ from main)

@andrew-farries andrew-farries force-pushed the af/add-ownertoken-to-gpctl branch 2 times, most recently from f3d60e4 to 5026995 Compare May 13, 2022 10:44
@roboquat roboquat added size/L and removed size/M labels May 13, 2022
@andrew-farries andrew-farries force-pushed the af/add-ownertoken-to-gpctl branch 2 times, most recently from 8d4509f to 8ef589e Compare May 13, 2022 11:03
@andrew-farries andrew-farries marked this pull request as ready for review May 13, 2022 11:15
@andrew-farries andrew-farries requested a review from a team May 13, 2022 11:15
@github-actions github-actions bot added the team: workspace Issue belongs to the Workspace team label May 13, 2022
Copy link
Member

@easyCZ easyCZ left a comment

Choose a reason for hiding this comment

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

The PR description uses --gitpod-api-url but the flag looks to be --address if I'm not mistaken. Also left a comment about consistency of workspace ID argument

var workspaceID string

cmd := &cobra.Command{
Use: "ownertoken",
Copy link
Member

Choose a reason for hiding this comment

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

I'd possibly call this owner-token just for readability, up to you.

@easyCZ
Copy link
Member

easyCZ commented May 13, 2022

The PR description uses --gitpod-api-url but the flag looks to be --address

Ignore, I confused the CLI with the API servier.

@andrew-farries andrew-farries force-pushed the af/add-ownertoken-to-gpctl branch from 75e94f3 to 2068bb6 Compare May 13, 2022 11:45
Copy link
Member

@easyCZ easyCZ left a comment

Choose a reason for hiding this comment

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

LGTM

/hold

Copy link
Contributor

@csweichel csweichel left a comment

Choose a reason for hiding this comment

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

LGTM. We'll rectify the cmd style in a follow-up

@andrew-farries andrew-farries force-pushed the af/add-ownertoken-to-gpctl branch from 2068bb6 to 66591db Compare May 13, 2022 13:23
@andrew-farries
Copy link
Contributor Author

/unhold

@roboquat roboquat merged commit aecaa76 into main May 13, 2022
@roboquat roboquat deleted the af/add-ownertoken-to-gpctl branch May 13, 2022 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note-none size/L team: workspace Issue belongs to the Workspace team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants