diff --git a/playbooks/basic_configuration.yml b/playbooks/basic_configuration.yml index 9ef6b97d5ae47c4e1acad6ff05d2a98eaf7bc575..864b87f9ac3974ab6b4a5e26190beb507d647e76 100644 --- a/playbooks/basic_configuration.yml +++ b/playbooks/basic_configuration.yml @@ -98,13 +98,13 @@ tags: - influx_storage -- name: launch loki - hosts: loki +- name: launch loki + hosts: loki gather_facts: no roles: - - loki + - loki tags: - - loki + - loki - name: setup control server basic services diff --git a/quick_build_role.sh b/quick_build_role.sh index 3c5714e3ece412b446983d60c2a66825c2712988..6a5309d9a3578a719994ca8ee5033633f9820264 100755 --- a/quick_build_role.sh +++ b/quick_build_role.sh @@ -13,14 +13,14 @@ HELP fi ROLE=$1 -shift +shift echo "Building role \"$ROLE\" ..." export ANSIBLE_ROLES_PATH="$(pwd)/roles" export ANSIBLE_RETRY_FILES_ENABLED="False" -ansible-playbook "$@" -e base_path=`pwd` --tags=build /dev/stdin <<END +ansible-playbook "$@" -e base_path=`pwd` --tags=build,deploy /dev/stdin <<END --- - hosts: dev_server[0] gather_facts: no diff --git a/roles/common/defaults/main.yml b/roles/common/defaults/main.yml index 3a8368d7ab35e6709f2156b3fe9c1d1752cde663..08b48b7de666401421ded9ff185fe33d898f1f7c 100644 --- a/roles/common/defaults/main.yml +++ b/roles/common/defaults/main.yml @@ -13,6 +13,7 @@ launch_influx_sidecar: true install_dashboard: true # If true, no dashboard will be installed register_as_pipeline: true do_docker_build: true +do_deploy: false dashboard_template: "common_dashboard.json" dashboard_panels: "" diff --git a/roles/common/tasks/build_tasks.yml b/roles/common/tasks/build_tasks.yml index 572c01af895852940fb0611c1d9b068cb0700bf9..09e19712b9d1f55f9f9e8874f7bf6b7014b09bca 100644 --- a/roles/common/tasks/build_tasks.yml +++ b/roles/common/tasks/build_tasks.yml @@ -76,24 +76,6 @@ until: "push_result is not failed" -- name: "Tag also with deploy_tag {{ image_name }}:{{ version_tag }}-> {{ image_name }}:{{ deploy_tag }}" - block: - - debug: - msg: "Tag also with deploy_tag {{ image_name }}:{{ version_tag }}-> {{ image_name }}:{{ deploy_tag }}" - - docker_image: - name: "{{ docker_registry }}:{{ docker_registry_port }}/{{ image_name }}" - state: absent - force_absent: yes - tag: "{{ deploy_tag }}" - - docker_image: - name: "{{ docker_registry }}:{{ docker_registry_port }}/{{ image_name }}:{{ version_tag }}" - repository: "{{ docker_registry }}:{{ docker_registry_port }}/{{ image_name }}:{{ deploy_tag }}" - state: present - source: local - push: yes - force_tag: true - when: version_tag != deploy_tag - - name: Remove the temporary directory file: path: "{{ build_directory.path }}" diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml index fd152da9269dd08cb77a647db345bd659d8ae54b..7506825a6218f27d6708fcc53606e49fc74c9e9e 100644 --- a/roles/common/tasks/main.yml +++ b/roles/common/tasks/main.yml @@ -19,6 +19,25 @@ - build when: do_docker_build is true +- name: "Tag also with deploy_tag {{ image_name }}:{{ version_tag }}-> {{ image_name }}:{{ deploy_tag }}" + block: + - debug: + msg: "Tag also with deploy_tag {{ image_name }}:{{ version_tag }}-> {{ image_name }}:{{ deploy_tag }}" + - docker_image: + name: "{{ docker_registry }}:{{ docker_registry_port }}/{{ image_name }}" + state: absent + force_absent: yes + tag: "{{ deploy_tag }}" + - docker_image: + name: "{{ docker_registry }}:{{ docker_registry_port }}/{{ image_name }}:{{ version_tag }}" + repository: "{{ docker_registry }}:{{ docker_registry_port }}/{{ image_name }}:{{ deploy_tag }}" + state: present + source: local + push: yes + force_tag: true + when: (version_tag != deploy_tag) and do_deploy + + - name: "Tag latest only: {{ image_name }}:latest -> {{ image_name }}:{{ version_tag }}" docker_image: name: "{{ docker_registry }}:{{ docker_registry_port }}/{{ image_name }}:latest" @@ -32,3 +51,4 @@ - name: "{{ image_name }}:: Launch EDD docker container" import_tasks: launch_tasks.yml + when: not do_deploy diff --git a/roles/dig_pack_controller/templates/Dockerfile b/roles/dig_pack_controller/templates/Dockerfile index bd3e0aecb6abd630f94aac558e6debef7621c157..2a12234ead56d5920c0406f0b07965d054a128c9 100644 --- a/roles/dig_pack_controller/templates/Dockerfile +++ b/roles/dig_pack_controller/templates/Dockerfile @@ -12,7 +12,7 @@ RUN apt-get install -y python3-matplotlib && \ cd /src && \ git clone {{ mpikat_repository }} mpikat &&\ cd mpikat && \ - git checkout -B {{ mpikat_branch }} origin/{{ mpikat_branch }} && \ + git checkout {{ mpikat_branch }} && \ pip3 install . WORKDIR /root diff --git a/roles/edd_master_controller/tasks/main.yml b/roles/edd_master_controller/tasks/main.yml index 0bbfb80b649f7a79c23ccdb8f8db4c428b6aff8f..b61cdf968b4c6c680da0b51ae1b304187af6b4cd 100644 --- a/roles/edd_master_controller/tasks/main.yml +++ b/roles/edd_master_controller/tasks/main.yml @@ -58,6 +58,7 @@ launch_redis_sidecar: true install_dashboard: false register_as_pipeline: false + deploy_tag: "{{ version_tag }}" # master controller does not get a deploy tag but always uses the version tag as it cannot be updated on-the-fly anyway - set_fact: master_controller_ip: "{{ ansible_host }}" diff --git a/roles/edd_master_controller/templates/Dockerfile b/roles/edd_master_controller/templates/Dockerfile index b3d8f6cf0ffe5246aae68405a2df6539a2f67615..a547009bfcb60a823829054276132df6f5fca7de 100644 --- a/roles/edd_master_controller/templates/Dockerfile +++ b/roles/edd_master_controller/templates/Dockerfile @@ -29,12 +29,12 @@ ENV ANSIBLE_CONFIG=/etc/ansible/ansible.cfg RUN cd /src/ &&\ git clone {{ mpikat_repository }} mpikat &&\ cd mpikat && \ - git checkout -B {{ mpikat_branch }} origin/{{ mpikat_branch }}&& \ + git checkout {{ mpikat_branch }} && \ pip3 install . && \ cd ~ &&\ git clone {{ provision_repository }} edd_ansible &&\ cd edd_ansible && \ - git checkout -B {{ provision_branch }} origin/{{ provision_branch }} && \ + git checkout {{ provision_branch }} && \ cd .. && \ ansible-galaxy collection install -r edd_ansible/{{ edd_inventory_folder }}/requirements.yml &&\ mkdir -p /etc/ansible/ &&\ diff --git a/roles/effelsberg_scpi_interface/templates/Dockerfile b/roles/effelsberg_scpi_interface/templates/Dockerfile index 8aeec71a9a786879cff0780dc05080176bfeb311..19774612eef5fcaf39a334fcc0f7f15a3140c841 100644 --- a/roles/effelsberg_scpi_interface/templates/Dockerfile +++ b/roles/effelsberg_scpi_interface/templates/Dockerfile @@ -10,7 +10,7 @@ USER root RUN cd /src/ &&\ git clone {{ mpikat_repository }} mpikat &&\ cd mpikat && \ - git checkout -B {{ mpikat_branch }} origin/{{ mpikat_branch }}&& \ + git checkout {{ mpikat_branch }} && \ pip3 install . && \ echo 'DONE!' diff --git a/roles/effelsberg_status_server/templates/Dockerfile b/roles/effelsberg_status_server/templates/Dockerfile index 674fcc33e0d762b6616ba7267d1364c677cb14e0..594f69b614afe27736d2626d42e31151b9ee838d 100644 --- a/roles/effelsberg_status_server/templates/Dockerfile +++ b/roles/effelsberg_status_server/templates/Dockerfile @@ -16,7 +16,7 @@ RUN cd /src/ &&\ cd /src &&\ git clone {{ mpikat_repository }} mpikat &&\ cd mpikat && \ - git checkout -B {{ mpikat_branch }} origin/{{ mpikat_branch }}&& \ + git checkout {{ mpikat_branch }} && \ pip3 install . && \ echo 'DONE!' diff --git a/roles/fits_interface/templates/Dockerfile b/roles/fits_interface/templates/Dockerfile index a5f556e7d03bf2c462f5bb8860eeaef44859b630..e750cc1b2039bb30a2d5ac5dec6e55ca55a72dc4 100644 --- a/roles/fits_interface/templates/Dockerfile +++ b/roles/fits_interface/templates/Dockerfile @@ -12,7 +12,7 @@ RUN apt-get install -y python3-matplotlib && \ cd /src && \ git clone {{ mpikat_repository }} mpikat &&\ cd mpikat && \ - git checkout -B {{ mpikat_branch }} origin/{{ mpikat_branch }}&& \ + git checkout {{ mpikat_branch }} && \ pip3 install . WORKDIR /root diff --git a/roles/gated_full_stokes_spectrometer/templates/Dockerfile b/roles/gated_full_stokes_spectrometer/templates/Dockerfile index af0e18de1c374e0119ee8e7c8769327015a1b261..4b1309c264660e857a1c7aa6a963b26a0b1b8519 100644 --- a/roles/gated_full_stokes_spectrometer/templates/Dockerfile +++ b/roles/gated_full_stokes_spectrometer/templates/Dockerfile @@ -10,6 +10,6 @@ USER root RUN cd /src &&\ git clone {{ mpikat_repository }} mpikat &&\ cd mpikat && \ - git checkout -B {{ mpikat_branch }} origin/{{ mpikat_branch }} && \ + git checkout {{ mpikat_branch }} && \ pip3 install . WORKDIR /root diff --git a/roles/gated_spectrometer/templates/Dockerfile b/roles/gated_spectrometer/templates/Dockerfile index 1f537e307e94c2e9b81bf936fb730cf00d2197d9..bea4dcce03f71893b64a7b99af886175b1e93fea 100644 --- a/roles/gated_spectrometer/templates/Dockerfile +++ b/roles/gated_spectrometer/templates/Dockerfile @@ -10,7 +10,7 @@ USER root RUN cd /src/ &&\ git clone {{ mpikat_repository }} mpikat &&\ cd mpikat && \ - git checkout -B {{ mpikat_branch }} origin/{{ mpikat_branch }} && \ + git checkout {{ mpikat_branch }} && \ pip3 install . WORKDIR /root diff --git a/roles/hdf5_writer/templates/Dockerfile b/roles/hdf5_writer/templates/Dockerfile index 0a1e76135918366040a6809ef69709fff1423e85..ada5846e17c3111cbb2d67d6dc2a0e07a0b9be57 100644 --- a/roles/hdf5_writer/templates/Dockerfile +++ b/roles/hdf5_writer/templates/Dockerfile @@ -14,7 +14,7 @@ RUN mkdir -p /src && \ cd /src && \ git clone {{ mpikat_repository }} mpikat &&\ cd mpikat && \ - git checkout -B {{ mpikat_branch }} origin/{{ mpikat_branch }}&& \ + git checkout {{ mpikat_branch }} && \ pip3 install . WORKDIR /root diff --git a/roles/pipeline_builder/tasks/main.yml b/roles/pipeline_builder/tasks/main.yml index e202c20cddedaf0125fc237f489fed11488aa71b..34778350a18599e4c3150e4a1344f84ff101be12 100644 --- a/roles/pipeline_builder/tasks/main.yml +++ b/roles/pipeline_builder/tasks/main.yml @@ -12,3 +12,16 @@ - build - buildbase - buildproducts + +# When the pipeline builder runs without tag, we have a deploy of the role, +# i.e. the containers with version_tag get the additional deploy_tag, if +# specified +- name: Deploy role + include_role: + role: "{{ item }}" + vars: + do_deploy: true + loop: "{{ build_list }}" + loop_control: + index_var: index + when: inventory_hostname == groups['gpu_server'][index % groups['gpu_server']|length] diff --git a/roles/skarab_pfb_controller/tasks/main.yml b/roles/skarab_pfb_controller/tasks/main.yml index e05d72101b1df3bf1bcbb771442c740ec208d202..8ebc762309bb27f63218150a0cb7e74cf09f0136 100644 --- a/roles/skarab_pfb_controller/tasks/main.yml +++ b/roles/skarab_pfb_controller/tasks/main.yml @@ -1,7 +1,7 @@ --- - fail: - msg: "WARNING!! SKARAB IS DEPRECATED. NO NEW SKARAB VERSIONS WILL BE BUILD DUE TO INCOMPATIBILITIES WITH NON-OUTDATED UBUNTU VERSIONS. BE CAUTIOUS WHEN USE PREVIOUS VERSIONS WITH CARE!" + msg: "WARNING!! SKARAB IS DEPRECATED. NO NEW SKARAB VERSIONS WILL BE BUILD DUE TO INCOMPATIBILITIES WITH NON-OUTDATED UBUNTU VERSIONS. BE CAUTIOUS! USE PREVIOUS VERSIONS WITH CARE!" ignore_errors: yes tags: - always diff --git a/roles/skarab_pfb_controller/templates/Dockerfile b/roles/skarab_pfb_controller/templates/Dockerfile index 25eba21a133712f1a26fded9161b77461c3481e5..00659876ff713ff476e7d19b652c8aced0f0d2ba 100644 --- a/roles/skarab_pfb_controller/templates/Dockerfile +++ b/roles/skarab_pfb_controller/templates/Dockerfile @@ -24,7 +24,7 @@ RUN cd /src && \ cd /src && \ git clone {{ mpikat_repository }} mpikat &&\ cd mpikat && \ - git checkout -B {{ mpikat_branch }} origin/{{ mpikat_branch }} && \ + git checkout {{ mpikat_branch }} && \ git lfs pull &&\ pip3 install .