-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
76 lines (67 loc) · 1.54 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
variables:
#variavle configured on GITLAB
ACCESS_KEY: $ACCESS_KEY
SECRET_KEY: $SECRET_KEY
VERSION: $VERSION
REGION: $REGION
JAR_NAME: "infnet-devops-project-0.0.1-SNAPSHOT.jar"
stages:
- build
- test
- sonar
- deploy
- notification
build-job:
stage: build
script:
- echo "Compiling the code..."
- echo "Compile complete."
- gradle clean
- gradle build
artifacts:
paths:
- build/libs/
unit-test-job:
stage: test
script:
- echo "Running unit tests... This will take about 60 seconds."
- gradle test
- echo "Code coverage is 90%"
artifacts:
paths:
- build/libs
dependencies:
- build-job
#Simulating code quality
sonarlint-test-job:
stage: sonar
script:
- echo "Linting code... This will take about 10 seconds."
- echo "No lint issues found."
deploy-job:
stage: deploy
script:
- echo "Deploying application to S3"
- echo "Verifing if the File Exist
- ls build/libs
#deploy to artfactory nexus, jfrog
- echo "AWS CONNECT"
- ls
- sh ./configure_aws.sh $ACCESS_KEY $SECRET_KEY $REGION
- aws s3 cp build/libs/$JAR_NAME s3://infnet-devops-s3-bucket/
- echo "Application successfully deployed."
dependencies:
- sonarlint-test-job
sucess-notification:
stage: notification
when: on_success
script:
- echo "Sucess"
- sh send_notfication.sh
#send message to e-mail
failure-notification:
stage: notification
when: on_failure
script:
- echo "error"
#GITLAB was configured to send notification on pipeline failure