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 @@ <div class="ui container" id="navbar"> <div class="item brand" style="justify-content: space-between;"> - <a href="{{AppSubUrl}}/" data-content="{{if .IsSigned}}{{.i18n.Tr "dashboard"}}{{else}}{{.i18n.Tr "home"}}{{end}}"> - <img class="ui mini image" width="30" height="30" src="{{AssetUrlPrefix}}/img/logo.svg"> + <a href="{{AppSubUrl}}/" aria-label="{{if .IsSigned}}{{.i18n.Tr "dashboard"}}{{else}}{{.i18n.Tr "home"}}{{end}}"> + <img class="ui mini image" width="30" height="30" src="{{AssetUrlPrefix}}/img/logo.svg" alt="{{.i18n.Tr "logo"}}" aria-hidden="true"> </a> <div class="ui basic icon button mobile-only" id="navbar-expand-toggle"> <i class="sidebar icon"></i> @@ -77,7 +77,7 @@ <a class="stopwatch-link df ac" href="{{.ActiveStopwatch.IssueLink}}"> {{svg "octicon-issue-opened"}} <span class="stopwatch-issue">{{.ActiveStopwatch.RepoSlug}}#{{.ActiveStopwatch.IssueIndex}}</span> - <span class="ui label blue stopwatch-time my-0 mx-4" data-seconds="{{.ActiveStopwatch.Seconds}}"> + <span class="ui primary label stopwatch-time my-0 mx-4" data-seconds="{{.ActiveStopwatch.Seconds}}"> {{if .ActiveStopwatch}}{{Sec2Time .ActiveStopwatch.Seconds}}{{end}} </span> </a> diff --git a/docker/gitea/custom/templates/repo/header.tmpl b/docker/gitea/custom/templates/repo/header.tmpl index 12f36a465b..10a8be6a59 100644 --- a/docker/gitea/custom/templates/repo/header.tmpl +++ b/docker/gitea/custom/templates/repo/header.tmpl @@ -13,6 +13,7 @@ <a href="{{.Owner.HomeLink}}">{{.Owner.Name}}</a> <div class="mx-2">/</div> <a href="{{$.RepoLink}}">{{.Name}}</a> + <a href="{{$.RepoLink}}.rss"><i class="ui grey icon tooltip ml-3" data-content="{{$.i18n.Tr "rss_feed"}}" data-position="top center">{{svg "octicon-rss" 18}}</i></a> <div class="labels df ac fw"> {{if .IsTemplate}} {{if .IsPrivate}} @@ -36,7 +37,10 @@ {{end}} </div> </div> - {{if .IsMirror}}<div class="fork-flag">{{$.i18n.Tr "repo.mirror_from"}} <a target="_blank" rel="noopener noreferrer" href="{{if .SanitizedOriginalURL}}{{.SanitizedOriginalURL}}{{else}}{{(MirrorRemoteAddress $.Mirror).Address}}{{end}}">{{if .SanitizedOriginalURL}}{{.SanitizedOriginalURL}}{{else}}{{(MirrorRemoteAddress $.Mirror).Address}}{{end}}</a></div>{{end}} + {{if $.IsPullMirror}} + {{$address := MirrorRemoteAddress $.Context . $.Mirror.GetRemoteName}} + <div class="fork-flag">{{$.i18n.Tr "repo.mirror_from"}} <a target="_blank" rel="noopener noreferrer" href="{{$address.Address}}">{{$address.Address}}</a></div> + {{end}} {{if .IsFork}}<div class="fork-flag">{{$.i18n.Tr "repo.forked_from"}} <a href="{{.BaseRepo.Link}}">{{.BaseRepo.FullName}}</a></div>{{end}} {{if .IsGenerated}}<div class="fork-flag">{{$.i18n.Tr "repo.generated_from"}} <a href="{{.TemplateRepo.Link}}">{{.TemplateRepo.FullName}}</a></div>{{end}} </div> @@ -159,7 +163,7 @@ <a class="{{if .PageIsIssueList}}active{{end}} item" href="{{.RepoLink}}/issues"> {{svg "octicon-issue-opened"}} {{.i18n.Tr "repo.issues"}} {{if .Repository.NumOpenIssues}} - <span class="ui blue small label">{{CountFmt .Repository.NumOpenIssues}}</span> + <span class="ui primary small label">{{CountFmt .Repository.NumOpenIssues}}</span> {{end}} </a> {{end}} @@ -174,7 +178,7 @@ <a class="{{if .PageIsPullList}}active{{end}} item" href="{{.RepoLink}}/pulls"> {{svg "octicon-git-pull-request"}} {{.i18n.Tr "repo.pulls"}} {{if .Repository.NumOpenPulls}} - <span class="ui blue small label">{{CountFmt .Repository.NumOpenPulls}}</span> + <span class="ui primary small label">{{CountFmt .Repository.NumOpenPulls}}</span> {{end}} </a> {{end}} @@ -184,11 +188,17 @@ {{svg "octicon-git-pull-request"}} Proposed changes </a> + {{if .Permission.CanRead $.UnitTypePackages}} + <a href="{{.RepoLink}}/packages" class="{{ if .IsPackagesPage }}active{{end}} item"> + {{svg "octicon-package"}} {{.i18n.Tr "packages.title"}} + </a> + {{end}} + {{ if and (not .UnitProjectsGlobalDisabled) (.Permission.CanRead $.UnitTypeProjects)}} <a href="{{.RepoLink}}/projects" class="{{ if .IsProjectsPage }}active{{end}} item"> {{svg "octicon-project"}} {{.i18n.Tr "repo.project_board"}} {{if .Repository.NumOpenProjects}} - <span class="ui blue small label">{{CountFmt .Repository.NumOpenProjects}}</span> + <span class="ui primary small label">{{CountFmt .Repository.NumOpenProjects}}</span> {{end}} </a> {{ end }} @@ -198,7 +208,7 @@ <a class="{{if .PageIsReleaseList}}active{{end}} item" href="{{.RepoLink}}/releases"> {{svg "octicon-tag"}} {{.i18n.Tr "repo.releases"}} {{if .NumReleases}} - <span class="ui blue small label">{{CountFmt .NumReleases}}</span> + <span class="ui primary small label">{{CountFmt .NumReleases}}</span> {{end}} </a> {{end}} diff --git a/playbooks/roles/gitea/templates/app.ini.j2 b/playbooks/roles/gitea/templates/app.ini.j2 index 2358f48339..7cbbd3417f 100644 --- a/playbooks/roles/gitea/templates/app.ini.j2 +++ b/playbooks/roles/gitea/templates/app.ini.j2 @@ -40,6 +40,9 @@ DISABLE_STARS = true ; to true again. DISABLE_PARTIAL_CLONE = false +[packages] +ENABLED = false + [indexer] ISSUE_INDEXER_PATH = /data/gitea/indexers/issues.bleve REPO_INDEXER_ENABLED = true diff --git a/testinfra/test_gitea.py b/testinfra/test_gitea.py index 594905349d..9449a8c300 100644 --- a/testinfra/test_gitea.py +++ b/testinfra/test_gitea.py @@ -85,6 +85,14 @@ def test_project_clone(host): '/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( @@ -94,6 +102,14 @@ def test_partial_project_clone(host): '/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):