Merge pull request #24 from sergey-shambir/envsubst

Added support for envsubst in image/container name
This commit is contained in:
will Farrell 2019-03-17 13:08:19 -06:00 committed by GitHub
commit 945357ce4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -1,7 +1,7 @@
FROM library/docker:stable FROM library/docker:stable
ENV HOME_DIR=/opt/crontab ENV HOME_DIR=/opt/crontab
RUN apk add --no-cache --virtual .run-deps bash jq \ RUN apk add --no-cache --virtual .run-deps gettext bash jq \
&& mkdir -p ${HOME_DIR}/jobs ${HOME_DIR}/projects \ && mkdir -p ${HOME_DIR}/jobs ${HOME_DIR}/projects \
&& adduser -S docker -D && adduser -S docker -D

View File

@ -12,7 +12,7 @@ if [ "${LOG_FILE}" == "" ]; then
LOG_DIR=/var/log/crontab LOG_DIR=/var/log/crontab
LOG_FILE=${LOG_DIR}/jobs.log LOG_FILE=${LOG_DIR}/jobs.log
mkdir -p ${LOG_DIR} mkdir -p ${LOG_DIR}
touch ${LOG_FILE} touch ${LOG_FILE}
fi fi
CONFIG=${HOME_DIR}/config.json CONFIG=${HOME_DIR}/config.json
@ -40,7 +40,7 @@ slugify() {
make_image_cmd() { make_image_cmd() {
DOCKERARGS=$(echo ${1} | jq -r .dockerargs) DOCKERARGS=$(echo ${1} | jq -r .dockerargs)
if [ "${DOCKERARGS}" == "null" ]; then DOCKERARGS=; fi if [ "${DOCKERARGS}" == "null" ]; then DOCKERARGS=; fi
IMAGE=$(echo ${1} | jq -r .image) IMAGE=$(echo ${1} | jq -r .image | envsubst)
TMP_COMMAND=$(echo ${1} | jq -r .command) TMP_COMMAND=$(echo ${1} | jq -r .command)
echo "docker run ${DOCKERARGS} ${IMAGE} ${TMP_COMMAND}" echo "docker run ${DOCKERARGS} ${IMAGE} ${TMP_COMMAND}"
} }
@ -51,7 +51,7 @@ make_container_cmd() {
SCRIPT_NAME=$(echo ${1} | jq -r .name) SCRIPT_NAME=$(echo ${1} | jq -r .name)
SCRIPT_NAME=$(slugify $SCRIPT_NAME) SCRIPT_NAME=$(slugify $SCRIPT_NAME)
PROJECT=$(echo ${1} | jq -r .project) PROJECT=$(echo ${1} | jq -r .project)
CONTAINER=$(echo ${1} | jq -r .container) CONTAINER=$(echo ${1} | jq -r .container | envsubst)
TMP_COMMAND=$(echo ${1} | jq -r .command) TMP_COMMAND=$(echo ${1} | jq -r .command)
if [ "${PROJECT}" != "null" ]; then if [ "${PROJECT}" != "null" ]; then