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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: fix GH Codespaces building indefinitely #11981

Merged
merged 2 commits into from
Oct 11, 2023

Conversation

agilgur5
Copy link
Member

@agilgur5 agilgur5 commented Oct 10, 2023

Fixes #11423

Motivation

Make contributing easier for many users and those without too powerful local specs! Lots of folks have wanted to use it in issues and on Slack, so hopefully this should be a big help! 馃檪

  • Codespaces would run indefinitely on the onCreateCommand and never finish (seemingly due to kit? Runs indefinitely when used as an onCreateCommand in GH Codespaces聽kitproj/kit#44)
    • also it would just eat up CPU hours on Codespaces, even if you closed the tab and turned off your computer
      • had to manually go into Codespaces settings and turn it off after GH sent me an email that I used 24 CPU hours overnight while I was asleep 馃珷

Modifications

  • use postCreateCommand instead of onCreateCommand

    • postCreateCommand runs asynchronously after the container is started, unlike onCreateCommand
    • this finished fine in my Codespace
    • this also lets you access the codespace very quickly as pre-build.sh is running async!
  • add GH Codespaces instructions to the developer docs (not exactly "running locally" though... 馃 I believe you can connect a local VSCode editor to it though)

    • link to GH Codespaces
    • warn about async pre-build.sh -- can start editing, but may want to hold off running commands
      • (unless you know what you're doing -- you don't necessarily need to wait for everything to be ready for every command, but will want that for any testing or building)
    • instruct on how to use forwarded ports
  • remove old warning about Codespaces not working!

Verification

make docs passes

Ran it myself and got a Codespace running successfully! Screenshots:

Editor and Terminal with kit running, pre-build.sh complete and things are ready ("Finished configuring codespace" message at the bottom right):
Screenshot 2023-10-10 at 6 02 04 PM

Ports tab:
Screenshot 2023-10-10 at 6 01 50 PM

UI open in a new tab connected to the codespace:
Screenshot 2023-10-10 at 5 58 00 PM -- CODESPACES IS WORKING!!

- Codespaces would run indefinitely on the `onCreateCommand` and never finish
  - also it would just eat up CPU hours on Codespaces, even if you closed the tab and turned off your computer
    - had to manually go into Codespaces settings and turn it off after GH sent me an email that I used 24 CPU hours overnight while I was asleep 馃珷

- [`postCreateCommand`](https://containers.dev/implementors/json_reference/#lifecycle-scripts) instead runs asynchronously _after_ the container is started
  - this finished fine in my Codespace
  - this also lets you access the codespace very quickly as `pre-build.sh` is running async

Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
- link to GH Codespaces
- warn about async `pre-build.sh` -- can start editing, but may want to hold off running commands
  - unless you know what you're doing -- you don't _necessarily_ need to wait for everything to be ready for every command, but will want that for any testing or building
- instruct on how to use forwarded ports

- remove old warning about Codespaces not working!

Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
Copy link
Member

@Joibel Joibel left a comment

Choose a reason for hiding this comment

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

Thanks @agilgur5, looks good.

@terrytangyuan terrytangyuan enabled auto-merge (squash) October 11, 2023 11:12
@terrytangyuan terrytangyuan merged commit cd11a8b into argoproj:master Oct 11, 2023
26 checks passed
@agilgur5 agilgur5 deleted the fix-codespaces-postCreate branch October 11, 2023 13:39
@agilgur5 agilgur5 mentioned this pull request Oct 20, 2023
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/build Build or GithubAction/CI issues area/docs Incorrect, missing, or mistakes in docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Why can't use a devcontainer-based development environment using codespace?
3 participants