if [ "${SCHEDULE_PIPELINE_VARIABLE}" != "" ]; then
printf "[*] Adding variable ${SCHEDULE_PIPELINE_VARIABLE} to schedule..."
KEY=${SCHEDULE_PIPELINE_VARIABLE%=*}
VALUE=${SCHEDULE_PIPELINE_VARIABLE#*=}
if curl --fail-with-body -sSLX POST -H "PRIVATE-TOKEN: ${GL_TOKEN}" -F "key=${KEY}" -F "value=${VALUE}" "${CI_API_V4_URL}/projects/${PROJECT_ID}/pipeline_schedules/${SCHEDULE_ID}/variables" >/tmp/log 2>&1; then
echo " done."
else
echo " failed with the following error:"
cat /tmp/log
ERROR=1
fi
fi
if [ "${DISABLE_SCHEDULE_OWNERSHIP_WARNING}" = "" ]; then
if [ "$(echo $SCHEDULE | dasel -p json -w yaml '.owner.id')" = "${GL_TOKEN_USER_ID}" ]; then
echo "[!] The schedule is owned by the GL_TOKEN user named '${GL_TOKEN_NAME}' with username '${GL_TOKEN_USERNAME}', so you probably will not receive any warnings of pipeline failures."
echo "Go here and take ownership: $(echo ${PROJECT} | dasel -p json -w yaml '.web_url')/-/pipeline_schedules"
echo "Or disable this warning by setting a variable called DISABLE_SCHEDULE_OWNERSHIP_WARNING to 'true'."