Skip to content

Instantly share code, notes, and snippets.

@kenrachynski
Forked from slide/Jenkinsfile
Last active March 27, 2019 21:55
Show Gist options
  • Select an option

  • Save kenrachynski/55b5794cae03611645b2784485ff50d7 to your computer and use it in GitHub Desktop.

Select an option

Save kenrachynski/55b5794cae03611645b2784485ff50d7 to your computer and use it in GitHub Desktop.
groovy var
#!/usr/bin/env bash
if "${SITE_PART}" == 'booking'; then
SITE_URL="a"
else
SITE_URL="b"
fi
# Notify telegram channels about the deploy.
DEPLOY_MESSAGE="<a href='${JOB_URL}'>⚙</a><a href='${BUILD_URL}'>📋</a> [<a href='http://wikipedia.com'>${PROJECT}</a>] <a href='${SITE_URL}'>[${SITE_PART}] ${REGION}</a>"
#DEPLOY_MESSAGE=" <a href='${SITE_URL}'>${SITE_PART} ${REGION}</a>"
curl -X POST \
-H 'Content-Type: application/json' \
-d '{"chat_id": "${TG_CHAT_ID__TestChaT}"}' \
-d '{"text": "${DEPLOY_MESSAGE}"}' \
-d '{"disable_notification": true}' \
-d '{"disable_web_page_preview": true}' \
-d '{"parse_mode": "HTML"}' \
https://api.telegram.org/${TG_BOT_ID_TOKEN}/sendMessage
pipeline {
agent any
environment {
PROJECT = 'myproj'
SITE_PART = 'booking'
TG_BOT_ID_TOKEN = credentials('bot_token')
TG_CHAT_ID__TestChaT = credentials('TG_CHAT_ID__TestChaT')
}
options {
timestamps()
ansiColor('xterm')
}
stages {
stage('Curl') {
steps {
sh 'deploynode.sh'
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment