Skip to content

Commit

Permalink
Refine Jenkinsfile and remove unused configurations
Browse files Browse the repository at this point in the history
Signed-off-by: John Niang <johnniang@fastmail.com>
  • Loading branch information
JohnNiang committed Dec 14, 2021
1 parent 6b3ed07 commit 9b1b30a
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 160 deletions.
9 changes: 0 additions & 9 deletions Dockerfile-on-prem

This file was deleted.

103 changes: 0 additions & 103 deletions Jenkinsfile-on-prem

This file was deleted.

24 changes: 20 additions & 4 deletions Jenkinsfile-online
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ pipeline {
stage ('unit test') {
steps {
container ('maven') {
sh 'mvn clean -gs `pwd`/configuration/settings.xml test'
sh 'mvn clean test'
}
}
}

stage ('build & push') {
steps {
container ('maven') {
sh 'mvn -Dmaven.test.skip=true -gs `pwd`/configuration/settings.xml clean package'
sh 'mvn clean package -DskipTests'
sh 'docker build -f Dockerfile-online -t $REGISTRY/$DOCKERHUB_NAMESPACE/$APP_NAME:SNAPSHOT-$BRANCH_NAME-$BUILD_NUMBER .'
withCredentials([usernamePassword(passwordVariable : 'DOCKER_PASSWORD' ,usernameVariable : 'DOCKER_USERNAME' ,credentialsId : "$DOCKER_CREDENTIAL_ID" ,)]) {
sh 'echo "$DOCKER_PASSWORD" | docker login $REGISTRY -u "$DOCKER_USERNAME" --password-stdin'
Expand Down Expand Up @@ -65,7 +65,15 @@ pipeline {
}
steps {
input(id: 'deploy-to-dev', message: 'deploy to dev?')
kubernetesDeploy(configs: 'deploy/dev-ol/**', enableConfigSubstitution: true, kubeconfigId: "$KUBECONFIG_CREDENTIAL_ID")
container ('maven') {
withCredentials([
kubeconfigFile(
credentialsId: env.KUBECONFIG_CREDENTIAL_ID,
variable: 'KUBECONFIG')
]) {
sh 'envsubst < deploy/dev-all-in-one/devops-sample.yaml | kubectl apply -f -'
}
}
}
}
stage('push with tag'){
Expand Down Expand Up @@ -96,7 +104,15 @@ pipeline {
}
steps {
input(id: 'deploy-to-production', message: 'deploy to production?')
kubernetesDeploy(configs: 'deploy/prod-ol/**', enableConfigSubstitution: true, kubeconfigId: "$KUBECONFIG_CREDENTIAL_ID")
container ('maven') {
withCredentials([
kubeconfigFile(
credentialsId: env.KUBECONFIG_CREDENTIAL_ID,
variable: 'KUBECONFIG')
]) {
sh 'envsubst < deploy/prod-all-in-one/devops-sample.yaml | kubectl apply -f -'
}
}
}
}
}
Expand Down
43 changes: 0 additions & 43 deletions configuration/settings.xml

This file was deleted.

1 change: 0 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.1</version>
</dependency>
</dependencies>

Expand Down

0 comments on commit 9b1b30a

Please sign in to comment.