Skip to content

Commit

Permalink
Enable one-click gitpod and GitHub Codespaces setup for Linux develop…
Browse files Browse the repository at this point in the history
…ment (conda#11040)
  • Loading branch information
jaimergp authored Nov 17, 2021
1 parent 6933e2e commit d3090e1
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 2 deletions.
31 changes: 31 additions & 0 deletions .devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.194.3/containers/python-3
{
"name": "Linux / Python 3.9",
"image": "ghcr.io/conda/conda-ci:master-linux-python3.9",
"containerEnv": {
"RUNNING_ON_DEVCONTAINER": "1"
},

// Set *default* container specific settings.json values on container create.
"settings": {
"python.pythonPath": "/opt/conda/bin/python",
"terminal.integrated.profiles.linux": {
"Conda Bash": {
"path": "/bin/bash",
"args": ["--rcfile", "/home/test_user/.bashrc"]
}
},
"terminal.integrated.defaultProfile.linux": "Conda Bash"
},

"extensions": [
"ms-python.python",
"ms-python.vscode-pylance",
"eamodio.gitlens"
],

"postAttachCommand": ["/bin/bash", "/workspaces/conda/dev/docker.bashrc"],

"remoteUser": "test_user"
}
38 changes: 38 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# TODO: Replace gitpod with master
image: ghcr.io/conda/conda-ci:gitpod-linux-python3.9
tasks:
- name: initialize
init: |
mkdir -p .vscode
echo '{"python.pythonPath": "/opt/conda/bin/python"}' > .vscode/settings.json
git tag "$(git tag --sort=committerdate | tail -1).dev"
eval "$(sudo /opt/conda/bin/python -m conda init --dev bash)"
sudo su root -c "/opt/conda/bin/conda install -yq conda-build"
conda-build tests/test-recipes/activate_deactivate_package
command: |
eval "$(sudo /opt/conda/bin/python -m conda init --dev bash)"
vscode:
extensions:
- eamodio.gitlens
- ms-python.python
- ms-python.vscode-pylance

github:
prebuilds:
# enable for master branch
master: true
# enable for other branches (defaults to false)
branches: false
# enable for pull requests coming from this repo (defaults to true)
pullRequests: false
# enable for pull requests coming from forks (defaults to false)
pullRequestsFromForks: false
# add a check to pull requests (defaults to true)
addCheck: false
# add a "Review in Gitpod" button as a comment to pull requests (defaults to false)
addComment: false
# add a "Review in Gitpod" button to the pull request's description (defaults to false)
addBadge: false
# add a label once the prebuild is ready to pull requests (defaults to false)
addLabel: false
5 changes: 4 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
:alt: latest release version
:target: https://github.com/conda/conda/releases


Conda is a cross-platform, language-agnostic binary package manager. It is the
package manager used by `Anaconda
<https://www.anaconda.com/distribution/>`_ installations, but it may be
Expand Down Expand Up @@ -161,5 +160,9 @@ code and issue tracker for conda are on `GitHub <https://github.com/conda/conda>
Contributing
------------

.. image:: https://gitpod.io/button/open-in-gitpod.svg
:alt: open in gitpod for one-click development
:target: https://gitpod.io/#https://github.com/conda/conda

Contributions to conda are welcome. See the `contributing <CONTRIBUTING.md>`_ documentation
for instructions on setting up a development environment.
9 changes: 8 additions & 1 deletion ci/scripts/linux/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,18 @@
set -o errtrace -o pipefail -o errexit

apt-get update --fix-missing
apt-get install -y --no-install-recommends tini wget build-essential bzip2 ca-certificates libglib2.0-0 libxext6 libsm6 libxrender1 git mercurial subversion sudo
apt-get install -y --no-install-recommends \
tini wget build-essential bzip2 ca-certificates \
libglib2.0-0 libxext6 libsm6 libxrender1 git mercurial subversion \
sudo htop less nano man
apt-get clean
rm -rf /var/lib/apt/lists/*

useradd -m -s /bin/bash test_user
usermod -u 1001 test_user
groupmod -g 1001 test_user
echo "test_user ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers

### Gitpod user ###
useradd -l -u 33333 -G sudo -md /home/gitpod -s /bin/bash -p gitpod gitpod
echo "gitpod ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
11 changes: 11 additions & 0 deletions dev/docker.bashrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

echo "Initializing conda in dev mode..."
echo "Factory config is:"
grep -e "conda location" -e "conda version" -e "python version" <(conda info -a) | sed 's/^\s*/ /'
eval "$(sudo /opt/conda/bin/python -m conda init --dev bash)"
if [[ $RUNNING_ON_DEVCONTAINER == 1 ]]; then
conda init
fi
echo "Done! Now running:"
grep -e "conda location" -e "conda version" -e "python version" <(conda info -a) | sed 's/^\s*/ /'

0 comments on commit d3090e1

Please sign in to comment.