11version : 2
22jobs :
3- build :
4- docker :
5- - image : circleci/ruby:2.6.1-node-browsers
3+ build_test :
4+ resource_class : large
5+ machine :
6+ image : ubuntu-1604:201903-01
7+ environment :
8+ CHANGE_MINIKUBE_NONE_USER : true
9+ GOPATH : /home/circleci/go
10+ KUBECONFIG : /home/circleci/.kube/config
11+ KUBERNETES_VERSION : v1.15.2
12+ MINIKUBE_HOME : /home/circleci
13+ MINIKUBE_VERSION : v1.2.0
14+ MINIKUBE_WANTUPDATENOTIFICATION : false
15+ MINIKUBE_WANTREPORTERRORPROMPT : false
16+ SKAFFOLD_VERSION : v0.33.0
17+ GO111MODULE : " on"
18+ CI_SPLUNK_VERSION : " 7.3.2"
19+ CI_SPLUNK_FILENAME : splunk-7.3.2-c60db69f8e32-linux-2.6-amd64.deb
20+ CI_SPLUNK_HOST : 127.0.0.1
21+ CI_SPLUNK_PORT : 8089
22+ CI_SPLUNK_USERNAME : admin
23+ CI_SPLUNK_HEC_TOKEN : a6b5e77f-d5f6-415a-bd43-930cecb12959
24+ CI_SPLUNK_HEC_TOKEN_PERF : a6b5e77f-d5f6-415a-bd43-930cecb12959
25+ CI_SPLUNK_PASSWORD : helloworld
26+ CI_HEC_PROTOCOL : http
27+ CI_INDEX_EVENTS : circleci_events
28+ CI_INDEX_OBJECTS : circleci_objects
29+ CI_INDEX_METRICS : circleci_metrics
30+ CI_INDEX_NAMESPACE_ROUTING : test-namespace-routing
31+ CI_KAFKA_DATAGEN_IMAGE : chaitanyaphalak/kafkadatagen:1.0-4-gca7f6d8
632 working_directory : ~/repo
733 steps :
834 - checkout
9- - setup_remote_docker :
10- reusable : true
35+ - run :
36+ name : Install Splunk
37+ command : |
38+ cd /tmp && wget -O $CI_SPLUNK_FILENAME 'https://www.splunk.com/bin/splunk/DownloadActivityServlet?architecture=x86_64&platform=linux&version='$CI_SPLUNK_VERSION'&product=splunk&filename='$CI_SPLUNK_FILENAME'&wget=true'
39+ sudo dpkg -i $CI_SPLUNK_FILENAME
40+ # Set user seed
41+ hashed_pwd=$(sudo /opt/splunk/bin/splunk hash-passwd $CI_SPLUNK_PASSWORD)
42+ sudo tee /opt/splunk/etc/system/local/user-seed.conf > /dev/null << EOF
43+ [user_info]
44+ USERNAME = $CI_SPLUNK_USERNAME
45+ HASHED_PASSWORD = $hashed_pwd
46+ EOF
47+ # Add delete capability to admin role
48+ sudo tee -a /opt/splunk/etc/system/local/authorize.conf > /dev/null << EOF
49+ [role_admin]
50+ delete_by_keyword = enabled
51+ EOF
52+ # start Splunk
53+ sudo /opt/splunk/bin/splunk start --accept-license --answer-yes --no-prompt
54+ # Enable HEC services
55+ curl -X POST -u $CI_SPLUNK_USERNAME:$CI_SPLUNK_PASSWORD -k https://$CI_SPLUNK_HOST:$CI_SPLUNK_PORT/servicesNS/nobody/splunk_httpinput/data/inputs/http/http/enable
56+ # Create new HEC token
57+ curl -X POST -u $CI_SPLUNK_USERNAME:$CI_SPLUNK_PASSWORD -k -d "name=splunk_hec_token&token=$CI_SPLUNK_HEC_TOKEN" https://$CI_SPLUNK_HOST:$CI_SPLUNK_PORT/servicesNS/nobody/splunk_httpinput/data/inputs/http
58+ # Enable HEC new-token
59+ sudo /opt/splunk/bin/splunk http-event-collector enable -name splunk_hec_token -uri https://$CI_SPLUNK_HOST:$CI_SPLUNK_PORT -auth $CI_SPLUNK_USERNAME:$CI_SPLUNK_PASSWORD
60+ # Disable SSL for HEC new-token
61+ sudo /opt/splunk/bin/splunk http-event-collector update -uri https://$CI_SPLUNK_HOST:$CI_SPLUNK_PORT -enable-ssl 0 -auth $CI_SPLUNK_USERNAME:$CI_SPLUNK_PASSWORD
62+ # Setup Indexes
63+ sudo /opt/splunk/bin/splunk add index $CI_INDEX_EVENTS -auth $CI_SPLUNK_USERNAME:$CI_SPLUNK_PASSWORD
64+ sudo /opt/splunk/bin/splunk add index $CI_INDEX_OBJECTS -auth $CI_SPLUNK_USERNAME:$CI_SPLUNK_PASSWORD
65+ sudo /opt/splunk/bin/splunk add index $CI_INDEX_METRICS -datatype metric -auth $CI_SPLUNK_USERNAME:$CI_SPLUNK_PASSWORD
66+ sudo /opt/splunk/bin/splunk add index kube-system -auth $CI_SPLUNK_USERNAME:$CI_SPLUNK_PASSWORD
67+ sudo /opt/splunk/bin/splunk add index kube-public -auth $CI_SPLUNK_USERNAME:$CI_SPLUNK_PASSWORD
68+ sudo /opt/splunk/bin/splunk add index $CI_INDEX_NAMESPACE_ROUTING -auth $CI_SPLUNK_USERNAME:$CI_SPLUNK_PASSWORD
69+ sudo /opt/splunk/bin/splunk http-event-collector update -uri https://$CI_SPLUNK_HOST:$CI_SPLUNK_PORT -name splunk_hec_token -auth $CI_SPLUNK_USERNAME:$CI_SPLUNK_PASSWORD -index $CI_INDEX_EVENTS -indexes $CI_INDEX_METRICS,$CI_INDEX_OBJECTS,$CI_INDEX_EVENTS,$CI_INDEX_NAMESPACE_ROUTING,kube-system,kube-public
70+ # Restart Splunk
71+ sudo /opt/splunk/bin/splunk restart --accept-license --answer-yes --no-prompt
72+ - run :
73+ name : Install and Start minikube
74+ command : |
75+ # Install Kubectl
76+ curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/${KUBERNETES_VERSION}/bin/linux/amd64/kubectl
77+ chmod +x kubectl
78+ sudo mv kubectl /usr/local/bin/
79+ mkdir -p ${HOME}/.kube
80+ touch ${HOME}/.kube/config
81+ # Install Minikube
82+ curl -Lo minikube https://storage.googleapis.com/minikube/releases/${MINIKUBE_VERSION}/minikube-linux-amd64
83+ chmod +x minikube
84+ sudo mv minikube /usr/local/bin/
85+ # Start Minikube and Wait
86+ sudo -E minikube start --vm-driver=none --cpus 2 --memory 4098 --kubernetes-version=${KUBERNETES_VERSION}
87+ export JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'
88+ until kubectl get nodes -o jsonpath="$JSONPATH" 2>&1 | grep -q "Ready=True"; do
89+ sleep 1;
90+ done
1191 - run :
1292 name : Install dependencies
1393 command : |
@@ -17,32 +97,36 @@ jobs:
1797 sudo apt-get install -y python-pip libpython-dev > /dev/null 2>&1
1898 curl https://raw.githubusercontent.com/helm/helm/master/scripts/get | bash -s -- --version v2.12.3
1999 helm init -c
20- echo "Installing aws cli..."
21- sudo pip install awscli > /dev/null 2>&1
100+ docker pull $CI_KAFKA_DATAGEN_IMAGE
101+ pyenv global 3.6.5
102+ pip install --upgrade pip
103+ pip install -r test/requirements.txt
22104 - run :
23- name : Update configurables to build artifacts
105+ name : Lint helm charts
24106 command : |
25- .circleci/update_sck_config .sh
107+ .circleci/lint .sh
26108 - run :
27109 name : Build SCK artifacts
28110 command : |
29111 .circleci/build_sck_artifacts.sh
30112 - run :
31- name : Push SCK artifacts to s3
113+ name : Update configurables for unit test
32114 command : |
33- .circleci/push_sck_artifacts.sh
115+ export CI_SPLUNK_HEC_HOST=$(hostname -i)
116+ export CI_SPLUNK_HEC_HOST_PERF=$(hostname -i)
117+ .circleci/update_sck_config.sh
34118 - run :
35119 name : Deploy k8s connector
36120 command : |
37121 .circleci/deploy_connector.sh
38122 - run :
39123 name : Run functional tests
40124 command : |
125+ export CI_SPLUNK_HEC_HOST=$(hostname -i)
126+ pyenv global 3.6.5
127+ export PYTHONWARNINGS="ignore:Unverified HTTPS request"
128+ sleep 30
41129 .circleci/run_functional_tests.sh
42- - run :
43- name : Teardown deployment
44- command : |
45- helm delete --purge ci-$CIRCLE_SHA1
46130
47131 perf-test :
48132 docker :
@@ -93,10 +177,6 @@ jobs:
93177 sudo apt-get install -y python-pip libpython-dev > /dev/null 2>&1
94178 curl https://raw.githubusercontent.com/helm/helm/master/scripts/get | bash
95179 helm init -c
96- - run :
97- name : Update configurables to build artifacts
98- command : |
99- .circleci/update_sck_config_for_release.sh
100180 - run :
101181 name : Build SCK artifacts
102182 command : |
@@ -105,32 +185,52 @@ jobs:
105185 name : Push SCK artifacts to Github Release
106186 command : |
107187 .circleci/push_sck_release.sh
188+
189+ check_version :
190+ docker :
191+ - image : circleci/ruby:2.6.1-node-browsers
192+ working_directory : ~/repo
193+ steps :
194+ - attach_workspace :
195+ at : /tmp
196+ - checkout
197+ - setup_remote_docker :
198+ reusable : true
108199 - run :
109- name : Deploy k8s connector
110- command : |
111- .circleci/deploy_connector_release.sh
112- - run :
113- name : Run functional tests
200+ name : Check VERSION file for change
114201 command : |
115- .circleci/run_functional_tests.sh
116-
117- # Need to add teardown step
202+ .circleci/check_version_trigger_release.sh
118203
119204workflows :
120205 version : 2
121- build_perf-test :
206+ build_test :
122207 jobs :
123- - build :
208+ - build_test :
124209 filters :
125210 branches :
126- ignore : perf-testing
211+ ignore :
212+ - perf-testing
213+ - /^release\/.*/
214+ - master
215+ - check_version :
216+ requires :
217+ - build_test
218+ filters :
219+ branches :
220+ only : develop
221+ perf-test :
222+ jobs :
127223 - perf-test :
128224 filters :
129225 branches :
130226 only : perf-testing
131- - release :
132- requires :
133- - build
227+ release :
228+ jobs :
229+ - build_test :
134230 filters :
135231 branches :
136- only : release-testing
232+ only :
233+ - master
234+ - release :
235+ requires :
236+ - build_test
0 commit comments