Skip to content

feat(vscode-web): add offline, use_cached, extensions_dir and auto_install_extensions #235

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 23 commits into from
May 3, 2024

Conversation

michaelbrewer
Copy link
Contributor

@michaelbrewer michaelbrewer commented Apr 25, 2024

@michaelbrewer michaelbrewer marked this pull request as draft April 25, 2024 06:36
@michaelbrewer michaelbrewer marked this pull request as ready for review April 27, 2024 05:50
@matifali matifali requested review from mafredri and code-asher April 27, 2024 13:20
Copy link
Member

@code-asher code-asher left a comment

Choose a reason for hiding this comment

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

Looks good to me, but I think we should use the same name in all the comments/output/functions (maybe VS Code Web).

@michaelbrewer michaelbrewer requested a review from code-asher May 2, 2024 07:28
Copy link
Member

@matifali matifali left a comment

Choose a reason for hiding this comment

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

I think I have suggested all the name changes, but I could have missed some.

michaelbrewer and others added 5 commits May 2, 2024 00:59
Co-authored-by: Muhammad Atif Ali <me@matifali.dev>
Co-authored-by: Muhammad Atif Ali <me@matifali.dev>
Co-authored-by: Muhammad Atif Ali <me@matifali.dev>
Co-authored-by: Muhammad Atif Ali <me@matifali.dev>
Co-authored-by: Muhammad Atif Ali <me@matifali.dev>
michaelbrewer and others added 6 commits May 2, 2024 01:00
Co-authored-by: Muhammad Atif Ali <me@matifali.dev>
Co-authored-by: Muhammad Atif Ali <me@matifali.dev>
Co-authored-by: Muhammad Atif Ali <me@matifali.dev>
Co-authored-by: Muhammad Atif Ali <me@matifali.dev>
Co-authored-by: Muhammad Atif Ali <me@matifali.dev>
Co-authored-by: Muhammad Atif Ali <me@matifali.dev>
@michaelbrewer
Copy link
Contributor Author

I think I have suggested all the name changes, but I could have missed some.

some of this was there from before and some of it was exactly working code from the code-server implementation. I have accepted all your suggestions, but i will need to retest and fix CI errors.

@matifali
Copy link
Member

matifali commented May 2, 2024

Thank you, @michaelbrewer ❤️ . You are doing a great job of making modules super helpful.

Let's wait for an approval from @code-asher and I will merge and cut a release.

@michaelbrewer
Copy link
Contributor Author

Thank you, @michaelbrewer ❤️ . You are doing a great job of making modules super helpful.

Let's wait for an approval from @code-asher and I will merge and cut a release.

Would be nice to have official templates is composed of modules. :)

@matifali
Copy link
Member

matifali commented May 2, 2024

Would be nice to have official templates is composed of modules. :)

I have also thought about this and created an issue. But Coder bundles starter templates within the product and when we add modules that are fetched from registry, this does not work on restricted or air-gapped deployments.

@michaelbrewer
Copy link
Contributor Author

Would be nice to have official templates is composed of modules. :)

I have also thought about this and created an issue. But Coder bundles starter templates within the product and when we add modules that are fetched from registry, this does not work on restricted or air-gapped deployments.

Most of the included examples don't run air-gapped as they would curl to install code-server.

Maybe https://developer.hashicorp.com/terraform/language/providers/requirements#source-addresses to allow for registry.coder.com ?

@michaelbrewer
Copy link
Contributor Author

Scanning through the examples you can see cases of this:

  • examples/templates/aws-devcontainer/main.tf - (https://get.docker.com and https://registry.coder.com/modules/code-server etc..)
  • examples/templates/aws-linux/main.tf - (https://code-server.dev/install.sh)
  • examples/templates/docker/main.tf - (https://code-server.dev/install.sh)
    etc..

Copy link
Member

@code-asher code-asher left a comment

Choose a reason for hiding this comment

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

Thank you @matifali for all finding all the spots to update the name! Absolutely perfect.

I made a few more minor suggestions that I missed the first time around, nothing worth blocking over though so feel free to merge.

Thank you @michaelbrewer for putting this together!

if [ "${AUTO_INSTALL_EXTENSIONS}" = true ]; then
if ! command -v jq > /dev/null; then
echo "jq is required to install extensions from a workspace file."
exit 0
Copy link
Member

Choose a reason for hiding this comment

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

Just occurred to me, should this be considered a failure?

Suggested change
exit 0
exit 1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not sure. From a user perspective it would be nice to continue without an error and print a warning

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess there is where monitoring works when errors happen in a large deployment.

Copy link
Member

Choose a reason for hiding this comment

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

Oh if exit 1 prevents the workspace from starting then yeah, better to continue.

Copy link
Member

Choose a reason for hiding this comment

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

it doesn't prevent the workspace from starting but does show a warning on the page that the script was not successful.

Copy link
Member

Choose a reason for hiding this comment

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

Ahh gotcha yeah exit 1 seems like the right move then.

Copy link
Member

Choose a reason for hiding this comment

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

I think it's fine. If we don't fine jw we should just skip installing extensions and continue with the rest of the script.

Copy link
Member

Choose a reason for hiding this comment

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

I have mixed feelings about it, because enabling autoinstall without jq is a bug the template author has to fix (I think, right?), and not showing the error could make it so no one notices.

On the other hand, it does seem annoying as a user that I cannot launch VS Code just because someone forgot to install jq.

stderr gets highlighted in the terminal, right? Maybe we output to stderr and then keep going.

Also if we use node instead, we avoid the problem entirely.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will try the node to in another PR.

michaelbrewer and others added 5 commits May 2, 2024 17:45
Co-authored-by: Asher <ash@coder.com>
Co-authored-by: Asher <ash@coder.com>
Co-authored-by: Asher <ash@coder.com>
Co-authored-by: Asher <ash@coder.com>
@code-asher code-asher merged commit f5d4152 into coder:main May 3, 2024
2 checks passed
@michaelbrewer michaelbrewer deleted the feat/vsweb-web-missing-features branch May 30, 2024 05:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants