Skip to content

Commit

Permalink
Add deploy to cloudfoundry
Browse files Browse the repository at this point in the history
  • Loading branch information
mdeinum committed Oct 15, 2019
1 parent 6fda86a commit 058c0ef
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 37 deletions.
53 changes: 19 additions & 34 deletions .circleci/config.yml
@@ -1,54 +1,32 @@
version: 2
version: 2.1
# These environment variables must be set in CircleCI UI
#
# DOCKER_EMAIL - login info for docker hub
# DOCKER_USER
# DOCKER_PASS
#

orbs:
cloudfoundry: circleci/cloudfoundry@1.0
jobs:
build:
docker:
- image: circleci/openjdk:8
working_directory: ~/securing-devops
steps:
- checkout
- setup_remote_docker:
version: 17.11.0-ce
docker_layer_caching: true

- restore_cache:
key: securing-devops-boot-{{ checksum "pom.xml" }}

- run: mvn dependency:go-offline

- save_cache:
paths:
- ~/.m2
key: securing-devops-boot-{{ checksum "pom.xml" }}

- run: mvn verify

- run:
name: Save test results
command: |
mkdir -p ~/junit/
find . -type f -regex ".*/target/surefire-reports/.*xml" -exec cp {} ~/junit/ \;
when: always

- store_test_results:
path: ~/junit

- run:
name: Build Docker Container
command: |
mkdir -p target/dependencies
(cd target/dependencies; jar -xf ../*.jar)
docker build -f src/main/docker/Dockerfile -t mdeinum/${CIRCLE_PROJECT_REPONAME} .
- run:
name: Start Invoice Application (SSL)
command: docker run -p 443:8443 mdeinum/${CIRCLE_PROJECT_REPONAME}
background: true
path: target/surefire-reports
- store_artifacts:
path: target/invoicer-0.0.1-SNAPSHOT.jar
destination: invoicer.jar

dependency_check:
docker:
Expand All @@ -66,7 +44,7 @@ jobs:
steps:
- run: |
go get github.com/mozilla/tls-observatory/tlsobs
tlsobs -r 172.17.0.2
tlsobs invoicer.cfapps.io
zap:
docker:
- image: circleci/openjdk:8
Expand All @@ -87,7 +65,7 @@ jobs:
docker pull owasp/zap2docker-weekly && \
docker run \
--volumes-from zapwrk \
-t owasp/zap2docker-weekly zap-baseline.py -d -c zap-baseline.conf -t https://172.17.0.2/ || \
-t owasp/zap2docker-weekly zap-baseline.py -d -c zap-baseline.conf -t https://invoicer.cfapps.io/ || \
if [ $? -ne 1 ]; then exit 0; else exit 1; fi;
)
publish:
Expand All @@ -108,15 +86,22 @@ workflows:
default:
jobs:
- build
- tlsorb:
- cloudfoundry/push:
requires:
- build
appname: invoicer
org: Conspect
space: development
package: package: ~/securing-devops/invoicer.jar
- tlsorb:
requires:
- cloudfoundry/push
- dependency_check:
requires:
- build
- zap:
requires:
- build
- cloudfoundry/push
- publish:
requires:
- dependency_check
Expand Down
7 changes: 4 additions & 3 deletions src/main/resources/application.properties
@@ -1,6 +1,7 @@
server.ssl.key-store=classpath:invoice-keystore.p12
server.ssl.key-store-password=changeit
server.ssl.key-password=changeit
# server.port=8443
# server.ssl.key-store=classpath:invoice-keystore.p12
# server.ssl.key-store-password=changeit
# server.ssl.key-password=changeit

spring.jmx.enabled=false

Expand Down

0 comments on commit 058c0ef

Please sign in to comment.