Files
fedora-infra_ansible/roles/osbs-atomic-reactor/tasks/source_git.yml
2016-07-05 17:07:52 +00:00

28 lines
1.2 KiB
YAML

---
- name: pull base image
command: docker pull {{ atomic_reactor_git.base_registry }}/{{ atomic_reactor_git.base_image }}
when: atomic_reactor_git.base_image is defined
- name: tag base image
command: docker tag -f {{ atomic_reactor_git.base_registry }}/{{ atomic_reactor_git.base_image }} {{ atomic_reactor_git.base_image_retag }}
when: atomic_reactor_git.base_image_retag is defined
- name: pull git repository with Dockerfile
git:
repo: "{{ atomic_reactor_git.git_url }}"
dest: "{{ atomic_reactor_git.git_local_path }}"
version: "{{ atomic_reactor_git.git_branch }}"
accept_hostkey: yes
register: dockerfile_git_repo
changed_when: "dockerfile_git_repo.after|default('after') != dockerfile_git_repo.before|default('before')"
- name: check if atomic-reactor image is present
command: docker inspect {{ atomic_reactor_tag }}
register: image_present
failed_when: image_present.rc != 0 and ('No such image' not in image_present.stderr)
changed_when: image_present.rc != 0
- name: build atomic-reactor image
command: docker build --no-cache=true --tag={{ atomic_reactor_tag }} {{ atomic_reactor_git.git_local_path }}/{{ atomic_reactor_git.git_subdir }}
when: dockerfile_git_repo.changed or image_present.changed