Skip to content

Commit 7d2b25b

Browse files
EarthmanTearthmant
authored andcommitted
Merge branch 'master' into update-circle
__NODOCS__
2 parents 4428ccf + f06f584 commit 7d2b25b

File tree

9 files changed

+164
-111
lines changed

9 files changed

+164
-111
lines changed

.circleci/config.yml

Lines changed: 62 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ executors:
2727
machine:
2828
image: ubuntu-1604:201903-01
2929

30+
cloudify-machine-510:
31+
machine:
32+
image: ubuntu-1604:201903-01
3033

3134
commands:
3235

@@ -108,16 +111,16 @@ commands:
108111
exit 1
109112
fi
110113
111-
generate_py27_wagon:
114+
generate_py27py36_wagon:
112115
steps:
113116
- run:
114117
name: Create Workspace Build directory.
115118
command: mkdir -p workspace/build
116119
- run:
117-
name: Build py27 Wagon
120+
name: Build py27py36 Wagon
118121
command: |
119122
git clone https://github.com/cloudify-cosmo/cloudify-wagon-build-containers.git
120-
docker build -t cloudify-centos-7-wagon-builder cloudify-wagon-build-containers/centos_7
123+
docker build -t cloudify-centos-7-wagon-builder cloudify-wagon-build-containers/centos_7_py2py3
121124
docker run -v ~/project/:/packaging cloudify-centos-7-wagon-builder
122125
- run:
123126
name: copy wagon to workspace
@@ -127,36 +130,16 @@ commands:
127130
paths:
128131
- build/*
129132

130-
generate_py3_wagon:
133+
generate_rhel_py27py36_wagon:
131134
steps:
132135
- run:
133136
name: Create Workspace Build directory.
134137
command: mkdir -p workspace/build
135138
- run:
136-
name: Build py3 Wagon
139+
name: Build RHEL py27py36 Wagon
137140
command: |
138141
git clone https://github.com/cloudify-cosmo/cloudify-wagon-build-containers.git
139-
docker build -t cloudify-centos-7-py3-wagon-builder cloudify-wagon-build-containers/centos_7_py3
140-
docker run -v ~/project/:/packaging cloudify-centos-7-py3-wagon-builder
141-
- run:
142-
name: copy wagon to workspace
143-
command: cp *.wgn workspace/build/
144-
- persist_to_workspace:
145-
root: workspace
146-
paths:
147-
- build/*
148-
149-
150-
generate_rhel_py27_wagon:
151-
steps:
152-
- run:
153-
name: Create Workspace Build directory.
154-
command: mkdir -p workspace/build
155-
- run:
156-
name: Build RHEL 27 Wagon
157-
command: |
158-
git clone https://github.com/cloudify-cosmo/cloudify-wagon-build-containers.git
159-
docker build -t cloudify-redhat-7-wagon-builder cloudify-wagon-build-containers/redhat_7 --build-arg USERNAME="$USERNAME" --build-arg PASSWORD="$PASSWORD"
142+
docker build -t cloudify-redhat-7-wagon-builder cloudify-wagon-build-containers/redhat_7_py2py3 --build-arg USERNAME="$USERNAME" --build-arg PASSWORD="$PASSWORD"
160143
docker run -v ~/project/:/packaging cloudify-redhat-7-wagon-builder
161144
- run:
162145
name: copy wagon to workspace
@@ -166,7 +149,7 @@ commands:
166149
paths:
167150
- build/*
168151

169-
run_integration_tests:
152+
run_integration_tests_505:
170153
steps:
171154
- run:
172155
name: "Pull Submodules"
@@ -180,7 +163,8 @@ commands:
180163
command: pip install -U pip
181164
- run:
182165
name: install cloudify
183-
command: pip install -U cloudify==5.0.0 pytest==4.6.3 pyyaml==3.10
166+
command: |
167+
pip install -r test-requirements.txt
184168
- run:
185169
name: download manager docker image
186170
command: wget http://repository.cloudifysource.org/cloudify/5.0.5/ga-release/cloudify-docker-manager-5.0.5.tar
@@ -201,6 +185,41 @@ commands:
201185
command: pip install https://github.com/cloudify-incubator/cloudify-ecosystem-test/archive/latest.zip
202186
- run: pytest -s .circleci/test_examples.py
203187

188+
run_integration_tests_510:
189+
steps:
190+
- run:
191+
name: "Pull Submodules"
192+
command: |
193+
git submodule update --init --recursive --remote
194+
- attach_workspace:
195+
at: workspace
196+
- run:
197+
name: update pip
198+
command: pip install -U pip
199+
- run:
200+
name: install cloudify
201+
command: |
202+
pip install -r test-requirements.txt
203+
- run:
204+
name: download manager docker image
205+
command: wget http://repository.cloudifysource.org/cloudify/5.1.0/.dev1-release/cloudify-manager-aio-docker-5.1.0.dev1.tar
206+
- run:
207+
name: load docker image
208+
command: docker load -i cloudify-manager-aio-docker-5.1.0.dev1.tar
209+
- run:
210+
name: retain space by dumping the tar
211+
command: rm cloudify-manager-aio-docker-5.1.0.dev1.tar
212+
- run:
213+
name: show images
214+
command: docker images
215+
- run:
216+
name: start docker container
217+
command: docker run --name cfy_manager -d --restart unless-stopped -v /sys/fs/cgroup:/sys/fs/cgroup:ro --tmpfs /run --tmpfs /run/lock --security-opt seccomp:unconfined --cap-add SYS_ADMIN --network host cloudify-manager-aio:latest
218+
- run:
219+
name: install local project
220+
command: pip install https://github.com/cloudify-incubator/cloudify-ecosystem-test/archive/latest.zip
221+
- run: pytest -s .circleci/test_examples.py
222+
204223
release_plugin:
205224
steps:
206225
- run:
@@ -299,24 +318,32 @@ jobs:
299318
executor: wagon_generator
300319
steps:
301320
- checkout
302-
- generate_py27_wagon
321+
- generate_py27py36_wagon
303322
# - generate_py3_wagon # TODO: When we have Python3 Manager Integration Test.
304323

305324
rhel_wagon:
306325
executor: wagon_generator
307326
steps:
308327
- checkout
309-
- generate_rhel_py27_wagon
310-
328+
- generate_rhel_py27py36_wagon
311329

312-
integration_tests:
330+
integration_tests_505:
313331
executor: cloudify-machine
314332
environment:
315333
CLOUDIFY_SSL_TRUST_ALL: true
316-
IAAS: gcp
334+
IAAS: openstack
317335
steps:
318336
- checkout
319-
- run_integration_tests
337+
- run_integration_tests_505
338+
339+
integration_tests_510:
340+
executor: cloudify-machine-510
341+
environment:
342+
CLOUDIFY_SSL_TRUST_ALL: true
343+
IAAS: openstack
344+
steps:
345+
- checkout
346+
- run_integration_tests_510
320347

321348
release:
322349
executor: py27
@@ -369,6 +396,7 @@ workflows:
369396
# - release
370397
# - validate_documentation
371398

399+
372400
nightly:
373401
triggers:
374402
- schedule:

.circleci/test_examples.py

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,29 @@
2424
cleanup_on_failure, prepare_test
2525
)
2626

27-
OS_VERSION = '3.2.15'
27+
OS_VERSION = '3.2.16'
2828
OS_WAGON = 'https://github.com/cloudify-cosmo/cloudify-openstack-plugin/' \
29-
'releases/download/{v}/cloudify_openstack_plugin-{v}-py27-none-' \
30-
'linux_x86_64-centos-Core.wgn'.format(v=OS_VERSION)
31-
OS_PLUGIN = 'https://github.com/cloudify-cosmo/' \
32-
'cloudify-openstack-plugin/releases/download/' \
33-
'{v}/plugin.yaml'.format(v=OS_VERSION)
34-
PLUGINS_TO_UPLOAD = [(OS_WAGON, OS_PLUGIN)]
29+
'releases/download/{v}/cloudify_openstack_plugin-{v}-' \
30+
'centos-Core-py27.py36-none-linux_x86_64.wgn'.format(v=OS_VERSION)
31+
OS_PLUGIN = 'https://github.com/cloudify-cosmo/cloudify-openstack-plugin/' \
32+
'releases/download/{v}/plugin.yaml'.format(v=OS_VERSION)
33+
'''Temporary until all the plugins in the bundle will
34+
released with py2py3 wagons'''
35+
UT_VERSION = '1.23.5'
36+
UT_WAGON = 'https://github.com/cloudify-incubator/cloudify-utilities-plugin/' \
37+
'releases/download/{v}/cloudify_utilities_plugin-{v}-centos' \
38+
'-Core-py27.py36-none-linux_x86_64.wgn'.format(v=UT_VERSION)
39+
UT_PLUGIN = 'https://github.com/cloudify-incubator/cloudify-utilities-' \
40+
'plugin/releases/download/{v}/plugin.yaml'.format(v=UT_VERSION)
41+
FAB_VERSION = '2.0.4'
42+
FAB_WAGON = 'https://github.com/cloudify-cosmo/cloudify-fabric-plugin/' \
43+
'releases/download/{v}/cloudify_fabric_plugin-{v}-centos-' \
44+
'Core-py27.py36-none-linux_x86_64.wgn'.format(v=FAB_VERSION)
45+
FAB_PLUGIN = 'https://github.com/cloudify-cosmo/cloudify-fabric-plugin/' \
46+
'releases/download/{v}/plugin.yaml'.format(v=FAB_VERSION)
47+
48+
PLUGINS_TO_UPLOAD = [(OS_WAGON, OS_PLUGIN), (UT_WAGON, UT_PLUGIN),
49+
(FAB_WAGON, FAB_PLUGIN)]
3550

3651

3752
SECRETS_TO_CREATE = {
@@ -54,7 +69,7 @@
5469

5570
prepare_test(plugins=PLUGINS_TO_UPLOAD,
5671
secrets=SECRETS_TO_CREATE,
57-
plugin_test=False)
72+
plugin_test=False, execute_bundle_upload=False)
5873

5974
virtual_machine_list = ['examples/blueprint.yaml']
6075
infra_path = 'examples/blueprint-examples/virtual-machine/{0}.yaml'

examples/scripts/configure.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import logging
2525
from tempfile import mkstemp
2626

27-
from fabric.api import run, put, sudo
27+
from fabric2 import task
2828
RUN_WITH = 'source /home/centos/host_pool_service/bin/activate &&'
2929

3030
from cloudify import ctx
@@ -34,14 +34,14 @@
3434
POOL_CFG_PATH = os.path.join(BASE_DIR, 'pool.yaml')
3535

3636

37-
def get_key_content(key_file, logger):
37+
def get_key_content(key_file, logger, connection):
3838
'''Downloads a key and returns the key contents'''
3939
tfd, target_path = mkstemp()
4040
os.close(tfd)
4141
logger.debug('Downloading key file "{0}" to path "{1}"'
4242
.format(key_file, target_path))
4343
local_key_file = ctx.download_resource(key_file)
44-
put(local_key_file, target_path)
44+
connection.put(local_key_file, target_path)
4545
keycontent = None
4646
with open(target_path, 'r') as f_key:
4747
keycontent = f_key.read()
@@ -51,7 +51,7 @@ def get_key_content(key_file, logger):
5151
return keycontent
5252

5353

54-
def set_host_key_content(cfg, logger):
54+
def set_host_key_content(cfg, logger, connection):
5555
'''Replaces host key file string with key content
5656
5757
:param dict cfg: Host-Pool configuration data
@@ -67,7 +67,7 @@ def set_host_key_content(cfg, logger):
6767
# Default key file was specified, let's convert and use
6868
logger.debug('Default key file: "{0}"'.format(default_key_file))
6969
cfg['default']['credentials']['key'] = \
70-
get_key_content(default_key_file, logger)
70+
get_key_content(default_key_file, logger, connection)
7171
del cfg['default']['credentials']['key_file']
7272

7373
# Get the host keys
@@ -81,7 +81,7 @@ def set_host_key_content(cfg, logger):
8181
# Default key file was specified, let's convert and use
8282
logger.debug('Host key file: "{0}"'.format(host_key_file))
8383
host['credentials']['key'] = \
84-
get_key_content(host_key_file, logger)
84+
get_key_content(host_key_file, logger, connection)
8585
del host['credentials']['key_file']
8686
return cfg
8787

@@ -130,7 +130,8 @@ def get_hostpool_logger(mod, debug=False,
130130
return logger
131131

132132

133-
def main():
133+
@task
134+
def main(connection):
134135
'''Entry point'''
135136

136137
logger = get_hostpool_logger('configure',
@@ -146,7 +147,7 @@ def main():
146147
.format(ctx.node.properties['pool'], POOL_CFG_PATH))
147148
local_file = ctx.download_resource(ctx.node.properties['pool'],
148149
target_path=POOL_CFG_PATH)
149-
put(local_file, POOL_CFG_PATH)
150+
connection.put(local_file, POOL_CFG_PATH)
150151

151152
# if not os.path.exists(POOL_CFG_PATH):
152153
# raise NonRecoverableError('Configuration file for the Host-Pool '
@@ -162,7 +163,7 @@ def main():
162163
raise NonRecoverableError('Configuration file for the Host-Pool '
163164
'service is not valid YAML')
164165
logger.info('Converting host key files from blueprint')
165-
seed_config = set_host_key_content(cfg, logger)
166+
seed_config = set_host_key_content(cfg, logger, connection)
166167
ctx.instance.runtime_properties['seed_config'] = seed_config
167168

168169
# main()

examples/scripts/create.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020

2121
import os
2222

23-
from fabric.api import run, put, sudo
24-
from fabric.context_managers import cd
23+
from fabric2 import task
2524

2625
RUN_WITH = 'source /home/centos/host_pool_service/bin/activate &&'
2726

@@ -31,15 +30,15 @@
3130
RUN_WITH = 'source /home/centos/host_pool_service/bin/activate &&'
3231

3332

34-
def install_requirements():
33+
def install_requirements(connection):
3534
'''Install required Python packages'''
3635

37-
with cd('/home/centos'):
38-
run('curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py')
39-
run('python get-pip.py')
40-
run('pip install virtualenv')
41-
run('virtualenv /home/centos/host_pool_service')
42-
ctx.instance.runtime_properties['virtualenv'] = \
36+
with connection.cd("/home/centos"):
37+
connection.run('curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py')
38+
connection.run('python get-pip.py')
39+
connection.sudo('yum install -y python-virtualenv')
40+
connection.run('virtualenv /home/centos/host_pool_service')
41+
ctx.instance.runtime_properties['virtualenv'] = \
4342
'/home/centos/host_pool_service'
4443

4544
reqs = [
@@ -51,7 +50,7 @@ def install_requirements():
5150

5251
for req in reqs:
5352
ctx.logger.info('Installing Python package "{0}"'.format(req))
54-
run(RUN_WITH + 'pip install {0}'.format(req))
53+
connection.run(RUN_WITH + 'pip install {0}'.format(req))
5554
# install(req)
5655

5756

@@ -63,7 +62,8 @@ def create_virtualenv():
6362
os.system('source {0}/bin/activate'.format(venv_name))
6463

6564

66-
def main():
65+
@task
66+
def main(connection):
6767
'''Entry point'''
6868

6969
# create_virtualenv()
@@ -73,15 +73,15 @@ def main():
7373
ctx.logger.info('UNAME {0}'.format(os.uname()))
7474
try:
7575
ctx.logger.info('Creating working directory: "{0}"'.format(base_dir))
76-
run('mkdir -p {0}'.format(base_dir))
76+
connection.run('mkdir -p {0}'.format(base_dir))
7777
# if not os.path.isdir(base_dir):
7878
# os.makedirs(base_dir)
7979
except OSError as ex:
8080
ctx.logger.error('Error making directory "{0}"'.format(base_dir))
8181
raise RecoverableError(message=ex, retry_after=2)
8282

8383
ctx.logger.info('Installing required Python packages')
84-
install_requirements()
84+
install_requirements(connection)
8585

8686
ctx.logger.info('Setting runtime_property "working_directory" to "{0}"'
8787
.format(base_dir))

0 commit comments

Comments
 (0)