blob: 6faf483d61639a1d9cbdd19fd2a4c994121c568e [file] [log] [blame]
Petr Michalec6754a0c2017-03-01 11:51:13 +01001dist: trusty
2sudo: required
3
4addons:
5 apt:
6 sources:
7 - sourceline: 'deb http://apt.tcpcloud.eu/nightly trusty tcp tcp-salt'
8 - key_url: 'http://apt.tcpcloud.eu/public.gpg'
9 packages:
10 - curl
11 - subversion
12 - git
13 - salt-master
14 - salt-minion
15 - reclass
16 - python-pip
17 - tree
18
19
20#git:
21# submodules: false
22#
23before_install:
24 - sudo pip install cookiecutter
25# - test ! -e .gitmodules || sed -i 's,https://\([.a-z0-9_-]*\)/\(.*\),git@\1:\2,' .gitmodules
26# - test ! -e .gitmodules || git submodule update --init --recursive --remote
27
28env:
29 global:
30 - ENV_DOMAIN=ci.local
31 matrix:
32 - CLUSTER_NAME=openstack_mk_contrail
Petr Michalecb5138642017-03-02 18:01:59 +010033 - CLUSTER_NAME=openstack_mk_ovs
34 - CLUSTER_NAME=kubernetes_mk
Petr Michalec6754a0c2017-03-01 11:51:13 +010035
36install:
37 - export RECLASS_SYSTEM=file://$PWD
38 - mkdir ../$CLUSTER_NAME; cd ../$CLUSTER_NAME
39 - export RECLASS_REPO_PATH=$PWD
40 - export RECLASS_REPOSITORY=file://$RECLASS_REPO_PATH
41 - git clone git@github.com:Mirantis/mk2x-cookiecutter-reclass-model.git ../cookiecutter_models; cd ../cookiecutter_models
42 - export COOKIECUTTER_BASE=$PWD
43 - export ENV_DOMAIN=ci.local
44 - COOKIECUTTER_JSON=$COOKIECUTTER_BASE/cluster/$CLUSTER_NAME/cookiecutter.json
45 #- export ENV_DOMAIN=${CLUSTER_NAME//_/-}.$ENV_DOMAIN
46 - export MASTER_HOSTNAME=cfg01.$ENV_DOMAIN
47 - cd $RECLASS_REPO_PATH
48 - git init .
49# CI WORKAROUNDS
50 - export FORMULAS_SOURCE=pkg
51 - sed -i "s/deployment_name/$CLUSTER_NAME/g" $COOKIECUTTER_JSON
52 - sed -i "s/deploy-name.local/$ENV_DOMAIN/g" $COOKIECUTTER_JSON
53 - sed -i 's%.*reclass_repository.*%"reclass_repository":"'$RECLASS_REPOSITORY'",%g' $COOKIECUTTER_JSON
54 - cookiecutter $COOKIECUTTER_BASE/cluster/$CLUSTER_NAME --output-dir ./classes/cluster --no-input
55 - git add ./*
56 - git commit -am "Init, add cluster level"
57 - git submodule add $RECLASS_SYSTEM ./classes/system
58 - |
59 mkdir -p nodes;
60 git branch -a
61 tree -lL 3
62 cat <<-EOF > nodes/cfg01.$ENV_DOMAIN.yml
63 classes:
64 - cluster.$CLUSTER_NAME.infra.config
65 parameters:
66 _param:
67 linux_system_codename: trusty
68 reclass_data_revision: master
69 linux:
70 system:
71 name: cfg01
72 domain: $ENV_DOMAIN
73 # #######################
74
75 - git add ./*
76 - git commit -am "Add system level and salt-master node"
77# CI WORKAROUNDS
78 - export RECLASS_BRANCH=master
79 #- sed -ie "s#\(reclass_data_revision.\).*#\1 $RECLASS_BRANCH#" $(find nodes -name ${MASTER_HOSTNAME}.yml|tail -n1)
80 #- git commit -am "Fake branch update" || true
81# PREREQUSITES
82 - sudo mkdir /srv/salt; sudo cp -a $PWD /srv/salt/reclass
83 - sudo svn export --force https://github.com/salt-formulas/salt-formulas/trunk/deploy/scripts /srv/salt/scripts
84
85script:
86 - cd /srv/salt/scripts
87 - sudo ./salt-master-init.sh || exit 1
88
89after_failure:
90 - tree -lL 3 $RECLASS_REPO_PATH
91 - for i in ls -lta "/tmp/*verify*"; do echo -e "\n\n$i:";tail -n20 $i; done