Commit 54614157 by Administrator

Merge branch 'dev_cooperatic' into 'lacagette_prod'

Correctif parametres bouton 'Oubli validation service' dans FAQ

See merge request !257
parents 07102692 fed8bf23
Pipeline #3350 failed with stage
in 1 minute 5 seconds
...@@ -159,3 +159,5 @@ LOSSES_LOC_ID = 33 ...@@ -159,3 +159,5 @@ LOSSES_LOC_ID = 33
LOSSES_PICKING_TYPE_ID = 10 LOSSES_PICKING_TYPE_ID = 10
AUTOCONSO_LOC_ID = 27 AUTOCONSO_LOC_ID = 27
AUTOCONSO_PICKING_TYPE_ID = 7 AUTOCONSO_PICKING_TYPE_ID = 7
SUBSCRIPTION_ASK_FOR_SEX = True
\ No newline at end of file
...@@ -5,7 +5,7 @@ ci_data_dir="/home/django/third-party/scripts/data" ...@@ -5,7 +5,7 @@ ci_data_dir="/home/django/third-party/scripts/data"
coop=$1 coop=$1
instance=$2 #(prod not supported for now) instance=$2
#move to the third argument #move to the third argument
shift shift
shift shift
...@@ -35,17 +35,26 @@ fi ...@@ -35,17 +35,26 @@ fi
now=$( date +%Y%m%d_%H%M%S ) now=$( date +%Y%m%d_%H%M%S )
source "${ci_dir}/update_code.sh" source "${ci_dir}/prepare_mail.sh"
source "${ci_dir}/update_instance.sh"
if [[ "${instance}" == "preprod" ]]; then
repo="third-party"
echo "Prepare mail" "${coop}" "${instance}" "${repo}" "${now}" "${send_mails}" "${ci_dir}" "${ci_data_dir}"
prepare_mail "${coop}" "${instance}" "${repo}" "${now}" "${send_mails}" "${ci_dir}" "${ci_data_dir}"|| exit 1
repo="Odoo"
echo "Prepare mail" "${coop}" "${instance}" "${repo}" "${now}" "${send_mails}" "${ci_dir}" "${ci_data_dir}"
prepare_mail "${coop}" "${instance}" "${repo}" "${now}" "${send_mails}" "${ci_dir}" "${ci_data_dir}" || exit 1
fi
repo="third-party" repo="third-party"
echo "START PROCESS" "${coop}" "${instance}" "${repo}" "${now}" echo "Update instance" "${coop}" "${instance}" "${repo}" "${now}" "${send_mails}" "${ci_dir}" "${ci_data_dir}"
update_code "${coop}" "${instance}" "${repo}" "${now}" "${send_mails}" || exit 1 update_instance "${coop}" "${instance}" "${repo}" "${now}" "${send_mails}" "${ci_dir}" "${ci_data_dir}" || exit 1
echo "DONE"
repo="Odoo" repo="Odoo"
echo "START PROCESS" "${coop}" "${instance}" "${repo}" "${now}" echo "Update instance" "${coop}" "${instance}" "${repo}" "${now}" "${send_mails}" "${ci_dir}" "${ci_data_dir}"
update_code "${coop}" "${instance}" "${repo}" "${now}" "${send_mails}" || exit 1 update_instance "${coop}" "${instance}" "${repo}" "${now}" "${send_mails}" "${ci_dir}" "${ci_data_dir}" || exit 1
echo "DONE"
if [[ "${instance}" == "preprod" ]] && ${send_mails}; then if [[ "${instance}" == "preprod" ]] && ${send_mails}; then
python3 "${ci_dir}/send_mail.py" "${ci_data_dir}/ci_diff_third-party_${now}.txt" "${ci_data_dir}/ci_diff_Odoo_${now}.txt" "${coop}" python3 "${ci_dir}/send_mail.py" "${ci_data_dir}/ci_diff_third-party_${now}.txt" "${ci_data_dir}/ci_diff_Odoo_${now}.txt" "${coop}"
......
...@@ -35,8 +35,14 @@ grant lacagette to odoo; ...@@ -35,8 +35,14 @@ grant lacagette to odoo;
alter database lacagette owner to odoo; alter database lacagette owner to odoo;
select pg_terminate_backend(pid) from pg_stat_activity where pid <> pg_backend_pid() and datname = 'lacagette'; select pg_terminate_backend(pid) from pg_stat_activity where pid <> pg_backend_pid() and datname = 'lacagette';
alter database lacagette rename to odoo; alter database lacagette rename to odoo;
GRANT CONNECT ON DATABASE odoo TO metabase;
GRANT USAGE ON SCHEMA public TO metabase;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO metabase;
exit exit
nano /etc/postgresql/10/main/pg_hba.conf puis remplacer lacagette par odoo sur la ligne qui concerne metabase
exit exit
service postgresql restart
//CONFIGS //CONFIGS
sed -i -e 's/\/lacagette\//\/odoo\//g' /home/odoo/odoo-server.conf sed -i -e 's/\/lacagette\//\/odoo\//g' /home/odoo/odoo-server.conf
...@@ -61,3 +67,5 @@ delete from ir_attachment where mimetype in ('text/css','application/javascript' ...@@ -61,3 +67,5 @@ delete from ir_attachment where mimetype in ('text/css','application/javascript'
//puis deux restarts nécessaires... de odoo //puis deux restarts nécessaires... de odoo
restart django. restart django.
//METABASE : change database name in settings
\ No newline at end of file
prepare_mail() {
#Read arguments and set variables
coop=$1
instance=$2
repo=$3
now=$4
send_mails=$5
ci_dir=$6
ci_data_dir=$7
if [[ ${repo} == "third-party" ]]; then
user="django"
elif [[ ${repo} == "Odoo" ]]; then
user="odoo"
else
echo "Incorrect repo name : ${repo}"
if ${send_mails}; then
python3 "${ci_dir}/send_error_mail.py" "${coop} ${instance} ${repo} : incorrect repo name"
fi
exit 1
fi
cd /home/${user}/${repo}
su ${user} -c "git fetch --all"
#Check branch
branch_found_str=$( su ${user} -c "git ls-remote origin ${coop}_prod" ) #seems that git ls-remote is not "failing" so we need to check output
if [ -z "${branch_found_str}" ]; then
#branch prod does not exist, cannot go on
echo "${coop} ${instance} ${repo}: branch ${coop}_prod does not exist"
if ${send_mails}; then
python3 "${ci_dir}/send_error_mail.py" "${coop} ${instance} ${repo} : branch ${coop}_prod does not exist"
fi
exit 1
fi
###COMPARE BRANCHES AND DECIDE IF WE NEED TO CREATE A FILE CONTAINING NEW COMMITS###
#initialize file
if ! test -f "${ci_data_dir}/ci_diff_${repo}_last.txt"; then
touch "${ci_data_dir}/ci_diff_${repo}_last.txt"
fi
#new_commits="$( git log origin/${coop}_prod...origin/dev_cooperatic --no-merges --oneline )" (old version)
#Let's break down the new big line below :
#origin/${coop}_prod...origin/dev_cooperatic : we look for difference between develop branch and prod branch
#--pretty=format:'%s' : get rid of commit id
#the big grep+sed group : discard lines not maching pattern "merge [0-9]\+-... into dev_cooperatic" and only keep the [0-9]\+-.... part with a link to redmine
new_commits="$( git log origin/${coop}_prod...origin/dev_cooperatic --merges --oneline --pretty=format:'%s' | grep "into 'dev_cooperatic'" | sed "s/Merge branch '//g" | sed "s/' into 'dev_cooperatic'//g" | grep "^[0-9]\+" | sed -E 's/(^[0-9]+)/\<a href=\"https\:\/\/redmine.coopdev.fr\/issues\/\1\"\>\1\<\/a\>/g' )"
if [ -z "${new_commits}" ]; then
echo "${coop} ${instance} ${repo} : no difference between prod and dev_cooperatic"
#There are no difference between prod and dev_cooperatic therefore we don't want to send email for this repo.
#To inform the mailer that there is nothing new, we do not create ci_diff file at current time.
#The mailer will therefore use ci_diff_last to get the list of commits for the client.
#Not only there is nothing new, but also there is just no difference,
#therefore we need to erase the content the ci_diff_last file if not already empty (save time of first time it was erased)
if [[ -s "${ci_data_dir}/ci_diff_${repo}_last.txt" ]]; then
> "${ci_data_dir}/ci_diff_${repo}_last.txt"
fi
else
echo "${new_commits}" > "${ci_data_dir}/ci_diff_${repo}_${now}.txt"
#See if commit difference is the same than last time
if cmp "${ci_data_dir}/ci_diff_${repo}_last.txt" "${ci_data_dir}/ci_diff_${repo}_${now}.txt"; then
#As there are no new commits in prod, we don't want to send email for this repo.
#To indicate that, we delete just created ci_diff file at current time.
rm "${ci_data_dir}/ci_diff_${repo}_${now}.txt"
echo "${coop} ${instance} ${repo} : ci_diff_${repo} files are identical"
else
#We have created new ci_diff.
#Replace old ci_diff_last by new one
rm "${ci_data_dir}/ci_diff_${repo}_last.txt"
cp "${ci_data_dir}/ci_diff_${repo}_${now}.txt" "${ci_data_dir}/ci_diff_${repo}_last.txt"
fi
fi
}
\ No newline at end of file
...@@ -6,7 +6,7 @@ def is_coop_supported(coop): ...@@ -6,7 +6,7 @@ def is_coop_supported(coop):
def is_instance_supported(instance): def is_instance_supported(instance):
return instance == "preprod" or instance == "test" or instance == "dev" return instance == "preprod" or instance == "test" or instance == "dev" or instance == "prod"
def get_mail(coop): def get_mail(coop):
......
<div id="faqBDM" class=" mt-3"> <div id="faqBDM" class=" mt-3">
<div class="page_title txtcenter"> <div class="page_title txtcenter">
...@@ -157,8 +158,8 @@ ...@@ -157,8 +158,8 @@
href="javascript:void(0);" href="javascript:void(0);"
target="_blank" target="_blank"
type="button" type="button"
class="btn--primary faq_link_button ask_bdm_form_link" class="btn--primary faq_link_button"
id="request_form_link_btn3" id="late_service_form_link_btn"
> >
Oubli validation service Oubli validation service
</a> </a>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment