Auto-merging via docker-versions-create

This commit is contained in:
Geoff Bourne 2020-06-20 15:45:29 -05:00
commit 047a477f7b
8 changed files with 109 additions and 10 deletions

View File

@ -1,6 +1,6 @@
# 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 non-multiarch branches/tags name: Build and publish non-multiarch branches/tags
on: on:
push: push:
@ -36,4 +36,4 @@ jobs:
tag_with_sha: true tag_with_sha: true
cache_froms: itzg/minecraft-server:latest cache_froms: itzg/minecraft-server:latest
add_git_labels: true add_git_labels: true
push: false push: true

View File

@ -1,4 +1,17 @@
Individual scripts can be iteratively developed and tested using the following procedure. ## Adding a server type
Adding a new server `TYPE` can vary due to the complexity of obtaining and configuring each type; however, the addition of any server type includes at least the following steps:
1. Copy an existing "start-deploy*" script, such as [start-deployMohist](start-deployMohist) and rename it accordingly making sure to retain the "start-deploy" prefix
2. Modify the type-specific behavior between the "start-utils" preamble and the hand-off to `start-finalSetup01World` at the end of the script
3. Develop and test the changes using the [iterative process described below](#iterative-script-development)
4. Add a case-entry to the `case "${TYPE^^}"` in [start-configuration](start-configuration)
5. Add a section to the [README](README.md). It is recommended to copy-modify an existing section to retain a similar wording and level of detail
6. [Submit a pull request](https://github.com/itzg/docker-minecraft-server/pulls)
## Iterative script development
Individual scripts can be iteratively developed, debugged, and tested using the following procedure.
First, build a baseline of the image to include the packages needed by existing or new scripts: First, build a baseline of the image to include the packages needed by existing or new scripts:
@ -9,7 +22,7 @@ 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. 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 ```shell script
docker run -it --rm -v ${PWD}:/scripts -e SCRIPTS=/scripts/ --entrypoint bash mc-dev 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: 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:
@ -26,3 +39,36 @@ 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. > 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.
## Multi-base-image variants
Several base-image variants are maintained in order to offer choices in JDK provider and version. The variants are maintained in their respective branches:
- openj9
- openj9-nightly
- adopt11
- adopt13
- multiarch
The [docker-versions-create.sh](docker-versions-create.sh) script is configured with the branches to maintain and is used to merge changes from the master branch into the mulit-base variant branches. The script also manages git tagging the master branch along with the merged branches. So a typical use of the script would be like:
```shell script
./docker-versions-create.sh -s -t 1.2.0
```
> Most often the major version will be bumped unless a bug or hotfix needs to be published in which case the patch version should be incremented.
> The build and publishing of those branches and their tags is currently performed within Docker Hub.
## multiarch support
The [multiarch branch](https://github.com/itzg/docker-minecraft-server/tree/multiarch) supports running the image on amd64, arm64, and armv7 (aka RaspberryPi). Unlike the mainline branches, it is based on Ubuntu 18.04 since the openjdk package provided by Ubuntu includes full JIT support on all of the processor types.
The multiarch images are built and published by [a Github action](https://github.com/itzg/docker-minecraft-server/actions?query=workflow%3A%22Build+and+publish+multiarch%22), which [is configured in that branch](https://github.com/itzg/docker-minecraft-server/blob/multiarch/.github/workflows/build-multiarch.yml).
## Generating release notes
The following git command can be used to provide the bulk of release notes content:
```shell script
git log --invert-grep --grep "^ci:" --grep "^misc:" --pretty="- %s" 1.1.0..1.2.0
```

View File

@ -534,6 +534,15 @@ A [Mohist](https://github.com/Mohist-Community/Mohist) server can be used with
> **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 Catserver type server
A [Catserver](http://catserver.moe/) type server can be used with
-e TYPE=CATSERVER
> **NOTE** Catserver only provides a single release stream, so `VERSION` is ignored
## 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,7 +10,7 @@ function TrapExit {
batchMode=false batchMode=false
while getopts "hbt:" arg while getopts "hbt:s" arg
do do
case $arg in case $arg in
b) b)
@ -19,6 +19,9 @@ do
t) t)
tag=${OPTARG} tag=${OPTARG}
;; ;;
s)
tagArgs="-s -m 'Signed during docker-versions-create"
;;
h) h)
echo " echo "
Usage $0 [options] Usage $0 [options]
@ -28,6 +31,7 @@ Options:
when any merge fails when any merge fails
-t TAG tag and push the current revision on master with the given tag -t TAG tag and push the current revision on master with the given tag
and apply respective tags to each branch and apply respective tags to each branch
-s enable signed tags
-h display this help and exit -h display this help and exit
" "
exit exit

View File

@ -33,6 +33,7 @@ fi
if [[ $PROXY ]]; then if [[ $PROXY ]]; then
export http_proxy="$PROXY" export http_proxy="$PROXY"
export https_proxy="$PROXY" export https_proxy="$PROXY"
export JAVA_TOOL_OPTIONS+="-Djava.net.useSystemProxies=true"
log "INFO: Giving proxy time to startup..." log "INFO: Giving proxy time to startup..."
sleep 5 sleep 5
fi fi
@ -112,11 +113,15 @@ case "${TYPE^^}" in
;; ;;
MAGMA) MAGMA)
exec ${SCRIPTS:-/}start-magma "$@" exec ${SCRIPTS:-/}start-deployMagma "$@"
;; ;;
MOHIST) MOHIST)
exec ${SCRIPTS:-/}start-mohist "$@" exec ${SCRIPTS:-/}start-deployMohist "$@"
;;
CATSERVER)
exec ${SCRIPTS:-/}start-deployCatserver "$@"
;; ;;
*) *)

32
start-deployCatserver Normal file
View File

@ -0,0 +1,32 @@
#!/bin/bash
. ${SCRIPTS:-/}start-utils
set -o pipefail
set -e
latestAsset=$(
curl -fsSL https://api.github.com/repos/Luohuayu/CatServer/releases/latest | \
jq '.assets[] | select(.name | match(".*-universal.jar"))'
)
if [[ -z "${latestAsset}" ]]; then
log "ERROR: latest release of Catserver is missing universal.jar asset"
exit 1
fi
isDebugging && log "Latest asset ${latestAsset}"
latestJarName=$(echo ${latestAsset} | jq --raw-output '.name')
latestJarId=$(echo ${latestAsset} | jq --raw-output '.id')
export SERVER="/data/${latestJarName}"
if [ ! -f ${SERVER} ]; then
log "Downloading ${latestJarName}"
curl -H "Accept:application/octet-stream" -o "$SERVER" -fsSL https://api.github.com/repos/Luohuayu/CatServer/releases/assets/${latestJarId}
fi
export SKIP_LOG4J_CONFIG=true
# Continue to Final Setup
exec ${SCRIPTS:-/}start-finalSetup01World "$@"

0
start-magma → start-deployMagma Executable file → Normal file
View File

9
start-mohist → start-deployMohist Executable file → Normal file
View File

@ -1,17 +1,19 @@
#!/bin/bash #!/bin/bash
. ${SCRIPTS:-/}start-utils . ${SCRIPTS:-/}start-utils
requireVar VANILLA_VERSION
set -o pipefail set -o pipefail
set -e set -e
isDebugging && set -x isDebugging && set -x
requireVar VANILLA_VERSION
mohistJobs=https://ci.codemc.io/job/Mohist-Community/job/ mohistJobs=https://ci.codemc.io/job/Mohist-Community/job/
mohistJob=${mohistJobs}Mohist-${VANILLA_VERSION}/ mohistJob=${mohistJobs}Mohist-${VANILLA_VERSION}/
if ! curl -X HEAD -o /dev/null -fsSL "${mohistJob}"; then if ! curl -X HEAD -o /dev/null -fsSL "${mohistJob}"; then
log "ERROR: mohist builds do not exist for ${VANILLA_VERSION}" log "ERROR: mohist builds do not exist for ${VANILLA_VERSION}"
log " check https://ci.codemc.io/job/Mohist-Community/ for available versions" log " check https://ci.codemc.io/job/Mohist-Community/ for available versions"
log " and set VERSION accordingly"
exit 1 exit 1
fi fi
@ -24,17 +26,18 @@ baseName=$(basename "${latestBuildRelPath}")
if [[ ${baseName} != *-server.jar* ]]; then if [[ ${baseName} != *-server.jar* ]]; then
log "ERROR: mohist build for ${VANILLA_VERSION} is not a valid server jar, found ${baseName}" 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" log " check https://ci.codemc.io/job/Mohist-Community/ for available versions"
log " and set VERSION accordingly"
exit 1 exit 1
fi fi
export SERVER="/data/${baseName}" export SERVER="/data/${baseName}"
if [ ! -f ${SERVER} ]; then if [ ! -f ${SERVER} ]; then
log "Downloading ${SERVER}" log "Downloading ${baseName}"
curl -o "${SERVER}" -fsSL "${mohistJob}lastSuccessfulBuild/artifact/${latestBuildRelPath}" curl -o "${SERVER}" -fsSL "${mohistJob}lastSuccessfulBuild/artifact/${latestBuildRelPath}"
fi fi
export SKIP_LOG4J_CONFIG=true export SKIP_LOG4J_CONFIG=true
# Continue to Final Setup # Continue to Final Setup
exec ${SCRIPTS:-/}start-finalSetup01World $@ exec ${SCRIPTS:-/}start-finalSetup01World "$@"