Commit ca9f79e8 by Yvon

deployement : only show merges + format + add link to redmine + rework email

parent c8394a0e
Pipeline #3150 failed with stage
in 1 minute 6 seconds
......@@ -6,6 +6,12 @@ coops_mails = {
'graoucoop': 'change me on preprod only !'
}
coops_usernames = {
'lacagette' : 'Antonin',
'supercafoutch' : 'Marin',
'graoucoop' : 'Julien'
}
coops_preprod_urls = {
'lacagette': 'https://preprod.odoo.lacagette-coop.fr',
'supercafoutch': 'https://preprod.odoo.supercafoutch.cooperatic.fr/',
......
......@@ -26,10 +26,9 @@ def run(tp_file,od_file,coop):
od_file = "/home/django/third-party/scripts/data/ci_diff_Odoo_last.txt"
od_file_exists = os.path.exists(od_file)
body = "Cher client, chère cliente, nous expérimentons un nouvel outil pour faciliter les tests et la mise à jour du code.\n\n"
body = body + "De nouveaux développements ont été mis en ligne sur " + ci_secrets.coops_preprod_urls[coop] + ".\n"
body = body + "Ci dessous le récapitulatif des développements en attente de mise en production."
body = body + "Merci de tester leur fonctionnement et nous faire un retour sur redmine quand c'est possible, sinon en répondant à assistance-redmine@coopdev.fr." + ".\n\n\n"
body = "Bonjour" + ci_secrets.coops_usernames[coop] +",\n\n"
body = body + "De nouveaux développements en attente de mise en production ont été mis en ligne sur " + ci_secrets.coops_preprod_urls[coop] + ".\n"
body = body + "On te remercie de bien vouloir tester ces évolutions et de nous faire un retour via les liens redmine ci-dessous (si possible), ou en répondant à assistance-redmine@coopdev.fr." + ".\n\n\n"
if tp_file_exists:
tp_f = open(tp_file,"r")
body = body + "Evolutions des applications tierces :\n\n" + tp_f.read() + "\n\n"
......@@ -38,7 +37,7 @@ def run(tp_file,od_file,coop):
od_f = open(od_file,"r")
body = body + "Evolutions d'odoo :\n\n" + od_f.read() + "\n\n"
tp_f.close()
body = body + "Cordialement.\n\n(Ceci est un mail automatique.)"
body = body + "Coopérativement.\nCoopdev Foodcoops"
msg.set_content(body)
s = smtplib.SMTP('smtp-relay.sendinblue.com', port=587)
s.login("brevo@ksuite-coopdev.fr", ci_secrets.mail_server_password)
......
......@@ -37,7 +37,13 @@ update_code() {
###COMPARE BRANCHES AND DECIDE IF WE NEED TO CREATE A FILE CONTAINING NEW COMMITS###
new_commits="$( git log origin/${coop}_prod...origin/dev_cooperatic --no-merges --oneline )"
#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 new commits"
#As there are no new commits in prod, we don't want to send email for this repo.
......
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