-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from garystafford/h2
Merge H2 Feature Branch Changes to Master
- Loading branch information
Showing
24 changed files
with
326 additions
and
151 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,67 +3,67 @@ | |
def PROJECT_NAME = "spring-postgresql-demo" | ||
|
||
pipeline { | ||
agent any | ||
tools { | ||
gradle 'gradle' | ||
} | ||
stages { | ||
stage('Checkout GitHub') { | ||
steps { | ||
git changelog: true, poll: true, | ||
branch: 'h2', | ||
url: "https://github.com/garystafford/${PROJECT_NAME}" | ||
} | ||
} | ||
stage('Build') { | ||
steps { | ||
sh 'gradle wrapper' | ||
sh './gradlew clean build -x test' | ||
} | ||
} | ||
stage('Unit Test') { | ||
steps { | ||
withEnv(['SPRING_DATASOURCE_URL=jdbc:h2:file:~/elections']) { | ||
sh './gradlew cleanTest test' | ||
} | ||
junit '**/build/test-results/test/*.xml' | ||
} | ||
} | ||
stage('SonarQube Analysis') { | ||
steps { | ||
withSonarQubeEnv('Local SonarQube') { | ||
sh "./gradlew sonarqube -Dsonar.projectName=${PROJECT_NAME}" | ||
agent any | ||
tools { | ||
gradle 'gradle' | ||
} | ||
} | ||
} | ||
stage('Archive Artifact') { | ||
steps { | ||
archiveArtifacts 'build/libs/*.jar' | ||
} | ||
} | ||
stage('Publish Artifact') { | ||
steps { | ||
withCredentials([string(credentialsId: 'GIT_TOKEN', variable: 'GIT_TOKEN')]) { | ||
dir('build/libs/') { | ||
sh "git init \ | ||
&& git config user.name \"jenkins-ci\" \ | ||
&& git config user.email \"[email protected]\" \ | ||
&& git add *.jar \ | ||
stages { | ||
stage('Checkout GitHub') { | ||
steps { | ||
git changelog: true, poll: true, | ||
branch: 'master', | ||
url: "https://github.com/garystafford/${PROJECT_NAME}" | ||
} | ||
} | ||
stage('Build') { | ||
steps { | ||
sh 'gradle wrapper' | ||
sh './gradlew clean build -x test' | ||
} | ||
} | ||
stage('Unit Test') { // unit test against h2 | ||
steps { | ||
withEnv(['SPRING_DATASOURCE_URL=jdbc:h2:file:~/elections']) { | ||
sh './gradlew cleanTest test' | ||
} | ||
junit '**/build/test-results/test/*.xml' | ||
} | ||
} | ||
stage('SonarQube Analysis') { | ||
steps { | ||
withSonarQubeEnv('sonarqube') { | ||
sh "./gradlew sonarqube -Dsonar.projectName=${PROJECT_NAME}" | ||
} | ||
} | ||
} | ||
stage('Archive Artifact') { // option 1 to build Dockerfile in next pipeline | ||
steps { | ||
archiveArtifacts 'build/libs/*.jar' | ||
} | ||
} | ||
stage('Publish Artifact') { // option 2 to build Dockerfile in next pipeline | ||
steps { | ||
withCredentials([string(credentialsId: 'GIT_TOKEN', variable: 'GIT_TOKEN')]) { | ||
dir('build/libs/') { | ||
sh "git init \ | ||
&& git config user.name \"jenkins-ci\" \ | ||
&& git config user.email \"[email protected]\" \ | ||
&& git add *.jar \ | ||
&& git commit -m \"Publish build artifact\" \ | ||
&& git push --force --quiet --progress \ | ||
&& git push --force --quiet --progress \ | ||
\"https://x-access-token:${GIT_TOKEN}@github.com/garystafford/${PROJECT_NAME}.git\" \ | ||
master:build-artifacts-gke" | ||
} | ||
master:build-artifacts-gke" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
post { | ||
success { | ||
slackSend(color: '#008000', message: "SUCCESS: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})") | ||
} | ||
failure { | ||
slackSend(color: '#FF0000', message: "FAILURE: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})") | ||
} | ||
} | ||
} | ||
} | ||
} | ||
post { | ||
success { | ||
slackSend(color: '#008000', message: "SUCCESS: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})") | ||
} | ||
failure { | ||
slackSend(color: '#FF0000', message: "FAILURE: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})") | ||
} | ||
} | ||
} |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#!groovy | ||
|
||
def PROJECT_NAME = "spring-postgresql-demo" | ||
|
||
pipeline { | ||
agent any | ||
stages { | ||
stage('Checkout GitHub') { | ||
steps { | ||
git changelog: true, poll: false, | ||
branch: 'master', | ||
url: "https://github.com/garystafford/${PROJECT_NAME}" | ||
} | ||
} | ||
stage('Get Cluster Creds') { | ||
steps { | ||
dir('kubernetes') { | ||
sh 'sh ./part1b-get-cluster-creds.sh' | ||
} | ||
} | ||
} | ||
stage('Build Environments') { // dev, test, uat | ||
steps { | ||
dir('kubernetes') { | ||
sh 'sh ./part2-create-environments.sh' | ||
} | ||
} | ||
} | ||
stage('Deploy Postgres to dev') { // doesn't work with istio! | ||
steps { | ||
dir('kubernetes') { | ||
sh 'sh ./deploy-postgres-gke-dev.sh' | ||
} | ||
} | ||
} | ||
stage('Deploy Election v1 to dev') { | ||
environment { // get cluster ip ranges for deploy script | ||
IP_RANGES = sh(returnStdout: true, | ||
script: 'sh ./kubernetes/get-cluster-ip-ranges.sh') | ||
} | ||
steps { | ||
dir('kubernetes') { | ||
sh 'env | sort' | ||
sh 'sh ./part3a-deploy-v1-dev.sh' | ||
} | ||
} | ||
} | ||
stage('Smoke Test') { // assumes 'api.dev.voter-demo.com' reachable | ||
steps { | ||
dir('postman') { | ||
nodejs('nodejs') { | ||
sh 'sh newman-smoke-tests-minikube.sh' | ||
} | ||
junit '**/newman/*.xml' | ||
} | ||
} | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/sh | ||
|
||
# docker login --username <username> --password <password> | ||
|
||
docker build --no-cache -t garystafford/spring-postgresql-demo:1.1.0 . | ||
docker push garystafford/spring-postgresql-demo:1.1.0 |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
|
||
# deploy postgres within cluster vs. external postgres (i.e. AWS) | ||
|
||
# set -x | ||
|
||
# postgresql in a pod | ||
kubectl apply -f ./postgres-local/postgres-deployment.yaml -n dev | ||
|
||
kubectl apply -f ./postgres-local/postgres-service.yaml -n dev | ||
|
||
kubectl get pods -n dev |
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
Oops, something went wrong.