LoginSignup
0
0

More than 3 years have passed since last update.

【Jekins pipeline】CurlでChatwok APIのメッセージ送信を使う

Posted at

pipeline {
  agent any

  stages {
    stage('exec') {

      environment {
        apiKey="xxx"
        roomId="yyy 数字のみ"
        url="https://api.chatwork.com/v2/rooms/${roomId}/messages"
        message="Jenkins Job ${env.JOB_NAME} : ${currentBuild.currentResult}"
      }

      steps {
        sh('curl -X POST -H "X-ChatWorkToken: $apiKey" -d "body=$message" "$url"')
        // bad
        // sh '''
        //   curl -X POST -H "X-ChatWorkToken: $apiKey" -d "body=${message}" "${url}"
        // '''
      }
    }
  }
}

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0