From 99b1c503663cdfc05d22790ba10584ef464fc0d1 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Tue, 13 Feb 2024 21:29:41 +0100 Subject: [PATCH 01/11] Upgrade to 2.426.3~ynh1 --- README.md | 2 +- README_fr.md | 2 +- conf/app.src | 4 ++-- manifest.json | 2 +- scripts/_common.sh | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 00904e2..9a0d9af 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Extendable continuous integration server -**Shipped version:** 2.426.1~ynh1 +**Shipped version:** 2.426.3~ynh1 ## Screenshots diff --git a/README_fr.md b/README_fr.md index 9dc08f6..3a418b6 100644 --- a/README_fr.md +++ b/README_fr.md @@ -18,7 +18,7 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po Serveur d'intégration continue extensible -**Version incluse :** 2.426.1~ynh1 +**Version incluse :** 2.426.3~ynh1 ## Captures d’écran diff --git a/conf/app.src b/conf/app.src index c947edd..cdb4626 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://pkg.jenkins.io/debian-stable/binary/jenkins_2.426.1_all.deb -SOURCE_SUM=a30fd080820c88e13801b80fd3d7434757b331a9fe7728b59493faaca3402949 +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 diff --git a/manifest.json b/manifest.json index c59bd1f..6d5bb1e 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Extendable continuous integration server", "fr": "Serveur d'intégration continue extensible" }, - "version": "2.426.1~ynh1", + "version": "2.426.3~ynh1", "url": "https://jenkins.io/index.html", "upstream": { "license": "MIT", diff --git a/scripts/_common.sh b/scripts/_common.sh index 07781a7..5421bc8 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,7 +5,7 @@ #================================================= # dependencies used by the app -pkg_dependencies="openjdk-11-jdk|openjdk-17-jdk daemon net-tools" +pkg_dependencies="openjdk-11-jdk|openjdk-17-jdk|openjdk-21-jdk daemon net-tools" PLUGIN_CLI_VERSION=2.9.3 From e59aee93d0fdd9982d73075e77ed29e883192e1f Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Mon, 18 Mar 2024 23:00:18 +0000 Subject: [PATCH 02/11] Auto-update README --- README.md | 15 +++++++-------- README_fr.md | 17 ++++++++--------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 9a0d9af..1cd9f3b 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ @@ -17,7 +17,6 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in ## Overview Extendable continuous integration server - **Shipped version:** 2.426.3~ynh1 ## Screenshots @@ -30,11 +29,11 @@ Extendable continuous integration server ## Documentation and resources -* Official app website: -* Official user documentation: -* Upstream app code repository: -* YunoHost Store: -* Report a bug: +- Official app website: +- Official user documentation: +- Upstream app code repository: +- YunoHost Store: +- Report a bug: ## Developer info @@ -42,7 +41,7 @@ Please send your pull request to the [testing branch](https://github.com/YunoHos To try the testing branch, please proceed like that. -``` bash +```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 diff --git a/README_fr.md b/README_fr.md index 3a418b6..f0c5fd7 100644 --- a/README_fr.md +++ b/README_fr.md @@ -1,5 +1,5 @@ @@ -17,7 +17,6 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po ## Vue d’ensemble Serveur d'intégration continue extensible - **Version incluse :** 2.426.3~ynh1 ## Captures d’écran @@ -30,11 +29,11 @@ Serveur d'intégration continue extensible ## Documentations et ressources -* Site officiel de l’app : -* Documentation officielle utilisateur : -* Dépôt de code officiel de l’app : -* YunoHost Store: -* Signaler un bug : +- Site officiel de l’app : +- Documentation officielle utilisateur : +- Dépôt de code officiel de l’app : +- YunoHost Store : +- Signaler un bug : ## Informations pour les développeurs @@ -42,10 +41,10 @@ Merci de faire vos pull request sur la [branche testing](https://github.com/Yuno Pour essayer la branche testing, procédez comme suit. -``` bash +```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 :** \ No newline at end of file +**Plus d’infos sur le packaging d’applications :** From 0f6fd470770fff0e1ca175b1cf346c66427b2bdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Wed, 14 Feb 2024 13:31:37 +0100 Subject: [PATCH 03/11] Packaging v2 --- .github/workflows/updater.sh | 100 ------------- .github/workflows/updater.yml | 49 ------- check_process | 49 ------- conf/app.src | 7 - conf/jenkins-plugin-manager.src | 7 - doc/ADMIN.md | 1 + doc/ADMIN_fr.md | 1 + doc/DISCLAIMER.md | 1 - doc/DISCLAIMER_fr.md | 1 - doc/POST_INSTALL.md | 4 + manifest.json | 54 ------- manifest.toml | 79 ++++++++++ scripts/_common.sh | 21 +-- scripts/backup | 14 +- scripts/change_url | 66 ++++----- scripts/config | 4 +- scripts/install | 246 +++++++++----------------------- scripts/remove | 50 ++----- scripts/restore | 34 ++--- scripts/upgrade | 60 ++++---- tests.toml | 11 ++ 21 files changed, 266 insertions(+), 593 deletions(-) delete mode 100644 .github/workflows/updater.sh delete mode 100644 .github/workflows/updater.yml delete mode 100644 check_process delete mode 100644 conf/app.src delete mode 100644 conf/jenkins-plugin-manager.src create mode 100644 doc/ADMIN.md create mode 100644 doc/ADMIN_fr.md delete mode 100644 doc/DISCLAIMER.md delete mode 100644 doc/DISCLAIMER_fr.md create mode 100644 doc/POST_INSTALL.md delete mode 100644 manifest.json create mode 100644 manifest.toml create mode 100644 tests.toml diff --git a/.github/workflows/updater.sh b/.github/workflows/updater.sh deleted file mode 100644 index c438b8a..0000000 --- a/.github/workflows/updater.sh +++ /dev/null @@ -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 < 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 diff --git a/.github/workflows/updater.yml b/.github/workflows/updater.yml deleted file mode 100644 index a56d7cb..0000000 --- a/.github/workflows/updater.yml +++ /dev/null @@ -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 ' - author: 'yunohost-bot ' - 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 diff --git a/check_process b/check_process deleted file mode 100644 index aa32213..0000000 --- a/check_process +++ /dev/null @@ -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 diff --git a/conf/app.src b/conf/app.src deleted file mode 100644 index cdb4626..0000000 --- a/conf/app.src +++ /dev/null @@ -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 diff --git a/conf/jenkins-plugin-manager.src b/conf/jenkins-plugin-manager.src deleted file mode 100644 index b03be32..0000000 --- a/conf/jenkins-plugin-manager.src +++ /dev/null @@ -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 diff --git a/doc/ADMIN.md b/doc/ADMIN.md new file mode 100644 index 0000000..b0d4d0f --- /dev/null +++ b/doc/ADMIN.md @@ -0,0 +1 @@ +Use the admin panel of your Jenkins to configure this app. diff --git a/doc/ADMIN_fr.md b/doc/ADMIN_fr.md new file mode 100644 index 0000000..5046d0e --- /dev/null +++ b/doc/ADMIN_fr.md @@ -0,0 +1 @@ +Utilisez le panneau d'administration Jenkins pour configurer l'application. diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md deleted file mode 100644 index ab6a635..0000000 --- a/doc/DISCLAIMER.md +++ /dev/null @@ -1 +0,0 @@ -* Use the admin panel of your Jenkins to configure this app. diff --git a/doc/DISCLAIMER_fr.md b/doc/DISCLAIMER_fr.md deleted file mode 100644 index b40e1b9..0000000 --- a/doc/DISCLAIMER_fr.md +++ /dev/null @@ -1 +0,0 @@ -* Utiliser le panneau d'administration Jenkins pour configurer l'application. diff --git a/doc/POST_INSTALL.md b/doc/POST_INSTALL.md new file mode 100644 index 0000000..485d769 --- /dev/null +++ b/doc/POST_INSTALL.md @@ -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). diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 6d5bb1e..0000000 --- a/manifest.json +++ /dev/null @@ -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 - } - ] - } -} diff --git a/manifest.toml b/manifest.toml new file mode 100644 index 0000000..cdb7c66 --- /dev/null +++ b/manifest.toml @@ -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" + ] diff --git a/scripts/_common.sh b/scripts/_common.sh index 5421bc8..75053b4 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -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]}" } #================================================= diff --git a/scripts/backup b/scripts/backup index b267b1a..27e6444 100644 --- a/scripts/backup +++ b/scripts/backup @@ -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 diff --git a/scripts/change_url b/scripts/change_url index d75f978..5016a21 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -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 diff --git a/scripts/config b/scripts/config index d65196f..1f8773e 100644 --- a/scripts/config +++ b/scripts/config @@ -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}" #================================================= diff --git a/scripts/install b/scripts/install index cf95030..525b909 100644 --- a/scripts/install +++ b/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" <> "$final_path/jenkins.install.UpgradeWizard.state" <> "$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 diff --git a/scripts/remove b/scripts/remove index 78675da..4f6c8b7 100644 --- a/scripts/remove +++ b/scripts/remove @@ -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 diff --git a/scripts/restore b/scripts/restore index 8dff3e5..ef942d7 100644 --- a/scripts/restore +++ b/scripts/restore @@ -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 diff --git a/scripts/upgrade b/scripts/upgrade index 4cf4a78..4e56b19 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -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 diff --git a/tests.toml b/tests.toml new file mode 100644 index 0000000..3adf683 --- /dev/null +++ b/tests.toml @@ -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" From a1fdf1568e04b201f244f8696a970fdacd80747f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Wed, 14 Feb 2024 13:38:43 +0100 Subject: [PATCH 04/11] fix apt install --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index cdb7c66..dcf3f86 100644 --- a/manifest.toml +++ b/manifest.toml @@ -73,7 +73,7 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen [resources.apt] packages = [ - "openjdk-11-jdk|openjdk-17-jdk|openjdk-21-jdk", + "openjdk-11-jdk\\|openjdk-17-jdk\\|openjdk-21-jdk", "daemon", "net-tools" ] From f83de3a58d140f0bf35e0c6abefeeed0c91eae21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Wed, 14 Feb 2024 14:27:36 +0100 Subject: [PATCH 05/11] update doc, fix upgrade --- doc/POST_UPGRADE.md | 4 + manifest.toml | 4 +- scripts/upgrade | 182 +++++++++----------------------------------- 3 files changed, 44 insertions(+), 146 deletions(-) create mode 100644 doc/POST_UPGRADE.md diff --git a/doc/POST_UPGRADE.md b/doc/POST_UPGRADE.md new file mode 100644 index 0000000..485d769 --- /dev/null +++ b/doc/POST_UPGRADE.md @@ -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). diff --git a/manifest.toml b/manifest.toml index dcf3f86..42a79e4 100644 --- a/manifest.toml +++ b/manifest.toml @@ -23,8 +23,8 @@ fund = "https://www.jenkins.io/donate" 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. +ldap = true +sso = false 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, ... diff --git a/scripts/upgrade b/scripts/upgrade index 4e56b19..3a16436 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -10,41 +10,6 @@ source _common.sh source ynh_send_readme_to_admin__2 source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#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 -#================================================= -ynh_script_progression --message="Checking version..." - -upgrade_type=$(ynh_check_app_version_changed) - -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." - -# Backup the current version of the app -#REMOVEME? ynh_backup_before_upgrade -#REMOVEME? ynh_clean_setup () { - ynh_clean_check_starting - # Restore it if the upgrade fails -#REMOVEME? ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - #================================================= # STANDARD UPGRADE STEPS #================================================= @@ -52,7 +17,7 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= 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" #================================================= # ENSURE DOWNWARD COMPATIBILITY @@ -60,32 +25,17 @@ ynh_systemd_action --service_name=$app --action="stop" --line_match="Stopped" -- ynh_script_progression --message="Ensuring downward compatibility..." # If overwrite_nginx doesn't exist, create it -if [ -z "$overwrite_nginx" ]; then - overwrite_nginx=1 - ynh_app_setting_set --app=$app --key=overwrite_nginx --value=$overwrite_nginx +if [ -z "${overwrite_nginx:-}" ]; then + overwrite_nginx=1 + ynh_app_setting_set --app="$app" --key="overwrite_nginx" --value="$overwrite_nginx" fi # Remove the apt list entry for jenkins -if [ -e "/etc/apt/sources.list.d/jenkins.list" ] -then - ynh_secure_remove --file=/etc/apt/sources.list.d/jenkins.list - # Get APT key id for jenkins - apt_key=$(apt-key list | grep -B1 "Kohsuke Kawaguchi" | grep pub | cut -d'/' -f2 | cut -d' ' -f1) - # Delete the APT key - apt-key del $apt_key - apt-get update -fi - -# Cleaning legacy permissions -#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 -#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" +if [ -e "/etc/apt/sources.list.d/jenkins.list" ]; then + ynh_secure_remove --file=/etc/apt/sources.list.d/jenkins.list + # Delete the APT key + apt-key del "$(apt-key list | grep -B1 "Kohsuke Kawaguchi" | grep pub | cut -d'/' -f2 | cut -d' ' -f1)" + apt-get update fi # Remove the log files @@ -94,120 +44,64 @@ ynh_secure_remove --file="/var/log/$app" # No more needed since systemd ynh_delete_file_checksum --file="/etc/default/jenkins" -#================================================= -# CREATE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Making sure dedicated system user exists..." - -# Create a dedicated user (if not existing) -#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= +ynh_script_progression --message="Upgrading source files..." -if [ "$upgrade_type" == "UPGRADE_APP" ] -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="$install_dir" - chmod 750 "$install_dir" - chmod -R o-rwx "$install_dir" - chown -R $app:$app "$install_dir" +# Download jenkins deb file and install it. +ynh_setup_source --dest_dir="$install_dir" +ynh_setup_source --source_id="jenkins-plugin-manager" --dest_dir="$install_dir" - dpkg --install --force-confnew ../conf/jenkins.deb +chmod -R o-rwx "$install_dir" +chown -R "$app:$app" "$install_dir" - #================================================= - # 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\"" --target_file="/lib/systemd/system/jenkins.service" - - systemctl daemon-reload --quiet - - ynh_systemd_action --service_name=$app --action="restart" --line_match="Started" --log_path="systemd" -fi +dpkg --install --force-confnew "$install_dir/jenkins.deb" #================================================= -# UPGRADE DEPENDENCIES +# SETUP APPLICATION #================================================= -#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." +ynh_script_progression --message="Setting up application..." -#REMOVEME? ynh_install_app_dependencies $pkg_dependencies +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 -#================================================= -# NGINX CONFIGURATION -#================================================= - -# Overwrite the nginx configuration only if it's allowed -if [ $overwrite_nginx -eq 1 ] -then - ynh_script_progression --message="Upgrading NGINX web server configuration..." - - # Create a dedicated NGINX config - ynh_add_nginx_config -fi - -#================================================= -# SPECIFIC UPGRADE -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." - -#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload +ynh_systemd_action --service_name="$app" --action="restart" --line_match="Started" --log_path="systemd" #================================================= # UPGRADE PLUGINS #================================================= ynh_script_progression --message="Upgrading 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 '^(.*?) ') +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" +) +mapfile -t UPDATE_LIST < <("${jenkins_plugin_manager[@]}" --list | grep -o '.*\..*' | grep -oP '^(.*?) ') -for plugin in ${UPDATE_LIST} -do - $jenkins_plugin_manager --plugins "$plugin" || true +for plugin in "${UPDATE_LIST[@]}"; do + "${jenkins_plugin_manager[@]}" --plugins "$plugin" || true done #================================================= -# GENERIC FINALIZATION +# REAPPLY SYSTEM CONFIGURATIONS #================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." +ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1 -yunohost service add $app --description="Jenkins Continuous Integration Server" +# Overwrite the nginx configuration only if it's allowed +if [ "$overwrite_nginx" -eq 1 ]; then + ynh_add_nginx_config +fi + +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="Started" --log_path="systemd" - -#================================================= -# 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=upgrade - -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." - -#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload +ynh_systemd_action --service_name="$app" --action="restart" --line_match="Started" --log_path="systemd" #================================================= # END OF SCRIPT From 0e34be5b2c2892abcfcd843f1c93ec6c57b12882 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Tue, 19 Mar 2024 00:08:28 +0100 Subject: [PATCH 06/11] Cleanup --- scripts/backup | 38 +-------- scripts/change_url | 106 ++---------------------- scripts/install | 11 +-- scripts/remove | 4 +- scripts/restore | 118 +++++--------------------- scripts/upgrade | 15 ++-- scripts/ynh_send_readme_to_admin__2 | 123 ---------------------------- 7 files changed, 36 insertions(+), 379 deletions(-) delete mode 100644 scripts/ynh_send_readme_to_admin__2 diff --git a/scripts/backup b/scripts/backup index 27e6444..3b36061 100644 --- a/scripts/backup +++ b/scripts/backup @@ -1,7 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= @@ -10,32 +8,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -#REMOVEME? ynh_clean_setup () { - ynh_clean_check_starting -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_print_info --message="Loading installation settings..." - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#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 -#================================================= - -ynh_systemd_action --service_name=$app --action="stop" --line_match="Stopped" --log_path="systemd" - #================================================= # DECLARE DATA AND CONF FILES TO BACKUP #================================================= @@ -48,19 +20,11 @@ ynh_print_info --message="Declaring files to be backed up..." ynh_backup --src_path="$install_dir" --not_mandatory #================================================= -# BACKUP THE NGINX CONFIGURATION +# BACKUP THE SYSTEM CONFIGURATION #================================================= ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# SPECIFIC BACKUP -#================================================= -# START SYSTEMD SERVICE -#================================================= - -ynh_systemd_action --service_name=$app --action="restart" --line_match="Started" --log_path="systemd" - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/change_url b/scripts/change_url index 5016a21..1232e75 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -1,7 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC STARTING #================================================= # IMPORT GENERIC HELPERS #================================================= @@ -9,70 +7,12 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# RETRIEVE ARGUMENTS -#================================================= - -#REMOVEME? old_domain=$YNH_APP_OLD_DOMAIN -#REMOVEME? old_path=$YNH_APP_OLD_PATH - -#REMOVEME? new_domain=$YNH_APP_NEW_DOMAIN -#REMOVEME? new_path=$YNH_APP_NEW_PATH - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." - -#REMOVEME? # Needed for helper "ynh_add_nginx_config" -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) - -#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) - -#================================================= -# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP -#================================================= -#REMOVEME? ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." - -# Backup the current version of the app -#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. -#REMOVEME? ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" - - # Restore it if the upgrade fails -#REMOVEME? ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# CHECK WHICH PARTS SHOULD BE CHANGED -#================================================= - -#REMOVEME? change_domain=0 -#REMOVEME? if [ "$old_domain" != "$new_domain" ] -then - #REMOVEME? change_domain=1 -fi - -#REMOVEME? change_path=0 -#REMOVEME? if [ "$old_path" != "$new_path" ] -then - #REMOVEME? change_path=1 -fi - -#================================================= -# STANDARD MODIFICATIONS #================================================= # 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" --log_path="systemd" #================================================= # MODIFY URL IN NGINX CONF @@ -81,56 +21,24 @@ ynh_script_progression --message="Updating NGINX web server configuration..." 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 -#REMOVEME? ynh_backup_if_checksum_is_different --file="$nginx_conf_path" - # Set global variables for NGINX helper -#REMOVEME? domain="$old_domain" -#REMOVEME? path="$new_path" - # Create a dedicated 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 -#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 -#REMOVEME? ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" -fi - -#================================================= -# SPECIFIC MODIFICATIONS #================================================= # MODIFY JENKINS SETUP #================================================= ynh_script_progression --message="Updating Jenkins setup..." -ynh_replace_string --match_string="Environment=\"JENKINS_PREFIX=$old_path\"" --replace_string="Environment=\"JENKINS_PREFIX=$new_path\"" --target_file="/lib/systemd/system/jenkins.service" +ynh_replace_string --target_file="/lib/systemd/system/jenkins.service" \ + --match_string="Environment=\"JENKINS_PREFIX=$old_path\"" \ + --replace_string="Environment=\"JENKINS_PREFIX=$new_path\"" + systemctl daemon-reload --quiet -#================================================= -# GENERIC FINALISATION #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." +ynh_script_progression --message="Starting $app's systemd service..." --weight=1 # Start a systemd service -ynh_systemd_action --service_name=$app --action="start" --line_match="Started" --log_path="systemd" - -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." - -#REMOVEME? #REMOVEME? ynh_systemd_action --service_name=nginx --action=reload +ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" #================================================= # END OF SCRIPT diff --git a/scripts/install b/scripts/install index 525b909..396a233 100644 --- a/scripts/install +++ b/scripts/install @@ -1,13 +1,10 @@ #!/bin/bash -#================================================= -# GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= source _common.sh -source ynh_send_readme_to_admin__2 source /usr/share/yunohost/helpers #================================================= @@ -15,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= jenkins_version=$(ynh_app_upstream_version) -ynh_app_setting_set --app=$app --key=overwrite_nginx --value=1 +ynh_app_setting_set --app="$app" --key="overwrite_nginx" --value="1" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -29,8 +26,6 @@ ynh_setup_source --source_id="jenkins-plugin-manager" --dest_dir="$install_dir" chmod -R o-rwx "$install_dir" chown -R "$app:$app" "$install_dir" -#================================================= -# SPECIFIC SETUP #================================================= # INSTALL JENKINS #================================================= @@ -59,7 +54,7 @@ ynh_replace_string --target_file="/lib/systemd/system/jenkins.service" \ --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" --log_path="systemd" if [[ $dpkg_install_failed -ge 1 ]]; then dpkg --configure -a @@ -129,7 +124,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" +ynh_systemd_action --service_name="$app" --action="restart" --log_path="systemd" #================================================= # END OF SCRIPT diff --git a/scripts/remove b/scripts/remove index 4f6c8b7..05e04f1 100644 --- a/scripts/remove +++ b/scripts/remove @@ -1,7 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= @@ -19,7 +17,7 @@ if ynh_exec_warn_less yunohost service status "$app" >/dev/null; then yunohost service remove "$app" fi -ynh_systemd_action --service_name="$app" --action="stop" --line_match="Stopped" --log_path="systemd" +ynh_systemd_action --service_name="$app" --action="stop" --log_path="systemd" # Remove the dedicated NGINX config ynh_remove_nginx_config diff --git a/scripts/restore b/scripts/restore index ef942d7..b50f757 100644 --- a/scripts/restore +++ b/scripts/restore @@ -1,75 +1,21 @@ #!/bin/bash -#================================================= -# GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= # Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh -source ../settings/scripts/ynh_send_readme_to_admin__2 source /usr/share/yunohost/helpers #================================================= -# MANAGE SCRIPT FAILURE +# RESTORE THE APP MAIN DIR #================================================= +ynh_script_progression --message="Restoring the app main directory..." --weight=1 -#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 -#REMOVEME? ynh_abort_if_errors +ynh_restore_file --origin_path="$install_dir" --not_mandatory -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#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 -#================================================= -#REMOVEME? ynh_script_progression --message="Validating restoration parameters..." - -#REMOVEME? test ! -d $install_dir \ - || ynh_die --message="There is already a directory: $install_dir " - -#================================================= -# STANDARD RESTORATION STEPS -#================================================= -# RECREATE THE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Recreating the dedicated system user..." - -# Create the dedicated user (if not existing) -#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" - -#================================================= -# SPECIFIC RESTORATION -#================================================= -# REINSTALL DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." - -# Define and install dependencies -#REMOVEME? ynh_install_app_dependencies $pkg_dependencies - -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the NGINX web server configuration..." - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" +chown -R "$app:www-data" "$install_dir" #================================================= # INSTALL JENKINS @@ -83,55 +29,29 @@ dpkg --install --force-confnew ../conf/jenkins.deb #================================================= # SETUP APPLICATION #================================================= -ynh_script_progression --message="Setuping application..." +ynh_script_progression --message="Setting up $app's 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" +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" +#================================================= +# RESTORE SYSTEM CONFIGURATIONS +#================================================= +ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 + +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" + +yunohost service add "$app" --description="Jenkins Continuous Integration Server" #================================================= -# RESTORE THE APP MAIN DIR +# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE #================================================= -ynh_script_progression --message="Restoring the app main directory..." +ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1 -ynh_restore_file --origin_path="$install_dir" --not_mandatory - -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." - -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="Started" --log_path="systemd" - -#================================================= -# 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=restore - -#================================================= -# GENERIC FINALIZATION -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." +ynh_systemd_action --service_name="$app" --action="restart" --log_path="systemd" ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/upgrade b/scripts/upgrade index 3a16436..6c657f2 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -1,23 +1,18 @@ #!/bin/bash -#================================================= -# GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= source _common.sh -source ynh_send_readme_to_admin__2 source /usr/share/yunohost/helpers -#================================================= -# STANDARD UPGRADE STEPS #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Stopping a systemd service..." +ynh_script_progression --message="Stopping $app's systemd service..." -ynh_systemd_action --service_name="$app" --action="stop" --line_match="Stopped" --log_path="systemd" +ynh_systemd_action --service_name="$app" --action="stop" --log_path="systemd" #================================================= # ENSURE DOWNWARD COMPATIBILITY @@ -68,7 +63,7 @@ ynh_replace_string --target_file="/lib/systemd/system/jenkins.service" \ --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" --log_path="systemd" #================================================= # UPGRADE PLUGINS @@ -99,9 +94,9 @@ yunohost service add "$app" --description="Jenkins Continuous Integration Server #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." +ynh_script_progression --message="Starting $app's systemd service..." -ynh_systemd_action --service_name="$app" --action="restart" --line_match="Started" --log_path="systemd" +ynh_systemd_action --service_name="$app" --action="restart" --log_path="systemd" #================================================= # END OF SCRIPT diff --git a/scripts/ynh_send_readme_to_admin__2 b/scripts/ynh_send_readme_to_admin__2 deleted file mode 100644 index 8b1edf1..0000000 --- a/scripts/ynh_send_readme_to_admin__2 +++ /dev/null @@ -1,123 +0,0 @@ -#!/bin/bash - -# Send an email to inform the administrator -# -# usage: ynh_send_readme_to_admin --app_message=app_message [--recipients=recipients] [--type=type] -# | arg: -m --app_message= - The file with the content to send to the administrator. -# | arg: -r, --recipients= - The recipients of this email. Use spaces to separate multiples recipients. - default: root -# example: "root admin@domain" -# If you give the name of a YunoHost user, ynh_send_readme_to_admin will find its email adress for you -# example: "root admin@domain user1 user2" -# | arg: -t, --type= - Type of mail, could be 'backup', 'change_url', 'install', 'remove', 'restore', 'upgrade' -ynh_send_readme_to_admin() { - # Declare an array to define the options of this helper. - declare -Ar args_array=( [m]=app_message= [r]=recipients= [t]=type= ) - local app_message - local recipients - local type - # Manage arguments with getopts - - ynh_handle_getopts_args "$@" - app_message="${app_message:-}" - recipients="${recipients:-root}" - type="${type:-install}" - - # Get the value of admin_mail_html - admin_mail_html=$(ynh_app_setting_get $app admin_mail_html) - admin_mail_html="${admin_mail_html:-0}" - - # Retrieve the email of users - find_mails () { - local list_mails="$1" - local mail - local recipients=" " - # Read each mail in argument - for mail in $list_mails - do - # Keep root or a real email address as it is - if [ "$mail" = "root" ] || echo "$mail" | grep --quiet "@" - then - recipients="$recipients $mail" - else - # But replace an user name without a domain after by its email - if mail=$(ynh_user_get_info "$mail" "mail" 2> /dev/null) - then - recipients="$recipients $mail" - fi - fi - done - echo "$recipients" - } - recipients=$(find_mails "$recipients") - - # Subject base - local mail_subject="☁️🆈🅽🅷☁️: \`$app\`" - - # Adapt the subject according to the type of mail required. - if [ "$type" = "backup" ]; then - mail_subject="$mail_subject has just been backup." - elif [ "$type" = "change_url" ]; then - mail_subject="$mail_subject has just been moved to a new URL!" - elif [ "$type" = "remove" ]; then - mail_subject="$mail_subject has just been removed!" - elif [ "$type" = "restore" ]; then - mail_subject="$mail_subject has just been restored!" - elif [ "$type" = "upgrade" ]; then - mail_subject="$mail_subject has just been upgraded!" - else # install - mail_subject="$mail_subject has just been installed!" - fi - - local mail_message="This is an automated message from your beloved YunoHost server. - -Specific information for the application $app. - -$(cat "$app_message")" - - # Store the message into a file for further modifications. - echo "$mail_message" > mail_to_send - - # If a html email is required. Apply html tags to the message. - if [ "$admin_mail_html" -eq 1 ] - then - # Insert 'br' tags at each ending of lines. - ynh_replace_string "$" "
" mail_to_send - - # Insert starting HTML tags - sed --in-place '1s@^@\n\n\n\n@' mail_to_send - - # Keep tabulations - ynh_replace_string " " "\ \ " mail_to_send - ynh_replace_string "\t" "\ \ " mail_to_send - - # Insert url links tags - ynh_replace_string "__URL_TAG1__\(.*\)__URL_TAG2__\(.*\)__URL_TAG3__" "\1" mail_to_send - - # Insert finishing HTML tags - echo -e "\n\n" >> mail_to_send - - # Otherwise, remove tags to keep a plain text. - else - # Remove URL tags - ynh_replace_string "__URL_TAG[1,3]__" "" mail_to_send - ynh_replace_string "__URL_TAG2__" ": " mail_to_send - fi - - # Define binary to use for mail command - if [ -e /usr/bin/bsd-mailx ] - then - local mail_bin=/usr/bin/bsd-mailx - else - local mail_bin=/usr/bin/mail.mailutils - fi - - if [ "$admin_mail_html" -eq 1 ] - then - content_type="text/html" - else - content_type="text/plain" - fi - - # Send the email to the recipients - cat mail_to_send | $mail_bin -a "Content-Type: $content_type; charset=UTF-8" -s "$mail_subject" "$recipients" -} From ef3e23daca40b78899e2cc4961f3b068c0506825 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Tue, 19 Mar 2024 00:09:31 +0100 Subject: [PATCH 07/11] Add doc --- doc/DESCRIPTION.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/DESCRIPTION.md diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md new file mode 100644 index 0000000..85d8e6f --- /dev/null +++ b/doc/DESCRIPTION.md @@ -0,0 +1 @@ +The leading open source automation server, Jenkins provides hundreds of plugins to support building, deploying and automating any project. From 5f44f1e6e85fbad03d18606eec0eeb1a5375f6c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Tue, 19 Mar 2024 00:34:10 +0100 Subject: [PATCH 08/11] Fix install_dir --- manifest.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/manifest.toml b/manifest.toml index 42a79e4..e1d4c1d 100644 --- a/manifest.toml +++ b/manifest.toml @@ -58,8 +58,10 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen rename = "jenkins.deb" [resources.system_user] + home = "/var/lib/jenkins" [resources.install_dir] + dir = "/var/lib/jenkins" [resources.permissions] main.url = "/" From 45ff482d2b9fd7a6a5a8f893a441db6120e42040 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Tue, 19 Mar 2024 00:43:14 +0100 Subject: [PATCH 09/11] fix config script --- scripts/config | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/scripts/config b/scripts/config index 1f8773e..5f825be 100644 --- a/scripts/config +++ b/scripts/config @@ -1,7 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC STARTING #================================================= # IMPORT GENERIC HELPERS #================================================= @@ -9,16 +7,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# RETRIEVE ARGUMENTS -#================================================= - -app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID} - -final_path=$(ynh_app_setting_get --app=$app --key=final_path) - -#================================================= -# SPECIFIC CODE #================================================= # LOAD VALUES #================================================= From c5475035b300d6b8bb98944640d17288a3cd4844 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Tue, 19 Mar 2024 00:53:34 +0100 Subject: [PATCH 10/11] Fix config panel --- config_panel.toml | 13 +------------ scripts/config | 22 +++++----------------- 2 files changed, 6 insertions(+), 29 deletions(-) diff --git a/config_panel.toml b/config_panel.toml index b30c273..6e2862c 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -6,19 +6,8 @@ name = "Jenkins configuration" [main.overwrite_files] name = "Overwriting config files" - [main.overwrite_files.overwrite_nginx] + [main.overwrite_files.overwrite_nginx] ask = "Overwrite the NGINX config file?" type = "boolean" default = true help = "If the file is overwritten, a backup will be created." - - - [main.global_config] - name = "Global configuration" - - [main.global_config.email_type] - ask = "Send HTML email to admin?" - type = "boolean" - default = true - help = "Allow app scripts to send HTML mails instead of plain text." - \ No newline at end of file diff --git a/scripts/config b/scripts/config index 5f825be..b6336de 100644 --- a/scripts/config +++ b/scripts/config @@ -17,15 +17,10 @@ source /usr/share/yunohost/helpers # Otherwise, keep the value from the app config. # Overwrite nginx configuration -old_overwrite_nginx="$(ynh_app_setting_get --app=$app --key=overwrite_nginx)" -old_overwrite_nginx=$(b01_to_bool $old_overwrite_nginx) +old_overwrite_nginx="$(ynh_app_setting_get --app="$app" --key="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=$(b01_to_bool $old_admin_mail_html) -admin_mail_html="${YNH_CONFIG_MAIN_GLOBAL_CONFIG_EMAIL_TYPE:-$old_admin_mail_html}" - #================================================= # SHOW_CONFIG FUNCTION FOR 'SHOW' COMMAND #================================================= @@ -35,8 +30,6 @@ show_config() { # echo "YNH_CONFIG_${PANEL_ID}_${SECTION_ID}_${OPTION_ID}=value" echo "YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_NGINX=$overwrite_nginx" - - echo "YNH_CONFIG_MAIN_GLOBAL_CONFIG_EMAIL_TYPE=$admin_mail_html" } #================================================= @@ -44,17 +37,12 @@ show_config() { #================================================= apply_config() { - # Set overwrite_nginx - overwrite_nginx=$(bool_to_01 $overwrite_nginx) - ynh_app_setting_set --app=$app --key=overwrite_nginx --value="$overwrite_nginx" - - # Set admin_mail_html - admin_mail_html=$(bool_to_01 $admin_mail_html) - ynh_app_setting_set --app=$app --key=admin_mail_html --value="$admin_mail_html" + overwrite_nginx=$(bool_to_01 "$overwrite_nginx") + ynh_app_setting_set --app="$app" --key=overwrite_nginx --value="$overwrite_nginx" } #================================================= # GENERIC FINALIZATION #================================================= -ynh_app_config_run $1 +ynh_app_config_run "$1" From 12559dc86f99323f8f94cc318508effd6012019f Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Tue, 19 Mar 2024 09:02:53 +0000 Subject: [PATCH 11/11] Auto-update README --- README.md | 9 +++------ README_fr.md | 9 +++------ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 1cd9f3b..c66e8db 100644 --- a/README.md +++ b/README.md @@ -16,17 +16,14 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in ## Overview -Extendable continuous integration server -**Shipped version:** 2.426.3~ynh1 +The leading open source automation server, Jenkins provides hundreds of plugins to support building, deploying and automating any project. + +**Shipped version:** 2.426.3~ynh2 ## Screenshots ![Screenshot of Jenkins](./doc/screenshots/screenshot1.png) -## Disclaimers / important information - -* Use the admin panel of your Jenkins to configure this app. - ## Documentation and resources - Official app website: diff --git a/README_fr.md b/README_fr.md index f0c5fd7..222a0bb 100644 --- a/README_fr.md +++ b/README_fr.md @@ -16,17 +16,14 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po ## Vue d’ensemble -Serveur d'intégration continue extensible -**Version incluse :** 2.426.3~ynh1 +The leading open source automation server, Jenkins provides hundreds of plugins to support building, deploying and automating any project. + +**Version incluse :** 2.426.3~ynh2 ## Captures d’écran ![Capture d’écran de Jenkins](./doc/screenshots/screenshot1.png) -## Avertissements / informations importantes - -* Utiliser le panneau d'administration Jenkins pour configurer l'application. - ## Documentations et ressources - Site officiel de l’app :