Skip to content

Commit 002bd63

Browse files
EarthmanTkaplanyanivNelynehemia
authored
New Build (#242)
* context * test plugin * test * update tests to run on remote manager * add setup_manager to job kubernetes_integration_tests_py3 * test _file_resource_create * add test kubernetes_integration_tests_py3 * add test kubernetes_integration_tests_py3 * add test kubernetes_integration_tests_py3 * update test_features.py Not ready * remove managerorb * update config * minor changes * attempt to add webbrowser module * foo * logging the message * fixing the hashing * merge additions --------- Co-authored-by: kaplanyaniv <[email protected]> Co-authored-by: Nelynehemia <[email protected]> Co-authored-by: Nely Nehemia <[email protected]>
1 parent 736d37b commit 002bd63

10 files changed

+87
-50
lines changed

.circleci/config.yml

+35-14
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ orbs:
44
node: cloudify/public-unittest-orb@volatile
55
wagonorb: cloudify/wagon-bulder-orb@volatile
66
releaseorb: cloudify/release-orb@volatile
7-
managerorb: cloudify/manager-orb@volatile
87

98
checkout:
109
post:
@@ -25,22 +24,40 @@ executors:
2524
image: ubuntu-2004:202201-02
2625

2726
commands:
27+
28+
setup_manager:
29+
steps:
30+
- run: |
31+
if [[ -z "${CLOUDIFY_HOST}" ]]; then
32+
exit 1
33+
fi
34+
- run: |
35+
if [[ -z "${CLOUDIFY_TENANT}" ]] && [ -z "${CIRCLE_PROJECT_REPONAME}" ]; then
36+
exit 1
37+
fi
38+
- run: |
39+
if [[ -z "${CLOUDIFY_TOKEN}" ]]; then
40+
exit 1
41+
fi
42+
- run: |
43+
response=$(curl --write-out '%{http_code}' --silent --insecure --header "Tenant: ${CLOUDIFY_TENANT}" --header "Authentication-Token: ${CLOUDIFY_TOKEN}" https://$CLOUDIFY_HOST/api/v3.1/status --output /dev/null)
44+
if [[ $response != 200 ]]; then
45+
echo "Failed to get manager status";
46+
exit 1
47+
fi
48+
- run: pip3 install https://github.com/cloudify-incubator/cloudify-ecosystem-test/archive/refs/heads/master.zip
49+
- run: git submodule update --init --recursive --remote
50+
51+
2852
prepare_test_manager:
2953
steps:
30-
- run: ecosystem-test prepare-test-manager -l $TEST_LICENSE -es gcp_credentials=$gcp_credentials --yum-package python-netaddr --yum-package git -p $(find ~/project/workspace/build/ -name *manylinux-py311-none-linux_x86_64.wgn*) ~/project/plugin.yaml
31-
- run: ecosystem-test upload-plugin -PN utilities
32-
- run: ecosystem-test upload-plugin -PN ansible
33-
- run: ecosystem-test upload-plugin -PN gcp
54+
- run: ecosystem-test prepare-remote-test-manager -es gcp_credentials=$gcp_credentials -p $(find ~/project/workspace/build/ -name *manylinux-py311-none-linux_x86_64.wgn*) ~/project/plugin.yaml
55+
- run: curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
56+
- run: sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
3457

3558
run_gke_test:
3659
steps:
37-
- run: echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
38-
- run: curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
39-
- run: sudo apt-get update
40-
- run: sudo apt-get install google-cloud-sdk-gke-gcloud-auth-plugin
41-
- run: sudo apt-get install kubectl
42-
- run: gcloud config set project trammell-project
43-
- run: ecosystem-test local-blueprint-test -b examples/blueprint-examples/kubernetes/gcp-gke/blueprint.yaml --test-id=gcp-gke -i resource_prefix=kube-$CIRCLE_BUILD_NUM --on-failure=uninstall-force --timeout=3000 --nested-test=.circleci/test_features.py
60+
- run: ecosystem-test remote-blueprint-test -b examples/blueprint-examples/kubernetes/gcp-gke/blueprint.yaml --test-id=gcp-gke -i resource_prefix=kube-$CIRCLE_BUILD_NUM --on-failure=uninstall-force --timeout=3000 --nested-test=.circleci/test_features.py
4461

4562
jobs:
4663
kubernetes_integration_tests_py3:
@@ -49,7 +66,9 @@ jobs:
4966
CLOUDIFY_SSL_TRUST_ALL: true
5067
steps:
5168
- checkout
52-
- managerorb/create_manager_container_latest
69+
- attach_workspace:
70+
at: workspace
71+
- setup_manager
5372
- prepare_test_manager
5473
- run_gke_test
5574

@@ -87,14 +106,16 @@ workflows:
87106
- wagonorb/wagon_311
88107
filters:
89108
branches:
90-
only: /([0-9\.]*\-build|master|dev)/
109+
only: /([0-9\.]*\-build|master|dev|RND-1248-k-8-s-plugin-nightly-failing)/
91110
- releaseorb/release:
92111
filters:
93112
branches:
94113
only: /master/
95114
requires:
96115
- node/unittests_job
97116
- wagonorb/wagon
117+
- wagonorb/wagon_311
118+
- wagonorb/arch64_wagon
98119
- wagonorb/rhel_wagon
99120
- kubernetes_integration_tests_py3
100121
- releaseorb/merge_docs_job:

.circleci/test_features.py

+37-28
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,18 @@
2323

2424
import pytest
2525

26-
from ecosystem_tests.dorkl import cleanup_on_failure
2726
from ecosystem_tests.dorkl.commands import handle_process
28-
from ecosystem_tests.dorkl.cloudify_api import (
29-
cloudify_exec,
30-
blueprints_upload,
31-
deployments_create,
32-
executions_start)
27+
from ecosystem_tests.ecosystem_tests_cli.logger import logger
28+
from ecosystem_tests.nerdl.api import (
29+
create_secret,
30+
with_client,
31+
get_node_instance,
32+
list_node_instances,
33+
upload_blueprint,
34+
create_deployment,
35+
wait_for_install,
36+
cleanup_on_failure)
37+
3338

3439
TEST_ID = environ.get('__ECOSYSTEM_TEST_ID', 'plugin-examples')
3540

@@ -40,14 +45,19 @@ def test_update(*_, **__):
4045
setup_cli()
4146
try:
4247
# Upload Cloud Watch Blueprint
43-
blueprints_upload(
48+
upload_blueprint(
4449
'examples/file-test.yaml',
4550
deployment_id)
4651
# Create Cloud Watch Deployment with Instance ID input
47-
deployments_create(
48-
deployment_id, {"resource_path": "resources/pod.yaml"})
52+
create_deployment(
53+
deployment_id,
54+
deployment_id,
55+
{
56+
"resource_path": "resources/pod.yaml"
57+
}
58+
)
4959
# Install Cloud Watch Deployment
50-
executions_start('install', deployment_id, 300)
60+
wait_for_install(deployment_id, 300)
5161
after_install = get_pod_info()
5262
update_params = {
5363
"kind": "Pod",
@@ -67,9 +77,9 @@ def test_update(*_, **__):
6777
tmp = tempfile.NamedTemporaryFile(delete=false, mode='w', suffix='.yaml')
6878
yaml.dump(params, tmp)
6979
tmp.close()
70-
executions_start(
71-
'update_resource_definition',
80+
wait_for_workflow(
7281
deployment_id,
82+
'update_resource_definition',
7383
300,
7484
params=tmp
7585
)
@@ -78,24 +88,31 @@ def test_update(*_, **__):
7888
assert after_install['spec']['containers'][0]['image'] == 'nginx:stable'
7989
assert after_update['spec']['containers'][0]['image'] == 'nginx:latest'
8090
# Uninstall Cloud Watch Deployment
81-
executions_start('uninstall', deployment_id, 300)
91+
wait_for_uninstall(deployment_id, 300)
8292
except:
8393
cleanup_on_failure(deployment_id)
8494

8595

8696
def setup_cli():
8797
cluster_name = runtime_properties(
8898
node_instance_by_name('kubernetes-cluster')['id'])['name']
89-
capabilities = cloudify_exec('cfy deployments capabilities gcp-gke')
90-
cloudify_exec('cfy secrets create -u -s {} kubernetes_endpoint'.format(
91-
capabilities['endpoint']['value']), get_json=False)
99+
capabilities = get_capabilities('gcp-gke')
100+
logger.info('capabilities: {}'.format(capabilities))
101+
create_secret('kubernetes_endpoint', capabilities['endpoint'])
92102
with open('gcp.json', 'wb') as outfile:
93103
creds = base64.b64decode(os.environ['gcp_credentials'])
94104
outfile.write(creds)
95105
handle_process('gcloud auth activate-service-account --key-file gcp.json')
96106
handle_process(
97-
'gcloud container clusters get-credentials {} --region us-west1-a'
98-
.format(cluster_name))
107+
'gcloud container clusters get-credentials {} '
108+
'--region us-west1-a --project {}'
109+
.format(cluster_name, 'trammell-project'))
110+
111+
112+
@with_client
113+
def get_capabilities(dep_id, client):
114+
dep = client.deployments.capabilities.get(dep_id)
115+
return dep.capabilities
99116

100117

101118
def get_pod_info():
@@ -115,17 +132,9 @@ def node_instance_by_name(name):
115132
raise Exception('No node instances found.')
116133

117134

118-
def nodes():
119-
return cloudify_exec('cfy nodes list')
120-
121-
122135
def node_instances():
123-
return cloudify_exec('cfy node-instances list')
124-
125-
126-
def node_instance(node_instance_id):
127-
return cloudify_exec('cfy node-instances get {}'.format(node_instance_id))
136+
return list_node_instances(TEST_ID)
128137

129138

130139
def runtime_properties(node_instance_id):
131-
return node_instance(node_instance_id)['runtime_properties']
140+
return get_node_instance(node_instance_id)['runtime_properties']

CHANGELOG.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -176,4 +176,5 @@
176176
- Check Drift Workflow
177177
- Check Status Workflow
178178
2.13.24: Support Azure Service Account Authentication.
179-
2.13.25: add __version__.py file in cloudify_kubernetes folder.
179+
2.13.25: add __version__.py file in cloudify_kubernetes folder.
180+
2.13.26: check plugin and update circleci config.

cloudify_kubernetes/__version__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version = '2.13.25'
1+
version = '2.13.26'

cloudify_kubernetes/tasks/shared_cluster.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
is_all_executions_finished)
3333
from cloudify_types.shared_resource.constants import \
3434
WORKFLOW_EXECUTION_TIMEOUT
35-
except ImportError:
35+
except ImportError as e:
3636
if PY311:
3737
from mgmtworker.cloudify_types.polling import poll_with_timeout
3838
from mgmtworker.cloudify_types.component.polling import (
@@ -41,7 +41,7 @@
4141
from mgmtworker.cloudify_types.shared_resource.constants import \
4242
WORKFLOW_EXECUTION_TIMEOUT
4343
elif not PY2:
44-
raise
44+
raise e
4545

4646

4747
@with_rest_client

extra-packaging-instructions.sh

+6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ then
55
cat <<EOF > ./pydoc/__init__.py
66
def get_doc(*args):
77
return ''
8+
EOF
9+
mkdir -p ./webbrowser
10+
touch ./webbrowser/__init__.py
11+
cat <<EOF > ./webbrowser/__init__.py
12+
def register(*args, **kwargs):
13+
return ''
814
EOF
915
git apply python311.patch
1016
fi

plugin.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ plugins:
33
kubernetes:
44
executor: central_deployment_agent
55
package_name: cloudify-kubernetes-plugin
6-
package_version: '2.13.25'
6+
package_version: '2.13.26'
77

88
data_types:
99

plugin_1_4.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ plugins:
33
kubernetes:
44
executor: central_deployment_agent
55
package_name: cloudify-kubernetes-plugin
6-
package_version: '2.13.25'
6+
package_version: '2.13.26'
77

88
data_types:
99

python311.patch

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ index f4d4d02..47b9aae 100755
123123
'cloudify_kubernetes.tasks',
124124
- 'cloudify_kubernetes.tasks.nested_resources'],
125125
+ 'cloudify_kubernetes.tasks.nested_resources',
126-
+ 'pydoc'],
126+
+ 'pydoc', 'webbrowser'],
127127
license='LICENSE',
128128
install_requires=install_requires
129129
)

v2_plugin.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ plugins:
33
kubernetes:
44
executor: central_deployment_agent
55
package_name: cloudify-kubernetes-plugin
6-
package_version: '2.13.25'
6+
package_version: '2.13.26'
77

88
data_types:
99

0 commit comments

Comments
 (0)