Skip to content

Snapshot losing important Gitpod env vars #9804

@shaal

Description

@shaal

Bug description

When opening a Gitpod snapshot, the value of GITPOD_REPO_ROOT changes.
Original workspace:
GITPOD_REPO_ROOT=/workspace/<my_project_name>

After snapshot:
GITPOD_REPO_ROOT=/workspace

When I check it https://gitpod.io/workspaces
The bottom (original workspace) displays the correct repo it belongs to - https://github.com/gitpod-io/template-sveltejs
The top (snapshot of workspace) displays the wrong one - undefined
image

Steps to reproduce

  1. Open any repo on Gitpod
  2. Run in terminal printenv | grep GITPOD_REPO_ROOT
  3. You should see /workspace/<your_repo_name>
  4. Create a new snapshot
  5. Open that snapshot.
  6. Run in terminal printenv | grep GITPOD_REPO_ROOT
  7. You would see that now it's only /workspace

Workspace affected

No response

Expected behavior

No response

Example repository

No response

Anything else?

This affects DrupalPod project, that uses this variable to make sure we're in the right directory of the project.

If this is helpful, there might be other unexpected changes to some of the variables?

I tested this with https://github.com/gitpod-io/template-sveltejs
Running printenv | grep GITPOD in terminal
Before snapshot:

GITPOD_REPO_ROOT=/workspace/template-sveltejs GITPOD_ANALYTICS_WRITER=segment GITPOD_OWNER_ID=2b35cc6b-508c-4438-9148-bb837856f556 GITPOD_WORKSPACE_ID=gitpodio-templatesvelte-cvhpl918bwn GITPOD_INTERVAL=30000 GITPOD_CODE_HOST=https://gitpod.io GITPOD_WORKSPACE_CONTEXT_URL=https://github.com/gitpod-io/template-sveltejs GITPOD_INSTANCE_ID=8c795498-ad47-464b-86dc-875da0040e58 GITPOD_WORKSPACE_URL=https://gitpodio-templatesvelte-cvhpl918bwn.ws-us44.gitpod.io GITPOD_THEIA_PORT=23000 GITPOD_WORKSPACE_CONTEXT={"isFile":false,"path":"","title":"gitpod-io/template-sveltejs - master","ref":"master","refType":"branch","revision":"a6c5701f2c70a3dd3f36bcf1c4bf6de995e9a4b4","repository":{"cloneUrl":"https://github.com/gitpod-io/template-sveltejs.git","host":"github.com","name":"template-sveltejs","owner":"gitpod-io","private":false,"fork":{"parent":{"cloneUrl":"https://github.com/sveltejs/template.git","host":"github.com","name":"template","owner":"sveltejs","private":false}}},"normalizedContextURL":"https://github.com/gitpod-io/template-sveltejs","checkoutLocation":"template-sveltejs","upstreamRemoteURI":"https://github.com/sveltejs/template.git","snapshotBucketId":"workspaces/black-manatee-4q9jme8u/snapshot-1640634946528943203.tar@gitpod-prod-user-cb603eaa-fff5-41a8-bfba-8786000cf0c7","prebuildWorkspaceId":"f2ed1095-bef2-49c8-b57a-8d3990ff9178","wasPrebuilt":true} GITPOD_CLI_APITOKEN=zjsEoFwKBW466k3TNEZXoz5Q4o.QcHJG GITPOD_WORKSPACE_CLUSTER_HOST=ws-us44.gitpod.io GITPOD_GIT_USER_NAME=shaal GITPOD_MEMORY=3435 GITPOD_ANALYTICS_SEGMENT_KEY=bUY8IRdJ42KjLOBS9LoIHMYFBD8rSzjU GITPOD_HOST=https://gitpod.io GITPOD_IDE_ALIAS=code GITPOD_GIT_USER_EMAIL=oshaal@phase2technology.com GITPOD_TASKS=[{"init":"npm install","command":"export CLIENT_URL=\"$(gp url 35729)/livereload.js?snipver=1&port=443\"\n{ gp await-port 5000 && sleep 5 && gp preview $(gp url 5000) & } &> /dev/null\ngp open src/App.svelte\nnpm run dev\n"}] 

After snapshot:

GITPOD_REPO_ROOT=/workspace GITPOD_ANALYTICS_WRITER=segment GITPOD_OWNER_ID=2b35cc6b-508c-4438-9148-bb837856f556 GITPOD_WORKSPACE_ID=copper-warbler-d11opp8k9xq GITPOD_INTERVAL=30000 GITPOD_CODE_HOST=https://gitpod.io GITPOD_WORKSPACE_CONTEXT_URL=snapshot/b4a849d2-db15-4074-9c2c-7ce15b7c6971 GITPOD_INSTANCE_ID=a0d9c6e7-0938-4ea7-8a0f-b8cb0ea76625 GITPOD_WORKSPACE_URL=https://copper-warbler-d11opp8k9xq.ws-us44.gitpod.io GITPOD_THEIA_PORT=23000 GITPOD_WORKSPACE_CONTEXT={"isFile":false,"path":"","title":"gitpod-io/template-sveltejs - master","ref":"master","refType":"branch","revision":"a6c5701f2c70a3dd3f36bcf1c4bf6de995e9a4b4","repository":{"cloneUrl":"https://github.com/gitpod-io/template-sveltejs.git","host":"github.com","name":"template-sveltejs","owner":"gitpod-io","private":false,"fork":{"parent":{"cloneUrl":"https://github.com/sveltejs/template.git","host":"github.com","name":"template","owner":"sveltejs","private":false}}},"normalizedContextURL":"snapshot/b4a849d2-db15-4074-9c2c-7ce15b7c6971","checkoutLocation":"template-sveltejs","upstreamRemoteURI":"https://github.com/sveltejs/template.git","snapshotBucketId":"workspaces/gitpodio-templatesvelte-cvhpl918bwn/snapshot-1651784911052196571.tar@gitpod-prod-user-2b35cc6b-508c-4438-9148-bb837856f556","prebuildWorkspaceId":"f2ed1095-bef2-49c8-b57a-8d3990ff9178","wasPrebuilt":true,"snapshotId":"b4a849d2-db15-4074-9c2c-7ce15b7c6971"} GITPOD_CLI_APITOKEN=L61cmjb_V9Wl5PD0AZSbAxdP8rwn169r GITPOD_WORKSPACE_CLUSTER_HOST=ws-us44.gitpod.io GITPOD_GIT_USER_NAME=shaal GITPOD_MEMORY=3435 GITPOD_ANALYTICS_SEGMENT_KEY=bUY8IRdJ42KjLOBS9LoIHMYFBD8rSzjU GITPOD_HOST=https://gitpod.io GITPOD_IDE_ALIAS=code GITPOD_GIT_USER_EMAIL=oshaal@phase2technology.com GITPOD_TASKS=[{"init":"npm install","command":"export CLIENT_URL=\"$(gp url 35729)/livereload.js?snipver=1&port=443\"\n{ gp await-port 5000 && sleep 5 && gp preview $(gp url 5000) & } &> /dev/null\ngp open src/App.svelte\nnpm run dev\n"}] 

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Scheduled

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions