|
| 1 | +- hosts: all |
| 2 | + tasks: |
| 3 | + - name: Executor install-docker role |
| 4 | + include_role: |
| 5 | + name: install-docker |
| 6 | + vars: |
| 7 | + use_upstream_docker: true |
| 8 | + |
| 9 | + - name: Ensure dependencies are installed |
| 10 | + become: true |
| 11 | + package: |
| 12 | + name: |
| 13 | + - docker-compose |
| 14 | + - python-pexpect |
| 15 | + state: installed |
| 16 | + |
| 17 | + - name: Build docker containers |
| 18 | + shell: make dev/build |
| 19 | + args: |
| 20 | + chdir: "{{ zuul.projects['github.com/ansible/galaxy'].src_dir }}" |
| 21 | + executable: /bin/bash |
| 22 | + |
| 23 | + - name: Run docker-compose up |
| 24 | + shell: make dev/up_detached |
| 25 | + args: |
| 26 | + chdir: "{{ zuul.projects['github.com/ansible/galaxy'].src_dir }}" |
| 27 | + executable: /bin/bash |
| 28 | + |
| 29 | + - name: Print list of images |
| 30 | + command: docker image ls --all --digests --no-trunc |
| 31 | + |
| 32 | + - name: Wait for galaxy to start |
| 33 | + uri: |
| 34 | + url: http://localhost:8000 |
| 35 | + register: result |
| 36 | + until: result.status == 200 and result.redirected == false |
| 37 | + retries: 120 |
| 38 | + |
| 39 | + - name: Create admin user |
| 40 | + expect: |
| 41 | + chdir: "{{ zuul.projects['github.com/ansible/galaxy'].src_dir }}" |
| 42 | + command: make dev/createsuperuser |
| 43 | + echo: true |
| 44 | + responses: |
| 45 | + 'Username:': admin |
| 46 | + 'Email address:': [email protected] |
| 47 | + 'Password:': secret |
| 48 | + 'Password \(again\):': secret |
| 49 | + timeout: 60 |
| 50 | + |
| 51 | + - name: Create admin token |
| 52 | + args: |
| 53 | + chdir: "{{ zuul.projects['github.com/ansible/galaxy'].src_dir }}" |
| 54 | + executable: /bin/bash |
| 55 | + shell: make USERNAME=admin dev/createusertoken | tail -n1 | cut -d ' ' -f3 |
| 56 | + register: _token |
| 57 | + |
| 58 | + - name: Create ansible.cfg configuration file |
| 59 | + copy: |
| 60 | + content: | |
| 61 | + [galaxy] |
| 62 | + server_list = buildset_galaxy |
| 63 | +
|
| 64 | + [galaxy_server.buildset_galaxy] |
| 65 | + url = http://localhost:8000 |
| 66 | + token = {{ _token.stdout }} |
| 67 | + dest: /tmp/galaxy.cfg |
| 68 | + mode: 0600 |
| 69 | + |
| 70 | + - name: Create network namespace |
| 71 | + args: |
| 72 | + chdir: "{{ zuul.projects['github.com/ansible/galaxy'].src_dir }}" |
| 73 | + executable: /bin/bash |
| 74 | + shell: make USERNAME=admin NAMESPACE=network dev/createnamespace |
| 75 | + |
| 76 | + - name: Confirm namespace exists |
| 77 | + uri: |
| 78 | + url: http://localhost:8000/api/v1/namespaces/?name=network |
| 79 | + register: result |
| 80 | + until: result.status == 200 |
| 81 | + retries: 120 |
| 82 | + |
| 83 | + - name: Assert namespace exists |
| 84 | + assert: |
| 85 | + that: |
| 86 | + - result.json.count != 0 |
| 87 | + |
| 88 | + - name: Setup tox role |
| 89 | + include_role: |
| 90 | + name: tox |
| 91 | + vars: |
| 92 | + tox_extra_args: -vv --notest |
| 93 | + tox_install_siblings: false |
| 94 | + zuul_work_dir: "{{ zuul.projects['github.com/ansible-network/releases'].src_dir }}" |
| 95 | + |
| 96 | + - name: Generate version number for ansible collection. |
| 97 | + args: |
| 98 | + chdir: "{{ zuul.project.src_dir }}" |
| 99 | + command: "{{ ansible_user_dir }}/{{ zuul.projects['github.com/ansible-network/releases'].src_dir }}/.tox/venv/bin/generate-ansible-collection" |
| 100 | + |
| 101 | + - name: Run build-ansible-collection role |
| 102 | + include_role: |
| 103 | + name: build-ansible-collection |
| 104 | + vars: |
| 105 | + ansible_galaxy_output_path: ~/artifacts |
| 106 | + ansible_galaxy_executable: "{{ ansible_user_dir }}/{{ zuul.projects['github.com/ansible-network/releases'].src_dir }}/.tox/venv/bin/ansible-galaxy" |
| 107 | + |
| 108 | + - name: Find tarballs to upload |
| 109 | + find: |
| 110 | + paths: ~/artifacts |
| 111 | + patterns: "*.tar.gz" |
| 112 | + register: found_tarballs |
| 113 | + |
| 114 | + - name: Publish collection to Ansible Galaxy |
| 115 | + environment: |
| 116 | + ANSIBLE_CONFIG: /tmp/galaxy.cfg |
| 117 | + shell: "{{ ansible_user_dir }}/{{ zuul.projects['github.com/ansible-network/releases'].src_dir }}/.tox/venv/bin/ansible-galaxy -vvv collection publish {{ item.path }}" |
| 118 | + register: result |
| 119 | + until: result.rc == 0 |
| 120 | + with_items: "{{ found_tarballs.files }}" |
| 121 | + |
| 122 | + - zuul_return: |
| 123 | + data: |
| 124 | + zuul: |
| 125 | + pause: true |
| 126 | + registry_ip_address: "{{ hostvars[groups.all[0]].ansible_host }}" |
0 commit comments