From b0b4f4410314ecf29860b444e53b9c2a2c7735a7 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Wed, 22 Sep 2021 23:49:12 +0200 Subject: [PATCH 01/10] serve-summaries --- conf/nginx.conf | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/conf/nginx.conf b/conf/nginx.conf index 043af6c..bcb3b45 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -18,10 +18,20 @@ location __PATH__/ { location __PATH__/logs { alias /home/CI_package_check/logs/; autoindex on; + default_type "text/plain"; } location __PATH__/badges/ { alias /home/CI_package_check/badges/; autoindex on; } + + location __PATH__/summary/ { + alias /home/CI_package_check/summary/; + autoindex on; + etag off; + more_set_headers "Cache-control: max-age=300, s-maxage=300"; + error_page 404 /ci/summary/empty.png; + } + } From 53d8362aea16a4804913806feed493023b5379d4 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Fri, 22 Oct 2021 00:19:44 +0200 Subject: [PATCH 02/10] Implement auto-updater --- .github/workflows/updater.sh | 64 +++++++++++++++++++++++++++++++++++ .github/workflows/updater.yml | 50 +++++++++++++++++++++++++++ 2 files changed, 114 insertions(+) create mode 100644 .github/workflows/updater.sh create mode 100644 .github/workflows/updater.yml diff --git a/.github/workflows/updater.sh b/.github/workflows/updater.sh new file mode 100644 index 0000000..f13a3e3 --- /dev/null +++ b/.github/workflows/updater.sh @@ -0,0 +1,64 @@ +#!/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 + +#================================================= +# FETCHING LATEST RELEASE AND ITS ASSETS +#================================================= + +# Fetching information +current_version=$(cat manifest.json | jq -j '.version|split("~")[0]') +current_yunorunner_release=$(grep -Po 'yunorunner_release="\K.*?(?=")' scripts/_common.sh) +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/commits/master" | jq -r '.commit.committer.date | split("T")[0]') +yunorunner_release=$(curl --silent "https://api.github.com/repos/$repo/commits/master" | jq -r '.sha') + +# Setting up the environment variables +echo "Current version: $current_version" +echo "Latest release from upstream: $version" +echo "VERSION=$version" >> $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 [[ ! "$version" > "$current_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 +#================================================= + +sed -i "s/$current_yunorunner_release/$yunorunner_release/gi" scripts/_common.sh + +#================================================= +# 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 new file mode 100644 index 0000000..5f1dcc1 --- /dev/null +++ b/.github/workflows/updater.yml @@ -0,0 +1,50 @@ +# 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@v2 + 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@v3 + 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 + From cb50a8fb06a2d0079aa317ba417ec67aa4715144 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 9 Jan 2022 14:34:05 +0100 Subject: [PATCH 03/10] Convert YYYY-MM-DD to YYYY.MM.DD for proper version handling --- .github/workflows/updater.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/updater.sh b/.github/workflows/updater.sh index f13a3e3..80d4473 100644 --- a/.github/workflows/updater.sh +++ b/.github/workflows/updater.sh @@ -16,7 +16,7 @@ current_version=$(cat manifest.json | jq -j '.version|split("~")[0]') current_yunorunner_release=$(grep -Po 'yunorunner_release="\K.*?(?=")' scripts/_common.sh) 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/commits/master" | jq -r '.commit.committer.date | split("T")[0]') +version=$(curl --silent "https://api.github.com/repos/$repo/commits/master" | jq -r '.commit.committer.date | split("T")[0] | gsub("-";".")') yunorunner_release=$(curl --silent "https://api.github.com/repos/$repo/commits/master" | jq -r '.sha') # Setting up the environment variables From 91fe537259a4e3661f067cd4cae3705af157d19f Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sun, 9 Jan 2022 13:34:38 +0000 Subject: [PATCH 04/10] Upgrade to v2021.10.19 --- manifest.json | 4 ++-- scripts/_common.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/manifest.json b/manifest.json index f3fd036..46184d4 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "CI runner of YunoHost", "fr": "Runner d'intégration continue de YunoHost" }, - "version": "2021.09.22~ynh3", + "version": "2021.10.19~ynh1", "url": "https://github.com/YunoHost/yunorunner", "upstream": { "license": "GPL-3.0-or-later", @@ -28,7 +28,7 @@ "nginx" ], "arguments": { - "install" : [ + "install": [ { "name": "domain", "type": "domain" diff --git a/scripts/_common.sh b/scripts/_common.sh index 88c8417..6efb1bd 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -9,7 +9,7 @@ pkg_dependencies="python3-venv python3-dev python3-pip sqlite3" yunorunner_repository="https://github.com/YunoHost/yunorunner" -yunorunner_release="0e87f07e8bcb1f3aee055a694f3c7198e22b4019" +yunorunner_release="266bad3ec0aa050f3c005e8e3d1220bcae716616" #================================================= # PERSONAL HELPERS From 3a39b0ea764fc4e9293580e4c035e4d98823aa54 Mon Sep 17 00:00:00 2001 From: Yunohost-Bot <> Date: Sun, 9 Jan 2022 13:34:41 +0000 Subject: [PATCH 05/10] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 23885a7..1949d2b 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in CI runner of YunoHost -**Shipped version:** 2021.09.22~ynh3 +**Shipped version:** 2021.10.19~ynh1 diff --git a/README_fr.md b/README_fr.md index b2095e6..e9f88bd 100644 --- a/README_fr.md +++ b/README_fr.md @@ -13,7 +13,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour Runner d'intégration continue de YunoHost -**Version incluse :** 2021.09.22~ynh3 +**Version incluse :** 2021.10.19~ynh1 From 596dfda12b4b298c6b6147f60d7759531ee77752 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 9 Jan 2022 14:47:59 +0100 Subject: [PATCH 06/10] Fix nginx.conf --- conf/nginx.conf | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index b6fef56..ff7c444 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -10,25 +10,22 @@ location __PATH__/ { # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc; - # Include SSOWAT user panel. - include conf.d/yunohost_panel.conf.inc; + location __PATH__/logs { + alias /home/CI_package_check/logs/; + autoindex on; + default_type "text/plain"; + } - location __PATH__/logs { - alias /home/CI_package_check/logs/; - autoindex on; - default_type "text/plain"; - } - - location __PATH__/badges/ { - alias /home/CI_package_check/badges/; - autoindex on; - } - - location __PATH__/summary/ { - alias /home/CI_package_check/summary/; - autoindex on; + location __PATH__/badges/ { + alias /home/CI_package_check/badges/; + autoindex on; + } + + location __PATH__/summary/ { + alias /home/CI_package_check/summary/; + autoindex on; etag off; more_set_headers "Cache-control: max-age=300, s-maxage=300"; - error_page 404 /ci/summary/empty.png; - } + error_page 404 /ci/summary/empty.png; + } } From eaab6c7b2c676e16b80912fee8836c6b566abb9b Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 9 Jan 2022 17:07:03 +0100 Subject: [PATCH 07/10] Silence pre-install git clone during CI tests --- check_process | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check_process b/check_process index f0f31f4..1571f8c 100644 --- a/check_process +++ b/check_process @@ -1,6 +1,6 @@ ;; Test complet ; pre-install - sudo git clone https://github.com/YunoHost/CI_package_check /home/CI_package_check + sudo git clone --quiet https://github.com/YunoHost/CI_package_check /home/CI_package_check ; Manifest domain="domain.tld" path="/path" From ef07918c4c123d30f64ae5cd0250a6d219f5a356 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sun, 9 Jan 2022 23:45:51 +0000 Subject: [PATCH 08/10] Upgrade to v2022.01.09 --- manifest.json | 2 +- scripts/_common.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index 46184d4..30c1710 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "CI runner of YunoHost", "fr": "Runner d'intégration continue de YunoHost" }, - "version": "2021.10.19~ynh1", + "version": "2022.01.09~ynh1", "url": "https://github.com/YunoHost/yunorunner", "upstream": { "license": "GPL-3.0-or-later", diff --git a/scripts/_common.sh b/scripts/_common.sh index 6efb1bd..1216083 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -9,7 +9,7 @@ pkg_dependencies="python3-venv python3-dev python3-pip sqlite3" yunorunner_repository="https://github.com/YunoHost/yunorunner" -yunorunner_release="266bad3ec0aa050f3c005e8e3d1220bcae716616" +yunorunner_release="de28fea3b51a3f5b4e3d0bdc956e2f172cea592c" #================================================= # PERSONAL HELPERS From 1335d42cbd7b1ebb53ac772fdd0a089323f11571 Mon Sep 17 00:00:00 2001 From: Yunohost-Bot <> Date: Sun, 9 Jan 2022 23:45:55 +0000 Subject: [PATCH 09/10] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1949d2b..73f7418 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in CI runner of YunoHost -**Shipped version:** 2021.10.19~ynh1 +**Shipped version:** 2022.01.09~ynh1 diff --git a/README_fr.md b/README_fr.md index e9f88bd..5f58092 100644 --- a/README_fr.md +++ b/README_fr.md @@ -13,7 +13,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour Runner d'intégration continue de YunoHost -**Version incluse :** 2021.10.19~ynh1 +**Version incluse :** 2022.01.09~ynh1 From f8f111b459d0e8189b23d40dcf918964e4f0cb92 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Mon, 10 Jan 2022 01:04:29 +0100 Subject: [PATCH 10/10] Add sensible timeout to service start detection --- scripts/change_url | 2 +- scripts/install | 2 +- scripts/restore | 2 +- scripts/upgrade | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index ba60148..d9ca583 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -79,7 +79,7 @@ fi #================================================= ynh_script_progression --message="Stopping a systemd service..." -ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" --line_match="Stopped YunoRunner CI" +ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" --line_match="Stopped YunoRunner CI" --timeout=30 #================================================= # MODIFY URL IN NGINX CONF diff --git a/scripts/install b/scripts/install index 202e137..91ac024 100644 --- a/scripts/install +++ b/scripts/install @@ -145,7 +145,7 @@ yunohost service add $app --description="$app daemon for YunoRunner" ynh_script_progression --message="Starting a systemd service..." # Start a systemd service -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started YunoRunner CI" +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started YunoRunner CI" --timeout=30 #================================================= # SETUP SSOWAT diff --git a/scripts/restore b/scripts/restore index 67bef3d..a51a6ae 100644 --- a/scripts/restore +++ b/scripts/restore @@ -113,7 +113,7 @@ yunohost service add $app --description="$app daemon for YunoRunner" #================================================= ynh_script_progression --message="Starting a systemd service..." -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started YunoRunner CI" +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started YunoRunner CI" --timeout=30 #================================================= # DEACTIVE MAINTENANCE MODE diff --git a/scripts/upgrade b/scripts/upgrade index 677b0ec..ee7e676 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -183,7 +183,7 @@ yunohost service add $app --description="$app daemon for YunoRunner" #================================================= ynh_script_progression --message="Starting a systemd service..." -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started YunoRunner CI" +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started YunoRunner CI" --timeout=30 #================================================= # DEACTIVE MAINTENANCE MODE