#!groovy

def outfile = "Dockerfile"
//def status = sh(script:"ls -la dir1 >${outfile} 2>&1", returnStatus:true)
def output(){ 
	script {
		return sh(script:'pwd', returnStdout:true).trim()
	}
}

def sendMessage(message){
	def encode = URLEncoder.encode(message,"UTF-8")
	withCredentials([string(credentialsId: 'TGBot', variable: 'SECRET')]) {
	responce = httpRequest(ConsoleLogResponceBody: true,
		contentType: 'APPLICATION_JSON',
		httpMode: 'GET',
		url: "https://api.telegram.org/bot$SECRET/sendMessage?text=$encode&chat_id=-1001282104904&disable_web_page_preview=true",
		validResponceCodes: '200')
		return responce
	}
}

pipeline {
   agent any
   environment{
   		PWD = output()
   }
   stages {
      stage('Hello') {
         steps {
            echo output("${PWD}")
         }
      }
   }
}