1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/gitlab_ynh.git synced 2024-09-03 18:36:35 +02:00

Merge pull request #153 from YunoHost-Apps/testing

Fix ssh
This commit is contained in:
Kayou 2021-05-17 19:27:48 +02:00 committed by GitHub
commit 437e3259a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 119 additions and 56 deletions

55
.github/ISSUE_TEMPLATE.md vendored Normal file
View file

@ -0,0 +1,55 @@
---
name: Bug report
about: When creating a bug report, please use the following template to provide all the relevant information and help debugging efficiently.
---
**How to post a meaningful bug report**
1. *Read this whole template first.*
2. *Determine if you are on the right place:*
- *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!*
- *Otherwise, the issue may be due to the app itself. Refer to its documentation or repository for help.*
- *When in doubt, post here and we will figure it out together.*
3. *Delete the italic comments as you write over them below, and remove this guide.*
---
### Describe the bug
*A clear and concise description of what the bug is.*
### Context
- Hardware: *VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / ...*
- YunoHost version: x.x.x
- I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...*
- Are you in a special context or did you perform some particular tweaking on your YunoHost instance?: *no / yes*
- If yes, please explain:
- Using, or trying to install package version/branch:
- If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`*
### Steps to reproduce
- *If you performed a command from the CLI, the command itself is enough. For example:*
```sh
sudo yunohost app install the_app
```
- *If you used the webadmin, please perform the equivalent command from the CLI first.*
- *If the error occurs in your browser, explain what you did:*
1. *Go to '...'*
2. *Click on '...'*
3. *Scroll down to '...'*
4. *See error*
### Expected behavior
*A clear and concise description of what you expected to happen. You can remove this section if the command above is enough to understand your intent.*
### Logs
*When an operation fails, YunoHost provides a simple way to share the logs.*
- *In the webadmin, the error message contains a link to the relevant log page. On that page, you will be able to 'Share with Yunopaste'. If you missed it, the logs of previous operations are also available under Tools > Logs.*
- *In command line, the command to share the logs is displayed at the end of the operation and looks like `yunohost log display [log name] --share`. If you missed it, you can find the log ID of a previous operation using `yunohost log list`.*
*After sharing the log, please copypaste directly the link provided by YunoHost (to help readability, no need to copypaste the entire content of the log here, just the link is enough...)*
*If applicable and useful, add screenshots to help explain your problem.*

16
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View file

@ -0,0 +1,16 @@
## Problem
- *Description of why you made this PR*
## Solution
- *And how do you fix that problem*
## PR Status
- [ ] Code finished and ready to be reviewed/tested
- [ ] The fix/enhancement were manually tested (if applicable)
## Automatic tests
Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ *after creating the PR*, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization)

View file

@ -14,7 +14,7 @@
"email": "pierre@kayou.io" "email": "pierre@kayou.io"
}, },
"requirements": { "requirements": {
"yunohost": ">= 4.1.5" "yunohost": ">= 4.2.3"
}, },
"multi_instance": false, "multi_instance": false,
"services": [ "services": [

View file

@ -1,22 +0,0 @@
## Problem
- *Description of why you made this PR*
## Solution
- *And how do you fix that problem*
## PR Status
- [ ] Code finished.
- [ ] Tested with Package_check.
- [ ] Fix or enhancement tested.
- [ ] Upgrade from last version tested.
- [ ] Can be reviewed and tested.
## Validation
---
- [ ] **Code review** :
- [ ] **Approval (LGTM)** :
*Code review and approval have to be from a member of @YunoHost-Apps/apps-group*
- **CI succeeded** :
[![Build Status](https://ci-apps-hq.yunohost.org/jenkins/job/gitlab_ynh%20PR-NUM-/badge/icon)](https://ci-apps-hq.yunohost.org/jenkins/job/gitlab_ynh%20PR-NUM-/)
*Please replace '-NUM-' in this link by the PR number.*
When the PR is marked as ready to merge, you have to wait for 3 days before really merging it.

View file

@ -112,7 +112,7 @@ ynh_backup_if_checksum_is_different --file="$config_path/gitlab.rb"
mkdir -p $config_path mkdir -p $config_path
cp -f ../conf/gitlab.rb "$config_path/gitlab.rb" cp -f $YNH_APP_BASEDIR/conf/gitlab.rb "$config_path/gitlab.rb"
ssh_port=$(grep -P "Port\s+\d+" /etc/ssh/sshd_config | grep -P -o "\d+") ssh_port=$(grep -P "Port\s+\d+" /etc/ssh/sshd_config | grep -P -o "\d+")
domain="$new_domain" domain="$new_domain"

View file

@ -142,7 +142,9 @@ fi
if [ $swap_needed -gt 0 ]; then if [ $swap_needed -gt 0 ]; then
ynh_script_progression --message="Adding $swap_needed Mo to swap..." ynh_script_progression --message="Adding $swap_needed Mo to swap..."
ynh_add_swap --size=$swap_needed if ! ynh_add_swap --size=$swap_needed; then
ynh_print_warn --message="Please add $swap_needed Mo to swap to make Gitlab work properly"
fi
fi fi
#================================================= #=================================================
@ -169,7 +171,7 @@ mkdir -p $config_path
touch "$config_path/gitlab-persistent.rb" touch "$config_path/gitlab-persistent.rb"
chown admin: "$config_path/gitlab-persistent.rb" chown admin: "$config_path/gitlab-persistent.rb"
cp -f ../conf/gitlab.rb "$config_path/gitlab.rb" cp -f $YNH_APP_BASEDIR/conf/gitlab.rb "$config_path/gitlab.rb"
ssh_port=$(grep -P "Port\s+\d+" /etc/ssh/sshd_config | grep -P -o "\d+") ssh_port=$(grep -P "Port\s+\d+" /etc/ssh/sshd_config | grep -P -o "\d+")
ynh_replace_string --match_string="__GENERATED_EXTERNAL_URL__" --replace_string="https://$domain${path_url%/}" --target_file="$config_path/gitlab.rb" ynh_replace_string --match_string="__GENERATED_EXTERNAL_URL__" --replace_string="https://$domain${path_url%/}" --target_file="$config_path/gitlab.rb"
@ -194,12 +196,12 @@ ynh_store_file_checksum --file="$config_path/gitlab.rb"
#================================================= #=================================================
ynh_script_progression --message="Setting up source files..." --weight=50 ynh_script_progression --message="Setting up source files..." --weight=50
source ./upgrade.d/upgrade.last.sh source $YNH_APP_BASEDIR/scripts/upgrade.d/upgrade.last.sh
cp ../conf/$architecture.src.default ../conf/$architecture.src cp $YNH_APP_BASEDIR/conf/$architecture.src.default $YNH_APP_BASEDIR/conf/$architecture.src
ynh_replace_string --match_string="__VERSION__" --replace_string="$gitlab_version" --target_file="../conf/$architecture.src" ynh_replace_string --match_string="__VERSION__" --replace_string="$gitlab_version" --target_file="$YNH_APP_BASEDIR/conf/$architecture.src"
ynh_replace_string --match_string="__SOURCE_FILENAME__" --replace_string="$gitlab_filename" --target_file="../conf/$architecture.src" ynh_replace_string --match_string="__SOURCE_FILENAME__" --replace_string="$gitlab_filename" --target_file="$YNH_APP_BASEDIR/conf/$architecture.src"
ynh_replace_string --match_string="__DEBIAN_VERSION__" --replace_string="$gitlab_debian_version" --target_file="../conf/$architecture.src" ynh_replace_string --match_string="__DEBIAN_VERSION__" --replace_string="$gitlab_debian_version" --target_file="$YNH_APP_BASEDIR/conf/$architecture.src"
ynh_replace_string --match_string="__SHA256_SUM__" --replace_string="$gitlab_source_sha256" --target_file="../conf/$architecture.src" ynh_replace_string --match_string="__SHA256_SUM__" --replace_string="$gitlab_source_sha256" --target_file="$YNH_APP_BASEDIR/conf/$architecture.src"
tempdir="$(mktemp -d)" tempdir="$(mktemp -d)"
@ -239,6 +241,9 @@ ynh_script_progression --message="Reconfigure GitLab..." --weight=13
gitlab-ctl reconfigure gitlab-ctl reconfigure
# Allow ssh for git
usermod -a -G "ssh.app" "git"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================

View file

@ -77,7 +77,9 @@ fi
if [ $swap_needed -gt 0 ]; then if [ $swap_needed -gt 0 ]; then
ynh_script_progression --message="Adding $swap_needed Mo to swap..." ynh_script_progression --message="Adding $swap_needed Mo to swap..."
ynh_add_swap --size=$swap_needed if ! ynh_add_swap --size=$swap_needed; then
ynh_print_warn --message="Please add $swap_needed Mo to swap to make Gitlab work properly"
fi
fi fi
#================================================= #=================================================
@ -94,13 +96,12 @@ ynh_restore_file --origin_path="$config_path/gitlab-persistent.rb"
#================================================= #=================================================
ynh_script_progression --message="Reinstalling GitLab..." --weight=50 ynh_script_progression --message="Reinstalling GitLab..." --weight=50
source ../settings/scripts/upgrade.d/upgrade.last.sh source $YNH_APP_BASEDIR/scripts/upgrade.d/upgrade.last.sh
mkdir -p ../conf/ cp $YNH_APP_BASEDIR/conf/$architecture.src.default $YNH_APP_BASEDIR/conf/$architecture.src
cp ../settings/conf/$architecture.src.default ../conf/$architecture.src ynh_replace_string --match_string="__VERSION__" --replace_string="$gitlab_version" --target_file="$YNH_APP_BASEDIR/conf/$architecture.src"
ynh_replace_string --match_string="__VERSION__" --replace_string="$gitlab_version" --target_file="../conf/$architecture.src" ynh_replace_string --match_string="__SOURCE_FILENAME__" --replace_string="$gitlab_filename" --target_file="$YNH_APP_BASEDIR/conf/$architecture.src"
ynh_replace_string --match_string="__SOURCE_FILENAME__" --replace_string="$gitlab_filename" --target_file="../conf/$architecture.src" ynh_replace_string --match_string="__DEBIAN_VERSION__" --replace_string="$gitlab_debian_version" --target_file="$YNH_APP_BASEDIR/conf/$architecture.src"
ynh_replace_string --match_string="__DEBIAN_VERSION__" --replace_string="$gitlab_debian_version" --target_file="../conf/$architecture.src" ynh_replace_string --match_string="__SHA256_SUM__" --replace_string="$gitlab_source_sha256" --target_file="$YNH_APP_BASEDIR/conf/$architecture.src"
ynh_replace_string --match_string="__SHA256_SUM__" --replace_string="$gitlab_source_sha256" --target_file="../conf/$architecture.src"
tempdir="$(mktemp -d)" tempdir="$(mktemp -d)"
@ -156,6 +157,9 @@ ynh_systemd_action --action=restart --service_name="gitlab-runsvdir" --log_path=
gitlab-rake gitlab:check SANITIZE=true gitlab-rake gitlab:check SANITIZE=true
# Allow ssh for git
usermod -a -G "ssh.app" "git"
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================

View file

@ -204,7 +204,9 @@ fi
if [ $swap_needed -gt 0 ]; then if [ $swap_needed -gt 0 ]; then
ynh_script_progression --message="Adding $swap_needed Mo to swap..." ynh_script_progression --message="Adding $swap_needed Mo to swap..."
ynh_add_swap --size=$swap_needed if ! ynh_add_swap --size=$swap_needed; then
ynh_print_warn --message="Please add $swap_needed Mo to swap to make Gitlab work properly"
fi
fi fi
#================================================= #=================================================
@ -221,17 +223,17 @@ then
current_version=$(grep gitlab-ce /opt/gitlab/version-manifest.txt | cut -d' ' -f2) current_version=$(grep gitlab-ce /opt/gitlab/version-manifest.txt | cut -d' ' -f2)
# Load the last available version # Load the last available version
source ./upgrade.d/upgrade.last.sh source $YNH_APP_BASEDIR/scripts/upgrade.d/upgrade.last.sh
last_version=$gitlab_version last_version=$gitlab_version
source_current_major_version () { source_current_major_version () {
if [ -e "./upgrade.d/upgrade.$current_major_version.first.sh" ]; then if [ -e "$YNH_APP_BASEDIR/scripts/upgrade.d/upgrade.$current_major_version.first.sh" ]; then
source ./upgrade.d/upgrade.$current_major_version.first.sh source $YNH_APP_BASEDIR/scripts/upgrade.d/upgrade.$current_major_version.first.sh
elif [ -e "./upgrade.d/upgrade.$current_major_version.last.sh" ]; then elif [ -e "$YNH_APP_BASEDIR/scripts/upgrade.d/upgrade.$current_major_version.last.sh" ]; then
source ./upgrade.d/upgrade.$current_major_version.last.sh source $YNH_APP_BASEDIR/scripts/upgrade.d/upgrade.$current_major_version.last.sh
# Finish with the last migration if the file doesn't exist # Finish with the last migration if the file doesn't exist
else else
source ./upgrade.d/upgrade.last.sh source $YNH_APP_BASEDIR/scripts/upgrade.d/upgrade.last.sh
fi fi
} }
@ -252,10 +254,10 @@ then
# to the current version, and if the version stored in the upgrade.$current_major_version.last.sh file # to the current version, and if the version stored in the upgrade.$current_major_version.last.sh file
# increment the major version to upgrade to the next version # increment the major version to upgrade to the next version
if dpkg --compare-versions "$gitlab_version" "le" "$current_version"; then if dpkg --compare-versions "$gitlab_version" "le" "$current_version"; then
if [ -e "./upgrade.d/upgrade.$current_major_version.last.sh" ]; then if [ -e "$YNH_APP_BASEDIR/scripts/upgrade.d/upgrade.$current_major_version.last.sh" ]; then
source ./upgrade.d/upgrade.$current_major_version.last.sh source $YNH_APP_BASEDIR/scripts/upgrade.d/upgrade.$current_major_version.last.sh
else else
source ./upgrade.d/upgrade.last.sh source $YNH_APP_BASEDIR/scripts/upgrade.d/upgrade.last.sh
fi fi
if dpkg --compare-versions "$gitlab_version" "le" "$current_version"; then if dpkg --compare-versions "$gitlab_version" "le" "$current_version"; then
current_major_version=$(($current_major_version + 1)) current_major_version=$(($current_major_version + 1))
@ -263,11 +265,11 @@ then
fi fi
fi fi
cp ../conf/$architecture.src.default ../conf/$architecture.src cp $YNH_APP_BASEDIR/conf/$architecture.src.default $YNH_APP_BASEDIR/conf/$architecture.src
ynh_replace_string --match_string="__VERSION__" --replace_string="$gitlab_version" --target_file="../conf/$architecture.src" ynh_replace_string --match_string="__VERSION__" --replace_string="$gitlab_version" --target_file="$YNH_APP_BASEDIR/conf/$architecture.src"
ynh_replace_string --match_string="__SOURCE_FILENAME__" --replace_string="$gitlab_filename" --target_file="../conf/$architecture.src" ynh_replace_string --match_string="__SOURCE_FILENAME__" --replace_string="$gitlab_filename" --target_file="$YNH_APP_BASEDIR/conf/$architecture.src"
ynh_replace_string --match_string="__DEBIAN_VERSION__" --replace_string="$gitlab_debian_version" --target_file="../conf/$architecture.src" ynh_replace_string --match_string="__DEBIAN_VERSION__" --replace_string="$gitlab_debian_version" --target_file="$YNH_APP_BASEDIR/conf/$architecture.src"
ynh_replace_string --match_string="__SHA256_SUM__" --replace_string="$gitlab_source_sha256" --target_file="../conf/$architecture.src" ynh_replace_string --match_string="__SHA256_SUM__" --replace_string="$gitlab_source_sha256" --target_file="$YNH_APP_BASEDIR/conf/$architecture.src"
tempdir="$(mktemp -d)" tempdir="$(mktemp -d)"
@ -308,7 +310,7 @@ ynh_backup_if_checksum_is_different --file="$config_path/gitlab.rb"
mkdir -p $config_path mkdir -p $config_path
cp -f ../conf/gitlab.rb "$config_path/gitlab.rb" cp -f $YNH_APP_BASEDIR/conf/gitlab.rb "$config_path/gitlab.rb"
ssh_port=$(grep -P "Port\s+\d+" /etc/ssh/sshd_config | grep -P -o "\d+") ssh_port=$(grep -P "Port\s+\d+" /etc/ssh/sshd_config | grep -P -o "\d+")
ynh_replace_string --match_string="__GENERATED_EXTERNAL_URL__" --replace_string="https://$domain${path_url%/}" --target_file="$config_path/gitlab.rb" ynh_replace_string --match_string="__GENERATED_EXTERNAL_URL__" --replace_string="https://$domain${path_url%/}" --target_file="$config_path/gitlab.rb"
@ -329,6 +331,9 @@ chown admin: "$config_path/gitlab-persistent.rb"
gitlab-ctl reconfigure gitlab-ctl reconfigure
# Allow ssh for git
usermod -a -G "ssh.app" "git"
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================