mirror of
https://github.com/YunoHost-Apps/jenkins_ynh.git
synced 2024-09-03 19:26:18 +02:00
Merge pull request #72 from YunoHost-Apps/testing
Upgrade to 2.332.3~ynh1
This commit is contained in:
commit
5ff1883636
14 changed files with 163 additions and 274 deletions
23
README.md
23
README.md
|
@ -5,7 +5,7 @@ It shall NOT be edited by hand.
|
|||
|
||||
# Jenkins for YunoHost
|
||||
|
||||
[![Integration level](https://dash.yunohost.org/integration/jenkins.svg)](https://dash.yunohost.org/appci/app/jenkins) ![](https://ci-apps.yunohost.org/ci/badges/jenkins.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/jenkins.maintain.svg)
|
||||
[![Integration level](https://dash.yunohost.org/integration/jenkins.svg)](https://dash.yunohost.org/appci/app/jenkins) ![Working status](https://ci-apps.yunohost.org/ci/badges/jenkins.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/jenkins.maintain.svg)
|
||||
[![Install Jenkins with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=jenkins)
|
||||
|
||||
*[Lire ce readme en français.](./README_fr.md)*
|
||||
|
@ -17,13 +17,11 @@ 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
|
||||
|
||||
## Screenshots
|
||||
|
||||
![](./doc/screenshots/screenshot1.png)
|
||||
![Screenshot of Jenkins](./doc/screenshots/screenshot1.png)
|
||||
|
||||
## Disclaimers / important information
|
||||
|
||||
|
@ -31,21 +29,22 @@ Extendable continuous integration server
|
|||
|
||||
## Documentation and resources
|
||||
|
||||
* Official app website: https://jenkins.io
|
||||
* Official user documentation: https://www.jenkins.io/doc/book/
|
||||
* Upstream app code repository: https://github.com/jenkinsci/jenkins
|
||||
* YunoHost documentation for this app: https://yunohost.org/app_jenkins
|
||||
* Report a bug: https://github.com/YunoHost-Apps/jenkins_ynh/issues
|
||||
* Official app website: <https://jenkins.io>
|
||||
* Official user documentation: <https://www.jenkins.io/doc/book/>
|
||||
* Upstream app code repository: <https://github.com/jenkinsci/jenkins>
|
||||
* YunoHost documentation for this app: <https://yunohost.org/app_jenkins>
|
||||
* Report a bug: <https://github.com/YunoHost-Apps/jenkins_ynh/issues>
|
||||
|
||||
## Developer info
|
||||
|
||||
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/jenkins_ynh/tree/testing).
|
||||
|
||||
To try the testing branch, please proceed like that.
|
||||
```
|
||||
|
||||
``` bash
|
||||
sudo yunohost app install https://github.com/YunoHost-Apps/jenkins_ynh/tree/testing --debug
|
||||
or
|
||||
sudo yunohost app upgrade jenkins -u https://github.com/YunoHost-Apps/jenkins_ynh/tree/testing --debug
|
||||
```
|
||||
|
||||
**More info regarding app packaging:** https://yunohost.org/packaging_apps
|
||||
**More info regarding app packaging:** <https://yunohost.org/packaging_apps>
|
||||
|
|
29
README_fr.md
29
README_fr.md
|
@ -1,10 +1,14 @@
|
|||
<!--
|
||||
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
|
||||
It shall NOT be edited by hand.
|
||||
-->
|
||||
|
||||
# Jenkins pour YunoHost
|
||||
|
||||
[![Niveau d'intégration](https://dash.yunohost.org/integration/jenkins.svg)](https://dash.yunohost.org/appci/app/jenkins) ![](https://ci-apps.yunohost.org/ci/badges/jenkins.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/jenkins.maintain.svg)
|
||||
[![Niveau d'intégration](https://dash.yunohost.org/integration/jenkins.svg)](https://dash.yunohost.org/appci/app/jenkins) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/jenkins.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/jenkins.maintain.svg)
|
||||
[![Installer Jenkins avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=jenkins)
|
||||
|
||||
*[Read this readme in english.](./README.md)*
|
||||
*[Lire ce readme en français.](./README_fr.md)*
|
||||
|
||||
> *Ce package vous permet d'installer Jenkins rapidement et simplement sur un serveur YunoHost.
|
||||
Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
|
||||
|
@ -13,13 +17,11 @@ 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
|
||||
|
||||
## Captures d'écran
|
||||
|
||||
![](./doc/screenshots/screenshot1.png)
|
||||
![Capture d'écran de Jenkins](./doc/screenshots/screenshot1.png)
|
||||
|
||||
## Avertissements / informations importantes
|
||||
|
||||
|
@ -27,21 +29,22 @@ Serveur d'intégration continue extensible
|
|||
|
||||
## Documentations et ressources
|
||||
|
||||
* Site officiel de l'app : https://jenkins.io
|
||||
* Documentation officielle utilisateur : https://www.jenkins.io/doc/book/
|
||||
* Dépôt de code officiel de l'app : https://github.com/jenkinsci/jenkins
|
||||
* Documentation YunoHost pour cette app : https://yunohost.org/app_jenkins
|
||||
* Signaler un bug : https://github.com/YunoHost-Apps/jenkins_ynh/issues
|
||||
* Site officiel de l'app : <https://jenkins.io>
|
||||
* Documentation officielle utilisateur : <https://www.jenkins.io/doc/book/>
|
||||
* Dépôt de code officiel de l'app : <https://github.com/jenkinsci/jenkins>
|
||||
* Documentation YunoHost pour cette app : <https://yunohost.org/app_jenkins>
|
||||
* Signaler un bug : <https://github.com/YunoHost-Apps/jenkins_ynh/issues>
|
||||
|
||||
## Informations pour les développeurs
|
||||
|
||||
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/jenkins_ynh/tree/testing).
|
||||
|
||||
Pour essayer la branche testing, procédez comme suit.
|
||||
```
|
||||
|
||||
``` bash
|
||||
sudo yunohost app install https://github.com/YunoHost-Apps/jenkins_ynh/tree/testing --debug
|
||||
ou
|
||||
sudo yunohost app upgrade jenkins -u https://github.com/YunoHost-Apps/jenkins_ynh/tree/testing --debug
|
||||
```
|
||||
|
||||
**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps
|
||||
**Plus d'infos sur le packaging d'applications :** <https://yunohost.org/packaging_apps>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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>
|
||||
|
|
7
conf/jenkins-plugin-manager.src
Normal file
7
conf/jenkins-plugin-manager.src
Normal 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
|
|
@ -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",
|
||||
|
|
|
@ -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
|
||||
#=================================================
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -39,6 +39,7 @@ ynh_script_progression --message="Backing up the app before changing its URL (ma
|
|||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
|
||||
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||
|
||||
|
@ -71,7 +72,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
|
||||
|
@ -109,28 +110,8 @@ fi
|
|||
#=================================================
|
||||
ynh_script_progression --message="Updating Jenkins setup..."
|
||||
|
||||
ynh_backup_if_checksum_is_different --file="/etc/default/jenkins"
|
||||
|
||||
if [ $change_path -eq 1 ]
|
||||
then
|
||||
# Add the path, in case of sub-path installation, into jenkins' boot options
|
||||
|
||||
# Change to root
|
||||
if [ "$new_path" == "/" ]
|
||||
then
|
||||
sed -i "s@--prefix=$old_path@@g" /etc/default/jenkins
|
||||
# Change to a sub path
|
||||
else
|
||||
if ! grep --quiet "prefix=$old_path" /etc/default/jenkins
|
||||
then
|
||||
sed -i "$ s@--httpPort=\$HTTP_PORT@& --prefix=$new_path@g" /etc/default/jenkins
|
||||
else
|
||||
sed -i "s@--prefix=$old_path@--prefix=$new_path@g" /etc/default/jenkins
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
ynh_store_file_checksum --file="/etc/default/jenkins"
|
||||
ynh_replace_string --match_string="Environment=\"JENKINS_PREFIX=$old_path\"" --replace_string="Environment=\"JENKINS_PREFIX=$new_path\"" --target_file="/lib/systemd/system/jenkins.service"
|
||||
systemctl daemon-reload --quiet
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALISATION
|
||||
|
@ -140,7 +121,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
|
||||
|
|
166
scripts/install
166
scripts/install
|
@ -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
|
||||
|
||||
#=================================================
|
||||
|
@ -75,6 +77,14 @@ ynh_script_progression --message="Installing dependencies..."
|
|||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring system user..."
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
|
@ -83,6 +93,11 @@ 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"
|
||||
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:$app "$final_path"
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
|
@ -94,29 +109,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 +122,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 +191,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 +199,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
|
||||
|
|
|
@ -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
|
||||
#=================================================
|
||||
|
|
|
@ -53,6 +53,14 @@ ynh_script_progression --message="Restoring the NGINX web server configuration..
|
|||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# RECREATE THE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Recreating the dedicated system user..."
|
||||
|
||||
# Create the dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC RESTORATION
|
||||
#=================================================
|
||||
|
@ -63,29 +71,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 +80,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 +98,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
|
||||
|
|
|
@ -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,20 @@ 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"
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Making sure dedicated system user exists..."
|
||||
|
||||
# Create a dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
|
@ -100,20 +111,23 @@ 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"
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:$app "$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 +159,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 +179,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
|
||||
|
|
Loading…
Reference in a new issue