You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

422 lines
10 KiB

8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
  1. stages:
  2. - unit-tests
  3. - deploy-gce-part1
  4. - deploy-gce-part2
  5. - deploy-gce-special
  6. variables:
  7. FAILFASTCI_NAMESPACE: 'kargo-ci'
  8. # DOCKER_HOST: tcp://localhost:2375
  9. ANSIBLE_FORCE_COLOR: "true"
  10. # asia-east1-a
  11. # asia-northeast1-a
  12. # europe-west1-b
  13. # us-central1-a
  14. # us-east1-b
  15. # us-west1-a
  16. before_script:
  17. - pip install ansible
  18. - pip install netaddr
  19. - pip install apache-libcloud==0.20.1
  20. - pip install boto==2.9.0
  21. - mkdir -p /.ssh
  22. - cp tests/ansible.cfg .
  23. .job: &job
  24. tags:
  25. - kubernetes
  26. - docker
  27. image: quay.io/ant31/kargo:master
  28. .docker_service: &docker_service
  29. services:
  30. - docker:dind
  31. .create_cluster: &create_cluster
  32. <<: *job
  33. <<: *docker_service
  34. .gce_variables: &gce_variables
  35. GCE_USER: travis
  36. SSH_USER: $GCE_USER
  37. TEST_ID: "$CI_PIPELINE_ID-$CI_BUILD_ID"
  38. CONTAINER_ENGINE: docker
  39. PRIVATE_KEY: $GCE_PRIVATE_KEY
  40. GS_ACCESS_KEY_ID: $GS_KEY
  41. GS_SECRET_ACCESS_KEY: $GS_SECRET
  42. ANSIBLE_KEEP_REMOTE_FILES: "1"
  43. BOOTSTRAP_OS: none
  44. LOG_LEVEL: "-vv"
  45. .gce: &gce
  46. <<: *job
  47. <<: *docker_service
  48. cache:
  49. key: "$CI_BUILD_REF_NAME"
  50. paths:
  51. - downloads/
  52. - $HOME/.cache
  53. stage: deploy-gce
  54. before_script:
  55. - docker info
  56. - pip install ansible==2.1.3.0
  57. - pip install netaddr
  58. - pip install apache-libcloud==0.20.1
  59. - pip install boto==2.9.0
  60. - mkdir -p /.ssh
  61. - cp tests/ansible.cfg .
  62. - mkdir -p $HOME/.ssh
  63. - echo $PRIVATE_KEY | base64 -d > $HOME/.ssh/id_rsa
  64. - echo $GCE_PEM_FILE | base64 -d > $HOME/.ssh/gce
  65. - echo $GCE_CREDENTIALS > $HOME/.ssh/gce.json
  66. - chmod 400 $HOME/.ssh/id_rsa
  67. - ansible-playbook --version
  68. - cp tests/ansible.cfg .
  69. - export PYPATH=$([ $BOOTSTRAP_OS = none ] && echo /usr/bin/python || echo /opt/bin/python)
  70. script:
  71. - pwd
  72. - ls
  73. - echo ${PWD}
  74. - >
  75. ansible-playbook tests/cloud_playbooks/create-gce.yml -i tests/local_inventory/hosts.cfg -c local $LOG_LEVEL
  76. -e mode=${CLUSTER_MODE}
  77. -e test_id=${TEST_ID}
  78. -e kube_network_plugin=${KUBE_NETWORK_PLUGIN}
  79. -e gce_project_id=${GCE_PROJECT_ID}
  80. -e gce_service_account_email=${GCE_ACCOUNT}
  81. -e gce_credentials_file=${HOME}/.ssh/gce.json
  82. -e cloud_image=${CLOUD_IMAGE}
  83. -e inventory_path=${PWD}/inventory/inventory.ini
  84. -e cloud_region=${CLOUD_REGION}
  85. # Create cluster
  86. - >
  87. ansible-playbook -i inventory/inventory.ini -u $SSH_USER -e ansible_ssh_user=$SSH_USER $SSH_ARGS
  88. -b --become-user=root -e cloud_provider=gce $LOG_LEVEL -e kube_network_plugin=${KUBE_NETWORK_PLUGIN}
  89. --private-key=${HOME}/.ssh/id_rsa
  90. -e bootstrap_os=${BOOTSTRAP_OS}
  91. -e ansible_python_interpreter=${PYPATH}
  92. -e download_run_once=true
  93. -e download_localhost=true
  94. -e deploy_netchecker=true
  95. -e local_release_dir=${PWD}/downloads
  96. cluster.yml
  97. # Tests Cases
  98. ## Test Master API
  99. - ansible-playbook -i inventory/inventory.ini -e ansible_python_interpreter=${PYPATH} -u $SSH_USER -e ansible_ssh_user=$SSH_USER $SSH_ARGS -b --become-user=root tests/testcases/010_check-apiserver.yml $LOG_LEVEL
  100. ## Ping the between 2 pod
  101. - ansible-playbook -i inventory/inventory.ini -e ansible_python_interpreter=${PYPATH} -u $SSH_USER -e ansible_ssh_user=$SSH_USER $SSH_ARGS -b --become-user=root tests/testcases/030_check-network.yml $LOG_LEVEL
  102. ## Advanced DNS checks
  103. - ansible-playbook -i inventory/inventory.ini -e ansible_python_interpreter=${PYPATH} -u $SSH_USER -e ansible_ssh_user=$SSH_USER $SSH_ARGS -b --become-user=root tests/testcases/040_check-network-adv.yml $LOG_LEVEL
  104. after_script:
  105. - >
  106. ansible-playbook -i inventory/inventory.ini tests/cloud_playbooks/delete-gce.yml -c local $LOG_LEVEL
  107. -e mode=${CLUSTER_MODE}
  108. -e test_id=${TEST_ID}
  109. -e kube_network_plugin=${KUBE_NETWORK_PLUGIN}
  110. -e gce_project_id=${GCE_PROJECT_ID}
  111. -e gce_service_account_email=${GCE_ACCOUNT}
  112. -e gce_credentials_file=${HOME}/.ssh/gce.json
  113. -e cloud_image=${CLOUD_IMAGE}
  114. -e inventory_path=${PWD}/inventory/inventory.ini
  115. -e cloud_region=${CLOUD_REGION}
  116. # Test matrix. Leave the comments for markup scripts.
  117. .coreos_calico_sep_variables: &coreos_calico_sep_variables
  118. # stage: deploy-gce-part1
  119. KUBE_NETWORK_PLUGIN: calico
  120. CLOUD_IMAGE: coreos-stable
  121. CLOUD_REGION: us-west1-b
  122. CLUSTER_MODE: separated
  123. BOOTSTRAP_OS: coreos
  124. .debian8_canal_ha_variables: &debian8_canal_ha_variables
  125. # stage: deploy-gce-part1
  126. KUBE_NETWORK_PLUGIN: canal
  127. CLOUD_IMAGE: debian-8-kubespray
  128. CLOUD_REGION: us-east1-b
  129. CLUSTER_MODE: ha
  130. .rhel7_weave_variables: &rhel7_weave_variables
  131. # stage: deploy-gce-part1
  132. KUBE_NETWORK_PLUGIN: weave
  133. CLOUD_IMAGE: rhel-7
  134. CLOUD_REGION: europe-west1-b
  135. CLUSTER_MODE: default
  136. .centos7_flannel_variables: &centos7_flannel_variables
  137. # stage: deploy-gce-part2
  138. KUBE_NETWORK_PLUGIN: flannel
  139. CLOUD_IMAGE: centos-7
  140. CLOUD_REGION: us-west1-a
  141. CLUSTER_MODE: default
  142. .debian8_calico_variables: &debian8_calico_variables
  143. # stage: deploy-gce-part2
  144. KUBE_NETWORK_PLUGIN: calico
  145. CLOUD_IMAGE: debian-8-kubespray
  146. CLOUD_REGION: us-central1-b
  147. CLUSTER_MODE: default
  148. .coreos_canal_variables: &coreos_canal_variables
  149. # stage: deploy-gce-part2
  150. KUBE_NETWORK_PLUGIN: canal
  151. CLOUD_IMAGE: coreos-stable
  152. CLOUD_REGION: us-east1-b
  153. CLUSTER_MODE: default
  154. BOOTSTRAP_OS: coreos
  155. .rhel7_canal_sep_variables: &rhel7_canal_sep_variables
  156. # stage: deploy-gce-special
  157. KUBE_NETWORK_PLUGIN: canal
  158. CLOUD_IMAGE: rhel-7
  159. CLOUD_REGION: us-east1-b
  160. CLUSTER_MODE: separated
  161. .ubuntu_weave_sep_variables: &ubuntu_weave_sep_variables
  162. # stage: deploy-gce-special
  163. KUBE_NETWORK_PLUGIN: weave
  164. CLOUD_IMAGE: ubuntu-1604-xenial
  165. CLOUD_REGION: us-central1-b
  166. CLUSTER_MODE: separated
  167. .centos7_calico_ha_variables: &centos7_calico_ha_variables
  168. # stage: deploy-gce-special
  169. KUBE_NETWORK_PLUGIN: calico
  170. CLOUD_IMAGE: centos-7
  171. CLOUD_REGION: europe-west1-b
  172. CLUSTER_MODE: ha
  173. .coreos_alpha_weave_ha_variables: &coreos_alpha_weave_ha_variables
  174. # stage: deploy-gce-special
  175. KUBE_NETWORK_PLUGIN: weave
  176. CLOUD_IMAGE: coreos-alpha
  177. CLOUD_REGION: us-west1-a
  178. CLUSTER_MODE: ha
  179. BOOTSTRAP_OS: coreos
  180. # Builds for PRs only (auto) and triggers (auto)
  181. coreos-calico-sep:
  182. stage: deploy-gce-part1
  183. <<: *job
  184. <<: *gce
  185. variables:
  186. <<: *gce_variables
  187. <<: *coreos_calico_sep_variables
  188. when: on_success
  189. except: ['triggers']
  190. only: [/^pr-.*$/]
  191. coreos-calico-sep-triggers:
  192. stage: deploy-gce-part1
  193. <<: *job
  194. <<: *gce
  195. variables:
  196. <<: *gce_variables
  197. <<: *coreos_calico_sep_variables
  198. when: on_success
  199. only: ['triggers']
  200. centos7-flannel:
  201. stage: deploy-gce-part2
  202. <<: *job
  203. <<: *gce
  204. variables:
  205. <<: *gce_variables
  206. <<: *centos7_flannel_variables
  207. when: on_success
  208. except: ['triggers']
  209. only: [/^pr-.*$/]
  210. centos7-flannel-triggers:
  211. stage: deploy-gce-part1
  212. <<: *job
  213. <<: *gce
  214. variables:
  215. <<: *gce_variables
  216. <<: *centos7_flannel_variables
  217. when: on_success
  218. only: ['triggers']
  219. ubuntu-weave-sep:
  220. stage: deploy-gce-special
  221. <<: *job
  222. <<: *gce
  223. variables:
  224. <<: *gce_variables
  225. <<: *ubuntu_weave_sep_variables
  226. when: on_success
  227. except: ['triggers']
  228. only: [/^pr-.*$/]
  229. ubuntu-weave-sep-triggers:
  230. stage: deploy-gce-part1
  231. <<: *job
  232. <<: *gce
  233. variables:
  234. <<: *gce_variables
  235. <<: *ubuntu_weave_sep_variables
  236. when: on_success
  237. only: ['triggers']
  238. # More builds for PRs/merges (manual) and triggers (auto)
  239. debian8-canal-ha:
  240. stage: deploy-gce-part1
  241. <<: *job
  242. <<: *gce
  243. variables:
  244. <<: *gce_variables
  245. <<: *debian8_canal_ha_variables
  246. when: manual
  247. except: ['triggers']
  248. only: ['master', /^pr-.*$/]
  249. debian8-canal-ha-triggers:
  250. stage: deploy-gce-part1
  251. <<: *job
  252. <<: *gce
  253. variables:
  254. <<: *gce_variables
  255. <<: *debian8_canal_ha_variables
  256. when: on_success
  257. only: ['triggers']
  258. rhel7-weave:
  259. stage: deploy-gce-part1
  260. <<: *job
  261. <<: *gce
  262. variables:
  263. <<: *gce_variables
  264. <<: *rhel7_weave_variables
  265. when: manual
  266. except: ['triggers']
  267. only: ['master', /^pr-.*$/]
  268. rhel7-weave-triggers:
  269. stage: deploy-gce-part1
  270. <<: *job
  271. <<: *gce
  272. variables:
  273. <<: *gce_variables
  274. <<: *rhel7_weave_variables
  275. when: on_success
  276. only: ['triggers']
  277. debian8-calico:
  278. stage: deploy-gce-part2
  279. <<: *job
  280. <<: *gce
  281. variables:
  282. <<: *gce_variables
  283. <<: *debian8_calico_variables
  284. when: manual
  285. except: ['triggers']
  286. only: ['master', /^pr-.*$/]
  287. debian8-calico-triggers:
  288. stage: deploy-gce-part1
  289. <<: *job
  290. <<: *gce
  291. variables:
  292. <<: *gce_variables
  293. <<: *debian8_calico_variables
  294. when: on_success
  295. only: ['triggers']
  296. coreos-canal:
  297. stage: deploy-gce-part2
  298. <<: *job
  299. <<: *gce
  300. variables:
  301. <<: *gce_variables
  302. <<: *coreos_canal_variables
  303. when: manual
  304. except: ['triggers']
  305. only: ['master', /^pr-.*$/]
  306. coreos-canal-triggers:
  307. stage: deploy-gce-part1
  308. <<: *job
  309. <<: *gce
  310. variables:
  311. <<: *gce_variables
  312. <<: *coreos_canal_variables
  313. when: on_success
  314. only: ['triggers']
  315. rhel7-canal-sep:
  316. stage: deploy-gce-special
  317. <<: *job
  318. <<: *gce
  319. variables:
  320. <<: *gce_variables
  321. <<: *rhel7_canal_sep_variables
  322. when: manual
  323. except: ['triggers']
  324. only: ['master', /^pr-.*$/,]
  325. rhel7-canal-sep-triggers:
  326. stage: deploy-gce-part1
  327. <<: *job
  328. <<: *gce
  329. variables:
  330. <<: *gce_variables
  331. <<: *rhel7_canal_sep_variables
  332. when: on_success
  333. only: ['triggers']
  334. centos7-calico-ha:
  335. stage: deploy-gce-special
  336. <<: *job
  337. <<: *gce
  338. variables:
  339. <<: *gce_variables
  340. <<: *centos7_calico_ha_variables
  341. when: manual
  342. except: ['triggers']
  343. only: ['master', /^pr-.*$/]
  344. centos7-calico-ha-triggers:
  345. stage: deploy-gce-part1
  346. <<: *job
  347. <<: *gce
  348. variables:
  349. <<: *gce_variables
  350. <<: *centos7_calico_ha_variables
  351. when: on_success
  352. only: ['triggers']
  353. # no triggers yet https://github.com/kubernetes-incubator/kargo/issues/613
  354. coreos-alpha-weave-ha:
  355. stage: deploy-gce-special
  356. <<: *job
  357. <<: *gce
  358. variables:
  359. <<: *gce_variables
  360. <<: *coreos_alpha_weave_ha_variables
  361. when: manual
  362. except: ['triggers']
  363. only: ['master', /^pr-.*$/]
  364. syntax-check:
  365. <<: *job
  366. stage: unit-tests
  367. script:
  368. - ansible-playbook -i inventory/local-tests.cfg -u root -e ansible_ssh_user=root -b --become-user=root cluster.yml -vvv --syntax-check
  369. except: ['triggers']
  370. tox-inventory-builder:
  371. stage: unit-tests
  372. <<: *job
  373. script:
  374. - pip install tox
  375. - cd contrib/inventory_builder && tox
  376. when: manual
  377. except: ['triggers']