Skip to content

Commit ac125dc

Browse files
authored
Temporarily replace GTNH ServerPacks call with restify+jq (#3938)
1 parent 4c0fd10 commit ac125dc

File tree

11 files changed

+20
-51
lines changed

11 files changed

+20
-51
lines changed

compose-dev.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
services:
2+
mc-dev:
3+
build:
4+
context: .
5+
environment:
6+
EULA: true
7+
volumes:
8+
- ./scripts:/image/scripts:ro
9+
- data:/data
10+
ports:
11+
- "25565:25565"
12+
stdin_open: true
13+
tty: true
14+
volumes:
15+
data:

docs/misc/contributing/development.md

Lines changed: 4 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -11,61 +11,15 @@ Adding a new server `TYPE` can vary due to the complexity of obtaining and confi
1111

1212
## Iterative script development
1313

14-
Individual scripts can be iteratively developed, debugged, and tested using the following procedure.
15-
16-
First, build a baseline of the image to include the packages needed by existing or new scripts:
17-
18-
PowerShell: (Example of building and testing ForgeAPI)
19-
```powershell
20-
$env:FOLDER_TO_TEST="forgeapimods_projectids"
21-
$env:IMAGE_TO_TEST="mc-dev"
22-
docker build -t $env:IMAGE_TO_TEST .
23-
pushd "tests/setuponlytests/$env:FOLDER_TO_TEST/"
24-
docker compose run mc
25-
docker compose down -v --remove-orphans
26-
popd
27-
```
28-
29-
PowerShell: Building different images of Java for testing
30-
```powershell
31-
$env:BASE_IMAGE='eclipse-temurin:8u312-b07-jre'
32-
$env:IMAGE_TO_TEST="mc-dev"
33-
docker build --build-arg BASE_IMAGE=$env:BASE_IMAGE -t $env:IMAGE_TO_TEST .
34-
```
35-
36-
Bash: (Example of building and testing ForgeAPI)
37-
```bash
38-
export FOLDER_TO_TEST="forgeapimods_file"
39-
export IMAGE_TO_TEST="mc-dev"
40-
docker build -t $IMAGE_TO_TEST .
41-
pushd tests/setuponlytests/$FOLDER_TO_TEST/
42-
docker compose run mc
43-
docker compose down -v --remove-orphans
44-
popd
45-
```
46-
47-
Using the baseline image, an interactive container can be started to iteratively run the scripts to be developed. By attaching the current workspace directory, you can use the local editor of your choice to iteratively modify scripts while using the container to run them.
48-
49-
```shell
50-
docker run -it --rm -v ${PWD}:/image/scripts --entrypoint bash mc-dev
51-
```
52-
53-
From within the container you can run individual scripts via the attached `/image/scripts/` path; however, be sure to set any environment variables expected by the scripts by either `export`ing them manually:
54-
55-
```shell
56-
export VERSION=1.12.2
57-
/image/scripts/start-deployFabric
58-
```
59-
60-
...or pre-pending script execution:
14+
The included `compose-dev.yml` will mount the local `scripts` code into the container and allow for iterative development. Replace `[-e key=value]` with any environment variables you wish to set for testing the modified scripts.
6115

6216
```shell
63-
VERSION=1.12.2 /image/scripts/start-deployFabric
17+
docker compose -f compose-dev.yml run --rm -it [-e key=value] mc-dev
6418
```
6519

66-
!!! note
20+
!!! tip
6721

68-
You may want to temporarily add an `exit` statement near the end of your script to isolate execution to just the script you're developing.
22+
To speed up the development cycle, it is recommended to set `SETUP_ONLY` to `true` as part of the run command above.
6923

7024
## Using development copy of tools
7125

scripts/start-deployAutoCF

100644100755
File mode changed.

scripts/start-deployFolia

100644100755
File mode changed.

scripts/start-deployGTNH

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ function getGTNHdownloadPath(){
88
gtnh_download_path=""
99
current_java_version=$(mc-image-helper java-release)
1010

11-
if ! packs_data="$(curl -sfL 'http://downloads.gtnewhorizons.com/ServerPacks/?raw')"; then
11+
if ! packs_data="$(restify --tag=a https://www.gtnewhorizons.com/version-history/ | jq -r '.[].href | select(test("Server"))')"; then
1212
logError "Failed to retrieve data from http://downloads.gtnewhorizons.com/ServerPacks/?raw"
1313
exit 1
1414
fi

scripts/start-deployLeaf

100644100755
File mode changed.

scripts/start-deployModrinth

100644100755
File mode changed.

scripts/start-deployNeoForge

100644100755
File mode changed.

scripts/start-deployPoseidon

100644100755
File mode changed.

scripts/start-rconcmds

100644100755
File mode changed.

0 commit comments

Comments
 (0)