diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/manifest.json b/manifest.json index 263c9d6..db28bc8 100644 --- a/manifest.json +++ b/manifest.json @@ -9,28 +9,33 @@ "en": "Serveur d'intégration continue extensible", "fr": "Extendable continuous integration server" }, + "url": "https://jenkins.io/index.html", "license": "free", "maintainer": { - "name": "Julien Malik", + "name": "Julien Malik et Maniack Crudelis", "email": "julien.malik@paraiso.me" }, - "multi_instance": "false", + "multi_instance": false, + "services": [ + "nginx" + ], "arguments": { "install" : [ { "name": "domain", + "type": "domain", "ask": { "en": "Choose a domain for Jenkins", "fr": "Choisissez un domaine pour Jenkins" }, - "example": "domain.org", - "default": "crudelis-test4.fr" + "example": "domain.org" }, { "name": "path", + "type": "path", "ask": { "en": "Choose a path for Jenkins", - "fr": "Choisissez un path pour Jenkins" + "fr": "Choisissez un chemin pour Jenkins" }, "example": "/jenkins", "default": "/jenkins" @@ -43,17 +48,7 @@ }, "choices": ["Yes", "No"], "default": "Yes" - }, - { - "name": "port", - "ask": { - "en": "Internal running port ?", - "fr": "Port de fonctionnement interne ?" - }, - "example": "8080", - "default": "8080" } ] } } - diff --git a/scripts/.fonctions b/scripts/.fonctions new file mode 100755 index 0000000..c05e16d --- /dev/null +++ b/scripts/.fonctions @@ -0,0 +1,211 @@ +#!/bin/bash + +CHECK_VAR () { # Vérifie que la variable n'est pas vide. +# $1 = Variable à vérifier +# $2 = Texte à afficher en cas d'erreur + test -n "$1" || (echo "$2" >&2 && false) +} + +EXIT_PROPERLY () { # Provoque l'arrêt du script en cas d'erreur. Et nettoye les résidus. + trap '' ERR + echo -e "\e[91m \e[1m" # Shell in light red bold + echo -e "!!\n $app install's script has encountered an error. Installation was cancelled.\n!!" >&2 + + CLEAN_SETUP # Appel la fonction de nettoyage spécifique du script install. + + # Compense le bug de ssowat qui ne supprime pas l'entrée de l'app en cas d'erreur d'installation. + sudo sed -i "\@\"$domain$path/\":@d" /etc/ssowat/conf.json + + ynh_die +} + +TRAP_ON () { # Activate signal capture + trap EXIT_PROPERLY ERR # Capturing exit signals on error +} + +TRAP_OFF () { # Ignoring signal capture until TRAP_ON + # Pour une raison que j'ignore, la fonction TRAP_ON fonctionne très bien. + # Mais pas la fonction TRAP_OFF... + # Utiliser directement `trap '' ERR` dans le code pour l'utiliser, à la place de la fonction. + trap '' ERR # Ignoring exit signals +} + +CHECK_USER () { # Vérifie la validité de l'user admin +# $1 = Variable de l'user admin. + ynh_user_exists "$1" || (echo "Wrong admin" >&2 && false) +} + +CHECK_PATH () { # Vérifie la présence du / en début de path. Et son absence à la fin. + if [ "${path:0:1}" != "/" ]; then # Si le premier caractère n'est pas un / + path="/$path" # Ajoute un / en début de path + fi + if [ "${path:${#path}-1}" == "/" ] && [ ${#path} -gt 1 ]; then # Si le dernier caractère est un / et que ce n'est pas le seul caractère. + path="${path:0:${#path}-1}" # Supprime le dernier caractère + fi +} + +CHECK_DOMAINPATH () { # Vérifie la disponibilité du path et du domaine. + sudo yunohost app checkurl $domain$path -a $app +} + +CHECK_FINALPATH () { # Vérifie que le dossier de destination n'est pas déjà utilisé. + final_path=/var/www/$app + if [ -e "$final_path" ] + then + echo "This path already contains a folder" >&2 + false + fi +} + +GENERATE_DB () { # Créer une base de données et un utilisateur dédié au nom de l'app. +# $1 = Nom de la base de donnée + db_user=$1 + # Génère un mot de passe aléatoire. +# db_pwd=$(head -n20 /dev/urandom | tr -c -d 'A-Za-z0-9' | head -c20) + db_pwd=$(ynh_string_random) + CHECK_VAR "$db_pwd" "db_pwd empty" + # Utilise '$app' comme nom d'utilisateur et de base de donnée + # Initialise la base de donnée et stocke le mot de passe mysql. + ynh_mysql_create_db $db_user $db_user $db_pwd + ynh_app_setting_set $app mysqlpwd $db_pwd +} + +SETUP_SOURCE () { # Télécharge la source, décompresse et copie dans $final_path +# $1 = Nom de l'archive téléchargée. + wget -nv -i ../sources/source_url -O $1 + # Vérifie la somme de contrôle de la source téléchargée. + md5sum -c ../sources/source_md5 --status || (echo "Corrupt source" >&2 && false) + # Décompresse la source + if [ "$(echo ${1##*.})" == "gz" ]; then + tar -x -f $1 + elif [ "$(echo ${1##*.})" == "zip" ]; then + unzip -q $1 + else + false # Format d'archive non pris en charge. + fi + # Copie les fichiers sources + sudo cp -a $(cat ../sources/source_dir)/. "$final_path" + # Copie les fichiers additionnels ou modifiés. + if test -e "../sources/ajouts"; then + sudo cp -a ../sources/ajouts/. "$final_path" + fi +} + +ADD_SYS_USER () { # Créer un utilisateur système dédié à l'app + if ynh_system_user_exists "$app" # Test l'existence de l'utilisateur + then + sudo useradd -d /var/www/$app --system --user-group $app --shell /usr/sbin/nologin || (echo "Unable to create $app system account" >&2 && false) + fi +} + +POOL_FPM () { # Créer le fichier de configuration du pool php-fpm et le configure. + sed -i "s@__NAMETOCHANGE__@$app@g" ../conf/php-fpm.conf + sed -i "s@__FINALPATH__@$final_path@g" ../conf/php-fpm.conf + sed -i "s@__USER__@$app@g" ../conf/php-fpm.conf + finalphpconf=/etc/php5/fpm/pool.d/$app.conf + sudo cp ../conf/php-fpm.conf $finalphpconf + sudo chown root: $finalphpconf + finalphpini=/etc/php5/fpm/conf.d/20-$app.ini + sudo cp ../conf/php-fpm.ini $finalphpini + sudo chown root: $finalphpini + sudo service php5-fpm reload +} + +STORE_MD5_CONFIG () { # Enregistre la somme de contrôle du fichier de config +# $1 = Nom du fichier de conf pour le stockage dans settings.yml +# $2 = Nom complet et chemin du fichier de conf. + ynh_app_setting_set $app $1_file_md5 $(sudo md5sum "$2" | cut -d' ' -f1) +} + +CHECK_MD5_CONFIG () { # Créé un backup du fichier de config si il a été modifié. +# $1 = Nom du fichier de conf pour le stockage dans settings.yml +# $2 = Nom complet et chemin du fichier de conf. + if [ "$(ynh_app_setting_get $app $1_file_md5)" != $(sudo md5sum "$2" | cut -d' ' -f1) ]; then + sudo cp -a "$2" "$2.backup.$(date '+%d.%m.%y_%Hh%M,%Ss')" # Si le fichier de config a été modifié, créer un backup. + fi +} + +FIND_PORT () { # Cherche un port libre. +# $1 = Numéro de port pour débuter la recherche. + port=$1 + while ! sudo yunohost app checkport $port ; do + port=$((port+1)) + done + CHECK_VAR "$port" "port empty" +} + + +### REMOVE SCRIPT + +REMOVE_NGINX_CONF () { # Suppression de la configuration nginx + if [ -e "/etc/nginx/conf.d/$domain.d/$app.conf" ]; then # Delete nginx config + echo "Delete nginx config" + sudo rm "/etc/nginx/conf.d/$domain.d/$app.conf" + sudo service nginx reload + fi +} + +REMOVE_FPM_CONF () { # Suppression de la configuration du pool php-fpm + if [ -e "/etc/php5/fpm/pool.d/$app.conf" ]; then # Delete fpm config + echo "Delete fpm config" + sudo rm "/etc/php5/fpm/pool.d/$app.conf" + fi + if [ -e "/etc/php5/fpm/conf.d/20-$app.ini" ]; then # Delete php config + echo "Delete php config" + sudo rm "/etc/php5/fpm/conf.d/20-$app.ini" + fi + sudo service php5-fpm reload +} + +REMOVE_LOGROTATE_CONF () { # Suppression de la configuration de logrotate + if [ -e "/etc/logrotate.d/$app" ]; then + echo "Delete logrotate config" + sudo rm "/etc/logrotate.d/$app" + fi +} + +SECURE_REMOVE () { # Suppression de dossier avec vérification des variables + chaine="$1" + no_var=0 + while (echo "$chaine" | grep -q '\$') # Boucle tant qu'il y a des $ dans la chaine + do + no_var=1 + global_var=$(echo "$chaine" | cut -d '$' -f 2) # Isole la première variable trouvée. + only_var=\$$(expr "$global_var" : '\([A-Za-z0-9_]*\)') # Isole complètement la variable en ajoutant le $ au début et en gardant uniquement le nom de la variable. Se débarrasse surtout du / et d'un éventuel chemin derrière. + real_var=$(eval "echo ${only_var}") # `eval "echo ${var}` permet d'interpréter une variable contenue dans une variable. + if test -z "$real_var" || [ "$real_var" = "/" ]; then + echo "Variable $only_var is empty, suppression of $chaine cancelled." >&2 + return 1 + fi + chaine=$(echo "$chaine" | sed "s@$only_var@$real_var@") # remplace la variable par sa valeur dans la chaine. + done + if [ "$no_var" -eq 1 ] + then + if [ -e "$chaine" ]; then + echo "Delete directory $chaine" + sudo rm -r "$chaine" + fi + return 0 + else + echo "No detected variable." >&2 + return 1 + fi +} + +REMOVE_BDD () { # Suppression de la base de donnée et de l'utilisateur associé. +# $1 = Nom de la base de donnée + # Utilise '$app' comme nom d'utilisateur et de base de donnée + db_user=$1 + if mysqlshow -u root -p$(sudo cat $MYSQL_ROOT_PWD_FILE) | grep -q "^| $db_user"; then + echo "Delete db" + ynh_mysql_drop_db $db_user + ynh_mysql_drop_user $db_user + fi +} + +REMOVE_SYS_USER () { # Supprime l'utilisateur système dédié à l'app + if ynh_system_user_exists "$app" # Test l'existence de l'utilisateur + then + sudo userdel $app + fi +} diff --git a/scripts/install b/scripts/install index b405dde..b0296b3 100644 --- a/scripts/install +++ b/scripts/install @@ -1,23 +1,50 @@ #!/bin/bash +source .fonctions # Charge les fonctions génériques habituellement utilisées dans le script + +CLEAN_SETUP () { +# Nettoyage des résidus d'installation non pris en charge par le script remove. +# Pas de nettoyage supplémentaire nécessaire ici... + echo "" +} +TRAP_ON # Active trap pour arrêter le script si une erreur est détectée. + # Retrieve arguments -domain=$1 -path=$2 -is_public=$3 -port=$4 -app=jenkins +domain=$YNH_APP_ARG_DOMAIN +path=$YNH_APP_ARG_PATH +is_public=$YNH_APP_ARG_IS_PUBLIC -sudo yunohost app checkport $port -if [[ ! $? -eq 0 ]]; then - echo "Port $port is not available. Aborting..." - exit 1 +app=$YNH_APP_INSTANCE_NAME + +# Source app helpers +source /usr/share/yunohost/helpers + +# Vérifie que les variables ne sont pas vides. +CHECK_VAR "$app" "app name not set" + + +CHECK_PATH # Vérifie et corrige la syntaxe du path. +CHECK_DOMAINPATH # Vérifie la disponibilité du path et du domaine. + +# Vérifie que le dossier de destination n'est pas déjà utilisé. +final_path=/var/lib/$app +if [ -e "$final_path" ] +then + echo "This path already contains a folder" >&2 + false fi -# Check domain/path availability -sudo yunohost app checkurl $domain$path -a jenkins -if [[ ! $? -eq 0 ]]; then - exit 1 -fi + +FIND_PORT 8080 # Cherche un port libre. + + +# Enregistre les infos dans la config YunoHost +sudo yunohost app setting $app domain -v $domain +sudo yunohost app setting $app path -v $path +sudo yunohost app setting $app is_public -v $is_public +sudo yunohost app setting $app port -v $port +sudo yunohost app setting $app final_path -v $final_path + echo "Install dependencies..." wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add - @@ -26,39 +53,37 @@ sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sour sudo apt-get update sudo apt-get install jenkins -y +# Renseigne le port sudo sed -i "s/^HTTP_PORT=.*/HTTP_PORT=$port/g" /etc/default/jenkins +# Ignore le Setup Wizard +sudo sed -i "s/-Djava.awt.headless=true/& -Djenkins.install.runSetupWizard=false/g" /etc/default/jenkins -if [[ "$path" != "/" ]]; -then - # $ means 'process only the last line' +if [ "$path" != "/" ]; +then # Ajoute le path en cas d'installation en sous-dossier dans les options de démarrage de Jenkins sudo sed -i "$ s@--httpPort=\$HTTP_PORT@& --prefix=$path@g" /etc/default/jenkins fi -sudo sed -i "s/-Djava.awt.headless=true/& -Djenkins.install.runSetupWizard=false/g" /etc/default/jenkins - -sudo service $app restart # Redémarre jenkins +sudo service $app restart # Redémarre jenkins pour prendre en compte les modifications tempfile="$(mktemp)" tail -f -n1 /var/log/$app/$app.log > "$tempfile" & # Suit le démarrage dans le log PID_TAIL=$! # Récupère le PID de la commande tail, qui est passée en arrière plan. -sudo yunohost service add jenkins -l /var/log/jenkins/jenkins.log +# Copie le fichier de config nginx +sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf +# Et modifie les variables dans le fichier de configuration nginx +sudo sed -i "s@__PATH__@$path@g" /etc/nginx/conf.d/$domain.d/$app.conf +sudo sed -i "s@__DOMAIN__@$domain@g" /etc/nginx/conf.d/$domain.d/$app.conf +sudo sed -i "s@__PORT__@$port@g" /etc/nginx/conf.d/$domain.d/$app.conf -echo "Nginx configuration (sso disabled)..." -sed -i "s@__PATH__@$path@g" ../conf/nginx.conf -sed -i "s@__PORT__@$port@g" ../conf/nginx.conf -sed -i "s@__DOMAIN__@$domain@g" ../conf/nginx.conf - -sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/jenkins.conf - -sudo yunohost app setting jenkins is_public -v $is_public -if [ "$is_public" = "Yes" ]; -then - sudo yunohost app setting jenkins unprotected_uris -v "/" -fi +# Jenkins est public par défaut, au moins pour le téléchargement de jenkins-cli.jar +sudo yunohost app setting $app unprotected_uris -v "/" sudo service nginx reload sudo yunohost app ssowatconf +# Ajoute le service au monitoring de Yunohost. +sudo yunohost service add jenkins -l /var/log/$app/$app.log + # Surveille le démarrage du service. config_OK=0 for i in `seq 1 60` @@ -67,7 +92,7 @@ do # La boucle attend le démarrage de jenkins Ou 60 secondes. # Si le log annonce une première fois le démarrage de jenkins. Fait sauter la sécurité de la première connexion de l'admin. Qui bloque curl et demande une identification inexistante une fois sur deux... sudo wget -nv --no-check-certificate https://$domain$path/jnlpJars/jenkins-cli.jar -O /var/lib/jenkins/jenkins-cli.jar for i in `seq 1 60` - do # La boucle attend la mise à jour des dépôts de plugins. Ou 20 secondes. + do # La boucle attend la mise à jour des dépôts de plugins. Ou 60 secondes. if test -e /var/lib/jenkins/updates/default.json; then break; else @@ -77,6 +102,7 @@ do # La boucle attend le démarrage de jenkins Ou 60 secondes. done java -jar /var/lib/jenkins/jenkins-cli.jar -s https://$domain$path install-plugin reverse-proxy-auth-plugin + # Configure la sécurité globale avec ldap par défaut. sudo cp ../conf/config.xml /var/lib/jenkins/ sudo chown jenkins: /var/lib/jenkins/config.xml @@ -86,11 +112,16 @@ do # La boucle attend le démarrage de jenkins Ou 60 secondes. i=1; fi if grep -q "INFOS: Jenkins is fully up and running" "$tempfile" && [ "$config_OK" -eq 1 ]; then - break # Si le log annonce une deuxième fois le démarrage d'etherpad, sort de la boucle. + break # Si le log annonce une deuxième fois le démarrage de jenkins, sort de la boucle. fi echo -n "." >&2 sleep 1 - done kill -s 15 $PID_TAIL > /dev/null # Arrête l'exécution de tail. sudo rm "$tempfile" + +# Si Jenkins est privé, retire l'autorisation publique. +if [ "$is_public" = "No" ]; +then # Retire l'accès public + sudo yunohost app setting $app unprotected_uris -d +fi