Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
O
odoo_docker
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Déploiement
Registre de conteneurs
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse du dépôt
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté GitLab
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
Le Filament
odoo_docker
Validations
a2752e45
Valider
a2752e45
rédigé
Il y a 9 mois
par
Théo - Le Filament
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
build: add headers to CSV and improve module installation logging
parent
cac6b4db
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
2
Pipelines
1
Afficher les modifications d'espaces
En ligne
Côte à côte
Affichage de
2 fichiers modifiés
10.0.Dockerfile
+2
-1
2 ajouts, 1 suppression
10.0.Dockerfile
get_addons
+188
-18
188 ajouts, 18 suppressions
get_addons
avec
190 ajouts
et
19 suppressions
10.0.Dockerfile
+
2
−
1
Voir le fichier @
a2752e45
...
@@ -71,7 +71,8 @@ RUN set -x; \
...
@@ -71,7 +71,8 @@ RUN set -x; \
&&
git clone
--single-branch
--branch
"
${
branch
}
"
--depth
1
"
${
repo
}
"
/tmp/repo
\
&&
git clone
--single-branch
--branch
"
${
branch
}
"
--depth
1
"
${
repo
}
"
/tmp/repo
\
&&
commit
=
"
$(
git
-C
/tmp/repo rev-parse HEAD
)
"
\
&&
commit
=
"
$(
git
-C
/tmp/repo rev-parse HEAD
)
"
\
&&
mv
/tmp/repo/
*
/opt/odoo/odoo/
\
&&
mv
/tmp/repo/
*
/opt/odoo/odoo/
\
&&
echo
"
${
repo
}
;
${
commit
}
"
>
$SAVE_COMMITS_DIR
/
$SAVE_COMMITS_FILENAME
\
&&
echo
"repo;ref;commit"
>
$SAVE_COMMITS_DIR
/
$SAVE_COMMITS_FILENAME
\
&&
echo
"
${
repo
}
;
${
branch
}
;
${
commit
}
"
>>
$SAVE_COMMITS_DIR
/
$SAVE_COMMITS_FILENAME
\
&&
rm
-r
/tmp/repo
\
&&
rm
-r
/tmp/repo
\
# Only keep French translations.
# Only keep French translations.
&& find /opt/odoo/odoo/addons/*/i18n/ /opt/odoo/odoo/odoo/addons/base/i18n/ -type f -not -name 'fr.po' -delete \
&& find /opt/odoo/odoo/addons/*/i18n/ /opt/odoo/odoo/odoo/addons/base/i18n/ -type f -not -name 'fr.po' -delete \
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
get_addons
+
188
−
18
Voir le fichier @
a2752e45
#!/bin/sh
#!/bin/sh
set
-e
#
set -e
ODOO_ROOT_DIR
=
${
ODOO_ROOT_DIR
:-
'/opt/odoo'
}
ODOO_ROOT_DIR
=
${
ODOO_ROOT_DIR
:-
'/opt/odoo'
}
SAVE_COMMITS_DIR
=
${
SAVE_COMMITS_DIR
:-
'/opt/odoo_commits'
}
SAVE_COMMITS_DIR
=
${
SAVE_COMMITS_DIR
:-
'/opt/odoo_commits'
}
SAVE_COMMITS_FILENAME
=
${
SAVE_COMMITS_FILENAME
:-
'custom_addons'
}
SAVE_COMMITS_FILENAME
=
${
SAVE_COMMITS_FILENAME
:-
'custom_addons'
}
TMP_REPO_PATH
=
${
TEMP_REPO_PATH
:-
'/tmp/repo'
}
TMP_REPO_PATH
=
${
TEMP_REPO_PATH
:-
'/tmp/repo'
}
CSV_FILE
=
"
${
SAVE_COMMITS_DIR
}
/
${
SAVE_COMMITS_FILENAME
}
"
CSV_HEADERS
=
'repo;ref;commit;module;dst'
# logging section: begin
STYLE_FGBLACK
=
'\033[30m'
STYLE_FGRED
=
'\033[31m'
STYLE_FGGREEN
=
'\033[32m'
STYLE_FGYELLOW
=
'\033[33m'
STYLE_FGBLUE
=
'\033[34m'
STYLE_FGMAGENTA
=
'\033[35m'
STYLE_FGCYAN
=
'\033[36m'
STYLE_FGLIGHTGRAY
=
'\033[37m'
STYLE_BGBLACK
=
'\033[40m'
STYLE_BGRED
=
'\033[41m'
STYLE_BGGREEN
=
'\033[42m'
STYLE_BGYELLOW
=
'\033[43m'
STYLE_BGBLUE
=
'\033[44m'
STYLE_BGMAGENTA
=
'\033[45m'
STYLE_BGCYAN
=
'\033[46m'
STYLE_BGLIGHTGRAY
=
'\033[47m'
STYLE_DEFAULT
=
'\033[39m'
STYLE_BOLD
=
'\033[1m'
STYLE_NORMAL
=
'\033[0m'
print_info
()
{
msg
=
"
$1
"
echo
"
${
STYLE_FGBLUE
}
info:
${
msg
}${
STYLE_DEFAULT
}
"
}
print_success
()
{
msg
=
"
$1
"
print_info
"
${
msg
}
${
STYLE_FGGREEN
}
success
${
STYLE_DEFAULT
}
"
}
print_failed
()
{
msg
=
"
$1
"
print_info
"
${
msg
}
${
STYLE_FGRED
}
failed
${
STYLE_DEFAULT
}
"
}
print_err
()
{
msg
=
"
$1
"
exit_code
=
"
${
2
:-
0
}
"
echo
"
${
STYLE_BOLD
}${
STYLE_FGRED
}
err:
${
msg
}${
STYLE_DEFAULT
}${
STYLE_NORMAL
}
"
[
"
$exit_code
"
!=
"0"
]
&&
exit_script
"
$exit_code
"
}
exit_script
()
{
exit_code
=
"
${
1
:-
0
}
"
exit
"
$exit_code
"
}
# logging section: end
save_commit
()
{
save_commit
()
{
repo
=
"
$1
"
repo
=
"
$1
"
commit
=
"
$2
"
ref
=
"
$2
"
module
=
"
$3
"
commit
=
"
$3
"
dst
=
"
$4
"
module
=
"
$4
"
echo
"
${
repo
}
;
${
commit
}
;
${
module
}
;
${
dst
}
"
>>
"
${
SAVE_COMMITS_DIR
}
/
${
SAVE_COMMITS_FILENAME
}
"
dst
=
"
$5
"
if
[
-f
"
$CSV_FILE
"
]
;
then
if
[
"
$(
head
--lines
=
1
$CSV_FILE
)
"
!=
"
$CSV_HEADERS
"
]
;
then
sed
-i
"1s/^/
${
CSV_HEADERS
}
\n
/"
"
$CSV_FILE
"
if
[
"
$?
"
-ne
0
]
;
then
return
1
fi
fi
else
echo
"
$CSV_HEADERS
"
>
"
$CSV_FILE
"
fi
echo
"
${
repo
}
;
${
ref
}
;
${
commit
}
;
${
module
}
;
${
dst
}
"
>>
"
$CSV_FILE
"
if
[
"
$?
"
-ne
0
]
;
then
return
1
fi
return
0
}
}
repo
=
"
$1
"
repo
=
"
$1
"
...
@@ -23,30 +91,132 @@ dst="$1"
...
@@ -23,30 +91,132 @@ dst="$1"
shift
shift
modules
=
"
$@
"
modules
=
"
$@
"
set
+e
# Clonning repo.
# set +e
log_action
=
"repo '
$repo
': clonning [no tree + branch]..."
print_info
"
$log_action
"
git clone
--branch
"
${
ref
}
"
--filter
=
tree:0
"
${
repo
}
"
"
${
TMP_REPO_PATH
}
"
if
[
"
$?
"
-eq
0
]
;
then
print_success
"
$log_action
"
else
print_failed
"
$log_action
"
log_action
=
"repo '
$repo
': clonning [no tree]..."
print_info
"
$log_action
"
git clone
--filter
=
tree:0
"
${
repo
}
"
"
${
TMP_REPO_PATH
}
"
if
[
"
$?
"
-eq
0
]
;
then
print_success
"
$log_action
"
else
print_failed
"
$log_action
"
log_action
=
"repo '
$repo
': clonning [branch]..."
print_info
"
$log_action
"
git clone
--single-branch
--branch
"
${
ref
}
"
--depth
1
"
${
repo
}
"
"
${
TMP_REPO_PATH
}
"
git clone
--single-branch
--branch
"
${
ref
}
"
--depth
1
"
${
repo
}
"
"
${
TMP_REPO_PATH
}
"
if
[
"
$?
"
!=
0
]
;
then
if
[
"
$?
"
-eq
0
]
;
then
print_success
"
$log_action
"
else
print_failed
"
$log_action
"
log_action
=
"repo '
$repo
': clonning [classic]..."
print_info
"
$log_action
"
git clone
"
${
repo
}
"
"
${
TMP_REPO_PATH
}
"
git clone
"
${
repo
}
"
"
${
TMP_REPO_PATH
}
"
if
[
"
$?
"
-eq
0
]
;
then
print_success
"
$log_action
"
else
print_failed
"
$log_action
"
print_err
"unable to clone repo '
$repo
'"
1
fi
fi
set
-e
fi
fi
fi
# set -e
## Get module code and save informations about it in a CSV file.
# Checkout to ref.
log_action
=
"repo '
${
repo
}
': checkout to '
${
ref
}
'"
print_info
"
$log_action
"
git
-C
"
${
TMP_REPO_PATH
}
"
checkout
"
${
ref
}
"
git
-C
"
${
TMP_REPO_PATH
}
"
checkout
"
${
ref
}
"
if
[
"
$?
"
-eq
0
]
;
then
print_success
"
$log_action
"
else
print_failed
"
$log_action
"
print_err
"unable to checkout to '
${
ref
}
' in repo '
${
repo
}
'"
2
fi
# Get commit number.
log_action
=
"repo '
${
repo
}
': getting commit number..."
print_info
"
$log_action
"
commit
=
"
$(
git
-C
${
TMP_REPO_PATH
}
rev-parse HEAD
)
"
commit
=
"
$(
git
-C
${
TMP_REPO_PATH
}
rev-parse HEAD
)
"
if
[
"
$?
"
-eq
0
]
;
then
print_success
"
$log_action
"
else
print_failed
"
$log_action
"
print_err
"unable to get commit number in repo '
${
repo
}
'"
3
fi
# Get selected modules from repo.
if
[
-n
"
$modules
"
]
;
then
if
[
-n
"
$modules
"
]
;
then
print_info
"repo '
${
repo
}
': repo with multiple modules detected, modules selected: [
$(
echo
$modules
|
sed
's/ /, /g'
)
]"
# Install each module.
for
module
in
$modules
;
do
for
module
in
$modules
;
do
if
[
-d
"
${
ODOO_ROOT_DIR
}
/
${
dst
}
/
${
module
}
"
]
;
then
module_dst
=
"
${
ODOO_ROOT_DIR
}
/
${
dst
}
/
${
module
}
"
rm
-r
"
${
ODOO_ROOT_DIR
}
/
${
dst
}
/
${
module
}
"
if
[
-d
"
$module_dst
"
]
;
then
print_info
"module '
${
module
}
': destination '
${
module_dst
}
' already exist removing..."
rm
-r
"
$module_dst
"
fi
fi
log_action
=
"module '
${
module
}
': moving module code to directory '
${
module_dst
}
'..."
print_info
"
$log_action
"
mv
"
${
TMP_REPO_PATH
}
/
${
module
}
"
"
${
ODOO_ROOT_DIR
}
/
${
dst
}
/"
mv
"
${
TMP_REPO_PATH
}
/
${
module
}
"
"
${
ODOO_ROOT_DIR
}
/
${
dst
}
/"
save_commit
"
$repo
"
"
$commit
"
"
$module
"
"
$dst
"
if
[
"
$?
"
-eq
0
]
;
then
print_success
"
$log_action
"
else
print_failed
"
$log_action
"
print_err
"unable to move module '
${
module
}
' from repo '
${
repo
}
' to directory '
${
module_dst
}
'"
5
fi
log_action
=
"module '
${
module
}
': saving module informations..."
print_info
"
$log_action
"
save_commit
"
$repo
"
"
$ref
"
"
$commit
"
"
$module
"
"
$dst
"
if
[
"
$?
"
-eq
0
]
;
then
print_success
"
$log_action
"
else
print_failed
"
$log_action
"
print_err
"unable to save informations of module '
${
module
}
' in file '
${
CSV_FILE
}
'"
6
fi
done
done
# Get repo as a module.
else
else
module_dst
=
"
${
ODOO_ROOT_DIR
}
/
${
dst
}
"
module
=
"
$(
basename
$dst
)
"
module
=
"
$(
basename
$dst
)
"
if
[
-d
"
${
ODOO_ROOT_DIR
}
/
${
dst
}
"
]
;
then
print_info
"repo '
${
repo
}
': repo as a single module detected: '
${
module
}
'"
rm
-r
"
${
ODOO_ROOT_DIR
}
/
${
dst
}
"
if
[
-d
"
$module_dst
"
]
;
then
print_info
"module '
${
module
}
': destination '
${
module_dst
}
' already exist removing..."
rm
-r
"
$module_dst
"
fi
log_action
=
"module '
${
module
}
': creating destination directory '
${
module_dst
}
'..."
print_info
"
$log_action
"
mkdir
-p
"
$module_dst
"
if
[
"
$?
"
-eq
0
]
;
then
print_success
"
$log_action
"
else
print_failed
"
$log_action
"
print_err
"unable to create destination directory '
${
module_dst
}
' for '
${
module
}
' from repo '
${
repo
}
'"
4
fi
log_action
=
"module '
${
module
}
': moving module code to directory '
${
module_dst
}
'..."
print_info
"
$log_action
"
mv
${
TMP_REPO_PATH
}
/
*
"
$module_dst
"
if
[
"
$?
"
-eq
0
]
;
then
print_success
"
$log_action
"
else
print_failed
"
$log_action
"
print_err
"unable to move code of module '
${
module
}
' from repo '
${
repo
}
' to directory '
${
module_dst
}
'"
5
fi
log_action
=
"module '
${
module
}
': saving module informations..."
print_info
"
$log_action
"
save_commit
"
$repo
"
"
$ref
"
"
$commit
"
"
$module
"
"
$dst
"
if
[
"
$?
"
-eq
0
]
;
then
print_success
"
$log_action
"
else
print_failed
"
$log_action
"
print_err
"unable to save informations of module '
${
module
}
' in file '
${
CSV_FILE
}
'"
6
fi
fi
mkdir
-p
"/
${
ODOO_ROOT_DIR
}
/
${
dst
}
"
mv
${
TMP_REPO_PATH
}
/
*
"
${
ODOO_ROOT_DIR
}
/
${
dst
}
/"
save_commit
"
$repo
"
"
$commit
"
"
$module
"
"
$dst
"
fi
fi
rm
-r
"
${
TMP_REPO_PATH
}
"
rm
-r
"
${
TMP_REPO_PATH
}
"
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter