From 7f06a0ce2e727b3b9f322933d08707cd7a0a4293 Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Wed, 22 Jun 2022 09:54:40 -0700 Subject: [PATCH] Update to Gitea 1.17 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 --- docker/gitea/Dockerfile | 7 ++++--- .../custom/templates/base/head_navbar.tmpl | 6 +++--- .../gitea/custom/templates/repo/header.tmpl | 20 ++++++++++++++----- playbooks/roles/gitea/templates/app.ini.j2 | 3 +++ testinfra/test_gitea.py | 16 +++++++++++++++ 5 files changed, 41 insertions(+), 11 deletions(-) diff --git a/docker/gitea/Dockerfile b/docker/gitea/Dockerfile index 6a4870943b..6d2e02c066 100644 --- a/docker/gitea/Dockerfile +++ b/docker/gitea/Dockerfile @@ -27,13 +27,13 @@ FROM docker.io/library/golang:1.18-bullseye AS build-env LABEL maintainer="infra-root@openstack.org" -ARG GITEA_VERSION="v1.16.9" +ARG GITEA_VERSION="v1.17.1" ENV TAGS "bindata $TAGS" #Build deps RUN apt-get update && apt-get -y install build-essential git apt-transport-https curl gnupg2 \ && curl -sS https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - \ - && echo "deb https://deb.nodesource.com/node_14.x bullseye main" | tee /etc/apt/sources.list.d/nodesource.list \ + && echo "deb https://deb.nodesource.com/node_16.x bullseye main" | tee /etc/apt/sources.list.d/nodesource.list \ && apt-get update \ && apt-get -q --option "Dpkg::Options::=--force-confold" --assume-yes install nodejs \ && mkdir -p ${GOPATH}/src/code.gitea.io/gitea @@ -92,8 +92,9 @@ COPY --from=build-env /go/src/code.gitea.io/gitea/docker/root / COPY --from=build-env /go/src/code.gitea.io/gitea/gitea /app/gitea/gitea COPY --from=build-env /go/src/code.gitea.io/gitea/environment-to-ini /usr/local/bin/environment-to-ini -# Copy our custom templates +# Copy our custom templates and some additional image files COPY custom/ /custom/ +# Copy our opendev logo contents to the custom location RUN --mount=type=bind,from=opendevorg/assets,target=/tmp/assets cp /tmp/assets/* /custom/public/img/ ENV GITEA_CUSTOM /custom diff --git a/docker/gitea/custom/templates/base/head_navbar.tmpl b/docker/gitea/custom/templates/base/head_navbar.tmpl index a26d6f9e56..e13ee6bfc2 100644 --- a/docker/gitea/custom/templates/base/head_navbar.tmpl +++ b/docker/gitea/custom/templates/base/head_navbar.tmpl @@ -1,7 +1,7 @@