Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ansible/delta-hosts/hosts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ delta-consul-c
[user-vault]
localhost

[user-local]
localhost

[worker]
localhost

Expand Down
3 changes: 3 additions & 0 deletions ansible/gamma-hosts/hosts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ gamma-consul-c
[user-vault]
localhost

[user-local]
localhost

[worker]
localhost

Expand Down
5 changes: 2 additions & 3 deletions ansible/group_vars/alpha-image-builder.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
app_name: image-builder
name: "{{ app_name }}"
# namespace (can include "registry.runnable.com:")
image_builder_docker_namespace: "{{ registry_host }}/runnable/image-builder"
app_repo: git@github.com:CodeNow/{{ app_name }}.git

repo: git@github.com:CodeNow/{{ name }}.git

# consul values
consul_values:
Expand Down
11 changes: 7 additions & 4 deletions ansible/image-builder.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
---
- hosts: user-local
vars_files:
- group_vars/alpha-image-builder.yml
roles:
- { role: build_with_dockerfile }

- hosts: "{{ dock | default('docks') }}"
vars_files:
- group_vars/alpha-image-builder.yml
roles:
- { role: notify, tags: [notify] }
- { role: node, tags: [setup] }
- { role: git_repo }
- { role: image-builder }
- { role: pull-image }
- { role: consul_value, tags: [consul_value] }
13 changes: 12 additions & 1 deletion ansible/roles/build_with_dockerfile/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,20 @@
become: yes
command: docker build {{ build_args | default("") }} --tag="{{ container_image }}:{{ container_tag }}" "{{ build_dir }}/{{ name }}/repo"

- name: login to registry
delegate_to: "{{ builder }}"
tags: deploy, build
become: yes
command: docker login -u {{ registry_username }} -p {{ registry_token }} -e "info@runnable.com" {{ registry_host }}

- name: push docker image
delegate_to: "{{ builder }}"
tags: deploy, build
become: yes
ignore_errors: True
command: docker push {{ container_image }}:{{ container_tag }}

- name: logout of registry
delegate_to: "{{ builder }}"
tags: deploy, build
become: yes
command: docker logout {{ registry_host }}
3 changes: 2 additions & 1 deletion ansible/roles/builder/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
- name: set number of images built
tags: deploy, build
set_fact:
# Quay IO includes deleted images in this query through the `end_ts` property
no_images_found: "{{ currently_built_tags|json_query('json.tags')|length == 0 }}"

- name: set number of images built
Expand Down Expand Up @@ -192,4 +193,4 @@
tags: deploy, build
when: build_image
become: yes
command: docker logout
command: docker logout {{ registry_host }}
16 changes: 0 additions & 16 deletions ansible/roles/image-builder/tasks/main.yml

This file was deleted.

15 changes: 15 additions & 0 deletions ansible/roles/pull-image/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
- name: login to registry
tags: deploy
become: yes
command: docker login -u {{ registry_username }} -p {{ registry_token }} -e "info@runnable.com" {{ registry_host }}

- name: pull image
tags: deploy
become: true
command: docker pull {{ container_image }}:{{ container_tag }}

- name: logout of registry
tags: deploy
become: yes
command: docker logout {{ registry_host }}