Skip to content

Commit

Permalink
setting up cicd
Browse files Browse the repository at this point in the history
  • Loading branch information
DickChesterwood committed Apr 29, 2019
1 parent c7eeb4d commit 75b682d
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
36 changes: 36 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
pipeline {
agent any

environment {
SERVICE_NAME = "fleetman-position-simulator"
ORGANIZATION_NAME = "fleetman-ci-cd-demo"
YOUR_DOCKERHUB_USERNAME="virtualpairprogrammers"
REPOSITORY_TAG="${YOUR_DOCKERHUB_USERNAME}/${ORGANIZATION_NAME}-${SERVICE_NAME}:${BUILD_ID}"
}

stages {
stage('Preparation') {
steps {
cleanWs()
git credentialsId: 'GitHub', url: "https://github.com/${ORGANIZATION_NAME}/${SERVICE_NAME}"
}
}
stage('Build') {
steps {
sh '''mvn clean package'''
}
}

stage('Build and Push Image') {
steps {
sh 'docker image build -t ${REPOSITORY_TAG} .'
}
}

stage('Deploy to Cluster') {
steps {
sh 'envsubst < ${WORKSPACE}/deploy.yaml | kubectl apply -f -'
}
}
}
}
23 changes: 23 additions & 0 deletions deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: position-simulator
spec:
selector:
matchLabels:
app: position-simulator
replicas: 1
template: # template for the pods
metadata:
labels:
app: position-simulator
spec:
containers:
- name: position-simulator
image: richardchesterwood/k8s-fleetman-position-simulator:release2
env:
- name: SPRING_PROFILES_ACTIVE
value: production-microservice
imagePullPolicy: Never
---
# No service for this microservice - it's "headless", it just sends out data and nothing calls it.

0 comments on commit 75b682d

Please sign in to comment.