diff --git a/.zuul.yaml b/.zuul.yaml index e71781b1a7..0956fe204f 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -136,6 +136,36 @@ vars: *gitea-init_vars files: *gitea-init_files +# Gitea jobs +- job: + name: system-config-build-image-gitea + description: Build a gitea image. + parent: system-config-build-image + vars: &gitea_vars + images: + - context: docker/gitea + target: gitea + repository: opendevorg/gitea + - context: docker/gitea + target: gitea-openssh + repository: opendevorg/gitea-openssh + files: &gitea_files + - docker/gitea/.* + +- job: + name: system-config-upload-image-gitea + description: Build and upload a gitea image. + parent: system-config-upload-image + vars: *gitea_vars + files: *gitea_files + +- job: + name: system-config-promote-image-gitea + description: Promote a previously published gitea image to latest. + parent: system-config-promote-image + vars: *gitea_vars + files: *gitea_files + # Role integration jobs. These test the top-level generic roles/* # under Zuul. The range of platforms should be the same as those for # openstack-zuul-jobs. @@ -420,6 +450,7 @@ - system-config-run-docker - system-config-build-image-jinja-init - system-config-build-image-gitea-init + - system-config-build-image-gitea gate: jobs: - tox-linters @@ -435,7 +466,9 @@ - system-config-run-docker - system-config-upload-image-jinja-init - system-config-upload-image-gitea-init + - system-config-upload-image-gitea promote: jobs: - system-config-promote-image-jinja-init - system-config-promote-image-gitea-init + - system-config-promote-image-gitea diff --git a/docker/gitea/Dockerfile b/docker/gitea/Dockerfile new file mode 100644 index 0000000000..d85f8ae9f9 --- /dev/null +++ b/docker/gitea/Dockerfile @@ -0,0 +1,114 @@ +# Copyright (c) 2018 Red Hat, Inc. +# Copyright (c) 2016 The Gitea Authors +# Copyright (c) 2015 The Gogs Authors +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +################################### +#Build stage +FROM golang:1.11-stretch AS build-env + +LABEL maintainer="infra-root@openstack.org" + +ARG GITEA_VERSION=v1.6.0 +ENV TAGS "bindata $TAGS" + +#Build deps +RUN apt-get update && apt-get -y install build-essential git \ + && mkdir -p ${GOPATH}/src/code.gitea.io/gitea + +#Setup repo +RUN git clone https://github.com/go-gitea/gitea ${GOPATH}/src/code.gitea.io/gitea +WORKDIR ${GOPATH}/src/code.gitea.io/gitea + +#Checkout version if set +RUN if [ -n "${GITEA_VERSION}" ]; then git checkout "${GITEA_VERSION}"; fi \ + && make clean generate build + +################################### +# Basic system setup common to all containers in our pod + +FROM debian:testing as base + +RUN apt-get update && apt-get -y install \ + bash \ + ca-certificates \ + curl \ + gettext \ + git \ + openssh-client \ + tzdata \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +RUN addgroup --system --gid 1000 git \ + && adduser \ + --system --no-create-home --disabled-login \ + --home /data/git \ + --shell /bin/bash \ + --uid 1000 \ + --gid 1000 \ + git \ + && echo "git:$(dd if=/dev/urandom bs=24 count=1 status=none | base64)" | chpasswd \ + && mkdir /custom + +# Copy the /etc config files and entrypoint script +COPY --from=build-env /go/src/code.gitea.io/gitea/docker / + +# Copy the app +COPY --from=build-env /go/src/code.gitea.io/gitea/gitea /app/gitea/gitea +RUN ln -s /app/gitea/gitea /usr/local/bin/gitea + +# Copy our custom templates +COPY custom/ /custom/ + +ENV GITEA_CUSTOM /custom + +################################### +# The gitea image +FROM base as gitea + +RUN apt-get update && apt-get -y install pandoc \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +EXPOSE 3000 +ENV USER git +VOLUME ["/data"] +ENTRYPOINT ["/usr/bin/entrypoint"] +CMD ["/app/gitea/gitea", "web"] +USER 1000:1000 + +################################### +# The openssh server image +FROM base as gitea-openssh + +RUN apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confold" \ + install openssh-server \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* \ + && mkdir /run/sshd + +COPY sshd-entrypoint.sh /usr/bin/entrypoint + +EXPOSE 22 +VOLUME ["/data"] +ENTRYPOINT ["/usr/bin/entrypoint"] +CMD ["/usr/sbin/sshd", "-D"] diff --git a/docker/gitea/custom/templates/home.tmpl b/docker/gitea/custom/templates/home.tmpl new file mode 100644 index 0000000000..49e0bdbd8b --- /dev/null +++ b/docker/gitea/custom/templates/home.tmpl @@ -0,0 +1,78 @@ +{{template "base/head" .}} +
OpenDev is a space for collaborative Open Source software development.
+OpenDev’s mission is to provide project hosting, continuous integration tooling, + and virtual collaboration spaces for Open Source software projects. OpenDev is + itself self hosted on this set of tools including Code Review (Gerrit), Continuous + Integration (Zuul), Etherpad, Wiki (mediawiki), Code Browsing (gitea) and so on. + This means that OpenDev itself is run like an open source project, you + can join us and help run the system. Additionally all of the services we run are + open source software themselves.
+ +We are still very early in the process of building this out. We have DNS servers + and this website running to start.
+Most of the services we plan to run will be inherited and rebranded from the + existing community run OpenStack Infrastructure. This means that we do already + have services running, but until we transition them into OpenDev they may say + “OpenStack” across the top or in their URLs.
+ +There are far too many things to capture here so we’ll go after the highlights instead:
+As mentioned previously the OpenDev services themselves are open source software managed on top of Opendev itself. This means that in addition to using OpenDev to host your software development activities you can help us run OpenDev with all of the same tools.
+If you use the system and find it useful, we’d love to have your help running it as well.
+ +It is more than that. We want to make this toolset available to others that would find it helpful. OpenStack would become one of the OpenDev tenants, but other tenants like Zuul or $gizmo would be just as important.
+ +Yes! However, as noted above it is still early days yet and the early experience might be a bit bumpy. Certain things may still say “OpenStack” on them as we figure out the transition. And while any moves should come with appropriate redirects, we may have some inadvertent misses.
+ +Currently all of our test resources are Linux based. Adding additional platforms would likely require someone to help us get that running, but Zuul will support systems with ansible connection plugins. Talk to us!
+ +No. We’ll continue to communicate changes as they happen. We’ll also do our best to make this as smooth a transition as possible. If we run into situations that force us to break something we’ll be sure to let you know at that point.
+ +No.
+ +We’ve got a fair bit of experience with the existing toolset and adding new tools for which we’ve already got an answer is currently out of scope. We think the existing tools (like Gerrit) work well, and should only get better as we update them. The system is able to scale because we do not need multiple implementations of different software that solve similar problems.
+ +These will be updated when moved to their new OpenDev locations
+