Last active
January 14, 2024 18:40
-
-
Save BillyPurvis/67093ded71bfcb35ff2a42e9a9f36196 to your computer and use it in GitHub Desktop.
A Basic Jenkins Scripted Pipeline Github Clone Repo Stage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String branchName = env.BRANCH_NAME | |
String gitCredentials = "CREDENTIAL_ID" | |
String repoUrl = "https://github.com/username/repo-name.git" | |
node { | |
// Start Stages | |
stage('Clone') { | |
// Clones the repository from the current branch name | |
echo 'Make the output directory' | |
sh 'mkdir -p build' | |
echo 'Cloning files from (branch: "' + branchName + '" )' | |
dir('build') { | |
git branch: branchName, credentialsId: gitCredentials, url: repoUrl | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment