-
Notifications
You must be signed in to change notification settings - Fork 22
feat: add devcontainer #19
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
base: master
Are you sure you want to change the base?
Conversation
📝 WalkthroughWalkthroughA new Changes
Sequence Diagram(s)sequenceDiagram
participant Developer
participant DevContainer
participant Docker
participant Shell
Developer->>DevContainer: Open in container
DevContainer->>Docker: Build container (using Dockerfile)
Docker-->>DevContainer: Container created
DevContainer->>Shell: Run postCreateCommand (setup.bash)
Shell->>Shell: Remove Dockerfile, .gitpod.yml, .github
Shell->>Shell: Create README.md and .gitignore
Shell->>Shell: Initialize Conda and source .bashrc
Shell->>Shell: Append conda environment activation to .bashrc
Developer-->>DevContainer: Ready-to-use Snakemake tutorial environment
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.devcontainer/devcontainer.json
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (1)
.devcontainer/setup.bash (1)
4-5
:conda init
may prompt and duplicate work; pin the shell and silence output
conda init
without arguments selects the current shell heuristically and may prompt or inject duplicate blocks on successive runs. Pin it and make the script idempotent:-conda init +conda init bash >/dev/null + +# Apply changes only if they are new to avoid sourcing redundantly +source ~/.bashrc
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
.devcontainer/devcontainer.json
(1 hunks).devcontainer/setup.bash
(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- .devcontainer/devcontainer.json
🧰 Additional context used
🪛 Shellcheck (0.10.0)
.devcontainer/setup.bash
[error] 6-6: Couldn't parse this double quoted string. Fix to allow more checks.
(SC1073)
[error] 6-6: Expected end of double quoted string. Fix any mentioned problems and try again.
(SC1072)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: test
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (1)
.devcontainer/setup.bash (1)
6-6
: Fix stray trailing quote – script is currently syntactically invalidA double quote is left dangling at the end of the line, breaking parsing (
SC1072/SC1073
).
The script aborts before running anything after this point.-echo 'conda activate snakemake-tutorial' >> ~/.bashrc" +echo 'conda activate snakemake-tutorial' >> ~/.bashrc
🧹 Nitpick comments (1)
.devcontainer/setup.bash (1)
3-3
: Unnecessary escape charactersEscaping the quotes adds noise; a single-quoted string is clearer and avoids wildcard expansion just as well.
-echo \"*\" > .gitignore +echo '*' > .gitignore
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.devcontainer/setup.bash
(1 hunks)
🧰 Additional context used
🪛 Shellcheck (0.10.0)
.devcontainer/setup.bash
[error] 6-6: Couldn't parse this double quoted string. Fix to allow more checks.
(SC1073)
[error] 6-6: Expected end of double quoted string. Fix any mentioned problems and try again.
(SC1072)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: test
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
♻️ Duplicate comments (1)
.devcontainer/setup.bash (1)
9-9
: Remove the trailing double-quote to fix the syntax errorThe script still contains the stray
"
at the end of the line, making the whole file unparsable (SC1072/SC1073
).-echo 'conda activate snakemake-tutorial' >> ~/.bashrc" +echo 'conda activate snakemake-tutorial' >> ~/.bashrc
🧹 Nitpick comments (2)
.devcontainer/setup.bash (2)
6-6
: Write a bare asterisk without wrapping quotes
echo \"*\"
ends up writing"*"
(including quotes).
If the goal is to ignore everything, emit a raw asterisk while preventing glob expansion:-echo \"*\" > .gitignore +echo '*' > .gitignore
7-8
: Callconda init
non-interactively for reproducibilityRunning plain
conda init
can emit verbose output and may prompt depending on Conda versions.
Explicitly target bash and silence output to make CI/container builds deterministic:-conda init -source ~/.bashrc +conda init bash --quiet +source ~/.bashrc
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.devcontainer/setup.bash
(1 hunks)
🧰 Additional context used
🪛 Shellcheck (0.10.0)
.devcontainer/setup.bash
[error] 9-9: Couldn't parse this double quoted string. Fix to allow more checks.
(SC1073)
[error] 9-9: Expected end of double quoted string. Fix any mentioned problems and try again.
(SC1072)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (1)
.devcontainer/setup.bash (1)
5-5
:&&
prevents.github
removal on unlikely errors
Because the secondrm
executes only when the first one exits with0
, an (admittedly rare) permission error on eitherDockerfile
or.gitpod.yml
will skip deletion of.github
.
A simple;
is safer here.-rm -f Dockerfile .gitpod.yml && rm -rf .github +rm -f Dockerfile .gitpod.yml ; rm -rf .github
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.devcontainer/setup.bash
(1 hunks)
🧰 Additional context used
🪛 Shellcheck (0.10.0)
.devcontainer/setup.bash
[warning] 9-9: ShellCheck can't follow non-constant source. Use a directive to specify location.
(SC1090)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: test
🔇 Additional comments (1)
.devcontainer/setup.bash (1)
1-3
: Good: shebang + strict-mode added
Ensures predictable failure behaviour – thanks for incorporating the earlier feedback.
.devcontainer/setup.bash
Outdated
conda init | ||
source ~/.bashrc | ||
echo 'conda activate snakemake-tutorial' >> ~/.bashrc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
conda activate
line may be appended multiple times
If the container is rebuilt, each run appends another identical line to ~/.bashrc
, bloating it over time.
-grep -qxF 'conda activate snakemake-tutorial' ~/.bashrc || \
- echo 'conda activate snakemake-tutorial' >> ~/.bashrc
+if ! grep -qxF 'conda activate snakemake-tutorial' ~/.bashrc; then
+ echo 'conda activate snakemake-tutorial' >> ~/.bashrc
+fi
Also consider replacing source ~/.bashrc
with the non-interactive hook to silence SC1090:
eval "$(conda shell.bash hook)"
🧰 Tools
🪛 Shellcheck (0.10.0)
[warning] 9-9: ShellCheck can't follow non-constant source. Use a directive to specify location.
(SC1090)
🤖 Prompt for AI Agents
In .devcontainer/setup.bash around lines 8 to 10, prevent appending the 'conda
activate snakemake-tutorial' line multiple times to ~/.bashrc by first checking
if it already exists before appending. Also, replace 'source ~/.bashrc' with
'eval "$(conda shell.bash hook)"' to avoid the SC1090 warning and use the
recommended non-interactive conda initialization method.
echo -e "# Snakemake-Tutorial\n\nYour gitpod workspace for the snakemake-tutorial has been initialized. Now you can start with the [basic tutorial](https://snakemake.readthedocs.io/en/stable/tutorial/basics.html)." > README.md | ||
echo "*" > .gitignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overwrites & then hides almost everything
README.md
is overwritten unconditionally and the subsequent
echo "*"
ignores all new files—including the freshly written README.md
—so the user ends up with a repository that only tracks .gitignore
itself.
Consider either:
- Guarding creation (
[ -e README.md ] || …
) and using a narrower ignore pattern, or - Adding explicit negations for the few files you do want under version control.
Example:
-echo "*" > .gitignore
+cat > .gitignore <<'EOF'
+*
+!*.md
+!.devcontainer/**
+EOF
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
echo -e "# Snakemake-Tutorial\n\nYour gitpod workspace for the snakemake-tutorial has been initialized. Now you can start with the [basic tutorial](https://snakemake.readthedocs.io/en/stable/tutorial/basics.html)." > README.md | |
echo "*" > .gitignore | |
echo -e "# Snakemake-Tutorial\n\nYour gitpod workspace for the snakemake-tutorial has been initialized. Now you can start with the [basic tutorial](https://snakemake.readthedocs.io/en/stable/tutorial/basics.html)." > README.md | |
cat > .gitignore <<'EOF' | |
* | |
!*.md | |
!.devcontainer/** | |
EOF |
🤖 Prompt for AI Agents
In .devcontainer/setup.bash at lines 6-7, the script overwrites README.md
unconditionally and then writes "*" to .gitignore, which causes all files
including README.md to be ignored. To fix this, modify the script to check if
README.md exists before creating it, and update .gitignore to use a narrower
pattern or add explicit negations to ensure README.md and other important files
are not ignored.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (2)
.devcontainer/setup.bash (2)
6-7
:README.md
immediately ignored – same concern as previous reviewThe wildcard in
.gitignore
hides every file you just generated (includingREADME.md
).
See earlier comment for a narrower ignore pattern with negations.
8-11
: Idempotency / ShellCheck: re-init & duplicateconda activate
linesRunning this script twice will:
- Make
conda init
append a second block to~/.bashrc
.- Append yet another
conda activate snakemake-tutorial
line.Previous review already suggested guarding the append and using the non-interactive hook to avoid
SC1090
; it is still unresolved.Also applies to: 13-13
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
.devcontainer/devcontainer.json
(1 hunks).devcontainer/setup.bash
(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- .devcontainer/devcontainer.json
🧰 Additional context used
🪛 Shellcheck (0.10.0)
.devcontainer/setup.bash
[warning] 10-10: ShellCheck can't follow non-constant source. Use a directive to specify location.
(SC1090)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: test
# abort on error, undefined vars, and failed pipelines | ||
set -euo pipefail | ||
|
||
rm -f Dockerfile .gitpod.yml && rm -rf .github .devcontainer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don’t rm -rf
the directory you are executing from
rm -rf .devcontainer
deletes the folder that contains this very script while it is still running.
Although the inode stays open, this is brittle and may break future re-runs or tooling that expects .devcontainer
to exist after setup. Remove only the obsolete sub-artifacts instead.
-rm -f Dockerfile .gitpod.yml && rm -rf .github .devcontainer
+rm -f Dockerfile .gitpod.yml && rm -rf .github
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
rm -f Dockerfile .gitpod.yml && rm -rf .github .devcontainer | |
rm -f Dockerfile .gitpod.yml && rm -rf .github |
🤖 Prompt for AI Agents
In .devcontainer/setup.bash at line 5, avoid removing the entire .devcontainer
directory since it contains the running script. Instead of `rm -rf
.devcontainer`, modify the command to only delete obsolete sub-artifacts inside
.devcontainer, preserving the directory itself to prevent breaking future runs
or tooling that relies on its existence.
Summary by CodeRabbit