aerogearcatalog / sync-app-apb

Apache License 2.0
0 stars 3 forks source link

apb test is deprecated; apb bundle test fails #2

Open secondsun opened 5 years ago

secondsun commented 5 years ago

So the apb tools we've been using are all deprecated and all of our READMEs need to be reviewed.

For instance apb test has been replaced with apb bundle test. To get the bundle test to work, however, we have to do a few things first.

Steps to Setup Apb Bundles

  1. apb bundle prepare
  2. oc new-build --binary=true --name sync-app-apb
  3. oc start-build --follow --from-dir . sync-app-apb

The APB is now in a build pipeline in OpenShift and should be deployed to the local docker registry. At this point we must tell the apb tool about the registry.

apb registry add myregistry --namespaces=myproject --type=local_openshift

At this point we can now run apb bundle test sync-app-apb. I used the values from the test variables when prompted. The test fails with the following error logs

DEPRECATED: APB playbooks should be stored at /opt/apb/project
--
  |  
  | PLAY [Test sync-app-apb] *******************************************************
  |  
  | TASK [ansible.kubernetes-modules : Install latest openshift client] ************
  | skipping: [localhost]
  |  
  | TASK [ansibleplaybookbundle.asb-modules : debug] *******************************
  | skipping: [localhost]
  |  
  | TASK [create project for namespace] ********************************************
  | ok: [localhost]
  |  
  | TASK [Run the provision role] **************************************************
  |  
  | TASK [provision-sync-app-apb : Create sync-app deployment config] **************
  | An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'V1DeploymentTriggerImageChangeParams' object has no attribute '__name__'
  | fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"/opt/apb/.ansible/tmp/ansible-tmp-1546454148.38-1803317182328/AnsiballZ_openshift_v1_deployment_config.py\", line 113, in <module>\n    _ansiballz_main()\n  File \"/opt/apb/.ansible/tmp/ansible-tmp-1546454148.38-1803317182328/AnsiballZ_openshift_v1_deployment_config.py\", line 105, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/opt/apb/.ansible/tmp/ansible-tmp-1546454148.38-1803317182328/AnsiballZ_openshift_v1_deployment_config.py\", line 48, in invoke_module\n    imp.load_module('__main__', mod, module, MOD_DESC)\n  File \"/tmp/ansible_openshift_v1_deployment_config_payload_sPCjgL/__main__.py\", line 687, in <module>\n  File \"/tmp/ansible_openshift_v1_deployment_config_payload_sPCjgL/__main__.py\", line 681, in main\n  File \"/tmp/ansible_openshift_v1_deployment_config_payload_sPCjgL/ansible_openshift_v1_deployment_config_payload.zip/ansible/module_utils/k8s_common.py\", line 220, in execute_module\n  File \"/usr/lib/python2.7/site-packages/openshift/helper/ansible.py\", line 208, in object_from_params\n    self.__set_obj_attribute(obj, prop_path, param_value, param_name)\n  File \"/usr/lib/python2.7/site-packages/openshift/helper/ansible.py\", line 389, in __set_obj_attribute\n    setattr(obj, prop_name, self.__set_obj_attribute(sub_obj, property_path, param_value, param_name))\n  File \"/usr/lib/python2.7/site-packages/openshift/helper/ansible.py\", line 381, in __set_obj_attribute\n    self.__compare_obj_list(getattr(obj, prop_name), param_value, obj_type, param_name)\n  File \"/usr/lib/python2.7/site-packages/openshift/helper/ansible.py\", line 533, in __compare_obj_list\n    self.__update_object_properties(param_obj, value)\n  File \"/usr/lib/python2.7/site-packages/openshift/helper/ansible.py\", line 584, in __update_object_properties\n    class_snake_name = self.get_base_model_name_snake(obj_class.__name__)\nAttributeError: 'V1DeploymentTriggerImageChangeParams' object has no attribute '__name__'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
  |  
  | PLAY RECAP *********************************************************************
  | localhost                  : ok=1    changed=0    unreachable=0    failed=1
secondsun commented 5 years ago

If you want to deploy the apb to the service catalog, you must as cluster admin deploy the image to the openshift namespace in the internal docker registry. You can do this when you setup the builds or push it manually using docker push.