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

Corepack isn't persisted between sessions #20244

Open
davidrhoderick opened this issue Sep 26, 2024 · 5 comments
Open

Corepack isn't persisted between sessions #20244

davidrhoderick opened this issue Sep 26, 2024 · 5 comments
Labels
team: team-experience type: bug Something isn't working

Comments

@davidrhoderick
Copy link

Bug description

After the first init run of my workspace, every time I start the workspace, I have to re-enable corepack. I can't find in the documentation how to persist corepack from session to session.

Steps to reproduce

  1. Create a Redwood.js Gitpod workspace
  2. Notice how the project starts nicely.
  3. Close the session
  4. Turn off the Gitpod workspace
  5. Turn the Gitpod workspace back on (open it).
  6. Notice how you can't run yarn rw dev without first enabling corepack.

Workspace affected

redwoodjs-starter-1973l3npt3n

Expected behavior

I wish it would retain corepack's enabled state between sessions, just like my computer does.

Example repository

No response

Anything else?

No response

@davidrhoderick davidrhoderick added the type: bug Something isn't working label Sep 26, 2024
@axonasif
Copy link
Member

Hi @davidrhoderick,

How are you enabling corepack for the first time? Is there a public repo I can take a look at?

@davidrhoderick
Copy link
Author

I noticed it after forking the Redwood.js repo and I've only made changes to my Prisma schema so far so I think that should be representative.

It seems the init script worked well but when I came back to it, corepack isn't enabled. It's like we need a separate resume script to run after init. Unless I'm not understanding init correctly and it runs everytime it restarts, in which case, maybe there is an issue with the init steps.

@davidrhoderick
Copy link
Author

So I tried to add the following steps to my command:

image: gitpod/workspace-postgres

tasks:
  - init: |
      # Cleanup terminal
      printf "\033[3J\033c\033[3J"

      nvm install 20.15.1
      nvm use 20.15.1

      corepack enable
      corepack prepare yarn@stable --activate

      # Auto init a redwoodjs project for Gitpod if missing
      if test ! -e redwood.toml; then {
        # Create
        COREPACK_ENABLE_DOWNLOAD_PROMPT=0 corepack yarn create redwood-app . --overwrite --yes
      } else {
        COREPACK_ENABLE_DOWNLOAD_PROMPT=0 corepack yarn install
      } fi

    command: |
      corepack enable
      corepack prepare yarn@stable --activate
      cmd="yarn rw dev"
      printf "Executing '%s' ..." "${cmd}"
      ${cmd}

But it still doesn't work. I'm not sure I'm understanding exactly where to add this so that it runs every time a workspace is restarted...

@davidrhoderick
Copy link
Author

Looks to me that even when I make changes to the command, it never runs on start up. Do I need to re-init the image?

@axonasif
Copy link
Member

Hi @davidrhoderick, sorry for the the late follow up. One quick fix is to replace init with before. Of course, if you're using prebuilds, this defeats the purpose but we will need to take a more complicated approach if we want to fully use prebuilds.

Reason: https://www.gitpod.io/docs/configure/repositories/prebuilds#only-the-workspace-directory-is-persisted-from-a-prebuild

Let me know if this works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team: team-experience type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants