# jenkins / pipeline / practice
Jenkins Pipeline: SCM & Build
Today I successfully configured a Jenkins Pipeline project to automatically pull source code from GitHub (SCM) and execute a Build stage to prepare the application environment.
The Pipeline Flow
The core function of this pipeline is to establish a bridge between the version control system and the continuous integration server. The flow proceeds directly from SCM to Build.
Source Control Management (SCM)
Connected Jenkins directly to my GitHub repository. In this stage, Jenkins acts as a client, successfully cloning/downloading the latest project code from Git into its workspace.
The Build Stage
After pulling the code, the Build stage triggers. The purpose of this stage is to prepare the application environment by compiling source code, installing necessary dependencies, or building container images (e.g., using docker build -t myapp .).
Jenkinsfile Configuration
This is the declarative pipeline script used to define the stages for this task. It instructs the Jenkins agent to checkout the code and then run a simple shell execution.
pipeline { agent any stages { stage('SCM') { steps { git 'https://github.com/iamshanmugananthan/jenkins.git' } } stage('Build') { steps { sh 'echo Build Stage Running' } } } }
Steps Followed
Authentication & Setup
- 1. GitHub Auth
Opened GitHub Developer Settings and created a new Personal Access Token (PAT) for secure connection.
- 2. Jenkins Creds
Navigated to Jenkins and securely stored that PAT into Jenkins Credentials.
- 3. Create Project
Created a brand new Jenkins Pipeline Project via the Jenkins dashboard.
Pipeline Integration
- 4. Configure SCM
In the SCM section of the pipeline, added the GitHub repository URL and selected the stored credentials.
- 5. Set Branch
Changed the branch specifier to target the
mainbranch. - 6. Validate & Run
Ensured the root of the repository contained the valid
Jenkinsfile, saved the project, and clicked Build Now to run the pipeline successfully.