Jenkins pipeline using Github webhook

  1. 깃허브 토큰 생성, 젠킨스에서 스크립트 작성!
pipeline { 
	agent any
	
	tools {
		// Install the Maven version configured as "M3" and add it to the path.
		maven "mvn3.9.7"
	}
	
	stages {
		stage('checkout') {
			steps {
				checkout scmGit ~ 어쩌구
			}
		}
		stage('Build') {
			steps {
				// Get some code from a GitHub repository
				git '<https://github.com/jenkins-docs/simple-java-maven-app.git’>
				
				// Run Maven on a Unix agent.
				sh "mvn -Dmaven.test.failure.ignore=true clean package"
				
				// To run Maven on a Windows agent, use
				// bat “mvn -Dmaven.test.failure.ignore=true clean package" 
			}	
			post {
				// If Maven was able to run the tests, even if some of the test 
				// failed, record the test results and archive the jar file. 
				success {
					echo “Job Done" 
				}
			}
		}
	}
	
}
  1. 깃허브 레포에 Webhooks 만들기