1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/gitlab-runner_ynh.git synced 2024-09-03 19:15:58 +02:00

Apply example_ynh

This commit is contained in:
yalh76 2022-07-14 16:50:49 +02:00
parent efd050f9eb
commit eab6a0dd2e
14 changed files with 85 additions and 54 deletions

View file

@ -16,5 +16,6 @@
incorrect_path=0
port_already_use=0
change_url=0
;;; Levels
Level 5=auto
;;; Options
Email=
Notification=none

0
doc/.gitkeep Normal file
View file

1
doc/DESCRIPTION.md Normal file
View file

@ -0,0 +1 @@
GitLab Runner is a continuous integration tool to use with a GitLab instance (YNH or not).

1
doc/DESCRIPTION_fr.md Normal file
View file

@ -0,0 +1 @@
GitLab Runner est un outil d'intégration continue à utiliser avec une instance GitLab (YNH ou non).

12
doc/DISCLAIMER.md Normal file
View file

@ -0,0 +1,12 @@
## Configuration
How to configure this app: by the admin panel of GitLab or the settings "CI/CD" of your project.
### System configuration
Running a Gitlab Runner mandates to choose [an executor](https://docs.gitlab.com/runner/executors/) at registeration time (when the Gitlab Runner instance registers to a Gitlab instance). For now this YunoHost application only supports the `docker` executor.
## Additional information
* To retrieve the information to be provided to the installation such as the `token` or the `gitlab's url` you must go here: `Settings->CI/CD->Runners->"Set up a specific Runner manually"` in the project or admin section of the GitLab instance to link to this runner.
* If you get this message during a job: `Could not resolve host: you.domain.tld`, you can add `dns_search = [“you.domain.tld”]` in the section `[[runners]]` section.

13
doc/DISCLAIMER_fr.md Normal file
View file

@ -0,0 +1,13 @@
## Configuration
Comment configurer cette application: via le panneau d'administration de GitLab ou les paramettres "CI/CD" de votre projet.
### Configuration système
Lors du premier démarrage d'un Gitlab Runner, [un exécuteur](https://docs.gitlab.com/runner/executors/) doit être choisi (Lorsque l'instance Gitlab Runner s'enregistre auprès d'une instance Gitlab). Pour l'instant, cette application YunoHost ne supporte que l'[exécuteur `docker`](https://docs.gitlab.com/runner/executors/docker.html).
## Informations additionnelles
* Pour récupérer les informations à fournir à l'installation comme le `token` ou `l'url gitlab` vous devez vous rendre ici : `Settings->CI/CD->Runners->"Set up a specific Runner manually"` dans le projet
ou la section admin de l'instance GitLab à relier à ce runner.
* Si vous avez ce message pendant un travail : `Could not resolve host : you.domain.tld`, vous pouvez ajouter `dns_search = ["you.domain.tld"]` dans la section `[[runners]]`.

0
doc/screenshots/.gitkeep Normal file
View file

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 KiB

View file

@ -6,21 +6,27 @@
"en": "Continuous integration tool to use with a GitLab instance (YNH or not).",
"fr": "Outil d'intégration continue à utiliser avec une instance GitLab (YNH ou non)."
},
"version": "15.0.0~ynh1",
"version": "15.0.0~ynh2",
"url": "https://gitlab.com/gitlab-org/gitlab-runner",
"upstream": {
"license": "MIT",
"website": "https://gitlab.com/gitlab-org/gitlab-runner",
"admindoc": "https://docs.gitlab.com/runner/",
"code": "https://gitlab.com/gitlab-org/gitlab-runner"
},
"license": "MIT",
"maintainer": {
"name": "kay0u",
"email": "pierre@kayou.io"
},
"requirements": {
"yunohost": ">= 4.2.3"
"yunohost": ">= 4.3.0"
},
"multi_instance": false,
"services": [
],
"arguments": {
"install" : [
"install": [
{
"name": "gitlab_url",
"type": "string",

View file

@ -6,7 +6,7 @@
# IMPORT GENERIC HELPERS
#=================================================
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
@ -15,7 +15,6 @@ source /usr/share/yunohost/helpers
#=================================================
ynh_clean_setup () {
### Remove this function if there's nothing to clean before calling the remove script.
true
}
# Exit if an error occurs during the execution of the script
@ -24,7 +23,7 @@ ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info "Loading installation settings..."
ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
@ -38,4 +37,4 @@ app=$YNH_APP_INSTANCE_NAME
# END OF SCRIPT
#=================================================
ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

View file

@ -14,7 +14,6 @@ source /usr/share/yunohost/helpers
#=================================================
ynh_clean_setup () {
### Remove this function if there's nothing to clean before calling the remove script.
true
}
# Exit if an error occurs during the execution of the script
@ -82,18 +81,12 @@ ynh_app_setting_set --app=$app --key=config_path --value=$config_path
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# ADD DOCKER REPO
#=================================================
ynh_script_progression --message="Adding a new repo..."
ynh_install_extra_repo --repo="https://download.docker.com/linux/debian $(lsb_release -cs) stable" --key="https://download.docker.com/linux/debian/gpg" --name="${app}-docker"
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..."
ynh_install_extra_repo --repo="https://download.docker.com/linux/debian $(lsb_release -cs) stable" --key="https://download.docker.com/linux/debian/gpg" --name="${app}-docker"
ynh_install_app_dependencies $pkg_dependencies
#=================================================
@ -165,8 +158,9 @@ ynh_store_file_checksum "$config_path/config.toml"
#=================================================
# GENERIC FINALIZATION
#=================================================
# ADVERTISE SERVICE IN ADMIN PANEL
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..."
yunohost service add $app
@ -174,4 +168,4 @@ yunohost service add $app
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed" --last
ynh_script_progression --message="Installation of $app completed"

View file

@ -21,13 +21,13 @@ config_path=$(ynh_app_setting_get --app=$app --key=config_path)
#=================================================
# STANDARD REMOVE
#=================================================
# REMOVE SERVICE FROM ADMIN PANEL
# REMOVE SERVICE INTEGRATION IN YUNOHOST
#=================================================
# Remove a service from the admin panel, added by `yunohost service add`
if yunohost service status $app >/dev/null 2>&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"
ynh_script_progression --message="Removing $app service integration..."
yunohost service remove $app
fi
@ -48,27 +48,21 @@ dpkg --remove $app
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies"
ynh_script_progression --message="Removing dependencies..."
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
ynh_remove_extra_repo --name="${app}-docker"
#=================================================
# REMOVE APP CONFIG DIR
# REMOVE VARIOUS FILES
#=================================================
ynh_script_progression --message="Removing app config directory"
ynh_script_progression --message="Removing various files..."
ynh_secure_remove --file="$config_path"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Removing a repo..."
ynh_remove_extra_repo --name="${app}-docker"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of $app completed" --last
ynh_script_progression --message="Removal of $app completed"

View file

@ -6,7 +6,7 @@
# IMPORT GENERIC HELPERS
#=================================================
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
@ -15,7 +15,6 @@ source /usr/share/yunohost/helpers
#=================================================
ynh_clean_setup () {
#### Remove this function if there's nothing to clean before calling the remove script.
true
}
# Exit if an error occurs during the execution of the script
@ -24,7 +23,7 @@ ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading settings..."
ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
@ -41,22 +40,17 @@ docker_image=$(ynh_app_setting_get --app=$app --key=docker_image)
ynh_script_progression --message="Validating restoration parameters..."
test ! -d $config_path \
|| ynh_die "There is already a directory: $config_path "
|| ynh_die --message="There is already a directory: $config_path "
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
# ADD DOCKER REPO
#=================================================
ynh_script_progression --message="Restoring the docker repo..."
ynh_install_extra_repo --repo="https://download.docker.com/linux/debian $(lsb_release -cs) stable" --key="https://download.docker.com/linux/debian/gpg" --name="${app}-docker"
#=================================================
# INSTALL DEPENDENCIES
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling dependencies..."
# Define and install dependencies
ynh_install_extra_repo --repo="https://download.docker.com/linux/debian $(lsb_release -cs) stable" --key="https://download.docker.com/linux/debian/gpg" --name="${app}-docker"
ynh_install_app_dependencies $pkg_dependencies
#=================================================
@ -119,13 +113,21 @@ do
done
#=================================================
# ADVERTISE SERVICE IN ADMIN PANEL
# STORE THE CONFIG FILE CHECKSUM
#=================================================
# Calculate and store the config file checksum into the app settings
ynh_store_file_checksum "$config_path/config.toml"
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..."
yunohost service add $app
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Restoration completed for $app" --last
ynh_script_progression --message="Restoration completed for $app"

View file

@ -19,11 +19,11 @@ app=$YNH_APP_INSTANCE_NAME
architecture=$(ynh_app_setting_get --app=$app --key=architecture)
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
# CHECK VERSION
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..."
ynh_script_progression --message="Checking version..."
# NOTING TO DO HERE YET
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
@ -33,7 +33,7 @@ ynh_script_progression --message="Backing up the app before upgrading (may take
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# restore it if the upgrade fails
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
@ -41,6 +41,13 @@ ynh_abort_if_errors
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..."
# NOTING TO DO HERE YET
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
@ -77,8 +84,9 @@ ynh_script_progression --message="Upgrading dependencies..."
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# ADVERTISE SERVICE IN ADMIN PANEL
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..."
yunohost service add $app
@ -86,4 +94,4 @@ yunohost service add $app
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of $app completed" --last
ynh_script_progression --message="Upgrade of $app completed"