fix in ci script

This commit is contained in:
Wolfgang Ludger Hottgenroth 2021-11-26 14:54:40 +01:00
parent 21c28e64ee
commit a92f947685
Signed by: wn
GPG Key ID: 6C1E5E531E0D5D7F

View File

@ -8,3 +8,30 @@ versionize:
before_script:
- VERSION=`echo -e "import yaml\nwith open('openapi.yaml') as f:d=yaml.load(f)\nprint d['info']['version']" | python`
.deploy:
stage: deploy
image: devnexus.krohne.com:18079/repository/docker-krohne/krohnedockerbash:1.1.0
except:
- tags
artifacts:
paths:
- instance.txt
- api_major_version.txt
- api_version.txt
expire_in: 1 day
needs:
- dockerize
when: manual
allow_failure: false
script:
- echo $INSTANCE_SPECIFIER > instance.txt
- echo -n $API_VERSION > api_version.txt
- echo -n $API_MAJOR_VERSION > api_major_version.txt
- CONTAINER_NAME="${CI_PROJECT_PATH_SLUG}-${INSTANCE_SPECIFIER}-${API_MAJOR_VERSION}"
- SERVICE_PORT=$((SERVICE_FIRST_PORT + SERVICE_PORT_OFFSET + (API_MAJOR_VERSION - 1) % 5))
- echo "Service port is ${SERVICE_PORT}"
- docker stop $CONTAINER_NAME || echo "$CONTAINER_NAME not running, anyway okay"
- docker pull $IMAGE_NAME:$VERSION
- echo "docker run -d --rm -e TZ=Europe/Berlin -p $SERVICE_PORT:$WEBSERVICE_PORT --name $CONTAINER_NAME -e WEBSERVICE_INSTANCE=$INSTANCE_SPECIFIER -e Database__Password=$DATABASE_PASSWORD $IMAGE_NAME:$VERSION" > /start-scripts/${CONTAINER_NAME}.sh
- chmod 755 /start-scripts/${CONTAINER_NAME}.sh
- /start-scripts/${CONTAINER_NAME}.sh