forked from CloudSlang/cs-content
-
Notifications
You must be signed in to change notification settings - Fork 0
/
circle.yml
128 lines (120 loc) · 5.83 KB
/
circle.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# (c) Copyright 2014-2016 Hewlett-Packard Enterprise Development Company, L.P.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License v2.0 which accompany this distribution.
#
# The Apache License is available at
# http://www.apache.org/licenses/LICENSE-2.0
#
########################################################################################################################
# ENV VARS SET IN CIRCLE UI:
# - BUILD_MODE: set to a value - e.g. CHANGES_ONLY to activate (this is POC mode)
# - DO_API_TOKEN
# - DO_DROPLET_SSH_PRIVATE_KEY
# - DO_DROPLET_SSH_PUBLIC_KEY_ID
# - DO_REGION
general:
artifacts:
- "./cslang-builder/logs/builder.log"
machine:
environment:
# "${CIRCLE_PR_NUMBER}" = "" denotes that the build is not part of a fork PR
# ignore test suites on node 1 in fork builds
ACTIVE_CI_TEST_SUITES_DROPLETS_NODE_1: $(if [ "${CIRCLE_PR_NUMBER}" = "" ]; then echo '!default,coreos,cadvisor,docker-circleci'; else echo '!default'; fi)
ACTIVE_CI_TEST_SUITES_DROPLETS_NODE_2: $(if [ "${CIRCLE_PR_NUMBER}" = "" ]; then echo '!default,swarm'; else echo '!default'; fi)
COREOS_MACHINE_NAMES_1: "ci-${CIRCLE_BUILD_NUM}-coreos-1 ci-${CIRCLE_BUILD_NUM}-coreos-2 ci-${CIRCLE_BUILD_NUM}-coreos-3"
COREOS_MACHINE_NAMES_2: "ci-${CIRCLE_BUILD_NUM}-coreos-4 ci-${CIRCLE_BUILD_NUM}-coreos-5 ci-${CIRCLE_BUILD_NUM}-coreos-6"
RULE_DROPLET_MACHINE_NOT_FORK_1: '[ "${CIRCLE_PR_NUMBER}" = "" ] && [ "${CIRCLE_NODE_INDEX}" = "1" ]'
RULE_DROPLET_MACHINE_NOT_FORK_2: '[ "${CIRCLE_PR_NUMBER}" = "" ] && [ "${CIRCLE_NODE_INDEX}" = "2" ]'
CLOUD_CONFIG_FILE: 'ci-env/circleci/cloud-config.yaml'
DROPLETS_FILE_1: "droplets_${CIRCLE_BUILD_NUM}_1.txt"
DROPLETS_FILE_2: "droplets_${CIRCLE_BUILD_NUM}_2.txt"
COREOS_PLACEHOLDERS_1: '<coreos_host_1> <coreos_host_2> <coreos_host_3>'
COREOS_PLACEHOLDERS_2: '<coreos_host_4> <coreos_host_5> <coreos_host_6>'
CHANGES_ONLY_BUILD_MODE: '[ "${CIRCLE_BRANCH}" != "master" ] && [ -n $BUILD_MODE ]'
JAVA_OPTS: -Xms400m -Xmx2g -XX:PermSize=128m -XX:MaxPermSize=256m
pre:
- sudo curl -L -o /usr/bin/docker 'http://s3-external-1.amazonaws.com/circle-downloads/docker-1.8.2-circleci'; sudo chmod 0755 /usr/bin/docker; true
services:
- docker
dependencies:
override:
- echo ${CIRCLE_BRANCH}
- echo ${BUILD_MODE}
- ? >
if eval "${CHANGES_ONLY_BUILD_MODE}";
then echo 'Build mode: CHANGES_ONLY'
&& chmod +x ci-env/circleci/setup_changes_only_mode.sh
&& ci-env/circleci/setup_changes_only_mode.sh;
else echo 'Build mode: BASIC';
fi
: parallel: true
- docker info
- docker images
- ? > ### machine 1
if eval "${RULE_DROPLET_MACHINE_NOT_FORK_1}";
then chmod +x ci-env/circleci/create_droplets.sh
&& COREOS_MACHINE_NAMES=${COREOS_MACHINE_NAMES_1} DROPLETS_FILE=${DROPLETS_FILE_1}
ci-env/circleci/create_droplets.sh;
fi
: parallel: true
- ? > ### machine 2
if eval "${RULE_DROPLET_MACHINE_NOT_FORK_2}";
then chmod +x ci-env/circleci/create_droplets.sh
&& COREOS_MACHINE_NAMES=${COREOS_MACHINE_NAMES_2} DROPLETS_FILE=${DROPLETS_FILE_2}
ci-env/circleci/create_droplets.sh;
fi
: parallel: true
- ? > ### machine 0
if [ "${CIRCLE_NODE_INDEX}" = "0" ];
then docker run -p 49154:25 -e maildomain=example.com -e smtp_user=user:pwd,otheruser:pwd --name postfix -d catatnight/postfix
&& docker run -d -p 8500:8500 -p 8600:8600/udp gituser173/consul
&& docker run -d -e SWAGGER_HOST=http://localhost -e SWAGGER_BASE_PATH=/v2 -p 3000:8080 swaggerapi/petstore;
fi
: parallel: true
- ? > ### every machine
wget https://github.com/CloudSlang/cloud-slang/releases/download/cloudslang-1.0.2/cslang-builder.zip
&& unzip cslang-builder.zip
&& chmod +x cslang-builder/bin/cslang-builder
&& mkdir cslang-builder/lib/Lib
&& pip install -r python-lib/requirements.txt -t cslang-builder/lib/Lib
: parallel: true
- ? > ### machine 1
if eval "${RULE_DROPLET_MACHINE_NOT_FORK_1}";
then chmod +x ci-env/circleci/wait_for_droplets_and_update_test_inputs.sh
&& DROPLETS_FILE=${DROPLETS_FILE_1} COREOS_PLACEHOLDERS=${COREOS_PLACEHOLDERS_1}
ci-env/circleci/wait_for_droplets_and_update_test_inputs.sh;
fi
: parallel: true
- ? > ### machine 2
if eval "${RULE_DROPLET_MACHINE_NOT_FORK_2}";
then chmod +x ci-env/circleci/wait_for_droplets_and_update_test_inputs.sh
&& DROPLETS_FILE=${DROPLETS_FILE_2} COREOS_PLACEHOLDERS=${COREOS_PLACEHOLDERS_2}
ci-env/circleci/wait_for_droplets_and_update_test_inputs.sh;
fi
: parallel: true
test:
override:
- ? >
if eval "${CHANGES_ONLY_BUILD_MODE}";
then CHANGES_PARAM="--changes-only $(pwd)/changed_items.txt";
else CHANGES_PARAM="";
fi
&& case ${CIRCLE_NODE_INDEX} in
0) ./cslang-builder/bin/cslang-builder -des -rcf $(pwd)/configuration/runconfig/lane_0.properties ${CHANGES_PARAM} ;;
1) ./cslang-builder/bin/cslang-builder -des -rcf $(pwd)/configuration/runconfig/lane_1.properties ${CHANGES_PARAM} ;;
2) ./cslang-builder/bin/cslang-builder -des -rcf $(pwd)/configuration/runconfig/lane_2.properties ${CHANGES_PARAM} ;;
esac
: parallel: true
post:
- ? > ### machine 1
if eval "${RULE_DROPLET_MACHINE_NOT_FORK_1}";
then chmod +x ci-env/circleci/cleanup_env.sh
&& DROPLETS_FILE=${DROPLETS_FILE_1} ci-env/circleci/cleanup_env.sh;
fi
: parallel: true
- ? > ### machine 2
if eval "${RULE_DROPLET_MACHINE_NOT_FORK_2}";
then chmod +x ci-env/circleci/cleanup_env.sh
&& DROPLETS_FILE=${DROPLETS_FILE_2} ci-env/circleci/cleanup_env.sh;
fi
: parallel: true