Skip to content

Commit

Permalink
Merge pull request #54 from n1hility/master
Browse files Browse the repository at this point in the history
Introduce OpenShift verification
  • Loading branch information
n1hility authored Oct 14, 2018
2 parents c161759 + 0655a04 commit 533f90a
Showing 1 changed file with 73 additions and 18 deletions.
91 changes: 73 additions & 18 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,81 @@
# Add steps that use Docker Compose, tag images, push to a registry, run an image, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/docker

pool:
vmImage: 'Ubuntu 16.04'
jobs:
- job: Build
pool:
vmImage: 'Ubuntu 16.04'

variables:
imageName: 'shamrock:$(build.buildId)'
variables:
imageName: 'shamrock:$(build.buildId)'

steps:
steps:

- script: docker run --rm --publish 5432:5432 --name build-postgres -e POSTGRES_USER=hibernate_orm_test -e POSTGRES_PASSWORD=hibernate_orm_test -e POSTGRES_DB=hibernate_orm_test -d postgres:10.5
displayName: 'start postgres'
- script: docker run --rm --publish 5432:5432 --name build-postgres -e POSTGRES_USER=hibernate_orm_test -e POSTGRES_PASSWORD=hibernate_orm_test -e POSTGRES_DB=hibernate_orm_test -d postgres:10.5
displayName: 'start postgres'

- task: Maven@3
displayName: 'Maven Build'
inputs:
goals: 'install'
options: '-Dnative-image.docker-build -Dno-postgres -Dnative-image.xmx=4g'
- task: Maven@3
displayName: 'Maven Build'
inputs:
goals: 'install'
options: '-Dnative-image.docker-build -Dno-postgres -Dnative-image.xmx=4g'

- script: |
docker build -f docker/strict-example/Dockerfile -t jtgdocker1/shamrock-strict-example examples/strict/
docker login -u jtgdocker1 -p uEo-NTv-5YT-kk6
docker push jtgdocker1/shamrock-strict-example
docker logout
displayName: Publishing Strict Example Container Image
- script: |
docker build -f docker/strict-example/Dockerfile -t jtgdocker1/shamrock-strict-example examples/strict/
docker login -u jtgdocker1 -p uEo-NTv-5YT-kk6
docker push jtgdocker1/shamrock-strict-example
docker logout
displayName: Publishing Strict Example Container Image
- job: OpenShift_Verify
dependsOn: Build
pool:
vmImage: 'Ubuntu 16.04'

steps:
- script: |
curl https://github.com/openshift/origin/releases/download/v3.10.0/openshift-origin-client-tools-v3.10.0-dd10d17-linux-64bit.tar.gz --location --output oc-client.tgz
tar -xzvf oc-client.tgz
cd openshift-origin-client*
sudo echo '{"insecure-registries": ["172.30.0.0/16"]}' > daemon.json
sudo mv daemon.json /etc/docker
sudo cat /etc/docker/daemon.json
sudo systemctl daemon-reload
sudo systemctl restart docker
./oc cluster up
displayName: 'Launch OpenShift'
- script: |
function wait_for_pod() {
echo -n "Waiting for $1."
count=0;
VAL=""
while [ "$VAL" != "Running" ]
do
echo -n .
if [ $count -gt 20 ]; then
echo "Timed out waiting for $1!"
exit 1
fi
count=$((count+1))
sleep 2;
VAL=`./oc get pods | grep $1 | awk '{print $3}'`
done
echo "Ready!"
}
cd openshift-origin-client*
docker login -u jtgdocker1 -p uEo-NTv-5YT-kk6
docker pull jtgdocker1/shamrock-strict-example
docker pull centos/postgresql-10-centos7
docker logout
./oc create secret docker-registry jtgdocker1 --docker-username=jtgdocker1 --docker-password=uEo-NTv-5YT-kk6 --docker-email='[email protected]'
./oc secrets link default jtgdocker1 --for=pull
./oc new-app -e "POSTGRESQL_USER=hibernate_orm_test" -e "POSTGRESQL_PASSWORD=hibernate_orm_test" -e "POSTGRESQL_DATABASE=hibernate_orm_test" centos/postgresql-10-centos7
wait_for_pod postgres
./oc new-app -e "DATASOURCE_URL=jdbc:postgresql://postgresql-10-centos7/hibernate_orm_test" jtgdocker1/shamrock-strict-example
wait_for_pod shamrock
./oc status
VAL=`./oc get service shamrock-strict-example -o "custom-columns=IP:.spec.clusterIP" --no-headers=true`
VAL2=`curl -v http://$VAL:8080/jpa/testjpaeminjection`
test "$VAL2" = "OK"
displayName: 'Deploy and Test'

0 comments on commit 533f90a

Please sign in to comment.