Skip to content
Snippets Groups Projects
Commit 8add90fc authored by Tobias Winchen's avatar Tobias Winchen
Browse files

Merge branch 'devel' into 'production'

Ease deploy and rollback

See merge request !86
parents 46dd7c15 ff31fd8d
Branches
Tags 230223.0
1 merge request!86Ease deploy and rollback
Showing
with 52 additions and 35 deletions
...@@ -98,13 +98,13 @@ ...@@ -98,13 +98,13 @@
tags: tags:
- influx_storage - influx_storage
- name: launch loki - name: launch loki
hosts: loki hosts: loki
gather_facts: no gather_facts: no
roles: roles:
- loki - loki
tags: tags:
- loki - loki
- name: setup control server basic services - name: setup control server basic services
......
...@@ -13,14 +13,14 @@ HELP ...@@ -13,14 +13,14 @@ HELP
fi fi
ROLE=$1 ROLE=$1
shift shift
echo "Building role \"$ROLE\" ..." echo "Building role \"$ROLE\" ..."
export ANSIBLE_ROLES_PATH="$(pwd)/roles" export ANSIBLE_ROLES_PATH="$(pwd)/roles"
export ANSIBLE_RETRY_FILES_ENABLED="False" 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] - hosts: dev_server[0]
gather_facts: no gather_facts: no
......
...@@ -13,6 +13,7 @@ launch_influx_sidecar: true ...@@ -13,6 +13,7 @@ launch_influx_sidecar: true
install_dashboard: true # If true, no dashboard will be installed install_dashboard: true # If true, no dashboard will be installed
register_as_pipeline: true register_as_pipeline: true
do_docker_build: true do_docker_build: true
do_deploy: false
dashboard_template: "common_dashboard.json" dashboard_template: "common_dashboard.json"
dashboard_panels: "" dashboard_panels: ""
......
...@@ -76,24 +76,6 @@ ...@@ -76,24 +76,6 @@
until: "push_result is not failed" 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 - name: Remove the temporary directory
file: file:
path: "{{ build_directory.path }}" path: "{{ build_directory.path }}"
......
...@@ -19,6 +19,25 @@ ...@@ -19,6 +19,25 @@
- build - build
when: do_docker_build is true 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 }}" - name: "Tag latest only: {{ image_name }}:latest -> {{ image_name }}:{{ version_tag }}"
docker_image: docker_image:
name: "{{ docker_registry }}:{{ docker_registry_port }}/{{ image_name }}:latest" name: "{{ docker_registry }}:{{ docker_registry_port }}/{{ image_name }}:latest"
...@@ -32,3 +51,4 @@ ...@@ -32,3 +51,4 @@
- name: "{{ image_name }}:: Launch EDD docker container" - name: "{{ image_name }}:: Launch EDD docker container"
import_tasks: launch_tasks.yml import_tasks: launch_tasks.yml
when: not do_deploy
...@@ -12,7 +12,7 @@ RUN apt-get install -y python3-matplotlib && \ ...@@ -12,7 +12,7 @@ RUN apt-get install -y python3-matplotlib && \
cd /src && \ cd /src && \
git clone {{ mpikat_repository }} mpikat &&\ git clone {{ mpikat_repository }} mpikat &&\
cd mpikat && \ cd mpikat && \
git checkout -B {{ mpikat_branch }} origin/{{ mpikat_branch }} && \ git checkout {{ mpikat_branch }} && \
pip3 install . pip3 install .
WORKDIR /root WORKDIR /root
...@@ -58,6 +58,7 @@ ...@@ -58,6 +58,7 @@
launch_redis_sidecar: true launch_redis_sidecar: true
install_dashboard: false install_dashboard: false
register_as_pipeline: 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: - set_fact:
master_controller_ip: "{{ ansible_host }}" master_controller_ip: "{{ ansible_host }}"
......
...@@ -29,12 +29,12 @@ ENV ANSIBLE_CONFIG=/etc/ansible/ansible.cfg ...@@ -29,12 +29,12 @@ ENV ANSIBLE_CONFIG=/etc/ansible/ansible.cfg
RUN cd /src/ &&\ RUN cd /src/ &&\
git clone {{ mpikat_repository }} mpikat &&\ git clone {{ mpikat_repository }} mpikat &&\
cd mpikat && \ cd mpikat && \
git checkout -B {{ mpikat_branch }} origin/{{ mpikat_branch }}&& \ git checkout {{ mpikat_branch }} && \
pip3 install . && \ pip3 install . && \
cd ~ &&\ cd ~ &&\
git clone {{ provision_repository }} edd_ansible &&\ git clone {{ provision_repository }} edd_ansible &&\
cd edd_ansible && \ cd edd_ansible && \
git checkout -B {{ provision_branch }} origin/{{ provision_branch }} && \ git checkout {{ provision_branch }} && \
cd .. && \ cd .. && \
ansible-galaxy collection install -r edd_ansible/{{ edd_inventory_folder }}/requirements.yml &&\ ansible-galaxy collection install -r edd_ansible/{{ edd_inventory_folder }}/requirements.yml &&\
mkdir -p /etc/ansible/ &&\ mkdir -p /etc/ansible/ &&\
......
...@@ -10,7 +10,7 @@ USER root ...@@ -10,7 +10,7 @@ USER root
RUN cd /src/ &&\ RUN cd /src/ &&\
git clone {{ mpikat_repository }} mpikat &&\ git clone {{ mpikat_repository }} mpikat &&\
cd mpikat && \ cd mpikat && \
git checkout -B {{ mpikat_branch }} origin/{{ mpikat_branch }}&& \ git checkout {{ mpikat_branch }} && \
pip3 install . && \ pip3 install . && \
echo 'DONE!' echo 'DONE!'
......
...@@ -16,7 +16,7 @@ RUN cd /src/ &&\ ...@@ -16,7 +16,7 @@ RUN cd /src/ &&\
cd /src &&\ cd /src &&\
git clone {{ mpikat_repository }} mpikat &&\ git clone {{ mpikat_repository }} mpikat &&\
cd mpikat && \ cd mpikat && \
git checkout -B {{ mpikat_branch }} origin/{{ mpikat_branch }}&& \ git checkout {{ mpikat_branch }} && \
pip3 install . && \ pip3 install . && \
echo 'DONE!' echo 'DONE!'
......
...@@ -12,7 +12,7 @@ RUN apt-get install -y python3-matplotlib && \ ...@@ -12,7 +12,7 @@ RUN apt-get install -y python3-matplotlib && \
cd /src && \ cd /src && \
git clone {{ mpikat_repository }} mpikat &&\ git clone {{ mpikat_repository }} mpikat &&\
cd mpikat && \ cd mpikat && \
git checkout -B {{ mpikat_branch }} origin/{{ mpikat_branch }}&& \ git checkout {{ mpikat_branch }} && \
pip3 install . pip3 install .
WORKDIR /root WORKDIR /root
...@@ -10,6 +10,6 @@ USER root ...@@ -10,6 +10,6 @@ USER root
RUN cd /src &&\ RUN cd /src &&\
git clone {{ mpikat_repository }} mpikat &&\ git clone {{ mpikat_repository }} mpikat &&\
cd mpikat && \ cd mpikat && \
git checkout -B {{ mpikat_branch }} origin/{{ mpikat_branch }} && \ git checkout {{ mpikat_branch }} && \
pip3 install . pip3 install .
WORKDIR /root WORKDIR /root
...@@ -10,7 +10,7 @@ USER root ...@@ -10,7 +10,7 @@ USER root
RUN cd /src/ &&\ RUN cd /src/ &&\
git clone {{ mpikat_repository }} mpikat &&\ git clone {{ mpikat_repository }} mpikat &&\
cd mpikat && \ cd mpikat && \
git checkout -B {{ mpikat_branch }} origin/{{ mpikat_branch }} && \ git checkout {{ mpikat_branch }} && \
pip3 install . pip3 install .
WORKDIR /root WORKDIR /root
...@@ -14,7 +14,7 @@ RUN mkdir -p /src && \ ...@@ -14,7 +14,7 @@ RUN mkdir -p /src && \
cd /src && \ cd /src && \
git clone {{ mpikat_repository }} mpikat &&\ git clone {{ mpikat_repository }} mpikat &&\
cd mpikat && \ cd mpikat && \
git checkout -B {{ mpikat_branch }} origin/{{ mpikat_branch }}&& \ git checkout {{ mpikat_branch }} && \
pip3 install . pip3 install .
WORKDIR /root WORKDIR /root
...@@ -12,3 +12,16 @@ ...@@ -12,3 +12,16 @@
- build - build
- buildbase - buildbase
- buildproducts - 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]
--- ---
- fail: - 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 ignore_errors: yes
tags: tags:
- always - always
......
...@@ -24,7 +24,7 @@ RUN cd /src && \ ...@@ -24,7 +24,7 @@ RUN cd /src && \
cd /src && \ cd /src && \
git clone {{ mpikat_repository }} mpikat &&\ git clone {{ mpikat_repository }} mpikat &&\
cd mpikat && \ cd mpikat && \
git checkout -B {{ mpikat_branch }} origin/{{ mpikat_branch }} && \ git checkout {{ mpikat_branch }} && \
git lfs pull &&\ git lfs pull &&\
pip3 install . pip3 install .
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment