Skip to content

Commit

Permalink
Add parameter to speed gitpod clone
Browse files Browse the repository at this point in the history
  • Loading branch information
sarjona committed May 7, 2024
1 parent e99dca5 commit b682f73
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 8 additions & 1 deletion .gitpod/setup-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,15 @@ 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" ];
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ The Moodle Gitpod template supports the following environment variables:
* `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**:

Expand Down

0 comments on commit b682f73

Please sign in to comment.