Compare commits

...

6 Commits
1.1.0 ... 1.2.0

Author SHA1 Message Date
Geoff Bourne
2ee5a25c91 ci: adjusted main github action name 2020-06-19 13:23:05 -05:00
Geoff Bourne
60ef1b8867 ci: fixed github action tags matching 2020-06-19 13:15:23 -05:00
Geoff Bourne
3eaf756aa2 ci: adjusted github actions to build non-multiarch branches/tags 2020-06-19 11:41:53 -05:00
Geoff Bourne
bc318fa185 Added support for Mohist servers 2020-06-19 11:31:56 -05:00
Geoff Bourne
f93c42a23f Added support for tagging during docker-versions-create.sh 2020-06-19 11:31:41 -05:00
Geoff Bourne
f5dde77efe Enabled iterative development with SCRIPTS var 2020-06-19 11:05:32 -05:00
27 changed files with 178 additions and 55 deletions

View File

@@ -1,10 +1,21 @@
# This is a basic workflow to help you get started with Actions # This is a basic workflow to help you get started with Actions
name: build name: Build non-multiarch branches/tags
on: on:
push: push:
branches: [ master ] branches:
- master
- openj9
- openj9-nightly
- adopt11
- adopt13
tags:
- "[0-9]+.[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+-openj9"
- "[0-9]+.[0-9]+.[0-9]+-openj9-nightly"
- "[0-9]+.[0-9]+.[0-9]+-adopt11"
- "[0-9]+.[0-9]+.[0-9]+-adopt13"
pull_request: pull_request:
branches: [ master ] branches: [ master ]

28
DEVELOPMENT.md Normal file
View File

@@ -0,0 +1,28 @@
Individual scripts can be iteratively developed and tested using the following procedure.
First, build a baseline of the image to include the packages needed by existing or new scripts:
```shell script
docker build -t mc-dev .
```
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.
```shell script
docker run -it --rm -v ${PWD}:/scripts -e SCRIPTS=/scripts/ --entrypoint bash mc-dev
```
From within the container you can run individual scripts via the attached `/scripts/` path; however, be sure to set any environment variables expected by the scripts by either `export`ing them manually:
```shell script
export VANILLA_VERSION=1.12.2
/scripts/start-magma
```
...or pre-pending script execution:
```shell script
VANILLA_VERSION=1.12.2 /scripts/start-magma
```
> NOTE: 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.

View File

@@ -525,6 +525,15 @@ A [Magma](https://magmafoundation.org/) server, which is a combination of Forge
> **NOTE** there are limited base versions supported, so you will also need to set `VERSION`, such as "1.12.2" > **NOTE** there are limited base versions supported, so you will also need to set `VERSION`, such as "1.12.2"
## Running a Mohist server
A [Mohist](https://github.com/Mohist-Community/Mohist) server can be used with
-e TYPE=MOHIST
> **NOTE** there are limited base versions supported, so you will also need to set `VERSION`, such as "1.12.2"
## Running a server with a Feed the Beast modpack ## Running a server with a Feed the Beast modpack
> **NOTE** requires `itzg/minecraft-server:multiarch` image > **NOTE** requires `itzg/minecraft-server:multiarch` image

View File

@@ -10,12 +10,28 @@ function TrapExit {
batchMode=false batchMode=false
while getopts "b" arg while getopts "hbt:" arg
do do
case $arg in case $arg in
b) b)
batchMode=true batchMode=true
;; ;;
t)
tag=${OPTARG}
;;
h)
echo "
Usage $0 [options]
Options:
-b enable batch mode, which avoids interactive prompts and causes script to fail immediately
when any merge fails
-t TAG tag and push the current revision on master with the given tag
and apply respective tags to each branch
-h display this help and exit
"
exit
;;
*) *)
echo "Unsupported arg $arg" echo "Unsupported arg $arg"
exit 2 exit 2
@@ -34,6 +50,10 @@ test -d ./.git || { echo ".git folder was not found. Please start this script fr
git checkout master git checkout master
git pull --all || { echo "Can't pull the repo!"; \ git pull --all || { echo "Can't pull the repo!"; \
exit 1; } exit 1; }
if [[ $tag ]]; then
git tag $tag
git push origin $tag
fi
git_branches=$(git branch -a) git_branches=$(git branch -a)
@@ -57,6 +77,10 @@ for branch in "${branches_list[@]}"; do
git commit -m "Auto merge branch with master" -a git commit -m "Auto merge branch with master" -a
# push may fail if remote doesn't have this branch yet. In this case - sending branch # push may fail if remote doesn't have this branch yet. In this case - sending branch
git push || git push -u origin "$branch" || { echo "Can't push changes to the origin."; exit 1; } git push || git push -u origin "$branch" || { echo "Can't push changes to the origin."; exit 1; }
if [[ $tag ]]; then
git tag "$tag-$branch"
git push origin "$tag-$branch"
fi
elif ${batchMode}; then elif ${batchMode}; then
status=$? status=$?
echo "Git merge failed in batch mode" echo "Git merge failed in batch mode"

View File

@@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
. /start-utils . ${SCRIPTS:-/}start-utils
if isTrue "${ENABLE_AUTOPAUSE}" && [[ "$( ps -a -o stat,comm | grep 'java' | awk '{ print $1 }')" =~ ^T.*$ ]]; then if isTrue "${ENABLE_AUTOPAUSE}" && [[ "$( ps -a -o stat,comm | grep 'java' | awk '{ print $1 }')" =~ ^T.*$ ]]; then
echo "Java process suspended by Autopause function" echo "Java process suspended by Autopause function"

6
start
View File

@@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
. /start-utils . ${SCRIPTS:-/}start-utils
umask 0002 umask 0002
chmod g+w /data chmod g+w /data
@@ -45,7 +45,7 @@ if [ $(id -u) = 0 ]; then
echo 'hosts: files dns' > /etc/nsswitch.conf echo 'hosts: files dns' > /etc/nsswitch.conf
fi fi
exec su-exec ${runAsUser}:${runAsGroup} /start-configuration $@ exec su-exec ${runAsUser}:${runAsGroup} ${SCRIPTS:-/}start-configuration $@
else else
exec /start-configuration $@ exec ${SCRIPTS:-/}start-configuration $@
fi fi

View File

@@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
. /start-utils . ${SCRIPTS:-/}start-utils
log "Autopause functionality enabled" log "Autopause functionality enabled"

View File

@@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
. /start-utils . ${SCRIPTS:-/}start-utils
shopt -s nullglob shopt -s nullglob
@@ -69,53 +69,57 @@ cd /data || exit 1
export ORIGINAL_TYPE=${TYPE^^} export ORIGINAL_TYPE=${TYPE^^}
if isTrue "${ENABLE_AUTOPAUSE}"; then if isTrue "${ENABLE_AUTOPAUSE}"; then
/start-autopause ${SCRIPTS:-/}start-autopause
fi fi
log "Resolving type given ${TYPE}" log "Resolving type given ${TYPE}"
case "${TYPE^^}" in case "${TYPE^^}" in
*BUKKIT|SPIGOT) *BUKKIT|SPIGOT)
exec /start-deployBukkitSpigot "$@" exec ${SCRIPTS:-/}start-deployBukkitSpigot "$@"
;; ;;
PAPER) PAPER)
exec /start-deployPaper "$@" exec ${SCRIPTS:-/}start-deployPaper "$@"
;; ;;
TUINITY) TUINITY)
exec /start-deployTuinity "$@" exec ${SCRIPTS:-/}start-deployTuinity "$@"
;; ;;
FORGE) FORGE)
exec /start-deployForge "$@" exec ${SCRIPTS:-/}start-deployForge "$@"
;; ;;
FABRIC) FABRIC)
exec /start-deployFabric "$@" exec ${SCRIPTS:-/}start-deployFabric "$@"
;; ;;
FTB|CURSEFORGE) FTB|CURSEFORGE)
exec /start-deployFTB "$@" exec ${SCRIPTS:-/}start-deployFTB "$@"
;; ;;
VANILLA) VANILLA)
exec /start-deployVanilla "$@" exec ${SCRIPTS:-/}start-deployVanilla "$@"
;; ;;
SPONGEVANILLA) SPONGEVANILLA)
exec /start-deploySpongeVanilla "$@" exec ${SCRIPTS:-/}start-deploySpongeVanilla "$@"
;; ;;
CUSTOM) CUSTOM)
exec /start-deployCustom "$@" exec ${SCRIPTS:-/}start-deployCustom "$@"
;; ;;
CURSE_INSTANCE) CURSE_INSTANCE)
exec /start-validateCurseInstance "$@" exec ${SCRIPTS:-/}start-validateCurseInstance "$@"
;; ;;
MAGMA) MAGMA)
exec /start-magma "$@" exec ${SCRIPTS:-/}start-magma "$@"
;;
MOHIST)
exec ${SCRIPTS:-/}start-mohist "$@"
;; ;;
*) *)

View File

@@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
. /start-utils . ${SCRIPTS:-/}start-utils
set -e set -e
@@ -102,4 +102,4 @@ export TYPE=SPIGOT
export SKIP_LOG4J_CONFIG=true export SKIP_LOG4J_CONFIG=true
# Continue to Final Setup # Continue to Final Setup
exec /start-finalSetup01World $@ exec ${SCRIPTS:-/}start-finalSetup01World $@

View File

@@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
. /start-utils . ${SCRIPTS:-/}start-utils
if isURL ${CUSTOM_SERVER}; then if isURL ${CUSTOM_SERVER}; then
filename=$(basename ${CUSTOM_SERVER}) filename=$(basename ${CUSTOM_SERVER})
@@ -28,4 +28,4 @@ fi
export SKIP_LOG4J_CONFIG=true export SKIP_LOG4J_CONFIG=true
# Continue to Final Setup # Continue to Final Setup
exec /start-finalSetup01World $@ exec ${SCRIPTS:-/}start-finalSetup01World $@

View File

@@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
. /start-utils . ${SCRIPTS:-/}start-utils
export FTB_BASE_DIR=/data/FeedTheBeast export FTB_BASE_DIR=/data/FeedTheBeast
legacyJavaFixerUrl=http://ftb.cursecdn.com/FTB2/maven/net/minecraftforge/lex/legacyjavafixer/1.0/legacyjavafixer-1.0.jar legacyJavaFixerUrl=http://ftb.cursecdn.com/FTB2/maven/net/minecraftforge/lex/legacyjavafixer/1.0/legacyjavafixer-1.0.jar
@@ -135,4 +135,4 @@ elif [ -e "${FTB_DIR}/Install.sh" ]; then
fi fi
# Continue to Final Setup # Continue to Final Setup
exec /start-finalSetup01World $@ exec ${SCRIPTS:-/}start-finalSetup01World $@

View File

@@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
set -eu set -eu
. /start-utils . ${SCRIPTS:-/}start-utils
export TYPE=FABRIC export TYPE=FABRIC
@@ -75,4 +75,4 @@ else
fi fi
# Contineut to Final Setup # Contineut to Final Setup
exec /start-finalSetup01World $@ exec ${SCRIPTS:-/}start-finalSetup01World $@

View File

@@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
. /start-utils . ${SCRIPTS:-/}start-utils
export TYPE=FORGE export TYPE=FORGE
@@ -113,4 +113,4 @@ else
fi fi
# Continue to Final Setup # Continue to Final Setup
exec /start-finalSetup01World $@ exec ${SCRIPTS:-/}start-finalSetup01World $@

View File

@@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
. /start-utils . ${SCRIPTS:-/}start-utils
: ${PAPERBUILD:=latest} : ${PAPERBUILD:=latest}
export SERVER=paper_server-${VANILLA_VERSION}-${PAPERBUILD}.jar export SERVER=paper_server-${VANILLA_VERSION}-${PAPERBUILD}.jar
@@ -20,4 +20,4 @@ export TYPE=SPIGOT
export SKIP_LOG4J_CONFIG=true export SKIP_LOG4J_CONFIG=true
# Continue to Final Setup # Continue to Final Setup
exec /start-finalSetup01World $@ exec ${SCRIPTS:-/}start-finalSetup01World $@

View File

@@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
. /start-utils . ${SCRIPTS:-/}start-utils
export TYPE=spongevanilla export TYPE=spongevanilla
@@ -36,4 +36,4 @@ if [ ! -e $SERVER ] || [ -n "$FORCE_REDOWNLOAD" ]; then
fi fi
# Continue to Final Setup # Continue to Final Setup
exec /start-finalSetup01World $@ exec ${SCRIPTS:-/}start-finalSetup01World $@

View File

@@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
. /start-utils . ${SCRIPTS:-/}start-utils
if [ "${VERSION}" != "LATEST" ]; then if [ "${VERSION}" != "LATEST" ]; then
log "ERROR: Tunity server type only supports VERSION=LATEST" log "ERROR: Tunity server type only supports VERSION=LATEST"
@@ -24,4 +24,4 @@ fi
export TYPE=SPIGOT export TYPE=SPIGOT
# Continue to Final Setup # Continue to Final Setup
exec /start-finalSetup01World $@ exec ${SCRIPTS:-/}start-finalSetup01World $@

View File

@@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
. /start-utils . ${SCRIPTS:-/}start-utils
isDebugging && set -x isDebugging && set -x
set -o pipefail set -o pipefail
@@ -43,4 +43,4 @@ fi
isDebugging && ls -l isDebugging && ls -l
# Continue to Final Setup # Continue to Final Setup
exec /start-finalSetup01World $@ exec ${SCRIPTS:-/}start-finalSetup01World $@

View File

@@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
. /start-utils . ${SCRIPTS:-/}start-utils
set -e set -e
isDebugging && set -x isDebugging && set -x
@@ -51,4 +51,4 @@ if [[ "$WORLD" ]] && [ ! -d "$worldDest" ]; then
fi fi
fi fi
exec /start-finalSetup02Modpack $@ exec ${SCRIPTS:-/}start-finalSetup02Modpack $@

View File

@@ -2,7 +2,7 @@
set -e set -e
. /start-utils . ${SCRIPTS:-/}start-utils
# CURSE_URL_BASE used in manifest downloads below # CURSE_URL_BASE used in manifest downloads below
CURSE_URL_BASE=${CURSE_URL_BASE:-https://minecraft.curseforge.com/projects} CURSE_URL_BASE=${CURSE_URL_BASE:-https://minecraft.curseforge.com/projects}
@@ -154,4 +154,4 @@ if [[ "${GENERIC_PACK}" ]]; then
fi fi
fi fi
exec /start-finalSetup03Modconfig $@ exec ${SCRIPTS:-/}start-finalSetup03Modconfig $@

View File

@@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
. /start-utils . ${SCRIPTS:-/}start-utils
# If supplied with a URL for a config (simple zip of configurations), download it and unpack # If supplied with a URL for a config (simple zip of configurations), download it and unpack
if [[ "$MODCONFIG" ]]; then if [[ "$MODCONFIG" ]]; then
@@ -24,4 +24,4 @@ case "X$MODCONFIG" in
esac esac
fi fi
exec /start-finalSetup04ServerProperties $@ exec ${SCRIPTS:-/}start-finalSetup04ServerProperties $@

View File

@@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
. /start-utils . ${SCRIPTS:-/}start-utils
# FUNCTIONS # FUNCTIONS
function setServerProp { function setServerProp {
@@ -194,4 +194,4 @@ if isDebugging; then
cat /data/server.properties cat /data/server.properties
fi fi
exec /start-finalSetup05EnvVariables $@ exec ${SCRIPTS:-/}start-finalSetup05EnvVariables $@

View File

@@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
. /start-utils . ${SCRIPTS:-/}start-utils
if [ "${REPLACE_ENV_VARIABLES^^}" = "TRUE" ]; then if [ "${REPLACE_ENV_VARIABLES^^}" = "TRUE" ]; then
log "Replacing env variables in configs that match the prefix $ENV_VARIABLE_PREFIX..." log "Replacing env variables in configs that match the prefix $ENV_VARIABLE_PREFIX..."
@@ -25,4 +25,4 @@ if [ "${REPLACE_ENV_VARIABLES^^}" = "TRUE" ]; then
done < <(env) done < <(env)
fi fi
exec /start-minecraftFinalSetup $@ exec ${SCRIPTS:-/}start-minecraftFinalSetup $@

View File

@@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
. /start-utils . ${SCRIPTS:-/}start-utils
export SERVER="/data/magma-server-${VANILLA_VERSION}.jar" export SERVER="/data/magma-server-${VANILLA_VERSION}.jar"
@@ -15,4 +15,4 @@ fi
export SKIP_LOG4J_CONFIG=true export SKIP_LOG4J_CONFIG=true
# Continue to Final Setup # Continue to Final Setup
exec /start-finalSetup01World $@ exec ${SCRIPTS:-/}start-finalSetup01World $@

View File

@@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
. /start-utils . ${SCRIPTS:-/}start-utils
if [ -n "$OPS" ]; then if [ -n "$OPS" ]; then
log "Setting/adding ops" log "Setting/adding ops"

40
start-mohist Executable file
View File

@@ -0,0 +1,40 @@
#!/bin/bash
. ${SCRIPTS:-/}start-utils
requireVar VANILLA_VERSION
set -o pipefail
set -e
isDebugging && set -x
mohistJobs=https://ci.codemc.io/job/Mohist-Community/job/
mohistJob=${mohistJobs}Mohist-${VANILLA_VERSION}/
if ! curl -X HEAD -o /dev/null -fsSL "${mohistJob}"; then
log "ERROR: mohist builds do not exist for ${VANILLA_VERSION}"
log " check https://ci.codemc.io/job/Mohist-Community/ for available versions"
exit 1
fi
latestBuildRelPath=$(
curl -fsSL "${mohistJob}lastSuccessfulBuild/api/json" |
jq -r '.artifacts[0].relativePath'
)
baseName=$(basename "${latestBuildRelPath}")
if [[ ${baseName} != *-server.jar* ]]; then
log "ERROR: mohist build for ${VANILLA_VERSION} is not a valid server jar, found ${baseName}"
log " check https://ci.codemc.io/job/Mohist-Community/ for available versions"
exit 1
fi
export SERVER="/data/${baseName}"
if [ ! -f ${SERVER} ]; then
log "Downloading ${SERVER}"
curl -o "${SERVER}" -fsSL "${mohistJob}lastSuccessfulBuild/artifact/${latestBuildRelPath}"
fi
export SKIP_LOG4J_CONFIG=true
# Continue to Final Setup
exec ${SCRIPTS:-/}start-finalSetup01World $@

View File

@@ -100,3 +100,10 @@ function versionLessThan {
fi fi
fi fi
} }
requireVar() {
if [ ! -v $1 ]; then
log "ERROR: $1 is required to be set"
exit 1
fi
}

View File

@@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
. /start-utils . ${SCRIPTS:-/}start-utils
if ! [[ -v CURSE_INSTANCE_JSON ]]; then if ! [[ -v CURSE_INSTANCE_JSON ]]; then
log "ERROR: CURSE_INSTANCE_JSON needs to be set" log "ERROR: CURSE_INSTANCE_JSON needs to be set"
@@ -15,4 +15,4 @@ fi
log "Resolved CURSE_INSTANCE_JSON as ${CURSE_INSTANCE_JSON}" log "Resolved CURSE_INSTANCE_JSON as ${CURSE_INSTANCE_JSON}"
# Continue to Final Setup # Continue to Final Setup
exec /start-finalSetup01World "$@" exec ${SCRIPTS:-/}start-finalSetup01World "$@"