ansibleplaybookbundle / ansible-playbook-bundle

THIS REPO IS MIGRATING: https://github.com/automationbroker/apb
GNU General Public License v2.0
140 stars 70 forks source link

Bug 1533318 - Use internal registry in apb run #210

Closed djzager closed 6 years ago

djzager commented 6 years ago

Update the apb tool to use the internal registry on apb run.

djzager commented 6 years ago

Example:

 apb run --project dzager1 --dockerfile Dockerfile-canary
Finished writing dockerfile.
Building APB using tag: [172.30.1.1:5000/openshift/mediawiki-apb]
Successfully built APB image: 172.30.1.1:5000/openshift/mediawiki-apb
Pushing the image, this could take a minute...
Successfully pushed image: 172.30.1.1:5000/openshift/mediawiki-apb
mediawiki_db_schema(required)[default: mediawiki]:
mediawiki_site_name(required)[default: MediaWiki]:
mediawiki_site_lang(required)[default: en]:
mediawiki_admin_user(required)[default: admin]:
mediawiki_admin_pass(required): pass
Creating project dzager1
Created project
Creating service account in dzager1
Created service account
Creating role binding for apb-run-mediawiki-apb in dzager1
Created Role Binding
Creating pod with image 172.30.1.1:5000/openshift/mediawiki-apb in dzager1
Created Pod
APB run started
APB run complete: Succeeded
djzager commented 6 years ago

I still need to test this in a non-minishift environment, but here is what an apb run looks like with log output update:

$ apb run --project wordpress --dockerfile Dockerfile
Finished writing dockerfile.
Building APB using tag: [172.30.1.1:5000/openshift/wordpress-apb]
Successfully built APB image: 172.30.1.1:5000/openshift/wordpress-apb
Pushing the image, this could take a minute...
Successfully pushed image: 172.30.1.1:5000/openshift/wordpress-apb
Creating project wordpress
Created project
Creating service account in wordpress
Created service account
Creating role binding for apb-run-wordpress-apb in wordpress
Created Role Binding
Creating pod with image 172.30.1.1:5000/openshift/wordpress-apb in wordpress
Created Pod
APB run started
Pod in phase: Running
Pod in phase: Running
Pod in phase: Running
Pod in phase: Running
Pod in phase: Running
Pod in phase: Running
Pod in phase: Running
Pod in phase: Running
Pod in phase: Running
Pod in phase: Running
Pod in phase: Running
Pod in phase: Running
Pod in phase: Running
Pod in phase: Running
Pod in phase: Running
Pod in phase: Running
Pod in phase: Running
Pod in phase: Running
Pod in phase: Running
Pod in phase: Running
Pod in phase: Running
Pod in phase: Running
Pod in phase: Running
Pod in phase: Running
Pod in phase: Running
Pod in phase: Running
Pod in phase: Running
Pod in phase: Running
Pod in phase: Running
Pod in phase: Running
Pod in phase: Running
Pod in phase: Running
Pod in phase: Running
Pod in phase: Running
Pod in phase: Succeeded
+ [[ provision --extra-vars {"namespace": "wordpress", "_apb_plan_id": "default"} == *\s\2\i\/\a\s\s\e\m\b\l\e* ]]
+ ACTION=provision
+ shift
+ playbooks=/opt/apb/actions
+ CREDS=/var/tmp/bind-creds
+ TEST_RESULT=/var/tmp/test-result
+ whoami
+ '[' -w /etc/passwd ']'
++ id -u
+ echo 'apb:x:1000200000:0:apb user:/opt/apb:/sbin/nologin'
+ set +x
+ [[ -e /opt/apb/actions/provision.yaml ]]
+ [[ -e /opt/apb/actions/provision.yml ]]
+ ANSIBLE_ROLES_PATH=/etc/ansible/roles:/opt/ansible/roles
+ ansible-playbook /opt/apb/actions/provision.yml --extra-vars '{"namespace": "wordpress", "_apb_plan_id": "default"}'

PLAY [wordpress playbook to provision the application] *************************

TASK [ansible.kubernetes-modules : Install latest openshift client] ************
skipping: [localhost]

TASK [ansibleplaybookbundle.asb-modules : debug] *******************************
skipping: [localhost]

TASK [provision-wordpress : wordpress/charts/mariadb/templates/secrets.yaml] ***
changed: [localhost]

TASK [provision-wordpress : wordpress/templates/secrets.yaml] ******************
changed: [localhost]

TASK [provision-wordpress : wordpress/charts/mariadb/templates/configmap.yaml] ***
changed: [localhost]

TASK [provision-wordpress : wordpress/charts/mariadb/templates/tests.yaml] *****
changed: [localhost]

TASK [provision-wordpress : wordpress/charts/mariadb/templates/pvc.yaml] *******
changed: [localhost]

TASK [provision-wordpress : wordpress/templates/pvc.yaml] **********************
changed: [localhost]

TASK [provision-wordpress : wordpress/charts/mariadb/templates/svc.yaml] *******
changed: [localhost]

TASK [provision-wordpress : wordpress/templates/svc.yaml] **********************
changed: [localhost]

TASK [provision-wordpress : wordpress/charts/mariadb/templates/test-runner.yaml] ***
changed: [localhost]

TASK [provision-wordpress : wordpress/templates/tests/test-mariadb-connection.yaml] ***
changed: [localhost]

TASK [provision-wordpress : wordpress/charts/mariadb/templates/deployment.yaml] ***
changed: [localhost]

TASK [provision-wordpress : wordpress/templates/deployment.yaml] ***************
changed: [localhost]

PLAY RECAP *********************************************************************
localhost                  : ok=12   changed=12   unreachable=0    failed=0

+ EXIT_CODE=0
+ set +ex
+ '[' -f /var/tmp/test-result ']'
+ exit 0

APB run complete: Succeeded
djzager commented 6 years ago

Verified this on catasb cluster and it also functions as I hoped it would...flawlessly :sunglasses:

djzager commented 6 years ago

@jmontleon or @cfchase do you mind having a look at this?