Skip to content

Commit b2410d7

Browse files
author
Zhang Handi
committed
.travis.yml updated
1 parent 3247796 commit b2410d7

File tree

2 files changed

+24
-27
lines changed

2 files changed

+24
-27
lines changed

.travis.yml

+24-27
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,38 @@
11
language: java
22
jdk: oraclejdk8
3-
4-
# Define the services to use
53
services:
6-
- docker
7-
4+
- docker
85
before_install:
9-
- sudo service mysql stop
10-
- docker pull takimatraining/devops-training-db
11-
- docker run -d -p 127.0.0.1:3306:3306 takimatraining/devops-training-db
12-
13-
# Run Unit Test and Integration Tests
6+
- openssl aes-256-cbc -K $encrypted_f575727d0541_key -iv $encrypted_f575727d0541_iv
7+
-in travis_deploy_rsa.enc -out /tmp/travis_deploy_rsa -d
8+
- chmod 600 /tmp/travis_deploy_rsa
9+
- eval "$(ssh-agent -s)"
10+
- ssh-add /tmp/travis_deploy_rsa
11+
- echo -e "Host $SERVER_HOST\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
12+
- sudo service mysql stop
13+
- docker pull takimatraining/devops-training-db
14+
- docker run -d -p 127.0.0.1:3306:3306 takimatraining/devops-training-db
1415
script:
15-
- mvn verify
16+
- |
17+
mvn clean install sonar:sonar \
18+
-Dsonar.projectKey=<SONAR_PROJECT_KEY> \
19+
-Dsonar.organization=<SONAR_ORGANISATION_KEY> \
20+
-Dsonar.host.url=https://sonarcloud.io \
21+
-Dsonar.login=$SONAR_TOKEN
22+
23+
# Deploy updated container over ssh
24+
deploy:
25+
provider: script
26+
script: ssh -i /tmp/travis_deploy_rsa $DEPLOY_USER@$SERVER_HOST "sudo docker pull $IMAGE_NAME:$TAG && sudo docker rm -f app || true && sudo docker run -d --network net -p 80:8080 --name app $IMAGE_NAME:$TAG"
27+
on:
28+
branch: master
1629

17-
# Cache the .m2 folder to prevent redownloading dependencies on each build
1830
cache:
1931
directories:
2032
- "$HOME/.m2/repository"
21-
22-
# Environment variables are strings (double quotes)
23-
# Example:
24-
# - secure: "DpR1th9rZvLMX0......"
2533
env:
2634
global:
27-
- secure: <ENCRYPTED_TOKEN>
28-
29-
# The pipe (|) is useful to create multiline scripts
30-
script:
31-
- |
32-
mvn clean install sonar:sonar \
33-
-Dsonar.projectKey=<SONAR_PROJECT_KEY> \
34-
-Dsonar.organization=<SONAR_ORGANISATION_KEY> \
35-
-Dsonar.host.url=https://sonarcloud.io \
36-
-Dsonar.login=$SONAR_TOKEN
37-
38-
# Send an email to the commiter if the pipeline failed at some point
35+
- secure: "<ENCRYPTED_TOKEN>"
3936
notifications:
4037
email:
4138
on_failure: always

travis_deploy_rsa.enc

3.17 KB
Binary file not shown.

0 commit comments

Comments
 (0)