mirror of
https://github.com/YunoHost-Apps/jenkins_ynh.git
synced 2024-09-03 19:26:18 +02:00
Packaging v2
This commit is contained in:
parent
e59aee93d0
commit
0f6fd47077
21 changed files with 266 additions and 593 deletions
100
.github/workflows/updater.sh
vendored
100
.github/workflows/updater.sh
vendored
|
@ -1,100 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# PACKAGE UPDATING HELPER
|
||||
#=================================================
|
||||
|
||||
# This script is meant to be run by GitHub Actions
|
||||
# The YunoHost-Apps organisation offers a template Action to run this script periodically
|
||||
# Since each app is different, maintainers can adapt its contents so as to perform
|
||||
# automatic actions when a new upstream release is detected.
|
||||
|
||||
#=================================================
|
||||
# FETCHING LATEST RELEASE AND ITS ASSETS
|
||||
#=================================================
|
||||
|
||||
# Fetching information
|
||||
current_version=$(cat manifest.json | jq -j '.version|split("~")[0]')
|
||||
repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]')
|
||||
# Some jq magic is needed, because the latest upstream release is not always the latest version (e.g. security patches for older versions)
|
||||
version=$(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '.[] | select( .prerelease != true ) | select( .target_commitish | contains("refs/heads/master") | not ) | .tag_name' | sort -V | tail -1 | cut -d"-" -f2)
|
||||
assets="https://pkg.jenkins.io/debian-stable/binary/jenkins_${version}_all.deb"
|
||||
|
||||
# Setting up the environment variables
|
||||
echo "Current version: $current_version"
|
||||
echo "Latest release from upstream: $version"
|
||||
echo "VERSION=$version" >> $GITHUB_ENV
|
||||
echo "REPO=$repo" >> $GITHUB_ENV
|
||||
# For the time being, let's assume the script will fail
|
||||
echo "PROCEED=false" >> $GITHUB_ENV
|
||||
|
||||
# Proceed only if the retrieved version is greater than the current one
|
||||
if ! dpkg --compare-versions "$current_version" "lt" "$version" ; then
|
||||
echo "::warning ::No new version available"
|
||||
exit 0
|
||||
# Proceed only if a PR for this new version does not already exist
|
||||
elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.git ci-auto-update-v$version ; then
|
||||
echo "::warning ::A branch already exists for this update"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# UPDATE SOURCE FILES
|
||||
#=================================================
|
||||
|
||||
# Let's download source
|
||||
asset_url=$assets
|
||||
|
||||
echo "Handling asset at $asset_url"
|
||||
|
||||
src="app"
|
||||
|
||||
# Create the temporary directory
|
||||
tempdir="$(mktemp -d)"
|
||||
|
||||
# Download sources and calculate checksum
|
||||
filename=${asset_url##*/}
|
||||
curl --silent -4 -L $asset_url -o "$tempdir/$filename"
|
||||
checksum=$(sha256sum "$tempdir/$filename" | head -c 64)
|
||||
|
||||
# Delete temporary directory
|
||||
rm -rf $tempdir
|
||||
|
||||
# Get extension
|
||||
if [[ $filename == *.tar.gz ]]; then
|
||||
extension=tar.gz
|
||||
else
|
||||
extension=${filename##*.}
|
||||
fi
|
||||
|
||||
# Rewrite source file
|
||||
cat <<EOT > conf/$src.src
|
||||
SOURCE_URL=$asset_url
|
||||
SOURCE_SUM=$checksum
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=$extension
|
||||
SOURCE_IN_SUBDIR=true
|
||||
SOURCE_FILENAME=jenkins.deb
|
||||
SOURCE_EXTRACT=false
|
||||
EOT
|
||||
echo "... conf/$src.src updated"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPDATE STEPS
|
||||
#=================================================
|
||||
|
||||
# Any action on the app's source code can be done.
|
||||
# The GitHub Action workflow takes care of committing all changes after this script ends.
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
|
||||
# Replace new version in manifest
|
||||
echo "$(jq -s --indent 4 ".[] | .version = \"$version~ynh1\"" manifest.json)" > manifest.json
|
||||
|
||||
# No need to update the README, yunohost-bot takes care of it
|
||||
|
||||
# The Action will proceed only if the PROCEED environment variable is set to true
|
||||
echo "PROCEED=true" >> $GITHUB_ENV
|
||||
exit 0
|
49
.github/workflows/updater.yml
vendored
49
.github/workflows/updater.yml
vendored
|
@ -1,49 +0,0 @@
|
|||
# This workflow allows GitHub Actions to automagically update your app whenever a new upstream release is detected.
|
||||
# You need to enable Actions in your repository settings, and fetch this Action from the YunoHost-Apps organization.
|
||||
# This file should be enough by itself, but feel free to tune it to your needs.
|
||||
# It calls updater.sh, which is where you should put the app-specific update steps.
|
||||
name: Check for new upstream releases
|
||||
on:
|
||||
# Allow to manually trigger the workflow
|
||||
workflow_dispatch:
|
||||
# Run it every day at 6:00 UTC
|
||||
schedule:
|
||||
- cron: '0 6 * * *'
|
||||
jobs:
|
||||
updater:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Fetch the source code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Run the updater script
|
||||
id: run_updater
|
||||
run: |
|
||||
# Setting up Git user
|
||||
git config --global user.name 'yunohost-bot'
|
||||
git config --global user.email 'yunohost-bot@users.noreply.github.com'
|
||||
# Run the updater script
|
||||
/bin/bash .github/workflows/updater.sh
|
||||
- name: Commit changes
|
||||
id: commit
|
||||
if: ${{ env.PROCEED == 'true' }}
|
||||
run: |
|
||||
git commit -am "Upgrade to v$VERSION"
|
||||
- name: Create Pull Request
|
||||
id: cpr
|
||||
if: ${{ env.PROCEED == 'true' }}
|
||||
uses: peter-evans/create-pull-request@v4
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
commit-message: Update to version ${{ env.VERSION }}
|
||||
committer: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
|
||||
author: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
|
||||
signoff: false
|
||||
base: testing
|
||||
branch: ci-auto-update-v${{ env.VERSION }}
|
||||
delete-branch: true
|
||||
title: 'Upgrade to version ${{ env.VERSION }}'
|
||||
body: |
|
||||
Upgrade to v${{ env.VERSION }}
|
||||
draft: false
|
|
@ -1,49 +0,0 @@
|
|||
;; Test complet
|
||||
; Manifest
|
||||
domain="domain.tld"
|
||||
path="/path"
|
||||
is_public=1
|
||||
; Checks
|
||||
pkg_linter=1
|
||||
setup_sub_dir=1
|
||||
setup_root=1
|
||||
setup_nourl=0
|
||||
setup_private=1
|
||||
setup_public=1
|
||||
upgrade=1
|
||||
# 2.150.2~ynh2
|
||||
#upgrade=1 from_commit=29141b702f2954e0f72925121aea82a7fa3fc118
|
||||
# 2.263.1~ynh1
|
||||
#upgrade=1 from_commit=0e1aae7be82034650e2c1f6c1ad6d68a41b80176
|
||||
# 2.263.4~ynh1
|
||||
#upgrade=1 from_commit=72656bca2e144ef9a92cfec2af6cd13cb8e8aee3
|
||||
# 2.277.2~ynh1
|
||||
#upgrade=1 from_commit=e6cf48fdbcc7cac5c5147d4a7cc1ebfd9055bfef
|
||||
# 2.277.3~ynh1
|
||||
#upgrade=1 from_commit=3f0f52e24273e9da86ac2fa7000953b7734196a5
|
||||
# 2.277.4~ynh1
|
||||
#upgrade=1 from_commit=36fdba9bbd201832f5707083b878ae967052ad6a
|
||||
# 2.289.1~ynh1
|
||||
#upgrade=1 from_commit=abf516d8a4dd721af8b9a2560a2a1dbd7ea79fb8
|
||||
# 2.289.2~ynh1
|
||||
#upgrade=1 from_commit=c7a3a24e56e9be3b5991a175d08be116392b5a19
|
||||
# 2.289.3~ynh1
|
||||
#upgrade=1 from_commit=f165327adcc291a479ab73050bcaa1b84784e763
|
||||
# 2.303.1~ynh1
|
||||
#upgrade=1 from_commit=0bb8a4ca3a90693c5594a72379704f7e08519c92
|
||||
# 2.319.1~ynh1
|
||||
#upgrade=1 from_commit=449a3d43180316d6b1bdb693354bd7cdbe8ef987
|
||||
# 2.319.2~ynh1
|
||||
#upgrade=1 from_commit=7e40418b50b5c25d80f3bc521f9627cdd22c4201
|
||||
# 2.319.3~ynh1
|
||||
#upgrade=1 from_commit=ceac884c4d82f8164ec7ce391d354d794948bb72
|
||||
# 2.332.3~ynh1
|
||||
#upgrade=1 from_commit=5ff1883636f649c7e32d6b520fd54621f83097ba
|
||||
# 2.375.2~ynh1
|
||||
upgrade=1 from_commit=4733662adabc01ea1e29ca0bf55c45f204bb1857
|
||||
backup_restore=1
|
||||
multi_instance=0
|
||||
change_url=1
|
||||
;;; Options
|
||||
Email=
|
||||
Notification=none
|
|
@ -1,7 +0,0 @@
|
|||
SOURCE_URL=https://pkg.jenkins.io/debian-stable/binary/jenkins_2.426.3_all.deb
|
||||
SOURCE_SUM=7a453125a0194deba5a6464220e8beab3d0cd6a83f84f85a096babfaf5e752b5
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=deb
|
||||
SOURCE_IN_SUBDIR=true
|
||||
SOURCE_FILENAME=jenkins.deb
|
||||
SOURCE_EXTRACT=false
|
|
@ -1,7 +0,0 @@
|
|||
SOURCE_URL=https://github.com/jenkinsci/plugin-installation-manager-tool/releases/download/2.12.8/jenkins-plugin-manager-2.12.8.jar
|
||||
SOURCE_SUM=e5b22868c498c311ea1b776e9087af199b795ddbf0bc0474b0b4ca9e67837f26
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=jar
|
||||
SOURCE_IN_SUBDIR=false
|
||||
SOURCE_FILENAME=jenkins-plugin-manager.jar
|
||||
SOURCE_EXTRACT=false
|
1
doc/ADMIN.md
Normal file
1
doc/ADMIN.md
Normal file
|
@ -0,0 +1 @@
|
|||
Use the admin panel of your Jenkins to configure this app.
|
1
doc/ADMIN_fr.md
Normal file
1
doc/ADMIN_fr.md
Normal file
|
@ -0,0 +1 @@
|
|||
Utilisez le panneau d'administration Jenkins pour configurer l'application.
|
|
@ -1 +0,0 @@
|
|||
* Use the admin panel of your Jenkins to configure this app.
|
|
@ -1 +0,0 @@
|
|||
* Utiliser le panneau d'administration Jenkins pour configurer l'application.
|
4
doc/POST_INSTALL.md
Normal file
4
doc/POST_INSTALL.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
You can configure this app easily by using the experimental [config-panel feature](https://__DOMAIN__/yunohost/apps/__APP__/config-panel).
|
||||
You can also find some specific actions for this app by using the experimental [action feature](https://__DOMAIN__/yunohost/apps/__APP__/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).
|
|
@ -1,54 +0,0 @@
|
|||
{
|
||||
"name": "Jenkins",
|
||||
"id": "jenkins",
|
||||
"packaging_format": 1,
|
||||
"description": {
|
||||
"en": "Extendable continuous integration server",
|
||||
"fr": "Serveur d'intégration continue extensible"
|
||||
},
|
||||
"version": "2.426.3~ynh1",
|
||||
"url": "https://jenkins.io/index.html",
|
||||
"upstream": {
|
||||
"license": "MIT",
|
||||
"website": "https://jenkins.io",
|
||||
"userdoc": "https://www.jenkins.io/doc/book/",
|
||||
"code": "https://github.com/jenkinsci/jenkins",
|
||||
"cpe": "cpe:2.3:a:jenkins:jenkins"
|
||||
},
|
||||
"license": "MIT",
|
||||
"maintainer": {
|
||||
"name": "yalh76"
|
||||
},
|
||||
"previous_maintainers": [
|
||||
{
|
||||
"name": "Julien Malik et Maniack Crudelis",
|
||||
"email": "maniackc_dev@crudelis.fr"
|
||||
}
|
||||
],
|
||||
"requirements": {
|
||||
"yunohost": ">= 4.3.0"
|
||||
},
|
||||
"multi_instance": false,
|
||||
"services": [
|
||||
"nginx"
|
||||
],
|
||||
"arguments": {
|
||||
"install": [
|
||||
{
|
||||
"name": "domain",
|
||||
"type": "domain"
|
||||
},
|
||||
{
|
||||
"name": "path",
|
||||
"type": "path",
|
||||
"example": "/jenkins",
|
||||
"default": "/jenkins"
|
||||
},
|
||||
{
|
||||
"name": "is_public",
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
79
manifest.toml
Normal file
79
manifest.toml
Normal file
|
@ -0,0 +1,79 @@
|
|||
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json
|
||||
|
||||
packaging_format = 2
|
||||
|
||||
id = "jenkins"
|
||||
name = "Jenkins"
|
||||
description.en = "Extendable continuous integration server"
|
||||
description.fr = "Serveur d'intégration continue extensible"
|
||||
|
||||
version = "2.426.3~ynh2"
|
||||
|
||||
maintainers = ["yalh76"]
|
||||
|
||||
[upstream]
|
||||
license = "MIT"
|
||||
website = "https://jenkins.io"
|
||||
userdoc = "https://www.jenkins.io/doc/book/"
|
||||
code = "https://github.com/jenkinsci/jenkins"
|
||||
cpe = "cpe:2.3:a:cloudbees:jenkins"
|
||||
fund = "https://www.jenkins.io/donate"
|
||||
|
||||
[integration]
|
||||
yunohost = ">= 11.2"
|
||||
architectures = "all"
|
||||
multi_instance = false
|
||||
ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials.
|
||||
sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal.
|
||||
disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ...
|
||||
ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
|
||||
ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
|
||||
|
||||
[install]
|
||||
[install.domain]
|
||||
type = "domain"
|
||||
|
||||
[install.path]
|
||||
type = "path"
|
||||
default = "/jenkins"
|
||||
|
||||
[install.init_main_permission]
|
||||
type = "group"
|
||||
default = "visitors"
|
||||
|
||||
[resources]
|
||||
[resources.sources]
|
||||
[resources.sources.jenkins-plugin-manager]
|
||||
url = "https://github.com/jenkinsci/plugin-installation-manager-tool/releases/download/2.12.8/jenkins-plugin-manager-2.12.8.jar"
|
||||
sha256 = "e5b22868c498c311ea1b776e9087af199b795ddbf0bc0474b0b4ca9e67837f26"
|
||||
format = "whatever"
|
||||
extract = false
|
||||
rename = "jenkins-plugin-manager.jar"
|
||||
|
||||
[resources.sources.main]
|
||||
url = "https://pkg.jenkins.io/debian-stable/binary/jenkins_2.426.3_all.deb"
|
||||
sha256 = "7a453125a0194deba5a6464220e8beab3d0cd6a83f84f85a096babfaf5e752b5"
|
||||
format = "whatever"
|
||||
extract = false
|
||||
rename = "jenkins.deb"
|
||||
|
||||
[resources.system_user]
|
||||
|
||||
[resources.install_dir]
|
||||
|
||||
[resources.permissions]
|
||||
main.url = "/"
|
||||
github_webhook.url = "/github-webhook"
|
||||
github_webhook.allowed = "visitors"
|
||||
github_webhook.protected = false
|
||||
github_webhook.show_tile = false
|
||||
|
||||
[resources.ports]
|
||||
main.default = 8095
|
||||
|
||||
[resources.apt]
|
||||
packages = [
|
||||
"openjdk-11-jdk|openjdk-17-jdk|openjdk-21-jdk",
|
||||
"daemon",
|
||||
"net-tools"
|
||||
]
|
|
@ -4,11 +4,6 @@
|
|||
# COMMON VARIABLES
|
||||
#=================================================
|
||||
|
||||
# dependencies used by the app
|
||||
pkg_dependencies="openjdk-11-jdk|openjdk-17-jdk|openjdk-21-jdk daemon net-tools"
|
||||
|
||||
PLUGIN_CLI_VERSION=2.9.3
|
||||
|
||||
#=================================================
|
||||
# PERSONAL HELPERS
|
||||
#=================================================
|
||||
|
@ -17,18 +12,14 @@ PLUGIN_CLI_VERSION=2.9.3
|
|||
# BOOLEAN CONVERTER
|
||||
#=================================================
|
||||
|
||||
bool_to_01 () {
|
||||
local var="$1"
|
||||
[ "$var" = "true" ] && var=1
|
||||
[ "$var" = "false" ] && var=0
|
||||
echo "$var"
|
||||
bool_to_01() {
|
||||
declare -A bool01=([false]=0 [true]=1)
|
||||
echo "${bool01[$1]}"
|
||||
}
|
||||
|
||||
bool_to_true_false () {
|
||||
local var="$1"
|
||||
[ "$var" = "1" ] && var=true
|
||||
[ "$var" = "0" ] && var=false
|
||||
echo "$var"
|
||||
b01_to_bool() {
|
||||
declare -A b01bool=([0]=false [1]=true)
|
||||
echo "${b01bool[$1]}"
|
||||
}
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -14,21 +14,21 @@ source /usr/share/yunohost/helpers
|
|||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
#REMOVEME? ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
#REMOVEME? ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_print_info --message="Loading installation settings..."
|
||||
#REMOVEME? ynh_print_info --message="Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
|
||||
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
|
||||
#=================================================
|
||||
# STOP SYSTEMD SERVICE
|
||||
|
@ -45,7 +45,7 @@ ynh_print_info --message="Declaring files to be backed up..."
|
|||
# BACKUP THE APP MAIN DIR
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="$final_path" --not_mandatory
|
||||
ynh_backup --src_path="$install_dir" --not_mandatory
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE NGINX CONFIGURATION
|
||||
|
|
|
@ -13,56 +13,56 @@ source /usr/share/yunohost/helpers
|
|||
# RETRIEVE ARGUMENTS
|
||||
#=================================================
|
||||
|
||||
old_domain=$YNH_APP_OLD_DOMAIN
|
||||
old_path=$YNH_APP_OLD_PATH
|
||||
#REMOVEME? old_domain=$YNH_APP_OLD_DOMAIN
|
||||
#REMOVEME? old_path=$YNH_APP_OLD_PATH
|
||||
|
||||
new_domain=$YNH_APP_NEW_DOMAIN
|
||||
new_path=$YNH_APP_NEW_PATH
|
||||
#REMOVEME? new_domain=$YNH_APP_NEW_DOMAIN
|
||||
#REMOVEME? new_path=$YNH_APP_NEW_PATH
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
#REMOVEME? ynh_script_progression --message="Loading installation settings..."
|
||||
|
||||
# Needed for helper "ynh_add_nginx_config"
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
#REMOVEME? # Needed for helper "ynh_add_nginx_config"
|
||||
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
|
||||
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..."
|
||||
#REMOVEME? ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..."
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
#REMOVEME? ynh_backup_before_upgrade
|
||||
#REMOVEME? ynh_clean_setup () {
|
||||
#REMOVEME? 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"
|
||||
#REMOVEME? ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||
|
||||
# Restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
#REMOVEME? ynh_restore_upgradebackup
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
#REMOVEME? ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# CHECK WHICH PARTS SHOULD BE CHANGED
|
||||
#=================================================
|
||||
|
||||
change_domain=0
|
||||
if [ "$old_domain" != "$new_domain" ]
|
||||
#REMOVEME? change_domain=0
|
||||
#REMOVEME? if [ "$old_domain" != "$new_domain" ]
|
||||
then
|
||||
change_domain=1
|
||||
#REMOVEME? change_domain=1
|
||||
fi
|
||||
|
||||
change_path=0
|
||||
if [ "$old_path" != "$new_path" ]
|
||||
#REMOVEME? change_path=0
|
||||
#REMOVEME? if [ "$old_path" != "$new_path" ]
|
||||
then
|
||||
change_path=1
|
||||
#REMOVEME? change_path=1
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -79,28 +79,30 @@ ynh_systemd_action --service_name=$app --action="stop" --line_match="Stopped" --
|
|||
#=================================================
|
||||
ynh_script_progression --message="Updating NGINX web server configuration..."
|
||||
|
||||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||
ynh_change_url_nginx_config
|
||||
|
||||
#REMOVEME? nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||
|
||||
# Change the path in the NGINX config file
|
||||
if [ $change_path -eq 1 ]
|
||||
then
|
||||
# Make a backup of the original NGINX config file if modified
|
||||
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
|
||||
#REMOVEME? ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
|
||||
# Set global variables for NGINX helper
|
||||
domain="$old_domain"
|
||||
path_url="$new_path"
|
||||
#REMOVEME? domain="$old_domain"
|
||||
#REMOVEME? path="$new_path"
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
#REMOVEME? ynh_add_nginx_config
|
||||
fi
|
||||
|
||||
# Change the domain for NGINX
|
||||
if [ $change_domain -eq 1 ]
|
||||
then
|
||||
# Delete file checksum for the old conf file location
|
||||
ynh_delete_file_checksum --file="$nginx_conf_path"
|
||||
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
|
||||
#REMOVEME? ynh_delete_file_checksum --file="$nginx_conf_path"
|
||||
#REMOVEME? mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
|
||||
# Store file checksum for the new config file location
|
||||
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||
#REMOVEME? ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -126,9 +128,9 @@ ynh_systemd_action --service_name=$app --action="start" --line_match="Started" -
|
|||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..."
|
||||
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..."
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
#REMOVEME? #REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
|
@ -30,12 +30,12 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|||
|
||||
# Overwrite nginx configuration
|
||||
old_overwrite_nginx="$(ynh_app_setting_get --app=$app --key=overwrite_nginx)"
|
||||
old_overwrite_nginx=$(bool_to_true_false $old_overwrite_nginx)
|
||||
old_overwrite_nginx=$(b01_to_bool $old_overwrite_nginx)
|
||||
overwrite_nginx="${YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_NGINX:-$old_overwrite_nginx}"
|
||||
|
||||
# Type of admin mail configuration
|
||||
old_admin_mail_html="$(ynh_app_setting_get --app=$app --key=admin_mail_html)"
|
||||
old_admin_mail_html=$(bool_to_true_false $old_admin_mail_html)
|
||||
old_admin_mail_html=$(b01_to_bool $old_admin_mail_html)
|
||||
admin_mail_html="${YNH_CONFIG_MAIN_GLOBAL_CONFIG_EMAIL_TYPE:-$old_admin_mail_html}"
|
||||
|
||||
#=================================================
|
||||
|
|
246
scripts/install
246
scripts/install
|
@ -10,102 +10,24 @@ source _common.sh
|
|||
source ynh_send_readme_to_admin__2
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
# Clean installation remaining that are not handle by the remove script.
|
||||
ynh_clean_check_starting
|
||||
# Stop change_port()
|
||||
ynh_exec_warn_less kill -s 15 $pid_change_port
|
||||
|
||||
# Clean hosts
|
||||
sed -i '/#jenkins/d' /etc/hosts
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||
#=================================================
|
||||
|
||||
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
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Validating installation parameters..."
|
||||
|
||||
final_path=/var/lib/$app
|
||||
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
||||
|
||||
# Register (book) web path
|
||||
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
||||
|
||||
#=================================================
|
||||
# STORE SETTINGS FROM MANIFEST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Storing installation settings..."
|
||||
|
||||
ynh_app_setting_set --app=$app --key=domain --value=$domain
|
||||
ynh_app_setting_set --app=$app --key=path --value=$path_url
|
||||
ynh_app_setting_set --app=$app --key=overwrite_nginx --value=1
|
||||
ynh_app_setting_set --app=$app --key=admin_mail_html --value=1
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
#=================================================
|
||||
# FIND AND OPEN A PORT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Finding an available port..."
|
||||
|
||||
# Find an available port
|
||||
port=$(ynh_find_port --port=8095)
|
||||
ynh_app_setting_set --app=$app --key=port --value=$port
|
||||
|
||||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
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
|
||||
#=================================================
|
||||
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"
|
||||
ynh_setup_source --dest_dir="$install_dir"
|
||||
ynh_setup_source --source_id="jenkins-plugin-manager" --dest_dir="$install_dir"
|
||||
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:$app "$final_path"
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring NGINX web server..."
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R "$app:$app" "$install_dir"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
|
@ -115,92 +37,91 @@ ynh_add_nginx_config
|
|||
ynh_script_progression --message="Installing Jenkins..."
|
||||
|
||||
# Download jenkins deb file and install it.
|
||||
dpkg --install --force-confnew ../conf/jenkins.deb || true
|
||||
dpkg --install --force-confnew "$install_dir/jenkins.deb" || true
|
||||
dpkg_install_failed=$(dpkg-query -f '${status} ${package}\n' -W | awk '$4 ~ /^jenkins.*/ && $3 != "installed" {print $4}' | wc -l)
|
||||
|
||||
if [[ $dpkg_install_failed -ge 1 ]]; then
|
||||
ynh_print_warn --message="The service jenkins cannot be started for now."
|
||||
ynh_print_warn --message="The service jenkins cannot be started for now."
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# SETUP APPLICATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Setuping application on port $port..."
|
||||
ynh_script_progression --message="Setting up application on port $port..."
|
||||
|
||||
cat >> "$final_path/jenkins.install.InstallUtil.lastExecVersion" <<EOF
|
||||
$jenkins_version
|
||||
EOF
|
||||
chown $app:$app "$final_path/jenkins.install.InstallUtil.lastExecVersion"
|
||||
|
||||
cat >> "$final_path/jenkins.install.UpgradeWizard.state" <<EOF
|
||||
$jenkins_version
|
||||
EOF
|
||||
chown $app:$app "$final_path/jenkins.install.UpgradeWizard.state"
|
||||
|
||||
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"
|
||||
echo "$jenkins_version" >> "$install_dir/jenkins.install.InstallUtil.lastExecVersion"
|
||||
echo "$jenkins_version" >> "$install_dir/jenkins.install.UpgradeWizard.state"
|
||||
chown "$app:$app" "$install_dir/jenkins.install.InstallUtil.lastExecVersion"
|
||||
chown "$app:$app" "$install_dir/jenkins.install.UpgradeWizard.state"
|
||||
|
||||
ynh_replace_string --target_file="/lib/systemd/system/jenkins.service" \
|
||||
--match_string="Environment=\"JENKINS_PORT=8080\"" \
|
||||
--replace_string="Environment=\"JENKINS_PORT=$port\"\nEnvironment=\"JENKINS_PREFIX=$path\""
|
||||
systemctl daemon-reload --quiet
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="restart" --line_match="Started" --log_path="systemd"
|
||||
ynh_systemd_action --service_name="$app" --action="restart" --line_match="Started" --log_path="systemd"
|
||||
|
||||
if [[ $dpkg_install_failed -ge 1 ]]; then
|
||||
dpkg --configure -a
|
||||
dpkg --configure -a
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# INSTALL PLUGINS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing plugins..."
|
||||
|
||||
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_plugin_manager --plugins reverse-proxy-auth-plugin
|
||||
|
||||
# Install recommended plugins (those from Setup Wizard)
|
||||
$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-branch-source # GitHub Branch Source 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_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_plugin_manager --plugins fstrigger
|
||||
|
||||
#=================================================
|
||||
# ADD A CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Adding a configuration file..."
|
||||
|
||||
ynh_add_config --template="../conf/config.xml" --destination="$final_path/config.xml"
|
||||
|
||||
chown $app:$app "$final_path/config.xml"
|
||||
ynh_add_config --template="config.xml" --destination="$install_dir/config.xml"
|
||||
chown "$app:$app" "$install_dir/config.xml"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
# INSTALL PLUGINS
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||
ynh_script_progression --message="Installing plugins..."
|
||||
|
||||
yunohost service add $app --description="Jenkins Continuous Integration Server"
|
||||
jenkins_plugin_manager=(
|
||||
ynh_exec_warn_less java -jar "$install_dir/jenkins-plugin-manager.jar" --war /usr/share/java/jenkins.war --plugin-download-directory="$install_dir/plugins"
|
||||
)
|
||||
|
||||
# Install plugins for http authentication and ldap.
|
||||
"${jenkins_plugin_manager[@]}" --plugins reverse-proxy-auth-plugin
|
||||
|
||||
# Install recommended plugins (those from Setup Wizard)
|
||||
"${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-branch-source # GitHub Branch Source 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_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_plugin_manager[@]}" --plugins fstrigger
|
||||
|
||||
#=================================================
|
||||
# SYSTEM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
# Service is provided by the deb package
|
||||
yunohost service add "$app" --description="Jenkins Continuous Integration Server"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
|
@ -208,44 +129,7 @@ yunohost service add $app --description="Jenkins Continuous Integration Server"
|
|||
ynh_script_progression --message="Starting a systemd service..."
|
||||
|
||||
# Start a systemd service
|
||||
ynh_systemd_action --service_name=$app --action="restart" --line_match="Started" --log_path="systemd"
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring permissions..."
|
||||
|
||||
# Make app public if necessary
|
||||
if [ $is_public -eq 1 ]
|
||||
then
|
||||
# Everyone can access the app.
|
||||
# The "main" permission is automatically created before the install script.
|
||||
ynh_permission_update --permission="main" --add="visitors"
|
||||
fi
|
||||
|
||||
# /path/github-webhook has to be accessible for github's webhooks
|
||||
ynh_permission_create --permission="github-webhook" --url="/github-webhook" --allowed="visitors" --show_tile="false" --protected="true"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..."
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# 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"
|
||||
|
||||
echo "You can configure this app easily by using the experimental __URL_TAG1__config-panel feature__URL_TAG2__$admin_panel/config-panel__URL_TAG3__.
|
||||
You can also find some specific actions for this app by using the experimental __URL_TAG1__action feature__URL_TAG2__$admin_panel/actions__URL_TAG3__.
|
||||
|
||||
If you're facing an issue or want to improve this app, please open a new issue in this __URL_TAG1__project__URL_TAG2__https://github.com/YunoHost-Apps/jenkins_ynh__URL_TAG3__." > mail_to_send
|
||||
|
||||
ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="root" --type=install
|
||||
ynh_systemd_action --service_name="$app" --action="restart" --line_match="Started" --log_path="systemd"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
|
@ -10,59 +10,27 @@ source _common.sh
|
|||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
|
||||
#=================================================
|
||||
# STANDARD REMOVE
|
||||
#=================================================
|
||||
# REMOVE SERVICE INTEGRATION IN YUNOHOST
|
||||
# REMOVE SYSTEM CONFIGURATIONS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
|
||||
|
||||
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
||||
if ynh_exec_warn_less yunohost service status $app >/dev/null
|
||||
then
|
||||
ynh_script_progression --message="Removing $app service integration..."
|
||||
yunohost service remove $app
|
||||
if ynh_exec_warn_less yunohost service status "$app" >/dev/null; then
|
||||
yunohost service remove "$app"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# STOP SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Stopping a systemd service..."
|
||||
ynh_systemd_action --service_name="$app" --action="stop" --line_match="Stopped" --log_path="systemd"
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="stop" --line_match="Stopped" --log_path="systemd"
|
||||
# Remove the dedicated NGINX config
|
||||
ynh_remove_nginx_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing dependencies..."
|
||||
ynh_script_progression --message="Removing Jenkins deb packages..."
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_package_autopurge $app
|
||||
ynh_remove_app_dependencies
|
||||
|
||||
#=================================================
|
||||
# REMOVE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing app main directory..."
|
||||
|
||||
# Remove the app directory securely
|
||||
ynh_secure_remove --file="$final_path"
|
||||
|
||||
#=================================================
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing NGINX web server configuration..."
|
||||
|
||||
# Remove the dedicated NGINX config
|
||||
ynh_remove_nginx_config
|
||||
ynh_package_autopurge "$app"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC REMOVE
|
||||
|
|
|
@ -15,54 +15,54 @@ source /usr/share/yunohost/helpers
|
|||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
#REMOVEME? ynh_clean_setup () {
|
||||
# Clean installation remaining that are not handle by the remove script.
|
||||
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
|
||||
ynh_abort_if_errors
|
||||
#REMOVEME? ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
#REMOVEME? ynh_script_progression --message="Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path)
|
||||
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
|
||||
#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE RESTORED
|
||||
#=================================================
|
||||
ynh_script_progression --message="Validating restoration parameters..."
|
||||
#REMOVEME? ynh_script_progression --message="Validating restoration parameters..."
|
||||
|
||||
test ! -d $final_path \
|
||||
|| ynh_die --message="There is already a directory: $final_path "
|
||||
#REMOVEME? test ! -d $install_dir \
|
||||
|| ynh_die --message="There is already a directory: $install_dir "
|
||||
|
||||
#=================================================
|
||||
# STANDARD RESTORATION STEPS
|
||||
#=================================================
|
||||
# RECREATE THE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Recreating the dedicated system user..."
|
||||
#REMOVEME? 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"
|
||||
#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC RESTORATION
|
||||
#=================================================
|
||||
# REINSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reinstalling dependencies..."
|
||||
#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..."
|
||||
|
||||
# Define and install dependencies
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
|
@ -85,7 +85,7 @@ dpkg --install --force-confnew ../conf/jenkins.deb
|
|||
#=================================================
|
||||
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"
|
||||
ynh_replace_string --match_string="Environment=\"JENKINS_PORT=8080\"" --replace_string="Environment=\"JENKINS_PORT=$port\"\nEnvironment=\"JENKINS_PREFIX=$path\"" --target_file="/lib/systemd/system/jenkins.service"
|
||||
|
||||
systemctl daemon-reload --quiet
|
||||
|
||||
|
@ -96,7 +96,7 @@ ynh_systemd_action --service_name=$app --action="restart" --line_match="Started"
|
|||
#=================================================
|
||||
ynh_script_progression --message="Restoring the app main directory..."
|
||||
|
||||
ynh_restore_file --origin_path="$final_path" --not_mandatory
|
||||
ynh_restore_file --origin_path="$install_dir" --not_mandatory
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
|
|
|
@ -13,15 +13,15 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
#REMOVEME? ynh_script_progression --message="Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
overwrite_nginx=$(ynh_app_setting_get --app=$app --key=overwrite_nginx)
|
||||
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path)
|
||||
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
|
||||
#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
#REMOVEME? overwrite_nginx=$(ynh_app_setting_get --app=$app --key=overwrite_nginx)
|
||||
|
||||
#=================================================
|
||||
# CHECK VERSION
|
||||
|
@ -33,17 +33,17 @@ upgrade_type=$(ynh_check_app_version_changed)
|
|||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
|
||||
#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
#REMOVEME? ynh_backup_before_upgrade
|
||||
#REMOVEME? ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
# Restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
#REMOVEME? ynh_restore_upgradebackup
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
#REMOVEME? ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
|
@ -77,15 +77,15 @@ then
|
|||
fi
|
||||
|
||||
# Cleaning legacy permissions
|
||||
if ynh_legacy_permissions_exists; then
|
||||
ynh_legacy_permissions_delete_all
|
||||
#REMOVEME? if ynh_legacy_permissions_exists; then
|
||||
#REMOVEME? ynh_legacy_permissions_delete_all
|
||||
|
||||
ynh_app_setting_delete --app=$app --key=is_public
|
||||
fi
|
||||
|
||||
# Create a permission if needed
|
||||
if ! ynh_permission_exists --permission="github-webhook"; then
|
||||
ynh_permission_create --permission="github-webhook" --url="/github-webhook" --allowed="visitors" --show_tile="false" --protected="true"
|
||||
#REMOVEME? if ! ynh_permission_exists --permission="github-webhook"; then
|
||||
#REMOVEME? ynh_permission_create --permission="github-webhook" --url="/github-webhook" --allowed="visitors" --show_tile="false" --protected="true"
|
||||
fi
|
||||
|
||||
# Remove the log files
|
||||
|
@ -97,10 +97,10 @@ ynh_delete_file_checksum --file="/etc/default/jenkins"
|
|||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Making sure dedicated system user exists..."
|
||||
#REMOVEME? 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"
|
||||
#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir"
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
|
@ -111,10 +111,10 @@ 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"
|
||||
ynh_setup_source --source_id="jenkins-plugin-manager" --dest_dir="$install_dir"
|
||||
chmod 750 "$install_dir"
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app:$app "$install_dir"
|
||||
|
||||
dpkg --install --force-confnew ../conf/jenkins.deb
|
||||
|
||||
|
@ -123,7 +123,7 @@ then
|
|||
#=================================================
|
||||
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"
|
||||
ynh_replace_string --match_string="Environment=\"JENKINS_PORT=8080\"" --replace_string="Environment=\"JENKINS_PORT=$port\"\nEnvironment=\"JENKINS_PREFIX=$path\"" --target_file="/lib/systemd/system/jenkins.service"
|
||||
|
||||
systemctl daemon-reload --quiet
|
||||
|
||||
|
@ -133,9 +133,9 @@ fi
|
|||
#=================================================
|
||||
# UPGRADE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading dependencies..."
|
||||
#REMOVEME? ynh_script_progression --message="Upgrading dependencies..."
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
|
@ -155,16 +155,16 @@ fi
|
|||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..."
|
||||
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..."
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# UPGRADE PLUGINS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading plugins..."
|
||||
|
||||
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"
|
||||
jenkins_plugin_manager="ynh_exec_warn_less java -jar $install_dir/jenkins-plugin-manager.jar --war /usr/share/java/jenkins.war --plugin-download-directory=$install_dir/plugins"
|
||||
UPDATE_LIST=$($jenkins_plugin_manager --list | grep -o '.*\..*' | grep -oP '^(.*?) ')
|
||||
|
||||
for plugin in ${UPDATE_LIST}
|
||||
|
@ -205,9 +205,9 @@ ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="root" --type
|
|||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..."
|
||||
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..."
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
11
tests.toml
Normal file
11
tests.toml
Normal file
|
@ -0,0 +1,11 @@
|
|||
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/tests.v1.schema.json
|
||||
|
||||
test_format = 1.0
|
||||
|
||||
[default]
|
||||
|
||||
# ------------
|
||||
# Tests to run
|
||||
# ------------
|
||||
|
||||
test_upgrade_from.4733662adabc01ea1e29ca0bf55c45f204bb1857.name = "2.375.2~ynh1"
|
Loading…
Add table
Reference in a new issue