Created
March 28, 2023 23:16
-
-
Save parjun8840/c347cb17c87c6048bd7d3831d0167469 to your computer and use it in GitHub Desktop.
commonWorkflow.groovy
This file contains 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
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