Commit 05ed34a9 authored by Jérome Perrin's avatar Jérome Perrin

software/gitea: new software

parent fd1a89c8
[instance-profile]
filename = instance.cfg.in
md5sum = 4b25eab9f46785386ae962921017a18c
[gitea-config-file]
filename = gitea-config-file.cfg.in
md5sum = 7d796620ecdb2f2583de11185e163285
\ No newline at end of file
; see https://docs.gitea.io/en-us/config-cheat-sheet/ for additional documentation.
APP_NAME = Gitea Nexedi TODO
;RUN_USER = git
; Either "dev", "prod" or "test", default is "dev"
RUN_MODE = prod
# If you don’t want the web installer to be able to write the config file at all, it is also possible to make the config file read-only for the gitea user (owner/group root:root, mode 0660), and set INSTALL_LOCK = true. In that case all database configuration details must be set beforehand in the config file, as well as the SECRET_KEY and INTERNAL_TOKEN values. See the command line documentation for information on using gitea generate secret INTERNAL_TOKEN.
[repository]
ROOT = {{ gitea['repositories-dir'] }}
#ACCESS_CONTROL_ALLOW_ORIGIN =
#DEFAULT_REPO_UNITS = repo.code,repo.releases,repo.issues,repo.pulls,repo.wiki
[repository.local]
; Path for local repository copy. Defaults to `tmp/local-repo`
LOCAL_COPY_PATH = tmp/local-repo
; Path for local wiki copy. Defaults to `tmp/local-wiki`
LOCAL_WIKI_PATH = tmp/local-wiki
[cors]
# TODO
ENABLED=false
[server]
; The protocol the server listens on. One of 'http', 'https', 'unix' or 'fcgi'.
PROTOCOL = https
DOMAIN = {{ gitea['domain'] }}
;ROOT_URL = %(PROTOCOL)s://%(DOMAIN)s:%(HTTP_PORT)s/
ROOT_URL = %(PROTOCOL)s://%(DOMAIN)s/
HTTP_ADDR = [{{ gitea['ipv6'] }}]
HTTP_PORT = {{ gitea['port'] }}
DISABLE_SSH = true
CERT_FILE = {{ gitea['ssl-cert-file'] }}
KEY_FILE = {{ gitea['ssl-key-file'] }}
STATIC_ROOT_PATH = {{ gitea['static-root-path'] }}
ENABLE_GZIP = true
[database]
DB_TYPE = postgres
HOST = {{ postgresql['pgdata-directory'] }}
NAME = {{ postgresql['dbname'] }}
USER = {{ postgresql['superuser'] }}
PASSWD = {{ postgresql['password'] }}
[security]
; !!CHANGE THIS TO KEEP YOUR USER DATA SAFE!!
SECRET_KEY = !#@FDEWREWR&*(
; How long to remember that a user is logged in before requiring relogin (in days)
LOGIN_REMEMBER_DAYS = 7
COOKIE_USERNAME = gitea_awesome
COOKIE_REMEMBER_NAME = gitea_incredible
; Reverse proxy authentication header name of user name
REVERSE_PROXY_AUTHENTICATION_USER = X-WEBAUTH-USER
REVERSE_PROXY_AUTHENTICATION_EMAIL = X-WEBAUTH-EMAIL
; The minimum password length for new Users
MIN_PASSWORD_LENGTH = 6
; Set to true to allow users to import local server paths
IMPORT_LOCAL_PATHS = false
; Set to true to prevent all users (including admin) from creating custom git hooks
DISABLE_GIT_HOOKS = false
; Set to false to allow pushes to gitea repositories despite having an incomplete environment - NOT RECOMMENDED
ONLY_ALLOW_PUSH_IF_GITEA_ENVIRONMENT_SET = true
;Comma separated list of character classes required to pass minimum complexity.
;If left empty or no valid values are specified, the default values ("lower,upper,digit,spec") will be used.
;Use "off" to disable checking.
#PASSWORD_COMPLEXITY = lower,upper,digit,spec
# XXX easier while testing
PASSWORD_COMPLEXITY = off
; Password Hash algorithm, either "pbkdf2", "argon2", "scrypt" or "bcrypt"
PASSWORD_HASH_ALGO = pbkdf2
; Set false to allow JavaScript to read CSRF cookie
CSRF_COOKIE_HTTP_ONLY = true
[mailer]
ENABLED = false
; Buffer length of channel, keep it as it is if you don't know what it is.
SEND_BUFFER_LEN = 100
; Prefix displayed before subject in mail
SUBJECT_PREFIX =
; Mail server
; Gmail: smtp.gmail.com:587
; QQ: smtp.qq.com:465
; Note, if the port ends with "465", SMTPS will be used. Using STARTTLS on port 587 is recommended per RFC 6409. If the server supports STARTTLS it will always be used.
HOST =
; Disable HELO operation when hostnames are different.
DISABLE_HELO =
; Custom hostname for HELO operation, if no value is provided, one is retrieved from system.
HELO_HOSTNAME =
; Do not verify the certificate of the server. Only use this for self-signed certificates
SKIP_VERIFY =
; Use client certificate
USE_CERTIFICATE = false
CERT_FILE = custom/mailer/cert.pem
KEY_FILE = custom/mailer/key.pem
; Should SMTP connection use TLS
IS_TLS_ENABLED = false
; Mail from address, RFC 5322. This can be just an email address, or the `"Name" <email@example.com>` format
FROM =
; Mailer user name and password
USER =
; Use PASSWD = `your password` for quoting if you use special characters in the password.
PASSWD =
; Send mails as plain text
SEND_AS_PLAIN_TEXT = false
; Set Mailer Type (either SMTP, sendmail or dummy to just send to the log)
MAILER_TYPE = smtp
; Specify an alternative sendmail binary
SENDMAIL_PATH = sendmail
; Specify any extra sendmail arguments
SENDMAIL_ARGS =
; Timeout for Sendmail
SENDMAIL_TIMEOUT = 5m
[log]
ROOT_PATH = {{ gitea['logs-dir'] }}
; TODO
MODE = console,file
[git]
PATH = {{ gitea['git-bin'] }}
# XXX what is this ?
; Disables highlight of added and removed changes
DISABLE_DIFF_HIGHLIGHT = false
[i18n]
LANGS = en-US
NAMES = English
[U2F]
; NOTE: THE DEFAULT VALUES HERE WILL NEED TO BE CHANGED
; Two Factor authentication with security keys
; https://developers.yubico.com/U2F/App_ID.html
;APP_ID = http://localhost:3000/
; Comma seperated list of trusted facets
;TRUSTED_FACETS = http://localhost:3000/
[other]
SHOW_FOOTER_BRANDING = false
; Show version information about Gitea and Go in the footer
SHOW_FOOTER_VERSION = true
; Show template execution time in the footer
SHOW_FOOTER_TEMPLATE_LOAD_TIME = true
# Code generated by gowork-snapshot; DO NOT EDIT.
# list of go git repositories to fetch
[gowork.goinstall]
depends_gitfetch =
${go_github.com_golang_dep:recipe}
${go_github.com_gogs_gogs:recipe}
${go_github.com_go-gitea_gitea:recipe}
[go_github.com_golang_dep]
<= go-git-package
go.importpath = github.com/golang/dep
repository = https://github.com/golang/dep
revision = 1f7c19e5f5
[go_github.com_gogs_gogs]
<= go-git-package
go.importpath = github.com/gogs/gogs
repository = https://github.com/gogs/gogs.git
revision = v0.11.91
[go_github.com_go-gitea_gitea]
<= go-git-package
go.importpath = code.gitea.io/gitea
repository = https://github.com/go-gitea/gitea.git
#revision = v1.12.0-dev-320-g4a04740daf
revision = v1.12.0-dev
{
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Parameters to instantiate Gitea",
"additionalProperties": false,
"properties": {
"smtp-server": {
"description": "SMTP server used by gitea to send emails (in host:port format). Leaving this empty will disable email sending.",
"type": "string"
},
"smtp-username": {
"description": "Username to connect to SMTP server",
"type": "string"
},
"smtp-password": {
"description": "Password to connect to SMTP server",
"type": "string"
},
"smtp-verify-ssl": {
"description": "Verify SSL certificate of SMTP server",
"type": "boolean",
"default": true
},
"email-from-address": {
"description": "Email address used in From: header of emails",
"type": "string"
},
"email-from-name": {
"description": "Name used in From: header of emails",
"default": "Gitea",
"type": "string"
}
}
}
{
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Values returned by gitea instantiation",
"additionalProperties": false,
"properties": {
"url": {
"description": "Shared frontend for this gitea instance",
"pattern": "^https://",
"type": "string"
}
},
"type": "object"
}
[buildout]
parts =
postgresql
publish-connection-parameter
extends = {{ monitor_template }}
eggs-directory = {{ buildout['eggs-directory'] }}
develop-eggs-directory = {{ buildout['develop-eggs-directory'] }}
offline = true
[gitea]
ipv6 = ${instance-parameter:ipv6-random}
port = 8180
url = https://[${:ipv6}]:${:port}
# TODO: published frontend URL
domain = softinstXXXX.host.vifib.net
repositories-dir = ${directory:gitea-repositories-dir}
logs-dir = ${directory:gitea-logs-dir}
custom-dir = ${directory:gitea-custom-dir}
work-path-dir = ${directory:gitea-work-path-dir}
static-root-path = {{ gitea_static_root_path }}
pid-file = ${directory:var}/${:_buildout_section_name_}.pid
ssl-cert-file = ${gitea-certificate:cert-file}
ssl-key-file = ${gitea-certificate:key-file}
git-bin = {{ git_bin }}
recipe = slapos.cookbook:wrapper
command-line =
{{ gitea_bin }}
--config ${gitea-config-file:rendered}
--work-path ${:work-path-dir}
--custom-path ${:custom-dir}
--pid ${:pid-file}
web
wrapper-path = ${directory:service}/gitea
hash-files =
${gitea-config-file:rendered}
environment =
PATH={{ gitea_environment_path }}:/usr/bin/:/bin/
# bug : /install complain
# Could not test 'git' command: exec: "git": executable file not found in $PATH
# so we also add it in $PATH here
# TODO: don't hardcode /usr/bin/:/bin/
[gitea-certificate]
<= generate-certificate
[gitea-config-file]
<= config-file
context =
section gitea gitea
section postgresql postgresql
key slapparameter_dict slap-configuration:configuration
[postgresql]
recipe = slapos.cookbook:postgres
bin = {{ postgresql_bin }}
services = ${directory:service}
dbname = gitea
superuser = gitea-psql
password = insecure
pgdata-directory = ${directory:srv}/postgresql
# disable listening on ip
ipv4 =
ipv6 =
port = 5432
promises = ${postgresql-promise:name}
[postgresql-psql]
recipe = slapos.cookbook:wrapper
wrapper-path = ${directory:bin}/${:_buildout_section_name_}
command-line =
${postgresql:bin}/psql
-h ${postgresql:pgdata-directory}
-U ${postgresql:superuser}
-d ${postgresql:dbname}
[postgresql-promise]
<= monitor-promise-base
module = check_command_execute
name = promise-postgresql.py
config-command = ${postgresql-psql:wrapper-path} -c '\q'
[instance-parameter]
recipe = slapos.cookbook:slapconfiguration
computer = ${slap-connection:computer-id}
partition = ${slap-connection:partition-id}
url = ${slap-connection:server-url}
key = ${slap-connection:key-file}
cert = ${slap-connection:cert-file}
[slap-configuration]
# apache-frontend reads from from a part named [slap-configuration]
recipe = slapos.cookbook:slapconfiguration.serialised
computer = ${slap-connection:computer-id}
partition = ${slap-connection:partition-id}
url = ${slap-connection:server-url}
key = ${slap-connection:key-file}
cert = ${slap-connection:cert-file}
[directory]
recipe = slapos.cookbook:mkdirectory
home = ${buildout:directory}
etc = ${:home}/etc
var = ${:home}/var
srv = ${:home}/srv
service = ${:etc}/service
promise = ${:etc}/promise
gitea-repositories-dir = ${:srv}/repositories/
gitea-logs-dir = ${:var}/log/
gitea-work-path-dir = ${:srv}/gitea/
gitea-custom-dir = ${:srv}/gitea-custom/
# macros
[generate-certificate]
recipe = plone.recipe.command
command =
if [ ! -e ${:key-file} ]
then
{{ openssl_bin }} req -x509 -nodes -days 3650 \
-subj "/C=AA/ST=X/L=X/O=Dis/CN=${:common-name}" \
-newkey rsa:1024 -keyout ${:key-file} \
-out ${:cert-file}
fi
update-command = ${:command}
key-file = ${directory:etc}/${:_buildout_section_name_}.key
cert-file = ${directory:etc}/${:_buildout_section_name_}.crt
common-name = ${:_buildout_section_name_}
[config-file]
recipe = slapos.recipe.template:jinja2
template = {{ buildout['parts-directory'] }}/${:_buildout_section_name_}/${:_buildout_section_name_}.cfg.in
rendered = ${directory:etc}/${:_buildout_section_name_}.cfg
mode = 0644
extensions = jinja2.ext.do
[check-port-listening-promise]
recipe = slapos.cookbook:check_port_listening
path = ${directory:promise}/${:_buildout_section_name_}
[check-url-available-promise]
recipe = slapos.cookbook:check_url_available
path = ${directory:promise}/${:_buildout_section_name_}
dash_path = {{ dash_bin }}
curl_path = {{ curl_bin }}
[publish-connection-parameter]
recipe = slapos.cookbook:publish
url = ${gitea:url}
[buildout]
extends =
../../stack/slapos.cfg
../../stack/nodejs.cfg
../../stack/monitor/buildout.cfg
../../component/make/buildout.cfg
../../component/golang/buildout.cfg
../../component/openssl/buildout.cfg
../../component/curl/buildout.cfg
../../component/dash/buildout.cfg
../../component/postgresql/buildout.cfg
../../component/sqlite3/buildout.cfg
buildout.hash.cfg
gowork.cfg
versions = versions
parts =
slapos-cookbook
instance-profile
gowork
git
postgresql
gitea-config-file
; gitea
[nodejs]
<= nodejs-10.6.0
[yarn]
# this could become a component, but it needs to be invoked from nodejs explicitly,
# otherwise it uses system's nodejs
recipe = slapos.recipe.build:download-unpacked
url = https://github.com/yarnpkg/yarn/releases/download/v1.16.0/yarn-v1.16.0.tar.gz
md5sum = 46790033c23803387890f545e4040690
[gitea]
recipe = slapos.recipe.cmmi
url = https://github.com/go-gitea/gitea/releases/download/v1.11.5/gitea-src-1.11.5.tar.gz
md5sum = a589686f187822fdd16ed3e1f7a57b14
environment =
PATH=${nodejs:location}/bin/:${golang1.12:location}/bin/:%(PATH)s
configure-command = false
make-targets = build
[gowork]
install = github.com/go-gitea/gitea
#github.com/gogs/gogs
# use recent go
golang = ${golang1.12:location}
[gowork.goinstall]
command = :
depends =
${gitea-install:recipe}
[gitea-install]
<= gowork.goinstall
command = bash -c "
export PATH=${nodejs:location}/bin:$PATH && \
. ${gowork:env.sh} && \
cd ${:gitea-src-dir} && \
make build install"
update-command =
gitea-src-dir = ${gowork:directory}/src/${go_github.com_go-gitea_gitea:go.importpath}
gitea-bin = ${gowork:directory}/bin/gitea
[download-file-base]
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/${:filename}
mode = 0644
[gitea-config-file]
<= download-file-base
[instance-profile]
recipe = slapos.recipe.template:jinja2
template = ${:_profile_base_location_}/${:filename}
rendered = ${buildout:directory}/instance.cfg
mode = 0644
extensions = jinja2.ext.do
context =
section buildout buildout
key openssl_bin openssl-output:openssl
key curl_bin :curl-bin
key dash_bin :dash-bin
key gitea_bin :gitea-bin
key gitea_static_root_path :gitea-static-root-path
key git_bin :git-bin
key gitea_environment_path :gitea-environment-path
key postgresql_bin :postgresql-bin
key monitor_template :monitor-template
curl-bin = ${curl:location}/bin/curl
dash-bin = ${dash:location}/bin/dash
gitea-bin = ${gitea-install:gitea-bin}
gitea-static-root-path = ${gitea-install:gitea-src-dir}
git-bin = ${git:location}/bin/git
postgresql-bin = ${postgresql10:location}/bin
monitor-template = ${monitor2-template:rendered}
gitea-environment-path = ${git:location}/bin/
[versions]
slapos.recipe.template = 4.2
inotifyx = 0.2.2
{
"name": "Gitea",
"description": "Gitea",
"serialisation": "json-in-xml",
"software-type": {
"default": {
"title": "Default",
"description": "Gitea",
"request": "instance-input-schema.json",
"response": "instance-output-schema.json",
"index": 0
}
}
}
Tests for gitea software release
##############################################################################
#
# Copyright (c) 2018 Nexedi SA and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from setuptools import setup, find_packages
version = '0.0.1.dev0'
name = 'slapos.test.gitea'
long_description = open("README.md").read()
setup(
name=name,
version=version,
description="Test for SlapOS' gitea",
long_description=long_description,
long_description_content_type='text/markdown',
maintainer="Nexedi",
maintainer_email="info@nexedi.com",
url="https://lab.nexedi.com/nexedi/slapos",
packages=find_packages(),
install_requires=[
'slapos.core',
'slapos.libnetworkcache',
'erp5.util',
'requests',
'supervisor',
'psutil',
],
zip_safe=True,
test_suite='test',
)
##############################################################################
#
# Copyright (c) 2019 Nexedi SA and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import os
import textwrap
import logging
import tempfile
import time
import requests
from slapos.testing.testcase import makeModuleSetUpAndTestCaseClass
setUpModule, SlapOSInstanceTestCase = makeModuleSetUpAndTestCaseClass(
os.path.abspath(
os.path.join(os.path.dirname(__file__), '..', 'software.cfg')))
class GiteaTestCase(SlapOSInstanceTestCase):
"""Base test case for gitea.
Since the instances takes timte to start and stop,
we increate as lot the number of retries.
"""
report_max_retry = 1
instance_max_retry = 1
class TestGitea(GiteaTestCase):
def setUp(self):
self.gitea_url = self.computer_partition.getConnectionParameterDict(
)['url']
def test_gitea_available(self):
import pdb; pdb.set_trace()
resp = requests.get(self.gitea_url, verify=False)
self.assertEqual(requests.codes.ok, resp.status_code)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment