mirror of
https://github.com/YunoHost-Apps/jenkins_ynh.git
synced 2024-09-03 19:26:18 +02:00
switch /var/lib/jenkin
This commit is contained in:
parent
b014e08e4f
commit
886fd97748
2 changed files with 15 additions and 15 deletions
|
@ -156,7 +156,7 @@ ynh_systemd_action --service_name=$app --action="restart" --line_match="Jenkins
|
||||||
|
|
||||||
# Enable Jenkins CLI Protocol/2 for jenkins-cli
|
# Enable Jenkins CLI Protocol/2 for jenkins-cli
|
||||||
# That the only protocol that allow connection without an authenticated user...
|
# 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=/var/lib/jenkins/config.xml
|
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
|
# 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="Jenkins is fully up and running" --log_path="/var/log/$app/$app.log" --timeout="$timeout"
|
||||||
|
@ -164,11 +164,11 @@ ynh_systemd_action --service_name=$app --action="restart" --line_match="Jenkins
|
||||||
ynh_script_progression --message="Installing plugins..." --weight=60
|
ynh_script_progression --message="Installing plugins..." --weight=60
|
||||||
|
|
||||||
# If the log says that jenkins has started, install the 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 /var/lib/jenkins/jenkins-cli.jar 2>&1
|
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`
|
for i in `seq 1 $timeout`
|
||||||
do
|
do
|
||||||
# Wait for an update of plugin repositories
|
# Wait for an update of plugin repositories
|
||||||
if test -e /var/lib/jenkins/updates/default.json; then
|
if test -e $final_path/updates/default.json; then
|
||||||
break;
|
break;
|
||||||
else
|
else
|
||||||
echo -n "."
|
echo -n "."
|
||||||
|
@ -179,10 +179,10 @@ done
|
||||||
# Remove the public access
|
# Remove the public access
|
||||||
ynh_permission_update --permission="main" --remove="visitors"
|
ynh_permission_update --permission="main" --remove="visitors"
|
||||||
|
|
||||||
ynh_replace_string --match_string="<useSecurity>true</useSecurity>" --replace_string="<useSecurity>false</useSecurity>" --target_file=/var/lib/jenkins/config.xml
|
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"
|
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 /var/lib/jenkins/jenkins-cli.jar -s http://${domain}:${port}${path_url%/}"
|
jenkins_cli="ynh_exec_warn_less java -jar $final_path/jenkins-cli.jar -s http://${domain}:${port}${path_url%/}"
|
||||||
|
|
||||||
# Install plugins for http authentication and ldap.
|
# Install plugins for http authentication and ldap.
|
||||||
$jenkins_cli install-plugin reverse-proxy-auth-plugin
|
$jenkins_cli install-plugin reverse-proxy-auth-plugin
|
||||||
|
@ -215,8 +215,8 @@ $jenkins_cli install-plugin ansicolor
|
||||||
$jenkins_cli install-plugin fstrigger
|
$jenkins_cli install-plugin fstrigger
|
||||||
|
|
||||||
# Set global security with ldap
|
# Set global security with ldap
|
||||||
cp ../conf/config.xml /var/lib/jenkins/
|
cp ../conf/config.xml $final_path/
|
||||||
chown jenkins: /var/lib/jenkins/config.xml
|
chown jenkins: $final_path/config.xml
|
||||||
|
|
||||||
# Clean hosts file
|
# Clean hosts file
|
||||||
sed -i '/#jenkins/d' /etc/hosts
|
sed -i '/#jenkins/d' /etc/hosts
|
||||||
|
@ -228,7 +228,7 @@ ynh_script_progression --message="Storing the config file checksum..."
|
||||||
|
|
||||||
# Calculate and store the config file checksum into the app settings
|
# Calculate and store the config file checksum into the app settings
|
||||||
ynh_store_file_checksum --file="/etc/default/jenkins"
|
ynh_store_file_checksum --file="/etc/default/jenkins"
|
||||||
ynh_store_file_checksum --file="/var/lib/jenkins/config.xml"
|
ynh_store_file_checksum --file="$final_path/config.xml"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
|
|
|
@ -97,7 +97,7 @@ ynh_script_progression --message="Activating maintenance mode..." --weight=2
|
||||||
ynh_maintenance_mode_ON
|
ynh_maintenance_mode_ON
|
||||||
|
|
||||||
ynh_backup_if_checksum_is_different --file="/etc/default/jenkins"
|
ynh_backup_if_checksum_is_different --file="/etc/default/jenkins"
|
||||||
ynh_backup_if_checksum_is_different --file="/var/lib/jenkins/config.xml"
|
ynh_backup_if_checksum_is_different --file="$final_path/config.xml"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD UPGRADE STEPS
|
# STANDARD UPGRADE STEPS
|
||||||
|
@ -182,19 +182,19 @@ ynh_maintenance_mode_OFF
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading jenkins-cli.phar..."
|
ynh_script_progression --message="Upgrading jenkins-cli.phar..."
|
||||||
|
|
||||||
wget -nv --no-check-certificate https://$domain${path_url%/}/jnlpJars/jenkins-cli.jar -O /var/lib/jenkins/jenkins-cli.jar 2>&1
|
wget -nv --no-check-certificate https://$domain${path_url%/}/jnlpJars/jenkins-cli.jar -O $final_path/jenkins-cli.jar 2>&1
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPGRADE PLUGINS
|
# UPGRADE PLUGINS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading plugins..." --weight=40
|
ynh_script_progression --message="Upgrading plugins..." --weight=40
|
||||||
|
|
||||||
cp /var/lib/jenkins/config.xml /var/lib/jenkins/config.xml.bak
|
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=/var/lib/jenkins/config.xml
|
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"
|
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 /var/lib/jenkins/jenkins-cli.jar -s http://127.0.0.1:${port}${path_url%/}"
|
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 '^(.*?) ')
|
UPDATE_LIST=$($jenkins_cli list-plugins | grep -oP '^(.*?) ')
|
||||||
|
|
||||||
for plugin in ${UPDATE_LIST}
|
for plugin in ${UPDATE_LIST}
|
||||||
|
@ -202,11 +202,11 @@ do
|
||||||
$jenkins_cli install-plugin "$plugin" || true
|
$jenkins_cli install-plugin "$plugin" || true
|
||||||
done
|
done
|
||||||
|
|
||||||
mv /var/lib/jenkins/config.xml.bak /var/lib/jenkins/config.xml
|
mv $final_path/config.xml.bak $final_path/config.xml
|
||||||
|
|
||||||
# Calculate and store the config file checksum into the app settings
|
# Calculate and store the config file checksum into the app settings
|
||||||
ynh_store_file_checksum --file="/etc/default/jenkins"
|
ynh_store_file_checksum --file="/etc/default/jenkins"
|
||||||
ynh_store_file_checksum --file="/var/lib/jenkins/config.xml"
|
ynh_store_file_checksum --file="$final_path/config.xml"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
|
|
Loading…
Add table
Reference in a new issue