forked from DevOpsManiac/CorpSite
-
Notifications
You must be signed in to change notification settings - Fork 1
/
codefresh_devops_draft.yml
107 lines (98 loc) · 3.5 KB
/
codefresh_devops_draft.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
version: '1.0'
stages:
- clone
- build
- test
- push
- deploy
# {
# "toolId": "${{sn_devops_toolId}}",
# "buildNumber": "${CF_BUILD_ID}",
# "nativeId": "HILR/Prod #${CF_BUILD_ID}",
# "name": "HILR/Prod",
# "id": "HILR/Prod #${CF_BUILD_ID}",
# "url": "https://dev.azure.com/lenn/CorpSite-ADO/_build/results?buildId=100#Prod/",
# "isMultiBranch": "false",
# "orchestrationTaskUrl": "https://dev.azure.com/lenn/CorpSite-ADO/_build?name=HILR#Prod",
# "orchestrationTaskName": "CorpSite-ADO/HILR#Prod",
# "upstreamTaskUrl": "https://dev.azure.com/lenn/CorpSite-ADO/_build/results?buildId=100#UAT/",
# "upstreamId": "CorpSite-ADO/HILR#UAT",
# "result": "building",
# "startDateTime": "2020-03-20 22:59:27"
# }
# {
# "toolId": "${{sn_devops_toolId}}",
# "buildNumber": "${CF_BUILD_ID}",
# "nativeId": "${{CF_PIPELINE_NAME}} #${CF_BUILD_ID}",
# "name": "${{CF_PIPELINE_NAME}}",
# "id": "${{CF_PIPELINE_NAME}} #${CF_BUILD_ID}",
# "url": "${{CF_PIPELINE_NAME}}",
# "isMultiBranch": "true",
# "orchestrationTaskUrl": "${{CF_BUILD_URL}}?step=sn_stage_start",
# "orchestrationTaskName": "${{CF_PIPELINE_NAME}}#sn_stage_start",
# }
steps:
sn_stage_start:
title: "SN DevOps start clone"
image: curlimages/curl
stage: clone
commands:
- |
echo "CF_BUILD_URL: ${CF_BUILD_URL}"
echo "CF_BUILD_ID: ${CF_BUILD_ID}"
echo "CF_STEP: ${CF_STEP_NAME}"
echo "-------------"
env | grep -i clone || true
env | grep -i stage || true
curl -X POST --header "Content-Type: application/json" --data '{"toolId":"${{sn_devops_toolId}}","buildNumber":"${CF_BUILD_ID}","nativeId":"${{CF_PIPELINE_NAME}} #${CF_BUILD_ID}","name":"${{CF_PIPELINE_NAME}}","id":"${{CF_PIPELINE_NAME}} #${CF_BUILD_ID}","url":"${{CF_PIPELINE_NAME}}","isMultiBranch":"true","orchestrationTaskUrl":"${{CF_BUILD_URL}}?step=sn_stage_start","orchestrationTaskName":"${{CF_PIPELINE_NAME}}#sn_stage_start"}' \
"https://${{sn_devops_user}}:${{sn_devops_password}}@${{sn_devops_url}}/api/sn_devops/devops/orchestration/changeControl?toolId=${sn_devops_toolId}"
clone:
title: Cloning repository
type: git-clone
repo: 'https://github.com/lrochette/CorpSite'
revision: master
stage: clone
build_application:
title: "Building Globex website"
image: maven:3.3-jdk-8
working_directory: "${{clone}}"
tag: "${{CF_BRANCH_TAG_NORMALIZED}}"
commands:
- mvn -Dmaven.repo.local=/codefresh/volume/m2_repository package
stage: "build"
test:
title: "Running test"
type: "freestyle" # Run any command
image: maven:3.3-jdk-8
working_directory: "${{clone}}"
commands:
- mvn -Dmaven.repo.local=/codefresh/volume/m2_repository test
stage: "test"
build_image:
title: "Building tomcat container"
type: "build"
image_name: "lrochette/globex"
working_directory: "${{clone}}"
tag: "${{CF_BRANCH_TAG_NORMALIZED}}"
dockerfile: "Dockerfile"
disable_push: true
stage: "build"
push:
type: push
title: "Pushing globex image"
candidate: ${{build_image}}
image_name: "lrochette/globex"
tag: "${{CF_BRANCH_TAG_NORMALIZED}}"
registry: docker-lr
stage: "push"
DeployToMyCluster:
title: deploying to cluster
type: deploy
stage: deploy
kind: kubernetes
cluster: [email protected]@onpremlr.us-east-1.eksctl.io
namespace: default
service: globex
candidate:
image: lrochette/globex:${{CF_BRANCH_TAG_NORMALIZED}}
registry: docker-lr