Build a gerrit image
The gerrit source dir needs three plugins cloned into the plugins dir and also a few files updated. Depends-On: https://review.openstack.org/631007 Change-Id: I56037137d43ee1cea0a4c17e48d09102e1599ddc
This commit is contained in:
parent
d1a2dfa6f5
commit
b1c4a6d36a
59
.zuul.yaml
59
.zuul.yaml
@ -223,6 +223,62 @@
|
|||||||
vars: *gitea-init_vars
|
vars: *gitea-init_vars
|
||||||
files: *gitea-init_files
|
files: *gitea-init_files
|
||||||
|
|
||||||
|
- job:
|
||||||
|
name: system-config-build-image-gerrit
|
||||||
|
description: Build a gerrit image
|
||||||
|
parent: system-config-build-image
|
||||||
|
pre-run: playbooks/zuul/gerrit/repos.yaml
|
||||||
|
required-projects: &gerrit_projects
|
||||||
|
- name: gerrit.googlesource.com/gerrit
|
||||||
|
override-checkout: stable-2.15
|
||||||
|
- name: gerrit.googlesource.com/plugins/commit-message-length-validator
|
||||||
|
override-checkout: stable-2.15
|
||||||
|
- name: gerrit.googlesource.com/plugins/download-commands
|
||||||
|
override-checkout: stable-2.15
|
||||||
|
- name: gerrit.googlesource.com/plugins/hooks
|
||||||
|
override-checkout: stable-2.15
|
||||||
|
- name: gerrit.googlesource.com/plugins/its-base
|
||||||
|
override-checkout: stable-2.15
|
||||||
|
- name: gerrit.googlesource.com/plugins/its-storyboard
|
||||||
|
override-checkout: stable-2.15
|
||||||
|
- name: gerrit.googlesource.com/plugins/javamelody
|
||||||
|
override-checkout: stable-2.15
|
||||||
|
- name: gerrit.googlesource.com/plugins/replication
|
||||||
|
override-checkout: stable-2.15
|
||||||
|
- name: gerrit.googlesource.com/plugins/reviewnotes
|
||||||
|
override-checkout: stable-2.15
|
||||||
|
- name: gerrit.googlesource.com/plugins/singleusergroup
|
||||||
|
override-checkout: stable-2.15
|
||||||
|
vars: &gerrit_vars
|
||||||
|
images:
|
||||||
|
- context: docker/gerrit
|
||||||
|
target: gerrit
|
||||||
|
repository: opendevorg/gerrit
|
||||||
|
path: /home/zuul/src/gerrit.googlesource.com/gerrit
|
||||||
|
tags:
|
||||||
|
- 2.15
|
||||||
|
build_args:
|
||||||
|
- BAZEL_OPTS="--local_resources=4096,2.0,1.0"
|
||||||
|
files: &gerrit_files
|
||||||
|
- docker/gerrit/.*
|
||||||
|
- playbooks/zuul/gerrit/.*
|
||||||
|
|
||||||
|
- job:
|
||||||
|
name: system-config-upload-image-gerrit
|
||||||
|
description: Build and upload a gerrit image
|
||||||
|
parent: system-config-upload-image
|
||||||
|
pre-run: playbooks/zuul/gerrit/repos.yaml
|
||||||
|
required-projects: *gerrit_projects
|
||||||
|
vars: *gerrit_vars
|
||||||
|
files: *gerrit_files
|
||||||
|
|
||||||
|
- job:
|
||||||
|
name: system-config-promote-image-gerrit
|
||||||
|
description: Promote a previously published gerrit image to latest
|
||||||
|
parent: system-config-promote-image
|
||||||
|
vars: *gerrit_vars
|
||||||
|
files: *gerrit_files
|
||||||
|
|
||||||
# Role integration jobs. These test the top-level generic roles/*
|
# Role integration jobs. These test the top-level generic roles/*
|
||||||
# under Zuul. The range of platforms should be the same as those for
|
# under Zuul. The range of platforms should be the same as those for
|
||||||
# openstack-zuul-jobs.
|
# openstack-zuul-jobs.
|
||||||
@ -508,6 +564,7 @@
|
|||||||
- system-config-build-image-gitea
|
- system-config-build-image-gitea
|
||||||
- system-config-build-image-jinja-init
|
- system-config-build-image-jinja-init
|
||||||
- system-config-build-image-gitea-init
|
- system-config-build-image-gitea-init
|
||||||
|
- system-config-build-image-gerrit
|
||||||
gate:
|
gate:
|
||||||
jobs:
|
jobs:
|
||||||
- tox-linters
|
- tox-linters
|
||||||
@ -524,8 +581,10 @@
|
|||||||
- system-config-upload-image-gitea
|
- system-config-upload-image-gitea
|
||||||
- system-config-upload-image-jinja-init
|
- system-config-upload-image-jinja-init
|
||||||
- system-config-upload-image-gitea-init
|
- system-config-upload-image-gitea-init
|
||||||
|
- system-config-upload-image-gerrit
|
||||||
promote:
|
promote:
|
||||||
jobs:
|
jobs:
|
||||||
- system-config-promote-image-gitea
|
- system-config-promote-image-gitea
|
||||||
- system-config-promote-image-jinja-init
|
- system-config-promote-image-jinja-init
|
||||||
- system-config-promote-image-gitea-init
|
- system-config-promote-image-gitea-init
|
||||||
|
- system-config-promote-image-gerrit
|
||||||
|
62
docker/gerrit/Dockerfile
Normal file
62
docker/gerrit/Dockerfile
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
# Copyright (c) 2019 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 openjdk:8 as builder
|
||||||
|
|
||||||
|
RUN groupadd builder && \
|
||||||
|
useradd builder --home-dir /usr/src --create-home -g builder
|
||||||
|
RUN \
|
||||||
|
echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | tee /etc/apt/sources.list.d/bazel.list \
|
||||||
|
&& curl -sL https://bazel.build/bazel-release.pub.gpg | apt-key add - \
|
||||||
|
&& curl -sL https://deb.nodesource.com/setup_8.x | bash - \
|
||||||
|
&& apt-get update \
|
||||||
|
&& apt-get install -y bazel nodejs build-essential zip unzip python maven
|
||||||
|
|
||||||
|
COPY . /usr/src
|
||||||
|
RUN chown -R builder /usr/src
|
||||||
|
|
||||||
|
USER builder
|
||||||
|
ARG BAZEL_OPTS
|
||||||
|
RUN cd /usr/src && bazel build release ${BAZEL_OPTS} && mv bazel-bin/release.war gerrit.war
|
||||||
|
|
||||||
|
FROM openjdk:8
|
||||||
|
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y dumb-init \
|
||||||
|
&& apt-get clean \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
RUN addgroup gerrit --system \
|
||||||
|
&& adduser \
|
||||||
|
--system \
|
||||||
|
--home /var/gerrit \
|
||||||
|
--shell /bin/bash \
|
||||||
|
--ingroup gerrit \
|
||||||
|
gerrit
|
||||||
|
|
||||||
|
USER gerrit
|
||||||
|
RUN mkdir /var/gerrit/bin
|
||||||
|
COPY --from=builder /usr/src/gerrit.war /var/gerrit/bin/gerrit.war
|
||||||
|
|
||||||
|
# Allow incoming traffic
|
||||||
|
EXPOSE 29418 8080
|
||||||
|
|
||||||
|
VOLUME /var/gerrit/git /var/gerrit/index /var/gerrit/cache /var/gerrit/db /etc/gerrit /var/log/gerrit
|
||||||
|
|
||||||
|
RUN ln -s /var/log/gerrit /var/gerrit/logs && \
|
||||||
|
ln -s /etc/gerrit /var/gerrit/config
|
||||||
|
|
||||||
|
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
||||||
|
CMD ["/usr/bin/java", "-jar", "/var/gerrit/bin/gerrit.war"]
|
33
playbooks/zuul/gerrit/repos.yaml
Normal file
33
playbooks/zuul/gerrit/repos.yaml
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
- hosts: all
|
||||||
|
tasks:
|
||||||
|
- name: Move plugin repos into gerrit tree
|
||||||
|
command: "mv -f {{ item }} ../gerrit/plugins"
|
||||||
|
args:
|
||||||
|
chdir: /home/zuul/src/gerrit.googlesource.com/plugins
|
||||||
|
loop:
|
||||||
|
- commit-message-length-validator
|
||||||
|
- download-commands
|
||||||
|
- hooks
|
||||||
|
- its-storyboard
|
||||||
|
- its-base
|
||||||
|
- javamelody
|
||||||
|
- replication
|
||||||
|
- reviewnotes
|
||||||
|
- singleusergroup
|
||||||
|
|
||||||
|
- name: Configure plugin bazel file
|
||||||
|
lineinfile:
|
||||||
|
path: /home/zuul/src/gerrit.googlesource.com/gerrit/tools/bzl/plugins.bzl
|
||||||
|
insertafter: "# Add custom core plugins here"
|
||||||
|
line: '"{{ item }}",'
|
||||||
|
loop:
|
||||||
|
- its-storyboard
|
||||||
|
- its-base
|
||||||
|
- javamelody
|
||||||
|
|
||||||
|
- name: Configure javamelody external plugin deps
|
||||||
|
file:
|
||||||
|
state: link
|
||||||
|
force: yes
|
||||||
|
src: javamelody/external_plugin_deps.bzl
|
||||||
|
path: /home/zuul/src/gerrit.googlesource.com/gerrit/plugins/external_plugin_deps.bzl
|
Loading…
x
Reference in New Issue
Block a user