1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/jenkins_ynh.git synced 2024-09-03 19:26:18 +02:00

Upgrade to 2.332.3~ynh1

This commit is contained in:
yalh76 2022-05-22 14:58:59 +02:00
parent ceac884c4d
commit 7199319f1b
14 changed files with 103 additions and 229 deletions

View file

@ -17,7 +17,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
Extendable continuous integration server
**Shipped version:** 2.319.3~ynh1
**Shipped version:** 2.332.3~ynh1

View file

@ -13,7 +13,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
Serveur d'intégration continue extensible
**Version incluse :** 2.319.3~ynh1
**Version incluse :** 2.332.3~ynh1

View file

@ -35,35 +35,11 @@
upgrade=1 from_commit=449a3d43180316d6b1bdb693354bd7cdbe8ef987
# 2.319.2~ynh1
upgrade=1 from_commit=7e40418b50b5c25d80f3bc521f9627cdd22c4201
# 2.319.3~ynh1
upgrade=1 from_commit=ceac884c4d82f8164ec7ce391d354d794948bb72
backup_restore=1
multi_instance=0
change_url=1
;;; Options
Email=
Notification=none
;;; Upgrade options
; commit=29141b702f2954e0f72925121aea82a7fa3fc118
name=Fix for getopts 13 Apr 2019
manifest_arg=domain=DOMAIN&path=PATH&is_public=1&
; commit=0e1aae7be82034650e2c1f6c1ad6d68a41b80176
name=2.263.1~ynh1
; commit=72656bca2e144ef9a92cfec2af6cd13cb8e8aee3
name=2.263.4~ynh1
; commit=e6cf48fdbcc7cac5c5147d4a7cc1ebfd9055bfef
name=2.277.2~ynh1
; commit=3f0f52e24273e9da86ac2fa7000953b7734196a5
name=2.277.3~ynh1
; commit=36fdba9bbd201832f5707083b878ae967052ad6a
name=2.277.4~ynh1
; commit=abf516d8a4dd721af8b9a2560a2a1dbd7ea79fb8
name=2.289.1~ynh1
; commit=c7a3a24e56e9be3b5991a175d08be116392b5a19
name=2.289.2~ynh1
; commit=f165327adcc291a479ab73050bcaa1b84784e763
name=2.289.3~ynh1
; commit=0bb8a4ca3a90693c5594a72379704f7e08519c92
name=2.303.1~ynh1
; commit=449a3d43180316d6b1bdb693354bd7cdbe8ef987
name=2.319.1~ynh1
; commit=7e40418b50b5c25d80f3bc521f9627cdd22c4201
name=2.319.2~ynh1

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://pkg.jenkins.io/debian-stable/binary/jenkins_2.319.3_all.deb
SOURCE_SUM=1c2e6cf55ab8f3ccad1611ce1b37cd936b5a35707bb6746ccef897570223b23d
SOURCE_URL=https://pkg.jenkins.io/debian-stable/binary/jenkins_2.332.3_all.deb
SOURCE_SUM=319fa6ab596f63b826a9ab6ba5a7230aff73d271acc6241ffb23788ffc123883
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=deb
SOURCE_IN_SUBDIR=true

View file

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<hudson>
<disabledAdministrativeMonitors/>
<version>1.0</version>
<version>__JENKINS_VERSION__</version>
<numExecutors>2</numExecutors>
<mode>NORMAL</mode>
<useSecurity>true</useSecurity>

View file

@ -0,0 +1,7 @@
SOURCE_URL=https://github.com/jenkinsci/plugin-installation-manager-tool/releases/download/2.9.3/jenkins-plugin-manager-2.9.3.jar
SOURCE_SUM=1faef87aa735cb48a040d09d7648294d17cee648a028be34399ffcda4293a337
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=jar
SOURCE_IN_SUBDIR=false
SOURCE_FILENAME=jenkins-plugin-manager.jar
SOURCE_EXTRACT=false

View file

@ -6,7 +6,7 @@
"en": "Extendable continuous integration server",
"fr": "Serveur d'intégration continue extensible"
},
"version": "2.319.3~ynh1",
"version": "2.332.3~ynh1",
"url": "https://jenkins.io/index.html",
"upstream": {
"license": "MIT",

View file

@ -7,6 +7,8 @@
# dependencies used by the app
pkg_dependencies="openjdk-11-jdk daemon net-tools"
PLUGIN_CLI_VERSION=2.9.3
#=================================================
# PERSONAL HELPERS
#=================================================

View file

@ -34,7 +34,7 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
# STOP SYSTEMD SERVICE
#=================================================
ynh_systemd_action --service_name=$app --action="stop" --line_match="Stopped LSB" --log_path="systemd"
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
@ -55,17 +55,11 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# SPECIFIC BACKUP
#=================================================
# BACKUP VARIOUS FILES
#=================================================
ynh_backup --src_path="/etc/default/$app"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_systemd_action --service_name=$app --action="restart" --line_match="Jenkins is fully up and running" --log_path="/var/log/$app/$app.log"
ynh_systemd_action --service_name=$app --action="restart" --line_match="Started Jenkins Continuous Integration Server" --log_path="systemd"
#=================================================
# END OF SCRIPT

View file

@ -71,7 +71,7 @@ fi
#=================================================
ynh_script_progression --message="Stopping a systemd service..."
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
#=================================================
# MODIFY URL IN NGINX CONF
@ -140,7 +140,7 @@ ynh_store_file_checksum --file="/etc/default/jenkins"
ynh_script_progression --message="Starting a systemd service..."
# Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --line_match="Jenkins is fully up and running" --log_path="/var/log/$app/$app.log" --timeout="300"
ynh_systemd_action --service_name=$app --action="start" --line_match="Started Jenkins Continuous Integration Server" --log_path="systemd"
#=================================================
# RELOAD NGINX

View file

@ -34,6 +34,8 @@ domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
is_public=$YNH_APP_ARG_IS_PUBLIC
jenkins_version=$(ynh_app_upstream_version)
app=$YNH_APP_INSTANCE_NAME
#=================================================
@ -65,7 +67,7 @@ ynh_app_setting_set --app=$app --key=admin_mail_html --value=1
ynh_script_progression --message="Finding an available port..."
# Find an available port
port=$(ynh_find_port --port=8080)
port=$(ynh_find_port --port=8095)
ynh_app_setting_set --app=$app --key=port --value=$port
#=================================================
@ -83,6 +85,7 @@ ynh_script_progression --message="Setting up source files..."
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="../conf"
ynh_setup_source --source_id="jenkins-plugin-manager" --dest_dir="$final_path"
#=================================================
# NGINX CONFIGURATION
@ -94,29 +97,6 @@ ynh_add_nginx_config
#=================================================
# SPECIFIC SETUP
#=================================================
# FIX THE PORT TO USE
#=================================================
ynh_script_progression --message="Fixing the port in Jenkins config..."
change_port() {
# Wait for the creation of the jenkins service file
timeout=600
for j in `seq 1 $timeout`
do
# Wait for an update of plugin repositories
if test -e /etc/default/jenkins; then
break;
else
sleep 0.5
fi
done
# And modify the port as soon as possible, to prevent a crach of jenkins if the default port is already used.
ynh_replace_string --match_string="^HTTP_PORT=.*" --replace_string="HTTP_PORT=$port" --target_file=/etc/default/jenkins
}
change_port &
pid_change_port=$!
#=================================================
# INSTALL JENKINS
#=================================================
@ -130,105 +110,67 @@ dpkg --install --force-confnew ../conf/jenkins.deb
#=================================================
ynh_script_progression --message="Setuping application..."
# Set the app as temporarily public for jenkins-cli.jar
ynh_script_progression --message="Configuring SSOwat..."
# Making the app public for curl
ynh_permission_update --permission="main" --add="visitors"
# Reload SSOwat config
yunohost app ssowatconf
cat >> "$final_path/jenkins.install.InstallUtil.lastExecVersion" <<EOF
$jenkins_version
EOF
chown $app:$app "$final_path/jenkins.install.InstallUtil.lastExecVersion"
# Ignore Setup Wizard
ynh_replace_string --match_string="\-Djava.awt.headless=true" --replace_string="& -Djenkins.install.runSetupWizard=false" --target_file=/etc/default/jenkins
cat >> "$final_path/jenkins.install.UpgradeWizard.state" <<EOF
$jenkins_version
EOF
chown $app:$app "$final_path/jenkins.install.UpgradeWizard.state"
if [ "$path_url" != "/" ]
then
# Add the path, in case of sub-path installation, into jenkins' boot options
sed -i "$ s@--httpPort=\$HTTP_PORT@& --prefix=$path_url@g" /etc/default/jenkins
fi
ynh_replace_string --match_string="Environment=\"JENKINS_PORT=8080\"" --replace_string="Environment=\"JENKINS_PORT=$port\"\nEnvironment=\"JENKINS_PREFIX=$path_url\"" --target_file="/lib/systemd/system/jenkins.service"
config_OK=0
timeout=3600
# Add the domain to /etc/hosts, to prevent any dns delay
echo "127.0.0.1 $domain #jenkins" | tee -a /etc/hosts
systemctl daemon-reload --quiet
# Wait for Jenkins to be fully started
ynh_systemd_action --service_name=$app --action="restart" --line_match="Jenkins is fully up and running" --log_path="/var/log/$app/$app.log" --timeout="$timeout"
# Enable Jenkins CLI Protocol/2 for jenkins-cli
# That the only protocol that allow connection without an authenticated user...
ynh_replace_string --match_string="<slaveAgentPort>0</slaveAgentPort>" --replace_string="&\n<enabledAgentProtocols><string>CLI2-connect</string></enabledAgentProtocols>" --target_file=$final_path/config.xml
# Wait for Jenkins to be fully started
ynh_systemd_action --service_name=$app --action="restart" --line_match="Jenkins is fully up and running" --log_path="/var/log/$app/$app.log" --timeout="$timeout"
ynh_systemd_action --service_name=$app --action="restart" --line_match="Started Jenkins Continuous Integration Server" --log_path="systemd"
#=================================================
# INSTALL PLUGINS
#=================================================
ynh_script_progression --message="Installing plugins..."
# If the log says that jenkins has started, install the plugins
wget -nv --no-check-certificate https://$domain${path_url%/}/jnlpJars/jenkins-cli.jar -O $final_path/jenkins-cli.jar 2>&1
for i in `seq 1 $timeout`
do
# Wait for an update of plugin repositories
if test -e $final_path/updates/default.json; then
break;
else
echo -n "."
sleep 1
fi
done
# Remove the public access
ynh_permission_update --permission="main" --remove="visitors"
ynh_replace_string --match_string="<useSecurity>true</useSecurity>" --replace_string="<useSecurity>false</useSecurity>" --target_file=$final_path/config.xml
ynh_systemd_action --service_name=$app --action="restart" --line_match="Jenkins is fully up and running" --log_path="/var/log/$app/$app.log" --timeout="$timeout"
jenkins_cli="ynh_exec_warn_less java -jar $final_path/jenkins-cli.jar -s http://${domain}:${port}${path_url%/}"
jenkins_plugin_manager="ynh_exec_warn_less java -jar $final_path/jenkins-plugin-manager.jar --war /usr/share/java/jenkins.war --plugin-download-directory=$final_path/plugins"
# Install plugins for http authentication and ldap.
$jenkins_cli install-plugin reverse-proxy-auth-plugin
$jenkins_plugin_manager --plugins reverse-proxy-auth-plugin
# Install recommended plugins (those from Setup Wizard)
$jenkins_cli install-plugin cloudbees-folder # Folders Plugin
$jenkins_cli install-plugin antisamy-markup-formatter # OWASP Markup Formatter Plugin
$jenkins_cli install-plugin pam-auth # PAM Authentication plugin
$jenkins_cli install-plugin mailer # Mailer Plugin
$jenkins_cli install-plugin ldap # LDAP Plugin
$jenkins_cli install-plugin matrix-auth # Matrix Authorization Strategy Plugin
$jenkins_cli install-plugin build-timeout # Build timeout plugin
$jenkins_cli install-plugin credentials-binding # Credentials Binding Plugin
$jenkins_cli install-plugin timestamper # Timestamper
$jenkins_cli install-plugin ws-cleanup # Workspace Cleanup Plugin
$jenkins_cli install-plugin ant # Ant Plugin
$jenkins_cli install-plugin gradle # Gradle Plugin
$jenkins_cli install-plugin workflow-aggregator # Pipeline
$jenkins_cli install-plugin pipeline-stage-view # Pipeline: Stage View Plugin
$jenkins_cli install-plugin git # Git plugin
$jenkins_cli install-plugin github-organization-folder # GitHub Organization Folder Plugin
$jenkins_cli install-plugin subversion # Subversion Plug-in
$jenkins_cli install-plugin email-ext # Email Extension Plugin
$jenkins_cli install-plugin ssh-slaves # SSH Slaves plugin
$jenkins_plugin_manager --plugins cloudbees-folder # Folders Plugin
$jenkins_plugin_manager --plugins antisamy-markup-formatter # OWASP Markup Formatter Plugin
$jenkins_plugin_manager --plugins pam-auth # PAM Authentication plugin
$jenkins_plugin_manager --plugins mailer # Mailer Plugin
$jenkins_plugin_manager --plugins ldap # LDAP Plugin
$jenkins_plugin_manager --plugins matrix-auth # Matrix Authorization Strategy Plugin
$jenkins_plugin_manager --plugins build-timeout # Build timeout plugin
$jenkins_plugin_manager --plugins credentials-binding # Credentials Binding Plugin
$jenkins_plugin_manager --plugins timestamper # Timestamper
$jenkins_plugin_manager --plugins ws-cleanup # Workspace Cleanup Plugin
$jenkins_plugin_manager --plugins ant # Ant Plugin
$jenkins_plugin_manager --plugins gradle # Gradle Plugin
$jenkins_plugin_manager --plugins workflow-aggregator # Pipeline
$jenkins_plugin_manager --plugins pipeline-stage-view # Pipeline: Stage View Plugin
$jenkins_plugin_manager --plugins git # Git plugin
$jenkins_plugin_manager --plugins github-organization-folder # GitHub Organization Folder Plugin
$jenkins_plugin_manager --plugins subversion # Subversion Plug-in
$jenkins_plugin_manager --plugins email-ext # Email Extension Plugin
$jenkins_plugin_manager --plugins ssh-slaves # SSH Slaves plugin
# Install extra comfort plugins
# Handle terminal colours. Enhance the readability of the terminal.
$jenkins_cli install-plugin ansicolor
$jenkins_plugin_manager --plugins ansicolor
# Monitoring of the local file system. Allow to monitor a directory and trig a job if a file has been modified.
$jenkins_cli install-plugin fstrigger
# Set global security with ldap
cp ../conf/config.xml $final_path/
chown jenkins: $final_path/config.xml
# Clean hosts file
sed -i '/#jenkins/d' /etc/hosts
$jenkins_plugin_manager --plugins fstrigger
#=================================================
# STORE THE CONFIG FILE CHECKSUM
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Storing the config file checksum..."
ynh_script_progression --message="Adding a configuration file..."
# Calculate and store the config file checksum into the app settings
ynh_store_file_checksum --file="/etc/default/jenkins"
ynh_store_file_checksum --file="$final_path/config.xml"
ynh_add_config --template="../conf/config.xml" --destination="$final_path/config.xml"
chown $app:$app "$final_path/config.xml"
#=================================================
# GENERIC FINALIZATION
@ -237,7 +179,7 @@ ynh_store_file_checksum --file="$final_path/config.xml"
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..."
yunohost service add $app --description="Extendable continuous integration server" --log="/var/log/$app/$app.log"
yunohost service add $app --description="Jenkins Continuous Integration Server"
#=================================================
# START SYSTEMD SERVICE
@ -245,7 +187,7 @@ yunohost service add $app --description="Extendable continuous integration serve
ynh_script_progression --message="Starting a systemd service..."
# Start a systemd service
ynh_systemd_action --service_name=$app --action="restart" --line_match="Jenkins is fully up and running" --log_path="/var/log/$app/$app.log" --timeout="$timeout"
ynh_systemd_action --service_name=$app --action="restart" --line_match="Started Jenkins Continuous Integration Server" --log_path="systemd"
#=================================================
# SETUP SSOWAT

View file

@ -37,7 +37,7 @@ fi
#=================================================
ynh_script_progression --message="Stopping a systemd service..."
ynh_systemd_action --service_name=$app --action="stop" --line_match="Stopped LSB" --log_path="systemd"
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
#=================================================
# REMOVE DEPENDENCIES
@ -74,9 +74,6 @@ ynh_script_progression --message="Removing various files..."
# Remove a directory securely
ynh_secure_remove --file="/etc/default/jenkins"
# Remove the log files
ynh_secure_remove --file="/var/log/$app"
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -63,29 +63,6 @@ ynh_script_progression --message="Reinstalling dependencies..."
# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# FIX THE PORT TO USE
#=================================================
ynh_script_progression --message="Fixing the port in Jenkins config..."
change_port() {
# Wait for the creation of the jenkins service file
timeout=600
for j in `seq 1 $timeout`
do
# Wait for an update of plugin repositories
if test -e /etc/default/jenkins; then
break;
else
sleep 0.5
fi
done
# And modify the port as soon as possible, to prevent a crach of jenkins if the default port is already used.
ynh_replace_string --match_string="^HTTP_PORT=.*" --replace_string="HTTP_PORT=$port" --target_file=/etc/default/jenkins
}
change_port &
pid_change_port=$!
#=================================================
# INSTALL JENKINS
#=================================================
@ -95,6 +72,17 @@ ynh_script_progression --message="Installing Jenkins..."
ynh_setup_source --dest_dir="../conf"
dpkg --install --force-confnew ../conf/jenkins.deb
#=================================================
# SETUP APPLICATION
#=================================================
ynh_script_progression --message="Setuping application..."
ynh_replace_string --match_string="Environment=\"JENKINS_PORT=8080\"" --replace_string="Environment=\"JENKINS_PORT=$port\"\nEnvironment=\"JENKINS_PREFIX=$path_url\"" --target_file="/lib/systemd/system/jenkins.service"
systemctl daemon-reload --quiet
ynh_systemd_action --service_name=$app --action="restart" --line_match="Started Jenkins Continuous Integration Server" --log_path="systemd"
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
@ -102,26 +90,19 @@ ynh_script_progression --message="Restoring the app main directory..."
ynh_restore_file --origin_path="$final_path" --not_mandatory
#=================================================
# RESTORE THE JENKINS' BOOT CONFIG
#=================================================
ynh_secure_remove --file="/etc/default/jenkins"
ynh_restore_file --origin_path=/etc/default/$app
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..."
yunohost service add $app --description="Extendable continuous integration server" --log="/var/log/$app/$app.log"
yunohost service add $app --description="Jenkins Continuous Integration Server"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..."
ynh_systemd_action --service_name=$app --action="restart" --line_match="Jenkins is fully up and running" --log_path="/var/log/$app/$app.log" --timeout="3600"
ynh_systemd_action --service_name=$app --action="restart" --line_match="Started Jenkins Continuous Integration Server" --log_path="systemd"
#=================================================
# SEND A README FOR THE ADMIN

View file

@ -45,9 +45,6 @@ ynh_clean_setup () {
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
ynh_backup_if_checksum_is_different --file="/etc/default/jenkins"
ynh_backup_if_checksum_is_different --file="$final_path/config.xml"
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
@ -55,7 +52,7 @@ ynh_backup_if_checksum_is_different --file="$final_path/config.xml"
#=================================================
ynh_script_progression --message="Stopping a systemd service..."
ynh_systemd_action --service_name=$app --action="stop" --line_match="Stopped LSB" --log_path="systemd"
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
@ -91,6 +88,12 @@ if ! ynh_permission_exists --permission="github-webhook"; then
ynh_permission_create --permission="github-webhook" --url="/github-webhook" --allowed="visitors" --show_tile="false" --protected="true"
fi
# Remove the log files
ynh_secure_remove --file="/var/log/$app"
# No more needed since systemd
ynh_delete_file_checksum --file="/etc/default/jenkins"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
@ -100,20 +103,19 @@ then
ynh_script_progression --message="Upgrading source files..."
# Download jenkins deb file and install it.
ynh_setup_source --dest_dir="../conf"
ynh_setup_source --source_id="jenkins-plugin-manager" --dest_dir="$final_path"
dpkg --install --force-confnew ../conf/jenkins.deb
#=================================================
# FIX JENKINS SETUP
# SETUP APPLICATION
#=================================================
ynh_script_progression --message="Setuping application..."
if [ "$path_url" != "/" ];
then
# Add the path, in case of sub-path installation, into jenkins' boot options
if ! grep --quiet "prefix=$path_url" /etc/default/jenkins
then
sed -i "$ s@--httpPort=\$HTTP_PORT@& --prefix=$path_url@g" /etc/default/jenkins
fi
fi
ynh_replace_string --match_string="Environment=\"JENKINS_PORT=8080\"" --replace_string="Environment=\"JENKINS_PORT=$port\"\nEnvironment=\"JENKINS_PREFIX=$path_url\"" --target_file="/lib/systemd/system/jenkins.service"
systemctl daemon-reload --quiet
ynh_systemd_action --service_name=$app --action="restart" --line_match="Started Jenkins Continuous Integration Server" --log_path="systemd"
fi
#=================================================
@ -145,46 +147,19 @@ ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# CHECK JENKINS STARTING
#=================================================
ynh_script_progression --message="Restarting Jenkins..."
# Wait for Jenkins to be fully started
ynh_systemd_action --service_name=$app --action="restart" --line_match="Jenkins is fully up and running" --log_path="/var/log/$app/$app.log" --timeout="3600"
#=================================================
# UPGRADE JENKINS-CLI.JAR
#=================================================
ynh_script_progression --message="Upgrading jenkins-cli.jar..."
wget -nv --no-check-certificate https://127.0.0.1${path_url%/}/jnlpJars/jenkins-cli.jar -O $final_path/jenkins-cli.jar.temp 2>&1
mv -f $final_path/jenkins-cli.jar.temp $final_path/jenkins-cli.jar
#=================================================
# UPGRADE PLUGINS
#=================================================
ynh_script_progression --message="Upgrading plugins..."
cp $final_path/config.xml $final_path/config.xml.bak
ynh_replace_string --match_string="<useSecurity>true</useSecurity>" --replace_string="<useSecurity>false</useSecurity>" --target_file=$final_path/config.xml
ynh_systemd_action --service_name=$app --action="restart" --line_match="Jenkins is fully up and running" --log_path="/var/log/$app/$app.log" --timeout="3600"
jenkins_cli="ynh_exec_warn_less java -jar $final_path/jenkins-cli.jar -s http://127.0.0.1:${port}${path_url%/}"
UPDATE_LIST=$($jenkins_cli list-plugins | grep -oP '^(.*?) ')
jenkins_plugin_manager="ynh_exec_warn_less java -jar $final_path/jenkins-plugin-manager.jar --war /usr/share/java/jenkins.war --plugin-download-directory=$final_path/plugins"
UPDATE_LIST=$($jenkins_plugin_manager --list | grep -o '.*\..*' | grep -oP '^(.*?) ')
for plugin in ${UPDATE_LIST}
do
$jenkins_cli install-plugin "$plugin" || true
$jenkins_plugin_manager --plugins "$plugin" || true
done
mv $final_path/config.xml.bak $final_path/config.xml
# Calculate and store the config file checksum into the app settings
ynh_store_file_checksum --file="/etc/default/jenkins"
ynh_store_file_checksum --file="$final_path/config.xml"
#=================================================
# GENERIC FINALIZATION
#=================================================
@ -192,14 +167,14 @@ ynh_store_file_checksum --file="$final_path/config.xml"
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..."
yunohost service add $app --description="Extendable continuous integration server" --log="/var/log/$app/$app.log"
yunohost service add $app --description="Jenkins Continuous Integration Server"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..."
ynh_systemd_action --service_name=$app --action="restart" --line_match="Jenkins is fully up and running" --log_path="/var/log/$app/$app.log"
ynh_systemd_action --service_name=$app --action="restart" --line_match="Started Jenkins Continuous Integration Server" --log_path="systemd"
#=================================================
# SEND A README FOR THE ADMIN