Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
build.yml 7.86 KiB
- name: Build testing image
  hosts: localhost

  tasks:
    - name: Log into private registry
      community.docker.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 Netbox
      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 image Postgres
      community.docker.docker_image:
        state: absent
        name: "{{ lookup('ansible.builtin.env', 'CI_PROJECT_NAME') }}/postgres:{{ lookup('ansible.builtin.env', 'CI_COMMIT_SHORT_SHA') }}"
        force_absent: true

    - name: Remove image Redis
      community.docker.docker_image:
        state: absent
        name: "{{ lookup('ansible.builtin.env', 'CI_PROJECT_NAME') }}/redis:{{ lookup('ansible.builtin.env', 'CI_COMMIT_SHORT_SHA') }}"
        force_absent: true


    - name: Remove image psw_rotation
      community.docker.docker_image:
        state: absent
        name: "{{ lookup('ansible.builtin.env', 'CI_PROJECT_NAME') }}/psw_rotation:{{ lookup('ansible.builtin.env', 'CI_COMMIT_SHORT_SHA') }}"
        force_absent: true

    - name: Building image Netbox
      community.docker.docker_image:
        build:
          pull: true
          path: ../
          args:
            http_proxy: "{{ lookup('ansible.builtin.env', 'HTTP_PROXY') }}"
            https_proxy: "{{ lookup('ansible.builtin.env', 'HTTPS_PROXY') }}"
          nocache: true
        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: Building image PSW rotation
      community.docker.docker_image:
        build:
          pull: true
          path: ../
          args:
            http_proxy: "{{ lookup('ansible.builtin.env', 'HTTP_PROXY') }}"
            https_proxy: "{{ lookup('ansible.builtin.env', 'HTTPS_PROXY') }}"
          nocache: true
        name: "{{ lookup('ansible.builtin.env', 'CI_PROJECT_NAME') }}/docker/psw_rotation:{{ lookup('ansible.builtin.env', 'CI_COMMIT_SHORT_SHA') }}"
        repository: "{{ lookup('ansible.builtin.env', 'CI_REGISTRY_IMAGE') }}/docker/psw_rotation:{{ lookup('ansible.builtin.env', 'CI_COMMIT_SHORT_SHA') }}"
        push: true
        force_source: true
        force_tag: true
        source: build

    - name: Building image Postgres
      community.docker.docker_image: