Skip to content

Commit

Permalink
Merge pull request #291 from sarjona/gitpoddata
Browse files Browse the repository at this point in the history
Gitpoddata
  • Loading branch information
sarjona authored May 7, 2024
2 parents 91820d3 + 20dad07 commit 835bd01
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 2 deletions.
9 changes: 9 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ tasks:
# Open Moodle site in browser.
gp ports await 8000 && gp preview $(gp url 8000)
# Change permissions to allow installation of plugins.
bin/moodle-docker-compose exec webserver bash -c 'chmod -R 777 .'
# Add some data if the file exists.
if [ -r "moodle/admin/tool/generator/tests/fixtures/gitpod-basic-scenario.feature" ];
then
bin/moodle-docker-compose exec webserver php admin/tool/generator/cli/runtestscenario.php --feature=./../tests/fixtures/gitpod-basic-scenario.feature
fi
command: |
# Update the patch to the latest version.
cd moodle
Expand Down
31 changes: 30 additions & 1 deletion .gitpod/setup-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,34 @@ then
export MOODLE_BRANCH=main
fi

if [ -z "$CLONEALL" ];
then
FASTCLONE='--depth 1'
else
FASTCLONE=""
fi

# Clone Moodle repository.
cd "${GITPOD_REPO_ROOT}" && git clone --branch "${MOODLE_BRANCH}" --single-branch "${MOODLE_REPOSITORY}" moodle
cd "${GITPOD_REPO_ROOT}" && git clone ${FASTCLONE} --branch "${MOODLE_BRANCH}" --single-branch "${MOODLE_REPOSITORY}" moodle

# Download the data file (if given). It will be used to generate some data.
if [ -n "$DATAFILE" ];
then
wget -O moodle/admin/tool/generator/tests/fixtures/gitpod-basic-scenario.feature "${DATAFILE}"
fi

# Install adminer.
if [ -n "$INSTALLADMINER" ];
then
cat << EOF > local.yml
services:
adminer:
image: adminer:latest
restart: always
ports:
- 8080:8080
depends_on:
- "db"
EOF
fi
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,11 @@ The Moodle Gitpod template supports the following environment variables:

* `MOODLE_REPOSITORY`. The Moodle repository to be cloned. The value should be URL encoded. If left undefined, the default repository `https://github.com/moodle/moodle.git` is used.
* `MOODLE_BRANCH`. The Moodle branch to be cloned. If left undefined, the default branch `main` is employed.
* `DATAFILE`. When specified, this feature URL initializes the Moodle site with essential data. The value should be URL encoded. The content of this file adheres to the [Behat generators format](https://moodledev.io/general/development/tools/generator#create-a-testing-scenario-using-behat-generators) for creating testing scenarios.
* `INSTALLADMINER`. Add this variable, set to any value, to install [adminer](https://www.adminer.org/).
* `CLONEALL`. If not set, a shallow clone is created, truncating the history to reduce the clone size. Set to `1` for a full clone.

For a practical demonstration, launch a Gitpod workspace with the 'main' branch patch for [MDL-79912](https://tracker.moodle.org/browse/MDL-79912). Simply open the following URL in your web browser (note that MOODLE_REPOSITORY should be URL encoded). The password for the admin user is **test**:
For a practical demonstration, launch a Gitpod workspace with the 'main' branch patch for [MDL-79912](https://tracker.moodle.org/browse/MDL-79912). Simply open the following URL in your web browser (note that MOODLE_REPOSITORY should be URL encoded). The password for the **admin** user is **test**:

```
https://gitpod.io/#MOODLE_REPOSITORY=https%3A%2F%2Fgithub.com%2Fsarjona%2Fmoodle.git,MOODLE_BRANCH=MDL-79912-main/https://github.com/moodlehq/moodle-docker
Expand Down

0 comments on commit 835bd01

Please sign in to comment.