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

Merge pull request #28 from YunoHost-Apps/testing

Global upgrade of the package
This commit is contained in:
Kayou 2020-12-22 14:42:50 +01:00 committed by GitHub
commit fd057705dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 73 additions and 73 deletions

View file

@ -19,11 +19,11 @@ new_docker_image=${YNH_ACTION_DOCKER_IMAGE}
app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID}
gitlab_url=$(ynh_app_setting_get $app gitlab_url)
token=$(ynh_app_setting_get $app token)
docker_image=$(ynh_app_setting_get $app docker_image)
executor=$(ynh_app_setting_get $app executor)
architecture=$(ynh_app_setting_get $app architecture)
gitlab_url=$(ynh_app_setting_get --app=$app --key=gitlab_url)
token=$(ynh_app_setting_get --app=$app --key=token)
docker_image=$(ynh_app_setting_get --app=$app --key=docker_image)
executor=$(ynh_app_setting_get --app=$app --key=executor)
architecture=$(ynh_app_setting_get --app=$app --key=architecture)
#=================================================
# CHECK IF ARGUMENTS ARE CORRECT
@ -47,7 +47,7 @@ fi
#=================================================
# BACKUP BEFORE ACTION THEN ACTIVE TRAP
#=================================================
ynh_script_progression "Backing up the app before action (may take a while)..."
ynh_script_progression --message="Backing up the app before action (may take a while)..."
# Backup the current version of the app
ynh_backup_before_action
@ -68,7 +68,7 @@ ynh_abort_if_errors
#=================================================
# REGISTER THE RUNNER
#=================================================
ynh_script_progression "Register Gitlab Runner..."
ynh_script_progression --message="Register Gitlab Runner..."
# Can be registered several time, to do this give a list of gitlab_url, token and docker_image separated by a comma.
split_char=","
@ -101,14 +101,14 @@ done
#=================================================
# STORE SETTINGS
#=================================================
ynh_script_progression "Storing settings..."
ynh_script_progression --message="Storing settings..."
ynh_app_setting_set $app gitlab_url $gitlab_url
ynh_app_setting_set $app token $token
ynh_app_setting_set $app docker_image $docker_image
ynh_app_setting_set --app=$app --key=gitlab_url --value=$gitlab_url
ynh_app_setting_set --app=$app --key=token --value=$token
ynh_app_setting_set --app=$app --key=docker_image --value=$docker_image
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression "Action of $app completed" --last
ynh_script_progression --message="Action of $app completed" --last

View file

@ -33,7 +33,7 @@ app=$YNH_APP_INSTANCE_NAME
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
ynh_script_progression "Validating installation parameters..."
ynh_script_progression --message="Validating installation parameters..."
config_path=/etc/$app
test ! -e "$config_path" || ynh_die "This path already contains a folder"
@ -71,48 +71,48 @@ fi
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_script_progression "Storing installation settings..."
ynh_script_progression --message="Storing installation settings..."
ynh_app_setting_set $app gitlab_url $gitlab_url
ynh_app_setting_set $app token $token
ynh_app_setting_set $app executor $executor
ynh_app_setting_set $app docker_image $docker_image
ynh_app_setting_set $app architecture $architecture
ynh_app_setting_set $app config_path $config_path
ynh_app_setting_set --app=$app --key=gitlab_url --value=$gitlab_url
ynh_app_setting_set --app=$app --key=token --value=$token
ynh_app_setting_set --app=$app --key=executor --value=$executor
ynh_app_setting_set --app=$app --key=docker_image --value=$docker_image
ynh_app_setting_set --app=$app --key=architecture --value=$architecture
ynh_app_setting_set --app=$app --key=config_path --value=$config_path
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# ADD DOCKER REPO
#=================================================
ynh_script_progression "Adding a new 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 "Installing dependencies..."
ynh_script_progression --message="Installing dependencies..."
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression "Setting up source files..."
ynh_script_progression --message="Setting up source files..."
update_src_version() {
source ./upgrade.d/upgrade.last.sh
cp ../conf/$architecture.src.default ../conf/$architecture.src
ynh_replace_string "__VERSION__" "$gitlab_runner_version" "../conf/$architecture.src"
ynh_replace_string "__SOURCE_FILENAME__" "$gitlab_runner_filename" "../conf/$architecture.src"
ynh_replace_string --match_string="__VERSION__" --replace_string="$gitlab_runner_version" --target_file="../conf/$architecture.src"
ynh_replace_string --match_string="__SOURCE_FILENAME__" --replace_string="$gitlab_runner_filename" --target_file="../conf/$architecture.src"
if [ $architecture = "x86-64" ]; then
ynh_replace_string "__SHA256_SUM__" "$gitlab_runner_x86_64_source_sha256" "../conf/$architecture.src"
ynh_replace_string --match_string="__SHA256_SUM__" --replace_string="$gitlab_runner_x86_64_source_sha256" --target_file="../conf/$architecture.src"
elif [ $architecture = "i386" ]; then
ynh_replace_string "__SHA256_SUM__" "$gitlab_runner_i386_source_sha256" "../conf/$architecture.src"
ynh_replace_string --match_string="__SHA256_SUM__" --replace_string="$gitlab_runner_i386_source_sha256" --target_file="../conf/$architecture.src"
elif [ $architecture = "arm" ]; then
ynh_replace_string "__SHA256_SUM__" "$gitlab_runner_arm_source_sha256" "../conf/$architecture.src"
ynh_replace_string --match_string="__SHA256_SUM__" --replace_string="$gitlab_runner_arm_source_sha256" --target_file="../conf/$architecture.src"
fi
}
@ -120,7 +120,7 @@ update_src_version
tempdir="$(mktemp -d)"
ynh_setup_source $tempdir $architecture
ynh_setup_source --dest_dir=$tempdir --source_id=$architecture
dpkg -i $tempdir/$gitlab_runner_filename
@ -129,7 +129,7 @@ dpkg -i $tempdir/$gitlab_runner_filename
#=================================================
# SETUP GITLAB RUNNER
#=================================================
ynh_script_progression "Configuring Gitlab Runner..."
ynh_script_progression --message="Configuring Gitlab Runner..."
# Can be registered several time, to do this give a list of gitlab_url, token and docker_image separated by a comma.
split_char=","
@ -174,4 +174,4 @@ yunohost service add $app
# END OF SCRIPT
#=================================================
ynh_script_progression "Installation of $app completed" --last
ynh_script_progression --message="Installation of $app completed" --last

View file

@ -12,11 +12,11 @@ source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression "Loading installation settings..."
ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
config_path=$(ynh_app_setting_get $app config_path)
config_path=$(ynh_app_setting_get --app=$app --key=config_path)
#=================================================
# STANDARD REMOVE
@ -27,28 +27,28 @@ config_path=$(ynh_app_setting_get $app config_path)
# Remove a service from the admin panel, added by `yunohost service add`
if yunohost service status $app >/dev/null 2>&1
then
ynh_script_progression "Removing $app service"
ynh_script_progression --message="Removing $app service"
yunohost service remove $app
fi
#=================================================
# UNREGISTER ALL RUNNERS
#=================================================
ynh_script_progression "Unregistering all runners..."
ynh_script_progression --message="Unregistering all runners..."
ynh_exec_warn_less $app unregister --all-runners
#=================================================
# REMOVE GITLAB RUNNER
#=================================================
ynh_script_progression "Removing Gitlab Runner"
ynh_script_progression --message="Removing Gitlab Runner"
dpkg --remove $app
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression "Removing dependencies"
ynh_script_progression --message="Removing dependencies"
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
@ -56,14 +56,14 @@ ynh_remove_app_dependencies
#=================================================
# REMOVE APP CONFIG DIR
#=================================================
ynh_script_progression "Removing app config directory"
ynh_script_progression --message="Removing app config directory"
ynh_secure_remove "$config_path"
ynh_secure_remove --file="$config_path"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression "Removing a repo..."
ynh_script_progression --message="Removing a repo..."
ynh_remove_extra_repo --name="${app}-docker"
@ -71,4 +71,4 @@ ynh_remove_extra_repo --name="${app}-docker"
# END OF SCRIPT
#=================================================
ynh_script_progression "Removal of $app completed" --last
ynh_script_progression --message="Removal of $app completed" --last

View file

@ -24,21 +24,21 @@ ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression "Loading settings..."
ynh_script_progression --message="Loading settings..."
app=$YNH_APP_INSTANCE_NAME
config_path=$(ynh_app_setting_get $app config_path)
architecture=$(ynh_app_setting_get $app architecture)
gitlab_url=$(ynh_app_setting_get $app gitlab_url)
token=$(ynh_app_setting_get $app token)
executor=$(ynh_app_setting_get $app executor)
docker_image=$(ynh_app_setting_get $app docker_image)
config_path=$(ynh_app_setting_get --app=$app --key=config_path)
architecture=$(ynh_app_setting_get --app=$app --key=architecture)
gitlab_url=$(ynh_app_setting_get --app=$app --key=gitlab_url)
token=$(ynh_app_setting_get --app=$app --key=token)
executor=$(ynh_app_setting_get --app=$app --key=executor)
docker_image=$(ynh_app_setting_get --app=$app --key=docker_image)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
ynh_script_progression "Validating restoration parameters..."
ynh_script_progression --message="Validating restoration parameters..."
test ! -d $config_path \
|| ynh_die "There is already a directory: $config_path "
@ -48,35 +48,35 @@ test ! -d $config_path \
#=================================================
# ADD DOCKER REPO
#=================================================
ynh_script_progression "Restoring the 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
#=================================================
ynh_script_progression "Reinstalling dependencies..."
ynh_script_progression --message="Reinstalling dependencies..."
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression "Reinstalling GitLab Runner..."
ynh_script_progression --message="Reinstalling GitLab Runner..."
update_src_version() {
source ../settings/scripts/upgrade.d/upgrade.last.sh
mkdir -p ../conf/
cp ../settings/conf/$architecture.src.default ../conf/$architecture.src
ynh_replace_string "__VERSION__" "$gitlab_runner_version" "../conf/$architecture.src"
ynh_replace_string "__SOURCE_FILENAME__" "$gitlab_runner_filename" "../conf/$architecture.src"
ynh_replace_string --match_string="__VERSION__" --replace_string="$gitlab_runner_version" --target_file="../conf/$architecture.src"
ynh_replace_string --match_string="__SOURCE_FILENAME__" --replace_string="$gitlab_runner_filename" --target_file="../conf/$architecture.src"
if [ $architecture = "x86-64" ]; then
ynh_replace_string "__SHA256_SUM__" "$gitlab_runner_x86_64_source_sha256" "../conf/$architecture.src"
ynh_replace_string --match_string="__SHA256_SUM__" --replace_string="$gitlab_runner_x86_64_source_sha256" --target_file="../conf/$architecture.src"
elif [ $architecture = "i386" ]; then
ynh_replace_string "__SHA256_SUM__" "$gitlab_runner_i386_source_sha256" "../conf/$architecture.src"
ynh_replace_string --match_string="__SHA256_SUM__" --replace_string="$gitlab_runner_i386_source_sha256" --target_file="../conf/$architecture.src"
elif [ $architecture = "arm" ]; then
ynh_replace_string "__SHA256_SUM__" "$gitlab_runner_arm_source_sha256" "../conf/$architecture.src"
ynh_replace_string --match_string="__SHA256_SUM__" --replace_string="$gitlab_runner_arm_source_sha256" --target_file="../conf/$architecture.src"
fi
}
@ -84,7 +84,7 @@ update_src_version
tempdir="$(mktemp -d)"
ynh_setup_source $tempdir $architecture
ynh_setup_source --dest_dir=$tempdir --source_id=$architecture
dpkg -i $tempdir/$gitlab_runner_filename
@ -93,7 +93,7 @@ dpkg -i $tempdir/$gitlab_runner_filename
#=================================================
# SETUP GITLAB RUNNER
#=================================================
ynh_script_progression "Configuring Gitlab Runner..."
ynh_script_progression --message="Configuring Gitlab Runner..."
# Can be registered several time, to do this give a list of gitlab_url, token and docker_image separated by a comma.
split_char=","
@ -129,4 +129,4 @@ yunohost service add $app
# END OF SCRIPT
#=================================================
ynh_script_progression "Restoration completed for $app" --last
ynh_script_progression --message="Restoration completed for $app" --last

View file

@ -12,23 +12,23 @@ source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression "Loading installation settings..."
ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
architecture=$(ynh_app_setting_get $app architecture)
architecture=$(ynh_app_setting_get --app=$app --key=architecture)
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression "Ensuring downward compatibility..."
ynh_script_progression --message="Ensuring downward compatibility..."
# NOTING TO DO HERE YET
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression "Backing up the app before upgrading (may take a while)..."
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
@ -44,20 +44,20 @@ ynh_abort_if_errors
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression "Upgrading source files..."
ynh_script_progression --message="Upgrading source files..."
update_src_version() {
source ./upgrade.d/upgrade.last.sh
cp ../conf/$architecture.src.default ../conf/$architecture.src
ynh_replace_string "__VERSION__" "$gitlab_runner_version" "../conf/$architecture.src"
ynh_replace_string "__SOURCE_FILENAME__" "$gitlab_runner_filename" "../conf/$architecture.src"
ynh_replace_string --match_string="__VERSION__" --replace_string="$gitlab_runner_version" --target_file="../conf/$architecture.src"
ynh_replace_string --match_string="__SOURCE_FILENAME__" --replace_string="$gitlab_runner_filename" --target_file="../conf/$architecture.src"
if [ $architecture = "x86-64" ]; then
ynh_replace_string "__SHA256_SUM__" "$gitlab_runner_x86_64_source_sha256" "../conf/$architecture.src"
ynh_replace_string --match_string="__SHA256_SUM__" --replace_string="$gitlab_runner_x86_64_source_sha256" --target_file="../conf/$architecture.src"
elif [ $architecture = "i386" ]; then
ynh_replace_string "__SHA256_SUM__" "$gitlab_runner_i386_source_sha256" "../conf/$architecture.src"
ynh_replace_string --match_string="__SHA256_SUM__" --replace_string="$gitlab_runner_i386_source_sha256" --target_file="../conf/$architecture.src"
elif [ $architecture = "arm" ]; then
ynh_replace_string "__SHA256_SUM__" "$gitlab_runner_arm_source_sha256" "../conf/$architecture.src"
ynh_replace_string --match_string="__SHA256_SUM__" --replace_string="$gitlab_runner_arm_source_sha256" --target_file="../conf/$architecture.src"
fi
}
@ -65,14 +65,14 @@ update_src_version
tempdir="$(mktemp -d)"
ynh_setup_source $tempdir $architecture
ynh_setup_source --dest_dir=$tempdir --source_id=$architecture
dpkg -i $tempdir/$gitlab_runner_filename
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression "Upgrading dependencies..."
ynh_script_progression --message="Upgrading dependencies..."
ynh_install_app_dependencies $pkg_dependencies
@ -86,4 +86,4 @@ yunohost service add $app
# END OF SCRIPT
#=================================================
ynh_script_progression "Upgrade of $app completed" --last
ynh_script_progression --message="Upgrade of $app completed" --last