wallabyjs / public

Repository for Wallaby.js questions and issues
http://wallabyjs.com
757 stars 45 forks source link

Support for Github Codespaces #2675

Open delucca opened 3 years ago

delucca commented 3 years ago

Issue description or question

Hi everyone.

I'm trying to use Wallaby with Github Codespaces but facing some issues.

For example every time I start a new Codespace, Wallaby runs the setup all over again, losing my settings (which other plugins are not losing) and also asking for me to input the license every time.

Was Wallaby tested for Github Codespaces?

smcenlly commented 3 years ago

We currently have not tested Wallaby with GitHub Codespaces. We have had some feedback via Twitter that Wallaby was working in Codespaces but that Wallaby worker processes were not being shutdown properly when the Codespace was terminated (this would be a Codespace issue, and not a Wallaby issue).

We have been on the waiting list for the Codespaces beta for a number of months now so that we can test/validate/verify that Wallaby works in that environment but we are still waiting to hear back. Until we get access to the beta (or if we don't, when it goes live) we won't be able to validate or investigate any issues that arise. At this point in time, while Wallaby may work in Codespaces environments it is not something that we officially support (we expect that to change once we get access).

To ensure that your problem is not project related, have you been able to confirm whether Wallaby works for your project outside of your Codespaces environment?

delucca commented 3 years ago

We currently have not tested Wallaby with GitHub Codespaces. We have had some feedback via Twitter that Wallaby was working in Codespaces but that Wallaby worker processes were not being shutdown properly when the Codespace was terminated (this would be a Codespace issue, and not a Wallaby issue).

We have been on the waiting list for the Codespaces beta waiting list for a number of months now so that we can test/validate/verify that Wallaby works in that environment but we are still waiting to hear back. Until we get access to the beta (or if we don't, when it goes live) we won't be able to validate or investigate any issues that arise. At this point in time, while Wallaby may work in Codespaces environments it is not something that we officially support (we expect that to change once we get access).

To ensure that your problem is not project related, have you been able to confirm whether Wallaby works for your project outside of your Codespaces environment?

Thanks for your quick response :)

Regarding my project: indeed, Wallaby works as expected on local VIsual Studio Code.

Actually, it is also working in Codespaces. The only problem I've found is that it always asks me to insert my license key when I create a Codespace. That should not happen since technically you can persist settings accros multiple Codespaces (a lot of plugins work that way)

But thanks for the explanation too! Looking forward for your invite hahaha

smcenlly commented 3 years ago

Wallaby stores its license key outside of VS Code settings so there may be a little more environmental configuration required. You may find the Remote Containers section of our VS Code docs useful for working out how to configure Codespaces. In particular you can see in our docker-compose.yml that we are copying your .wallaby folder which contains your Wallaby license and Wallaby's update files.

delucca commented 3 years ago

Thanks for sharing this doc!

Quick question, is it possible to set my license as an environment variable? If that is possible, I could use Codespaces secrets feature to enable by default

smcenlly commented 3 years ago

Is it possible to set my license as an environment variable?

Not today, and unfortunately this is probably not a feasible approach for us.

I've tried to escalate getting access to Codespaces beta so we can take a look ourselves as we want to make sure we do things the right way if we are going to make any changes to licensing, etc.


Having read through the documentation for codespaces, I expect that you could set an environment variable with a secret (e.g. private github credentials) and then create a dotfiles repo to personalize your codespace that has an install script that checks for your environment variable, and pulls your wallaby files from a private repo. The documentation says that currently your dotfiles repo needs to be public so you'd need a way to secure your wallaby license.

delucca commented 3 years ago

Is it possible to set my license as an environment variable?

Not today, and unfortunately this is probably not a feasible approach for us.

I've tried to escalate getting access to Codespaces beta so we can take a look ourselves as we want to make sure we do things the right way if we are going to make any changes to licensing, etc.


Having read through the documentation for codespaces, I expect that you could set an environment variable with a secret (e.g. private github credentials) and then create a dotfiles repo to personalize your codespace that has an install script that checks for your environment variable, and pulls your wallaby files from a private repo. The documentation says that currently your dotfiles repo needs to be public so you'd need a way to secure your wallaby license.

Actually, I could set a secret with my license and use that secret in a script from my dotfiles to create the required Wallaby files :)

It is a little hacky, but it should work

tom-fletcher commented 2 years ago

Bringing this back to your attention @smcenlly, as Codespaces are now out of beta and available for GitHub Teams

smcenlly commented 2 years ago

Thanks @tom-fletcher. Did you try Wallaby? I assume that you have a similar problem that people mentioned above - i.e. Wallaby is prompting for the license key each time you open the workspace?

If that is the only problem, we recommend setting your license content as a secret for your workspace and writing the license file to ~/.wallaby/key.lic as part of your dotfiles script.

tom-fletcher commented 2 years ago

I now have Wallaby working, although I haven't used it enough yet to know if there are still performance issues which were mentioned previously. Thanks for the hints on the license key which I have now set up - for anyone else looking to do this, this is how I did it:

Create Dotfiles repository

Create a repository under your personal account called dotfiles. This must to be public (private dotfiles repositories are not currently supported by Codespaces).

Clone this locally, then create a file called setup.sh with the following:

# Write the WallabyJS license key out. This requires the WALLABY_LICENSE_KEY secret to be enabled
# for the repository 
if [ $WALLABY_LICENSE_KEY ]
then
    mkdir -p ~/.wallaby
    echo $WALLABY_LICENSE_KEY > ~/.wallaby/key.lic
fi

Make sure this is executable:

chmod +x setup.sh

Commit/push the changes.

Add Secret to GitHub

Log in to your personal GitHub account and go to your Settings, then Codespaces. Ensure the box Automatically install dotfiles is ticked.

Under Codespaces secrets, create a new secret called WALLABY_LICENSE_KEY and enter your license key as the value. You will also need to select which repositories this applies to.

Be aware that if you create a new repository, you will need to come back here and update the secret to allow the new repository to access it.

Troubleshooting

Note that existing Codespaces created before you setup your dotfiles will not apply these, even after a rebuild. You will need to delete/recreate the Codespace.

Any issues, refer to Troubleshooting dotfiles for Codespaces. Also useful to have a look at your Creation log (⇧⌘P and Codespaces: View Creation Log) for any issues executing the setup.sh script.

smcenlly commented 2 years ago

Thanks for the update @tom-fletcher!

If you're able, we'd appreciate you telling us if it is stable for you. If everything is working and is stable, we'll update our docs and include your instructions for how to set up.

tom-fletcher commented 2 years ago

No worries @smcenlly.

I did a bit of testing - so far everything appears stable even after a few stops and restarts of the Codespace, and all the features appear to work as expected.