These will be re-added in followup changes based on the new zuul-jobs roles. Change-Id: I0c0691afb180903c573cc1a9eb39590fa58e7ca6changes/84/631084/2
parent
b1c4a6d36a
commit
9e6a4d327e
@ -1,62 +0,0 @@
|
||||
# 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"]
|
@ -1,19 +0,0 @@
|
||||
# Copyright 2018 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 opendevorg/jinja-init
|
||||
|
||||
COPY entrypoint.sh /
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
@ -1,30 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright 2018 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.
|
||||
|
||||
# Create directories needed by gitea
|
||||
mkdir -p /data/git
|
||||
chown 1000:1000 /data/git
|
||||
|
||||
mkdir -p /data/gitea
|
||||
chown 1000:1000 /data/gitea
|
||||
|
||||
# This one is used by openssh and can remain root-owned
|
||||
mkdir -p /data/ssh
|
||||
|
||||
# Template the config file (which can also be root-owned)
|
||||
export JINJA_SRC_FILE=/config_src/app.ini.j2
|
||||
export JINJA_DEST_FILE=/conf/app.ini
|
||||
python /run.py
|
@ -1,115 +0,0 @@
|
||||
# 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"]
|
||||
# this comment is here to perform a test run of the job.....
|
@ -1,7 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Generate host keys if necessary
|
||||
/etc/s6/openssh/setup
|
||||
|
||||
exec "$@"
|
@ -1,35 +0,0 @@
|
||||
# Copyright 2018 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 python:slim as build
|
||||
|
||||
RUN apt-get update && apt-get -y install \
|
||||
git \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& mkdir -p /src/jinja-init
|
||||
|
||||
RUN git clone https://github.com/ObjectifLibre/jinja-init /src/jinja-init
|
||||
WORKDIR /src/jinja-init
|
||||
|
||||
RUN git checkout 8c13a44124a5a363519df787b1cd0abd1198b8df
|
||||
|
||||
FROM python:slim as jinja-init
|
||||
|
||||
RUN pip install jinja2
|
||||
|
||||
COPY --from=build /src/jinja-init/run.py /
|
||||
|
||||
ENTRYPOINT ["python", "/run.py"]
|
||||
# this comment is here to perform a test run of the job...
|
@ -1,3 +0,0 @@
|
||||
- hosts: all
|
||||
roles:
|
||||
- install-docker
|
@ -1,20 +0,0 @@
|
||||
- name: List tags
|
||||
uri:
|
||||
url: "https://hub.docker.com/v2/repositories/{{ image.repository }}/tags?page_size=1000"
|
||||
status_code: 200
|
||||
register: tags
|
||||
- name: Set cutoff timestamp to 24 hours ago
|
||||
command: "python3 -c \"import datetime; print((datetime.datetime.utcnow()-datetime.timedelta(days=1)).strftime('%Y-%m-%dT%H:%M:%fZ'))\""
|
||||
register: cutoff
|
||||
- name: Delete all change tags older than the cutoff
|
||||
no_log: true
|
||||
loop: "{{ tags.json.results }}"
|
||||
loop_control:
|
||||
loop_var: docker_tag
|
||||
when: docker_tag.last_updated < cutoff.stdout and docker_tag.name.startswith('change_')
|
||||
uri:
|
||||
url: "https://hub.docker.com/v2/repositories/{{ image.repository }}/tags/{{ docker_tag.name }}/"
|
||||
method: DELETE
|
||||
status_code: 204
|
||||
headers:
|
||||
Authorization: "JWT {{ jwt_token.json.token }}"
|
@ -1,39 +0,0 @@
|
||||
- name: Get dockerhub token
|
||||
no_log: true
|
||||
uri:
|
||||
url: "https://auth.docker.io/token?service=registry.docker.io&scope=repository:{{ image.repository }}:pull,push"
|
||||
user: "{{ credentials.username }}"
|
||||
password: "{{ credentials.password }}"
|
||||
force_basic_auth: true
|
||||
register: token
|
||||
- name: Get manifest
|
||||
no_log: true
|
||||
uri:
|
||||
url: "https://registry.hub.docker.com/v2/{{ image.repository }}/manifests/change_{{ zuul.change }}"
|
||||
status_code: 200
|
||||
headers:
|
||||
Accept: "application/vnd.docker.distribution.manifestv2+json"
|
||||
Authorization: "Bearer {{ token.json.token }}"
|
||||
return_content: true
|
||||
register: manifest
|
||||
- name: "Put manifest"
|
||||
no_log: true
|
||||
loop: "{{ image.tags | default(['latest']) }}"
|
||||
loop_control:
|
||||
loop_var: new_tag
|
||||
uri:
|
||||
url: "https://registry.hub.docker.com/v2/{{ image.repository }}/manifests/{{ new_tag }}"
|
||||
method: PUT
|
||||
status_code: 201
|
||||
body: "{{ manifest.content | string }}"
|
||||
headers:
|
||||
Content-Type: "application/vnd.docker.distribution.manifestv2+json"
|
||||
Authorization: "Bearer {{ token.json.token }}"
|
||||
- name: Delete the current change tag
|
||||
no_log: true
|
||||
uri:
|
||||
url: "https://hub.docker.com/v2/repositories/{{ image.repository }}/tags/change_{{ zuul.change }}/"
|
||||
method: DELETE
|
||||
status_code: 204
|
||||
headers:
|
||||
Authorization: "JWT {{ jwt_token.json.token }}"
|
@ -1,22 +0,0 @@
|
||||
- hosts: localhost
|
||||
tasks:
|
||||
# This is used by the delete tasks
|
||||
- name: Get dockerhub JWT token
|
||||
no_log: true
|
||||
uri:
|
||||
url: "https://hub.docker.com/v2/users/login/"
|
||||
body_format: json
|
||||
body:
|
||||
username: "{{ credentials.username }}"
|
||||
password: "{{ credentials.password }}"
|
||||
register: jwt_token
|
||||
- name: Promote image
|
||||
loop: "{{ images }}"
|
||||
loop_control:
|
||||
loop_var: image
|
||||
include_tasks: promote-retag.yaml
|
||||
- name: Delete obsolete tags
|
||||
loop: "{{ images }}"
|
||||
loop_control:
|
||||
loop_var: image
|
||||
include_tasks: promote-delete-tag.yaml
|
@ -1,15 +0,0 @@
|
||||
- hosts: all
|
||||
tasks:
|
||||
- name: Build a docker image
|
||||
command: >-
|
||||
docker build {{ item.path | default('.') }} -f Dockerfile
|
||||
{% if target | default(false) -%}
|
||||
--target {{ target }}
|
||||
{% endif -%}
|
||||
{% for build_arg in item.build_args | default([]) -%}
|
||||
--build-arg {{ build_arg }}
|
||||
{% endfor -%}
|
||||
--tag {{ item.repository }}:change_{{ zuul.change }}
|
||||
args:
|
||||
chdir: "{{ zuul.project.src_dir }}/{{ item.context }}"
|
||||
loop: "{{ images }}"
|
@ -1,11 +0,0 @@
|
||||
- hosts: all
|
||||
tasks:
|
||||
- name: Upload image to dockerhub
|
||||
when: credentials is defined
|
||||
block:
|
||||
- name: Log in to dockerhub
|
||||
command: "docker login -u {{ credentials.username }} -p {{ credentials.password }}"
|
||||
no_log: true
|
||||
- name: Upload to dockerhub
|
||||
command: "docker push {{ item.repository }}:change_{{ zuul.change }}"
|
||||
loop: "{{ images }}"
|
Loading…
Reference in new issue