mirror of
https://github.com/YunoHost-Apps/jenkins_ynh.git
synced 2024-09-03 19:26:18 +02:00
Various fixes
This commit is contained in:
parent
336039d43f
commit
19843a9b1d
8 changed files with 99 additions and 32 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
||||||
*.swp
|
*.swp
|
||||||
*~
|
*~
|
||||||
Notes
|
Notes
|
||||||
|
*.kate-swp
|
||||||
|
|
|
@ -65,7 +65,7 @@ Please do your pull request to the [testing branch](https://github.com/YunoHost-
|
||||||
|
|
||||||
To try the testing branch, please proceed like that.
|
To try the testing branch, please proceed like that.
|
||||||
```
|
```
|
||||||
sudo yunohost app install https://github.com/YunoHost-Apps/jenkins_ynh/tree/testing --verbose
|
sudo yunohost app install https://github.com/YunoHost-Apps/jenkins_ynh/tree/testing --debug
|
||||||
or
|
or
|
||||||
sudo yunohost app upgrade jenkins -u https://github.com/YunoHost-Apps/jenkins_ynh/tree/testing --verbose
|
sudo yunohost app upgrade jenkins -u https://github.com/YunoHost-Apps/jenkins_ynh/tree/testing --debug
|
||||||
```
|
```
|
||||||
|
|
|
@ -65,7 +65,7 @@ Merci de faire vos pull request sur la [branche testing](https://github.com/Yuno
|
||||||
|
|
||||||
Pour tester la branche testing, merci de procéder ainsi.
|
Pour tester la branche testing, merci de procéder ainsi.
|
||||||
```
|
```
|
||||||
sudo yunohost app install https://github.com/YunoHost-Apps/jenkins_ynh/tree/testing --verbose
|
sudo yunohost app install https://github.com/YunoHost-Apps/jenkins_ynh/tree/testing --debug
|
||||||
ou
|
ou
|
||||||
sudo yunohost app upgrade jenkins -u https://github.com/YunoHost-Apps/jenkins_ynh/tree/testing --verbose
|
sudo yunohost app upgrade jenkins -u https://github.com/YunoHost-Apps/jenkins_ynh/tree/testing --debug
|
||||||
```
|
```
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
"en": "Extendable continuous integration server",
|
"en": "Extendable continuous integration server",
|
||||||
"fr": "Serveur d'intégration continue extensible"
|
"fr": "Serveur d'intégration continue extensible"
|
||||||
},
|
},
|
||||||
"version": "2.121.1~ynh2",
|
"version": "2.121.1~ynh3",
|
||||||
"url": "https://jenkins.io/index.html",
|
"url": "https://jenkins.io/index.html",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"maintainer": {
|
"maintainer": {
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
"email": "maniackc_dev@crudelis.fr"
|
"email": "maniackc_dev@crudelis.fr"
|
||||||
},
|
},
|
||||||
"requirements": {
|
"requirements": {
|
||||||
"yunohost": ">= 3.0.0"
|
"yunohost": ">= 3.3.3"
|
||||||
},
|
},
|
||||||
"multi_instance": false,
|
"multi_instance": false,
|
||||||
"services": [
|
"services": [
|
||||||
|
|
|
@ -607,6 +607,7 @@ ynh_systemd_action() {
|
||||||
if [ $i -eq $timeout ]
|
if [ $i -eq $timeout ]
|
||||||
then
|
then
|
||||||
echo "The service $service_name didn't fully started before the timeout." >&2
|
echo "The service $service_name didn't fully started before the timeout." >&2
|
||||||
|
echo "Please find here an extract of the end of the log of the service $service_name:"
|
||||||
journalctl --lines=$length -u $service_name >&2
|
journalctl --lines=$length -u $service_name >&2
|
||||||
test -n "$log_path" && echo "--" && tail --lines=$length "$log_path" >&2
|
test -n "$log_path" && echo "--" && tail --lines=$length "$log_path" >&2
|
||||||
fi
|
fi
|
||||||
|
@ -630,21 +631,24 @@ ynh_clean_check_starting () {
|
||||||
|
|
||||||
# Send an email to inform the administrator
|
# Send an email to inform the administrator
|
||||||
#
|
#
|
||||||
# usage: ynh_send_readme_to_admin app_message [recipients]
|
# usage: ynh_send_readme_to_admin --app_message=app_message [--recipients=recipients] [--type=type]
|
||||||
# | arg: -m --app_message= - The message to send to the administrator.
|
# | arg: -m --app_message= - The message to send to the administrator.
|
||||||
# | arg: -r, --recipients= - The recipients of this email. Use spaces to separate multiples recipients. - default: root
|
# | arg: -r, --recipients= - The recipients of this email. Use spaces to separate multiples recipients. - default: root
|
||||||
# example: "root admin@domain"
|
# example: "root admin@domain"
|
||||||
# If you give the name of a YunoHost user, ynh_send_readme_to_admin will find its email adress for you
|
# If you give the name of a YunoHost user, ynh_send_readme_to_admin will find its email adress for you
|
||||||
# example: "root admin@domain user1 user2"
|
# example: "root admin@domain user1 user2"
|
||||||
|
# | arg: -t, --type= - Type of mail, could be 'backup', 'change_url', 'install', 'remove', 'restore', 'upgrade'
|
||||||
ynh_send_readme_to_admin() {
|
ynh_send_readme_to_admin() {
|
||||||
# Declare an array to define the options of this helper.
|
# Declare an array to define the options of this helper.
|
||||||
declare -Ar args_array=( [m]=app_message= [r]=recipients= )
|
declare -Ar args_array=( [m]=app_message= [r]=recipients= [t]=type= )
|
||||||
local app_message
|
local app_message
|
||||||
local recipients
|
local recipients
|
||||||
|
local type
|
||||||
# Manage arguments with getopts
|
# Manage arguments with getopts
|
||||||
ynh_handle_getopts_args "$@"
|
ynh_handle_getopts_args "$@"
|
||||||
local app_message="${app_message:-...No specific information...}"
|
app_message="${app_message:-...No specific information...}"
|
||||||
local recipients="${recipients:-root}"
|
recipients="${recipients:-root}"
|
||||||
|
type="${type:-install}"
|
||||||
|
|
||||||
# Retrieve the email of users
|
# Retrieve the email of users
|
||||||
find_mails () {
|
find_mails () {
|
||||||
|
@ -670,7 +674,23 @@ ynh_send_readme_to_admin() {
|
||||||
}
|
}
|
||||||
recipients=$(find_mails "$recipients")
|
recipients=$(find_mails "$recipients")
|
||||||
|
|
||||||
local mail_subject="☁️🆈🅽🅷☁️: \`$app\` was just installed!"
|
# Subject base
|
||||||
|
local mail_subject="☁️🆈🅽🅷☁️: \`$app\`"
|
||||||
|
|
||||||
|
# Adapt the subject according to the type of mail required.
|
||||||
|
if [ "$type" = "backup" ]; then
|
||||||
|
mail_subject="$mail_subject has just been backup."
|
||||||
|
elif [ "$type" = "change_url" ]; then
|
||||||
|
mail_subject="$mail_subject has just been moved to a new URL!"
|
||||||
|
elif [ "$type" = "remove" ]; then
|
||||||
|
mail_subject="$mail_subject has just been removed!"
|
||||||
|
elif [ "$type" = "restore" ]; then
|
||||||
|
mail_subject="$mail_subject has just been restored!"
|
||||||
|
elif [ "$type" = "upgrade" ]; then
|
||||||
|
mail_subject="$mail_subject has just been upgraded!"
|
||||||
|
else # install
|
||||||
|
mail_subject="$mail_subject has just been installed!"
|
||||||
|
fi
|
||||||
|
|
||||||
local mail_message="This is an automated message from your beloved YunoHost server.
|
local mail_message="This is an automated message from your beloved YunoHost server.
|
||||||
|
|
||||||
|
@ -828,10 +848,16 @@ ynh_download_file () {
|
||||||
|
|
||||||
# Load value from configuration file (see above for a small doc about this file
|
# Load value from configuration file (see above for a small doc about this file
|
||||||
# format)
|
# format)
|
||||||
local file_url=$(grep 'FILE_URL=' "$YNH_CWD/../conf/${source_id}.src_file" | cut -d= -f2-)
|
local src_file="$YNH_CWD/../conf/${source_id}.src_file"
|
||||||
local file_sum=$(grep 'FILE_SUM=' "$YNH_CWD/../conf/${source_id}.src_file" | cut -d= -f2-)
|
# If the src_file doesn't exist, use the backup path instead, with a "settings" directory
|
||||||
local file_sumprg=$(grep 'FILE_SUM_PRG=' "$YNH_CWD/../conf/${source_id}.src_file" | cut -d= -f2-)
|
if [ ! -e "$src_file" ]
|
||||||
local filename=$(grep 'FILENAME=' "$YNH_CWD/../conf/${source_id}.src_file" | cut -d= -f2-)
|
then
|
||||||
|
src_file="$YNH_CWD/../settings/conf/${source_id}.src_file"
|
||||||
|
fi
|
||||||
|
local file_url=$(grep 'FILE_URL=' "$src_file" | cut -d= -f2-)
|
||||||
|
local file_sum=$(grep 'FILE_SUM=' "$src_file" | cut -d= -f2-)
|
||||||
|
local file_sumprg=$(grep 'FILE_SUM_PRG=' "$src_file" | cut -d= -f2-)
|
||||||
|
local filename=$(grep 'FILENAME=' "$src_file" | cut -d= -f2-)
|
||||||
|
|
||||||
# Default value
|
# Default value
|
||||||
file_sumprg=${file_sumprg:-sha256sum}
|
file_sumprg=${file_sumprg:-sha256sum}
|
||||||
|
|
|
@ -91,9 +91,15 @@ ynh_add_nginx_config
|
||||||
|
|
||||||
change_port() {
|
change_port() {
|
||||||
# Wait for the creation of the jenkins service file
|
# Wait for the creation of the jenkins service file
|
||||||
while [ ! -e /etc/default/jenkins ]
|
timeout=600
|
||||||
|
for j in `seq 1 $timeout`
|
||||||
do
|
do
|
||||||
|
# Wait for an update of plugin repositories
|
||||||
|
if test -e /etc/default/jenkins; then
|
||||||
|
break;
|
||||||
|
else
|
||||||
sleep 0.5
|
sleep 0.5
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
# And modify the port as soon as possible, to prevent a crach of jenkins if the default port is already used.
|
# And modify the port as soon as possible, to prevent a crach of jenkins if the default port is already used.
|
||||||
ynh_replace_string "^HTTP_PORT=.*" "HTTP_PORT=$port" /etc/default/jenkins
|
ynh_replace_string "^HTTP_PORT=.*" "HTTP_PORT=$port" /etc/default/jenkins
|
||||||
|
@ -107,7 +113,7 @@ pid_change_port=$!
|
||||||
|
|
||||||
# Download jenkins deb file and install it.
|
# Download jenkins deb file and install it.
|
||||||
ynh_download_file --dest_dir="../conf"
|
ynh_download_file --dest_dir="../conf"
|
||||||
dpkg --install ../conf/jenkins.deb
|
dpkg --install --force-confnew ../conf/jenkins.deb
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP JENKINS
|
# SETUP JENKINS
|
||||||
|
@ -147,7 +153,7 @@ timeout=3600
|
||||||
# Add the domain to /etc/hosts, to prevent any dns delay
|
# Add the domain to /etc/hosts, to prevent any dns delay
|
||||||
echo "127.0.0.1 $domain #jenkins" | tee -a /etc/hosts
|
echo "127.0.0.1 $domain #jenkins" | tee -a /etc/hosts
|
||||||
|
|
||||||
jenkins_cli="java -jar /var/lib/jenkins/jenkins-cli.jar -remoting -s http://$domain$path_url"
|
jenkins_cli="ynh_exec_warn_less java -jar /var/lib/jenkins/jenkins-cli.jar -remoting -s http://$domain$path_url"
|
||||||
|
|
||||||
# Wait for Jenkins to be fully started
|
# Wait for Jenkins to be fully started
|
||||||
ynh_systemd_action --action=restart --line_match="Jenkins is fully up and running" --log_path="/var/log/$app/$app.log" --timeout="$timeout"
|
ynh_systemd_action --action=restart --line_match="Jenkins is fully up and running" --log_path="/var/log/$app/$app.log" --timeout="$timeout"
|
||||||
|
@ -224,6 +230,12 @@ sed -i '/#jenkins/d' /etc/hosts
|
||||||
# SEND A README FOR THE ADMIN
|
# SEND A README FOR THE ADMIN
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
message="If you're facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/jenkins_ynh"
|
# Get main domain and buid the url of the admin panel of the app.
|
||||||
|
admin_panel="https://$(grep portal_domain /etc/ssowat/conf.json | cut -d'"' -f4)/yunohost/admin/#/apps/$app"
|
||||||
|
|
||||||
ynh_send_readme_to_admin --app_message="$message" --recipients="root"
|
message="You can configure this app easily by using the experimental config-panel feature: $admin_panel/config-panel.
|
||||||
|
You can also find some specific actions for this app by using the experimental action feature: $admin_panel/actions.
|
||||||
|
|
||||||
|
If you're facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/jenkins_ynh"
|
||||||
|
|
||||||
|
ynh_send_readme_to_admin --app_message="$message" --recipients="root" --type="install"
|
||||||
|
|
|
@ -18,6 +18,8 @@ source ../settings/scripts/_variables
|
||||||
ynh_clean_setup () {
|
ynh_clean_setup () {
|
||||||
# Clean installation remaining that are not handle by the remove script.
|
# Clean installation remaining that are not handle by the remove script.
|
||||||
ynh_clean_check_starting
|
ynh_clean_check_starting
|
||||||
|
# Stop change_port()
|
||||||
|
ynh_exec_warn_less kill -s 15 $pid_change_port
|
||||||
}
|
}
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
@ -73,9 +75,15 @@ ynh_install_app_dependencies $app_depencencies
|
||||||
|
|
||||||
change_port() {
|
change_port() {
|
||||||
# Wait for the creation of the jenkins service file
|
# Wait for the creation of the jenkins service file
|
||||||
while [ ! -e /etc/default/jenkins ]
|
timeout=600
|
||||||
|
for j in `seq 1 $timeout`
|
||||||
do
|
do
|
||||||
|
# Wait for an update of plugin repositories
|
||||||
|
if test -e /etc/default/jenkins; then
|
||||||
|
break;
|
||||||
|
else
|
||||||
sleep 0.5
|
sleep 0.5
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
# And modify the port as soon as possible, to prevent a crach of jenkins if the default port is already used.
|
# And modify the port as soon as possible, to prevent a crach of jenkins if the default port is already used.
|
||||||
ynh_replace_string "^HTTP_PORT=.*" "HTTP_PORT=$port" /etc/default/jenkins
|
ynh_replace_string "^HTTP_PORT=.*" "HTTP_PORT=$port" /etc/default/jenkins
|
||||||
|
@ -89,7 +97,7 @@ pid_change_port=$!
|
||||||
|
|
||||||
# Download jenkins deb file and install it.
|
# Download jenkins deb file and install it.
|
||||||
ynh_download_file --dest_dir="../conf"
|
ynh_download_file --dest_dir="../conf"
|
||||||
dpkg --install ../conf/jenkins.deb
|
dpkg --install --force-confnew ../conf/jenkins.deb
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE APP MAIN DIR
|
# RESTORE THE APP MAIN DIR
|
||||||
|
@ -115,7 +123,7 @@ yunohost service add $app --log "/var/log/$app/$app.log"
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Wait for Jenkins to be fully started
|
# Wait for Jenkins to be fully started
|
||||||
ynh_systemd_action --action=restart --line_match="Jenkins is fully up and running" --log_path="/var/log/$app/$app.log" --timeout="$timeout"
|
ynh_systemd_action --action=restart --line_match="Jenkins is fully up and running" --log_path="/var/log/$app/$app.log" --timeout="3600"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DEACTIVE MAINTENANCE MODE
|
# DEACTIVE MAINTENANCE MODE
|
||||||
|
@ -127,6 +135,12 @@ ynh_maintenance_mode_OFF
|
||||||
# SEND A README FOR THE ADMIN
|
# SEND A README FOR THE ADMIN
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
message="If you're facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/jenkins_ynh"
|
# Get main domain and buid the url of the admin panel of the app.
|
||||||
|
admin_panel="https://$(grep portal_domain /etc/ssowat/conf.json | cut -d'"' -f4)/yunohost/admin/#/apps/$app"
|
||||||
|
|
||||||
ynh_send_readme_to_admin --app_message="$message" --recipients="root"
|
message="You can configure this app easily by using the experimental config-panel feature: $admin_panel/config-panel.
|
||||||
|
You can also find some specific actions for this app by using the experimental action feature: $admin_panel/actions.
|
||||||
|
|
||||||
|
If you're facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/jenkins_ynh"
|
||||||
|
|
||||||
|
ynh_send_readme_to_admin --app_message="$message" --recipients="root" --type="restore"
|
||||||
|
|
|
@ -87,7 +87,7 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||||
then
|
then
|
||||||
# Download jenkins deb file and install it.
|
# Download jenkins deb file and install it.
|
||||||
ynh_download_file --dest_dir="../conf"
|
ynh_download_file --dest_dir="../conf"
|
||||||
dpkg --install ../conf/jenkins.deb
|
dpkg --install --force-confnew ../conf/jenkins.deb
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# FIX JENKINS SETUP
|
# FIX JENKINS SETUP
|
||||||
|
@ -134,14 +134,14 @@ fi
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_system_reload --action=reload --service_name=nginx
|
ynh_systemd_action --action=reload --service_name=nginx
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK JENKINS STARTING
|
# CHECK JENKINS STARTING
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Wait for Jenkins to be fully started
|
# Wait for Jenkins to be fully started
|
||||||
ynh_systemd_action --action=restart --line_match="Jenkins is fully up and running" --log_path="/var/log/$app/$app.log" --timeout="$timeout"
|
ynh_systemd_action --action=restart --line_match="Jenkins is fully up and running" --log_path="/var/log/$app/$app.log" --timeout="3600"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPGRADE JENKINS-CLI.PHAR
|
# UPGRADE JENKINS-CLI.PHAR
|
||||||
|
@ -154,3 +154,17 @@ wget -nv --no-check-certificate https://$domain$path_url/jnlpJars/jenkins-cli.ja
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_maintenance_mode_OFF
|
ynh_maintenance_mode_OFF
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SEND A README FOR THE ADMIN
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Get main domain and buid the url of the admin panel of the app.
|
||||||
|
admin_panel="https://$(grep portal_domain /etc/ssowat/conf.json | cut -d'"' -f4)/yunohost/admin/#/apps/$app"
|
||||||
|
|
||||||
|
message="You can configure this app easily by using the experimental config-panel feature: $admin_panel/config-panel.
|
||||||
|
You can also find some specific actions for this app by using the experimental action feature: $admin_panel/actions.
|
||||||
|
|
||||||
|
If you're facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/jenkins_ynh"
|
||||||
|
|
||||||
|
ynh_send_readme_to_admin --app_message="$message" --recipients="root" --type="upgrade"
|
||||||
|
|
Loading…
Add table
Reference in a new issue