Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS will be completely phased out by mid-2025. To see alternatives please check here

Skip to content
Snippets Groups Projects

add docker images builder

Merged Vehbo DZOGOVIC requested to merge autobuild-docker-images into main
8 files
+ 142
5
Compare changes
  • Side-by-side
  • Inline
Files
8
ansible/build.yml 0 → 100644
+ 50
0
- name: Build testing image
hosts: localhost
tasks:
- name: Log into private registry
docker_login:
registry: "{{ lookup('ansible.builtin.env','CI_REGISTRY') }}"
username: "{{ lookup('ansible.builtin.env','CI_REGISTRY_USER') }}"
password: "{{ lookup('ansible.builtin.env','CI_REGISTRY_PASSWORD') }}"
reauthorize: true
- name: Remove image
community.docker.docker_image:
state: absent
name: "{{ lookup('ansible.builtin.env','CI_PROJECT_NAME') }}:{{ lookup('ansible.builtin.env','CI_COMMIT_SHORT_SHA') }}"
force_absent: true
- name: Building image
community.docker.docker_image:
build:
path: ../
args:
http_proxy: "{{ lookup('ansible.builtin.env', 'HTTP_PROXY') }}"
https_proxy: "{{ lookup('ansible.builtin.env', 'HTTPS_PROXY') }}"
name: "{{ lookup('ansible.builtin.env','CI_PROJECT_NAME') }}:{{ lookup('ansible.builtin.env','CI_COMMIT_SHORT_SHA') }}"
repository: "{{ lookup('ansible.builtin.env','CI_REGISTRY_IMAGE') }}:{{ lookup('ansible.builtin.env','CI_COMMIT_SHORT_SHA') }}"
push: true
force_source: true
force_tag: true
source: build
- name: Remove local image
community.docker.docker_image:
state: absent
name: "{{ lookup('ansible.builtin.env','CI_PROJECT_NAME') }}:{{ lookup('ansible.builtin.env','CI_COMMIT_SHORT_SHA') }}"
force_absent: true
- name: Remove local image
community.docker.docker_image:
state: absent
name: "{{ lookup('ansible.builtin.env','CI_REGISTRY_IMAGE') }}:{{ lookup('ansible.builtin.env','CI_COMMIT_SHORT_SHA') }}"
force_absent: true
- name: Log out of registry
community.docker.docker_login:
state: absent
- name: debug
debug:
msg: "{{ lookup('ansible.builtin.env','CI_REGISTRY_IMAGE') }}:{{ lookup('ansible.builtin.env','CI_COMMIT_SHORT_SHA') }}"
Loading