7f06a0ce2e
Please carefully review the changelog: https://github.com/go-gitea/gitea/blob/v1.17.1/CHANGELOG.md and ensure that we've properly addressed the items listed there. I have listed the breaking changes list here and any actions we've taken or justification for why they don't affect us: * Require go1.18 for Gitea 1.17 (#19918) We were already using go 1.18. * Make AppDataPath absolute against the AppWorkPath if it is not (#19815) Path is already absolute: playbooks/roles/gitea/templates/app.ini.j2:APP_DATA_PATH = /data/gitea * Nuke the incorrect permission report on /api/v1/notifications (#19761) This has to do with how that api endpoint returns permissions. We don't use this anywhere as far as I can tell. * Refactor git module, make Gitea use internal git config (#19732) In the gitea container /data/git/.gitconfig is present but we don't appear to manage this in system-config. I think that means this change is a noop for us as gitea will move its managed .gitconfig from /data/git/.gitconfig to /data/git/repositories/.gitconfig. I expect the contents to be the same since gitea must be managing the file old content today. * Remove RequireHighlightJS field, update plantuml example. (#19615) This was a flag that toggled syntax highlighting on and off as best as I can tell. The default is to just have it turned on and we don't check the flag in any of our templates. * Increase minimal required git version to 2.0 (#19577) Debian Bullseye ships with 2.30.2-1. * Add a directory prefix gitea-src-VERSION to release-tar-file (#19396) They were tarbombing people and their tarballs extracted into the current dir. They now no longer do that. We build from git so this doesn't affect us. * Use "main" as default branch name (#19354) We explicitly set the default branch name to master for both gitea and gerrit. This should be a noop for us. Testing has been added to check this. https://opendev.org/opendev/system-config/src/branch/master/playbooks/roles/gitea-git-repos/library/gitea_create_repos.py#L129-L132 https://opendev.org/opendev/jeepyb/src/branch/master/jeepyb/cmd/manage_projects.py#L488 * Make cron task no notice on success (#19221) I'm not aware of us relying on any cron tasks or any cron task notifications. * Add pam account authorization check (#19040) We don't integrate with pam so the change in behavior to check authorization does not affect us. * Show messages for users if the ROOT_URL is wrong, show JavaScript errors (#18971) This message shows up in CI because ROOT_URL is https://opendev.org but we access gitea in testing via localhost. I don't think this is worth fixing. Its a good reminder that the instance is a test instance. * Refactor mirror code & fix StartToMirror (#18904) We don't mirror repos with gitea. Should be a noop for us. * Remove deprecated SSH ciphers from default (#18697) hmac-sha1-96, diffie-hellman-group1-sha1, and arcfour{128,256} are removed. The only ssh user is gerrit's replication. MINA should be able to support more modern ciphers and be fine. * Add the possibility to allow the user to have a favicon which differs from the main logo (#18542) Previously, logo.svg was used as the favicon.svg and gitea only fell back to favicon.png if the browser couldn't so the .svg. But now they want to support users having different logo.svg and favicon.svg. This necessitates explicitly adding a favicon.svg. Something we already do. Details at https://github.com/go-gitea/gitea/pull/18542 * Update reserved usernames list (#18438) This shouldn't be a problem for us as we don't have regular users and gerrit is not a reserved name. * Support custom ACME provider (#18340) We run ACME with LE out of band. This doesn't affect us. * Change initial TrustModel to committer (#18335) This changes the signed commits trust model from collaborator to committer. THis won't affect us as we aren't maintaining trusted keys. But basically this now shows if the signed commit by the committer matches the committer's key. * Update HTTP status codes (#18063) This changed redirect HTTP codes from 302 to 307. Shouldn't affect us. * Upgrade Alpine from 3.13 to 3.15 (#18050) We build on Debian and not alpine. The alpine nodejs version did change from 14 to 16 in this change and we've updated to match. * Restrict email address validation (#17688) If we had real users this may pose a problem as they are limiting the set of emails gitea would accept to a smaller set than they accepted before. Also fewer than actually allowed by email. But we don't have real users so this should be fine. * Refactor Router Logger (#17308) This streamlines and improves the log format of some of the gitea logs. We aren't automatically processing these logs today so this shouldn't have a major impact on us. Additionally this release adds a new git.HOME_PATH setting to set the location for writing out git configs and potential gnupg configs. We should be fine to let gitea write this content out to the default path, but there is potential for this to impact our ssh daemon. Changes made include: * Minimal updates to web templates to match 1.17 * Updating nodejs to v16 as v14 failed to build gitea * Disabling the new enabled by default "packages" feature * New test to check repos have a master branch by default instead of Gitea's new default of main. Change-Id: I88105eccd118e3daca72f0b86a6b351c35e37413
130 lines
5.0 KiB
Python
130 lines
5.0 KiB
Python
# Copyright 2018 Red Hat, Inc.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
from util import take_screenshots
|
|
|
|
testinfra_hosts = ['gitea99.opendev.org']
|
|
|
|
|
|
def test_gitea_listening(host):
|
|
gitea_https = host.socket("tcp://0.0.0.0:3000")
|
|
assert gitea_https.is_listening
|
|
gitea_http = host.socket("tcp://0.0.0.0:3080")
|
|
assert gitea_http.is_listening
|
|
gitea_ssh = host.socket("tcp://0.0.0.0:222")
|
|
assert gitea_ssh.is_listening
|
|
gitea_proxy = host.socket("tcp://0.0.0.0:3081")
|
|
assert gitea_proxy.is_listening
|
|
|
|
def test_ulimit(host):
|
|
cmd = host.run("docker exec gitea-docker_gitea-web_1 prlimit")
|
|
expected = ("STACK max stack size "
|
|
"16777216 9223372036854775807 bytes")
|
|
assert expected in cmd.stdout.split('\n')
|
|
|
|
def test_robots(host):
|
|
cmd = host.run('curl --insecure '
|
|
'--resolve gitea99.opendev.org:3081:127.0.0.1 '
|
|
'https://gitea99.opendev.org:3081/robots.txt')
|
|
assert 'Disallow: /' in cmd.stdout
|
|
|
|
def test_matrix_server(host):
|
|
cmd = host.run('curl --insecure -v '
|
|
'--resolve gitea99.opendev.org:3081:127.0.0.1 '
|
|
'https://gitea99.opendev.org:3081/.well-known/matrix/server')
|
|
assert '"m.server": "opendev.ems.host:443"' in cmd.stdout
|
|
assert 'Access-Control-Allow-Origin' not in cmd.stderr
|
|
|
|
def test_matrix_client(host):
|
|
cmd = host.run('curl --insecure -v '
|
|
'--resolve gitea99.opendev.org:3081:127.0.0.1 '
|
|
'https://gitea99.opendev.org:3081/.well-known/matrix/client')
|
|
assert '"base_url": "https://opendev.ems.host"' in cmd.stdout
|
|
assert 'Access-Control-Allow-Origin' in cmd.stderr
|
|
|
|
def test_proxy(host):
|
|
cmd = host.run('curl --insecure '
|
|
'--resolve gitea99.opendev.org:3081:127.0.0.1 '
|
|
'https://gitea99.opendev.org:3081/')
|
|
assert 'Git with a cup of tea' in cmd.stdout
|
|
|
|
def test_proxy_ua_blacklist(host):
|
|
cmd = host.run('curl --insecure -A '
|
|
'" Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; TencentTraveler 4.0)" '
|
|
'--resolve gitea99.opendev.org:3081:127.0.0.1 '
|
|
'https://gitea99.opendev.org:3081/')
|
|
assert '403 Forbidden' in cmd.stdout
|
|
|
|
def test_ondisk_logs(host):
|
|
mariadb_log = host.file('/var/log/containers/docker-mariadb.log')
|
|
assert mariadb_log.exists
|
|
|
|
gitea_log = host.file('/var/log/containers/docker-gitea.log')
|
|
assert gitea_log.exists
|
|
|
|
gitea_ssh_log = host.file('/var/log/containers/docker-gitea-ssh.log')
|
|
assert gitea_ssh_log.exists
|
|
assert gitea_ssh_log.contains("Server listening on :: port 222.")
|
|
|
|
def test_project_clone(host):
|
|
# Note this tests the result of a project rename in gitea as well.
|
|
cmd = host.run(
|
|
'GIT_SSL_NO_VERIFY=1 '
|
|
'git clone https://localhost:3081/opendev/disk-image-builder '
|
|
'/tmp/disk-image-builder')
|
|
assert "Cloning into '/tmp/disk-image-builder'..." in cmd.stderr
|
|
assert cmd.succeeded
|
|
# Check that our default of master is still honored.
|
|
# Gitea defaults to main as of 1.17.0.
|
|
cmd = host.run(
|
|
'git -C /tmp/disk-image-builder '
|
|
'symbolic-ref refs/remotes/origin/HEAD')
|
|
assert "refs/remotes/origin/master" in cmd.stdout
|
|
assert "refs/remotes/origin/main" not in cmd.stdout
|
|
assert cmd.succeeded
|
|
|
|
def test_partial_project_clone(host):
|
|
cmd = host.run(
|
|
'GIT_SSL_NO_VERIFY=1 '
|
|
'git clone --filter=blob:none '
|
|
'https://localhost:3081/opendev/system-config '
|
|
'/tmp/test-system-config-clone')
|
|
assert "Cloning into '/tmp/test-system-config-clone'..." in cmd.stderr
|
|
assert cmd.succeeded
|
|
# Check that our default of master is still honored.
|
|
# Gitea defaults to main as of 1.17.0.
|
|
cmd = host.run(
|
|
'git -C /tmp/test-system-config-clone '
|
|
'symbolic-ref refs/remotes/origin/HEAD')
|
|
assert "refs/remotes/origin/master" in cmd.stdout
|
|
assert "refs/remotes/origin/main" not in cmd.stdout
|
|
assert cmd.succeeded
|
|
|
|
def test_gitea_screenshots(host):
|
|
|
|
shots = (
|
|
('https://localhost:3081', None, 'gitea-main.png'),
|
|
('https://localhost:3081/opendev/system-config', None,
|
|
'gitea-project-system-config.png'),
|
|
('https://localhost:3081/opendev/disk-image-builder', None,
|
|
'gitea-project-dib.png'),
|
|
('https://localhost:3081/opendev/', None,
|
|
'gitea-org-opendev.png'),
|
|
('https://localhost:3081/explore/organizations', None,
|
|
'gitea-org-expore.png'),
|
|
)
|
|
|
|
take_screenshots(host, shots)
|
|
|