forked from ari-apc-lab/croupier
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
102 lines (95 loc) · 3.09 KB
/
.gitlab-ci.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
stages:
- test
- package
- deploy
# Change pip's cache directory to be inside the project directory since we can
# only cache local items.
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
# Pip's cache doesn't store the python packages
# https://pip.pypa.io/en/stable/reference/pip_install/#caching
#
# If you want to also cache the installed packages, you have to install
# them in a virtualenv and cache it as well.
cache:
paths:
- .cache/pip
- /var/cache/yum
flake8_linter:
stage: test
image: python:2.7
script:
- pip install tox
- tox -e flake8
unittests:
stage: test
image: python:2.7
script:
- pip install tox
- tox -e py27
package:
stage: package
image: centos:7
script:
- yum install -y -q zip
- DIR=${PWD##*/} && cd .. && zip -r $DIR/croupier_plugin.zip $DIR -x $DIR/.\* && cd $DIR
- yum install -y -q epel-release
- yum install -y -q python python-pip
- pip install -q wagon==0.6.1
- wagon create croupier_plugin.zip -a '--no-cache-dir -c constraints.txt'
- PLUGIN_NAME=$(echo *.wgn | awk -F- '{print $1}')
- PLUGIN_VERSION=$(echo *.wgn | awk -F- '{print $2}')
artifacts:
name: $PLUGIN_NAME-$PLUGIN_VERSION
paths:
- "*.wgn"
expire_in: 1 hour
only:
- master
- production
deploy:staging:
stage: deploy
image: centos:7
dependencies:
- package
script:
- yum install -y -q epel-release
- yum install -y -q python python-pip
- curl -L -O http://repository.cloudifysource.org/cloudify/18.10.4/community-release/cloudify-cli-community-18.10.4.rpm
- rpm -i cloudify-cli-community-18.10.4.rpm
- cfy profile use $ORCHESTRATOR_HOST -t default_tenant -u $ORCHESTRATOR_ADMIN_USER -p $ORCHESTRATOR_ADMIN_PASSWD
- PLUGIN_NAME=$(echo *.wgn | awk -F- '{print $1}')
- PLUGIN_VERSION=$(echo *.wgn | awk -F- '{print $2}')
- EXISTS=$(cfy plugins list | grep -E "$PLUGIN_NAME( )*\|( )*$PLUGIN_VERSION")
- if [ ! -z "$EXISTS" ]; then PLUGIN_ID=$(echo $EXISTS | awk -F'| ' '{print $2}'); cfy plugins delete $PLUGIN_ID; fi
- cfy plugins upload *.wgn -y plugin.yaml -t default_tenant
environment:
name: staging
url: http://portal.croupier.com
only:
- master
deploy:production:
stage: deploy
image: centos:7
dependencies:
- package
script:
- yum install -y -q epel-release
- yum install -y -q python python-pip
- curl -L -O http://repository.cloudifysource.org/cloudify/18.10.4/community-release/cloudify-cli-community-18.10.4.rpm
- rpm -i cloudify-cli-community-18.10.4.rpm
- cfy profile use $ORCHESTRATOR_HOST -t default_tenant -u $ORCHESTRATOR_ADMIN_USER -p $ORCHESTRATOR_ADMIN_PASSWD
- PLUGIN_NAME=$(echo *.wgn | awk -F- '{print $1}')
- PLUGIN_VERSION=$(echo *.wgn | awk -F- '{print $2}')
- EXISTS=$(cfy plugins list | grep -E "$PLUGIN_NAME( )*\|( )*$PLUGIN_VERSION")
- if [ ! -z "$EXISTS" ]; then PLUGIN_ID=$(echo $EXISTS | awk -F'| ' '{print $2}'); cfy plugins delete $PLUGIN_ID; fi
- cfy plugins upload *.wgn -y plugin.yaml -t default_tenant
environment:
name: production
url: http://portal.croupier.com
artifacts:
name: CI_COMMIT_REF_NAME
paths:
- "*.wgn"
only:
- tags