diff --git a/.zuul.yaml b/.zuul.yaml index a0f70c9223..e71781b1a7 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -109,6 +109,33 @@ vars: *jinja-init_vars files: *jinja-init_files +# Gitea-init jobs +- job: + name: system-config-build-image-gitea-init + description: Build a gitea-init image. + parent: system-config-build-image + vars: &gitea-init_vars + images: + - context: docker/gitea-init + target: gitea-init + repository: opendevorg/gitea-init + files: &gitea-init_files + - docker/gitea-init/.* + +- job: + name: system-config-upload-image-gitea-init + description: Build and upload a gitea-init image. + parent: system-config-upload-image + vars: *gitea-init_vars + files: *gitea-init_files + +- job: + name: system-config-promote-image-gitea-init + description: Promote a previously published gitea-init image to latest. + parent: system-config-promote-image + vars: *gitea-init_vars + files: *gitea-init_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. @@ -392,6 +419,7 @@ - system-config-run-nodepool - system-config-run-docker - system-config-build-image-jinja-init + - system-config-build-image-gitea-init gate: jobs: - tox-linters @@ -406,6 +434,8 @@ - system-config-run-nodepool - system-config-run-docker - system-config-upload-image-jinja-init + - system-config-upload-image-gitea-init promote: jobs: - system-config-promote-image-jinja-init + - system-config-promote-image-gitea-init diff --git a/docker/gitea-init/Dockerfile b/docker/gitea-init/Dockerfile new file mode 100644 index 0000000000..2534ed9ea7 --- /dev/null +++ b/docker/gitea-init/Dockerfile @@ -0,0 +1,19 @@ +# 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"] diff --git a/docker/gitea-init/entrypoint.sh b/docker/gitea-init/entrypoint.sh new file mode 100755 index 0000000000..b49da7c46e --- /dev/null +++ b/docker/gitea-init/entrypoint.sh @@ -0,0 +1,30 @@ +#!/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