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

Explore options for interactive debugging #103

Open
8 tasks done
bschilder opened this issue Oct 30, 2023 · 5 comments
Open
8 tasks done

Explore options for interactive debugging #103

bschilder opened this issue Oct 30, 2023 · 5 comments
Assignees
Labels
documentation Improvements or additions to documentation enhancement New feature or request GitHub Actions Issue occurring on GitHub Actions help wanted Extra attention is needed

Comments

@bschilder
Copy link
Collaborator

bschilder commented Oct 30, 2023

One weak point of CI/CD platforms that are runs remotely is that you can't directly debug in these environments.

However, running CI/CD on GitHub may offer some unique solutions to this as believe the GH Codespaces use the same VMs as GH Actions. Will explore this further and add to the rworkflows documentation if I find anything useful.

Access your existing codespaces here:
https://github.com/codespaces

Quickly access a repo-specific Codespace with the following link format. However, it seems this version of the Codespace it quite limited as you can't use it to run code in the terminal (it prompts you do create a Codespace with a certain amount of compute and then generates it for you):
https://github.dev/neurogenomics/rworkflows

GH Codespaces docs

Pricing

Screenshot 2023-10-30 at 10 23 22
@bschilder bschilder self-assigned this Oct 30, 2023
@bschilder bschilder added documentation Improvements or additions to documentation enhancement New feature or request GitHub Actions Issue occurring on GitHub Actions labels Oct 30, 2023
@bschilder
Copy link
Collaborator Author

bschilder commented Oct 30, 2023

Dev containers

You can configure a dev container using a .json, but it's not clear how to translate the GHA yaml files to this format, or whether all the options even translate:
https://github.com/neurogenomics/rworkflows/new/dev?dev_container_template=1&filename=.devcontainer%2Fdevcontainer.json

Screenshot 2023-10-30 at 10 37 14

You can customize these dev envs by adding "Features" to the config file, via the Marketplace window:

Screenshot 2023-10-30 at 10 39 56

Prebuilds

Prebuilds are basically Codepsaces that have already been setup and installed with a particular configuration, reducing the time it takes to spin up a new Codespace:
https://docs.github.com/en/codespaces/prebuilding-your-codespaces

@bschilder
Copy link
Collaborator Author

bschilder commented Oct 30, 2023

Potential solutions

  1. Create a rworkflows Codespace from the dev container on GitHub Container Registry.
  • Limitations
    • The way I create Docker containers atm is rather inefficient and doesn't follow all steps used in the action beforehand; Make Docker step less redundant #9
    • Probably won't have access to all the same inputs. and env. variables that are accessible in the GHA VM.

@bschilder bschilder moved this from Todo to In Progress in Project Management Oct 30, 2023
@bschilder
Copy link
Collaborator Author

bschilder commented Oct 30, 2023

Got a version of the rworkflows codespace working. Not sure how closely it mimics the GHA VM, but i'm at least able to do some debugging with conda:

Screenshot 2023-10-30 at 12 21 03

I also noticed that the env.GITHUB_TOKEN is indeed present within the Codespace:
Screenshot 2023-10-30 at 11 46 03

Remaining issues:

  1. Not sure how closely it mimics the GHA VM.
  2. Not sure how similar the ghcr.io/devcontainers/features/conda:1 feature I'm using mimics the conda-incubator/setup-miniconda@v2 action.
  3. Additional setup steps are still required for Visual Studio Code, such installing R plugins. Looking for ways to set this up automatically. Setting up dotfiles may help. Or better yet, specifying to install these extensions within the devcontainer.json file itself. More specific instructions here.
  4. Certain VSC key bindings don't work (e.g CMD+W). Tho creating a Codespace App may help with this.

@bschilder
Copy link
Collaborator Author

I've set up a basic dev container config file for rworkflows. It doesn't perfectly replicate the GHA runners and the actions used to install deps, but it does get somewhat close. This can be useful for debugging directly within GitHub.

Also created a use_codespace helper function to set up a dev container config file.

@github-project-automation github-project-automation bot moved this from In Progress to Done in Project Management Nov 1, 2023
@bschilder
Copy link
Collaborator Author

bschilder commented Nov 16, 2023

action-tmate

Another super useful avenue is action-tmate:

Debug your GitHub Actions via SSH by using tmate to get access to the runner system itself.

https://github.com/mxschmitt/action-tmate

That's almost exactly what I'm looking for! Will test implementing after making some other upgrades to rworkflows first.

There's also: https://github.com/fawazahmed0/action-debug

And this one that uses ngrok instead of tmate:
https://github.com/jessehouwing/debug-via-ssh

@bschilder bschilder reopened this Nov 16, 2023
@github-project-automation github-project-automation bot moved this from Done to In Progress in Project Management Nov 16, 2023
@bschilder bschilder added the help wanted Extra attention is needed label Nov 17, 2023
@bschilder bschilder removed this from the Publish rworkflows manuscript milestone Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request GitHub Actions Issue occurring on GitHub Actions help wanted Extra attention is needed
Projects
Status: In Progress
Development

No branches or pull requests

1 participant