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
[server] listWorkspaceSessions API #19733
Conversation
24dbb32
to
8a9506a
Compare
8a9506a
to
3f6007a
Compare
API responded 🐰 , generally LGTM
respond data example{
"pagination": {
"total": 3
},
"workspaceSessions": [
{
"workspace": {
"id": "mustardmh-springpetclin-83qmuz2qpc0",
"metadata": {
"ownerId": "ebfa0776-c604-4b62-98b4-fd74f3d58c5c",
"organizationId": "3b921ba3-62ef-4e3b-a644-08ab30f4fd2d",
"configurationId": "e0afbde4-d188-4e35-bb64-7eea78dae046",
"name": "mustard-mh/spring-petclinic - master",
"originalContextUrl": "https://github.com/mustard-mh/spring-petclinic/tree/master"
},
"spec": {
"initializer": {
"specs": [
{
"git": {
"remoteUri": "https://github.com/mustard-mh/spring-petclinic.git",
"upstreamRemoteUri": "https://github.com/gitpod-samples/spring-petclinic.git",
"targetMode": "CLONE_TARGET_MODE_REMOTE_COMMIT",
"cloneTarget": "b84fc2ca666c336a0468c65ac636d0a41499d68e",
"checkoutLocation": "spring-petclinic",
"config": {}
}
}
]
},
"type": "WORKSPACE_TYPE_PREBUILD",
"git": {},
"admission": "ADMISSION_LEVEL_OWNER_ONLY"
},
"status": {
"phase": {
"lastTransitionTime": "2024-05-10T15:32:15.383Z"
},
"prebuildResult": {},
"gitStatus": {
"cloneUrl": "https://github.com/mustard-mh/spring-petclinic.git",
"branch": "master",
"latestCommit": "b84fc2ca666c336a0468c65ac636d0a41499d68e"
}
}
},
"creationTime": "2024-05-10T15:32:15.749Z",
"startedTime": "2024-05-10T15:32:58.605Z",
"stoppingTime": "2024-05-10T15:34:04.823Z",
"stoppedTime": "2024-05-10T15:34:05.308Z"
},
{
"workspace": {
"id": "mustardmh-templatesvelt-08aia0x8m0e",
"metadata": {
"ownerId": "ebfa0776-c604-4b62-98b4-fd74f3d58c5c",
"organizationId": "3b921ba3-62ef-4e3b-a644-08ab30f4fd2d",
"name": "#1: Update README.md",
"originalContextUrl": "https://github.com/mustard-mh/template-sveltejs/pull/1"
},
"spec": {
"initializer": {
"specs": [
{
"git": {
"remoteUri": "https://github.com/mustard-mh/template-sveltejs.git",
"targetMode": "CLONE_TARGET_MODE_REMOTE_COMMIT",
"cloneTarget": "eb6a71af3aa82c9b1e979981d213676dd8879a2b",
"checkoutLocation": "template-sveltejs",
"config": {}
}
}
]
},
"type": "WORKSPACE_TYPE_REGULAR",
"git": {},
"admission": "ADMISSION_LEVEL_OWNER_ONLY"
},
"status": {
"phase": {
"lastTransitionTime": "2024-05-10T15:22:50.064Z"
},
"gitStatus": {
"cloneUrl": "https://github.com/mustard-mh/template-sveltejs.git",
"branch": "hw/test-pr",
"latestCommit": "eb6a71af3aa82c9b1e979981d213676dd8879a2b"
}
}
},
"creationTime": "2024-05-10T15:22:50.133Z",
"startedTime": "2024-05-10T15:23:39.126Z",
"stoppingTime": "2024-05-10T15:28:09.747Z",
"stoppedTime": "2024-05-10T15:29:01.072Z"
},
{
"workspace": {
"id": "mustardmh-springpetclin-ih7cfpagvx5",
"metadata": {
"ownerId": "ebfa0776-c604-4b62-98b4-fd74f3d58c5c",
"organizationId": "3b921ba3-62ef-4e3b-a644-08ab30f4fd2d",
"name": "mustard-mh/spring-petclinic - master",
"originalContextUrl": "https://github.com/mustard-mh/spring-petclinic"
},
"spec": {
"initializer": {
"specs": [
{
"git": {
"remoteUri": "https://github.com/mustard-mh/spring-petclinic.git",
"upstreamRemoteUri": "https://github.com/gitpod-samples/spring-petclinic.git",
"targetMode": "CLONE_TARGET_MODE_REMOTE_COMMIT",
"cloneTarget": "b84fc2ca666c336a0468c65ac636d0a41499d68e",
"checkoutLocation": "spring-petclinic",
"config": {}
}
}
]
},
"type": "WORKSPACE_TYPE_REGULAR",
"git": {},
"admission": "ADMISSION_LEVEL_OWNER_ONLY"
},
"status": {
"phase": {
"lastTransitionTime": "2024-05-10T15:21:55.878Z"
},
"gitStatus": {
"cloneUrl": "https://github.com/mustard-mh/spring-petclinic.git",
"branch": "master",
"latestCommit": "b84fc2ca666c336a0468c65ac636d0a41499d68e"
}
}
},
"creationTime": "2024-05-10T15:21:55.942Z",
"startedTime": "2024-05-10T15:23:31.378Z"
}
]
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approve to unblock. I'm not quite sure about the filter, i.e. can user find out which workspace (instance) made which usage data? But if we treat them as two different APIs, then I'm good with it (or let's wait users' feedback)
Don't forget to check last comment above (<3)
@@ -448,53 +448,32 @@ export class TypeORMWorkspaceDBImpl extends TransactionalDBImpl<WorkspaceDB> imp | |||
} | |||
|
|||
public async findSessionsInPeriod( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, this was actually dead code since the PAYG transition! 🧡
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concept + code changes LGTM ✔️
Really like that we are only exposing the bare minimum from the instance (timestamps). 👍
c56e417
to
17d9a98
Compare
|
GitGuardian id | GitGuardian status | Secret | Commit | Filename | |
---|---|---|---|---|---|
11010498 | Triggered | Generic High Entropy Secret | aedc230 | components/public-api/typescript-common/fixtures/toWorkspaceSession_2.json | View secret |
11010499 | Triggered | Generic High Entropy Secret | aedc230 | components/public-api/typescript-common/fixtures/toWorkspaceSession_3.json | View secret |
11010501 | Triggered | Generic High Entropy Secret | aedc230 | components/public-api/typescript-common/fixtures/toWorkspaceSession_4.json | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secret safely. Learn here the best practices.
- Revoke and rotate this secret.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
17d9a98
to
aedc230
Compare
/unhold |
Description
Introduces a new RPC for listing workspaces sessions (aka as workspace instances internally).
The API uses the same workspace shape which is already a shape that combines information from a workspace and a workspaceInstance (usually the latest one).
Related Issue(s)
Fixes https://linear.app/gitpod/issue/ENT-66/add-listworkspacesessions-rpc-call-to-workspace-service-endpoint
How to test
https://se-workspad026375d1b.preview.gitpod-dev.com/workspaces
Create a bunch of workspaces and also restart them in order to create multiple instances per workspace.
Ideally also do this with different users in the same work.
Use the new API to list the sessions and verify the data represents the system state.
Documentation
Preview status
gitpod:summary
Build Options
Build
Run the build with werft instead of GHA
Run Leeway with
--dont-test
Publish
Installer
Add desired feature flags to the end of the line above, space separated
Preview Environment / Integration Tests
If enabled this will build
install/preview
If enabled this will create the environment on GCE infra
Saves cost. Untick this only if you're really sure you need a non-preemtible machine.
Valid options are
all
,workspace
,webapp
,ide
,jetbrains
,vscode
,ssh
. If enabled,with-preview
andwith-large-vm
will be enabled./hold