@@ -14,40 +14,39 @@ runs:
1414 uses : actions/setup-python@v4.5.0
1515 with :
1616 python-version : " 3.x"
17+
1718 - name : " Install Python dependencies"
1819 run : pip install pyaml httplib2
1920 shell : bash
21+
2022 - name : " Setup Java 21"
2123 id : setup-java
2224 uses : actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4
2325 with :
2426 distribution : " temurin"
2527 java-version : " 21"
26- - name : " Extract deployment package"
27- run : |
28- mkdir project
29- unzip -qq ${{ inputs.mda-file }} -d project
30- cp configs/e2e/m2ee-native.yml project/m2ee-native.yml
31- sed -i -- 's=$ROOT_PATH=${{ github.workspace }}=g' project/m2ee-native.yml
32- sed -i -- 's=$JAVA_HOME=${{ steps.setup-java.outputs.path }}=g' project/m2ee-native.yml
28+
29+ - name : " Make setup-runtime.sh executable"
30+ run : chmod +x .github/scripts/setup-runtime.sh
3331 shell : bash
34- - name : " Setup m2ee"
32+
33+ - name : " Initial setup"
3534 run : |
36- mkdir -p var/log var/opt/m2ee var/run bin tmp
37- git clone https://github.com/KevinVlaanderen/m2ee-tools.git tmp/m2ee
38- mv tmp/m2ee/src/* var/opt/m2ee
39- chmod a=rwx var/log/ var/run/
40- echo "#!/bin/bash -x" > bin/m2ee
41- echo "python3 var/opt/m2ee/m2ee.py \$@" >>bin/m2ee
42- chmod +x bin/m2ee
35+ .github/scripts/setup-runtime.sh "${{ inputs.mda-file }}" "${{ inputs.mendix-version }}" "${{ steps.setup-java.outputs.path }}" "${{ github.workspace }}"
4336 shell : bash
44- - name : " Setup mxruntime"
37+
38+ - name : " Start mxruntime with retries"
4539 run : |
46- mkdir -p ${{ github.workspace }}/project/runtimes ${{ github.workspace }}/project/data/model-upload ${{ github.workspace }}/project/data/database ${{ github.workspace }}/project/data/files ${{ github.workspace }}/project/data/tmp
47- wget -q https://cdn.mendix.com/runtime/mendix-${{ inputs.mendix-version }}.tar.gz -O tmp/runtime.tar.gz
48- tar xfz tmp/runtime.tar.gz --directory ${{ github.workspace }}/project/runtimes
49- rm tmp/runtime.tar.gz
50- shell : bash
51- - name : " Start mxruntime"
52- run : bin/m2ee -c ${{ github.workspace }}/project/m2ee-native.yml --verbose --yolo start
53- shell : bash
40+ set -e
41+ MAX_RETRIES=3
42+ RETRY=0
43+ until bin/m2ee -c ${{ github.workspace }}/project/m2ee-native.yml --verbose --yolo start; do
44+ RETRY=$((RETRY+1))
45+ if [ $RETRY -ge $MAX_RETRIES ]; then
46+ echo "mxruntime failed after $MAX_RETRIES attempts."
47+ exit 1
48+ fi
49+ echo "mxruntime failed, retrying ($RETRY/$MAX_RETRIES)..."
50+ .github/scripts/setup-runtime.sh "${{ inputs.mda-file }}" "${{ inputs.mendix-version }}" "${{ steps.setup-java.outputs.path }}" "${{ github.workspace }}"
51+ done
52+ shell : bash
0 commit comments