Add gitea image jobs

Add jobs to build, upload, and promote a gitea image to Docker Hub.
This produces two images (gitea and openssh) from a single Dockerfile
via a multi-stage build.

Change-Id: I8e6136787f75cd69b881b7ac715418c86d356872
This commit is contained in:
James E. Blair 2019-01-15 14:36:38 -08:00
parent de9e62975a
commit bfbf0e347b
4 changed files with 232 additions and 0 deletions

View File

@ -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

114
docker/gitea/Dockerfile Normal file
View File

@ -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"]

View File

@ -0,0 +1,78 @@
{{template "base/head" .}}
<div class="home">
<div class="ui stackable middle very relaxed page grid">
<div class="sixteen wide center aligned centered column">
<div class="hero" id="opendev">
<h1 class="ui icon header title">
OpenDev
</h1>
<h2>Free Software Needs Free Tools</h2>
</div>
</div>
</div>
<div class="ui stackable middle very relaxed page grid">
<div class="sixteen wide left aligned centered column">
<p>OpenDev is a space for collaborative Open Source software development.</p>
<p>OpenDevs 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.</p>
<h1 id="current-status">Current Status</h1>
<p>We are still very early in the process of building this out. We have DNS servers
and this website running to start.</p>
<p>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.</p>
<h1 id="changes-we-plan-to-make">Changes we plan to make</h1>
<p>There are far too many things to capture here so well go after the highlights instead:</p>
<ul>
<li>Move existing services like Gerrit and Etherpad under the opendev.org domain. Remove OpenStack branding as necessary.</li>
<li>For the code review and CI toolchain treat the services as multitenant. This will likely involve moving code repos around.
<ul>
<li>Well need to build better project renaming and provisioning tools.</li>
</ul></li>
</ul>
<h1 id="join-us">Join Us</h1>
<p>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.</p>
<p>If you use the system and find it useful, wed love to have your help running it as well.</p>
<h1 id="faq">FAQ</h1>
<h2 id="isnt-this-just-openstack-infrastructure-rebranded">Isnt this just OpenStack Infrastructure rebranded?</h2>
<p>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.</p>
<h2 id="can-i-host-my-project-on-opendev">Can I host my project on OpenDev?</h2>
<p>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.</p>
<h2 id="can-i-run-tests-on-windows-or-osx-machines">Can I run tests on Windows or OSX machines?</h2>
<p>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!</p>
<h2 id="i-am-an-existing-openstack-infra-user-do-i-need-to-do-anything">I am an existing OpenStack Infra user do I need to do anything?</h2>
<p>No. Well continue to communicate changes as they happen. Well also do our best to make this as smooth a transition as possible. If we run into situations that force us to break something well be sure to let you know at that point.</p>
<h2 id="is-a-cla-required-for-hosted-repos">Is a CLA required for hosted repos?</h2>
<p>No.</p>
<h2 id="what-if-i-dont-like-gerrit-and-would-prefer-insert-tool-here">What if I dont like Gerrit and would prefer (insert tool here)?</h2>
<p>Weve got a fair bit of experience with the existing toolset and adding new tools for which weve 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.</p>
<h1 id="contact-info">Contact info</h1>
<p>These will be updated when moved to their new OpenDev locations</p>
<ul>
<li>Mailing list: openstack-infra@lists.openstack.org</li>
<li>IRC #openstack-infra on Freenode</li>
</ul>
</div>
</div>
</div>
{{template "base/footer" .}}

View File

@ -0,0 +1,7 @@
#!/bin/bash
set -e
# Generate host keys if necessary
/etc/s6/openssh/setup
exec "$@"