Skip to content

Instantly share code, notes, and snippets.

@parjun8840
Created March 28, 2023 23:16
Show Gist options
  • Save parjun8840/c347cb17c87c6048bd7d3831d0167469 to your computer and use it in GitHub Desktop.
Save parjun8840/c347cb17c87c6048bd7d3831d0167469 to your computer and use it in GitHub Desktop.
commonWorkflow.groovy
def call(String repoUrl) {
pipeline {
agent {
kubernetes {
yaml '''
apiVersion: v1
kind: Pod
spec:
containers:
- name: maven
image: maven:alpine
command:
- cat
tty: true
'''
}
}
stages {
stage("Checkout Code") {
steps {
container('maven') {
git branch: 'main',
url: "${repoUrl}"
}
}
}
stage("Cleaning workspace") {
steps {
container('maven'){
echo "Cleaning workspace"
sh "mvn -version"
sh "ls -lrt"
}
}
}
stage("Running Testcase") {
steps {
container('maven'){
echo "Running Testcase"
sh "mvn -version"
}
}
}
stage("Packing Application") {
steps {
container('maven'){
echo "Packing Application"
sh "mvn -version"
}
}
}
stage("Build Docker"){
steps {
container('maven') {
echo "Build Docker"
sh "mvn -version"
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment