// file : mod/options.cli -*- C++ -*-
// license : MIT; see accompanying LICENSE file
include ;
include ; // repository_location
include ;
include ;
include ;
namespace brep
{
// Web handler configuration options.
//
namespace options
{
// Option groups.
//
class handler
{
string email
{
"",
"Repository email. This email is used for the \cb{From:} header in
emails send by \cb{brep} (for example, build failure notifications)."
}
string host
{
"",
"Repository host. It specifies the scheme and the host address (but
not the root path; see \cb{root} below) that will be used whenever
\cb{brep} needs to construct an absolute URL to one of its locations
(for example, a link to a build log that is being send via email)."
}
dir_path root = "/"
{
"",
"Repository root. That is, this is the part of the URL between the
host name and the start of the repository. For example, root value
'\cb{/pkg}' means the repository URL is \cb{http://example.org/pkg/}.
Specify '\cb{/}' to use the web server root
(\cb{http://example.org/})."
}
string tenant-name = "tenant"
{
"",
"Name to call the tenant values on web pages. If not specified, then
\cb{tenant} is used."
}
uint16_t verbosity = 0
{
"",
"Trace verbosity level. Level 0 disables tracing, which is also the
default."
}
};
class openssl_options
{
path openssl = "openssl"
{
"",
"The openssl program to be used for crypto operations. You can also
specify additional options that should be passed to the openssl
program with \cb{openssl-option}. If the openssl program is not
explicitly specified, then \cb{brep} will use \cb{openssl} by
default."
}
strings openssl-option
{
"",
"Additional option to be passed to the openssl program (see
\cb{openssl} for details). Repeat this option to specify multiple
openssl options."
}
strings openssl-envvar
{
"[=value]",
"Environment variable to be set (=) or unset (just
) for the openssl program (see \cb{openssl} for details).
Repeat this option to specify multiple openssl variables. Note
that unspecified variables are inherited from the web server
process.
You need to at least set the \cb{RANDFILE} environment variable
to change the default location of the openssl program seed file
and maybe also the \cb{OPENSSL_CONF} variable if you would like
to use a custom openssl configuration file."
}
};
class package_db
{
string package-db-user
{
"",
"Package database login user name. If not specified, then operating
system (login) name is used. See also \c{package-db-role}."
}
string package-db-role = "brep"
{
"",
"Package database execution user name. If not empty then the login
user will be switched (with \c{SET ROLE}) to this user prior to
executing any statements. If not specified, then \cb{brep} is used."
}
string package-db-password
{
"",
"Package database password. If not specified, then login without
password is expected to work."
}
string package-db-name = "brep_package"
{
"",
"Package database name. If not specified, then \cb{brep_package} is
used by default."
}
string package-db-host
{
"",
"Package database host name, address, or socket. If not specified, then
connect to \cb{localhost} using the operating system-default
mechanism (Unix-domain socket, etc)."
}
uint16_t package-db-port = 0
{
"",
"Package database port number. If not specified, the default port is
used."
}
size_t package-db-max-connections = 5
{
"",
"The maximum number of concurrent package database connections per web
server process. If 0, then no limitation is applied. The default is
5."
}
size_t package-db-retry = 10
{
"",
"The maximum number of times to retry package database transactions in
the face of recoverable failures (deadlock, loss of connection, etc).
The default is 10."
}
};
class build: openssl_options
{
path build-config
{
"",
"Build configuration file. If not specified, then the package building
functionality will be disabled. If specified, then the build database
must be configured (see \cb{build-db-*}). The \cb{brep} instance
needs to be restarted after modifying for the changes to
take effect."
}
dir_path build-bot-agent-keys
{
"",
"Directory containing build bot agent public keys. If specified, then
\cb{brep} will perform agent authentication and will reject build
results from unauthenticated ones. If not specified, then build
results are accepted from all agents (which will be a security
risk if the \cb{brep} instance is publicly accessible).
The directory is expected to contain one PEM-encoded public key
per file with the \cb{.pem} extension. All other files and
subdirectories are ignored. The \cb{brep} instance needs to be
restarted after adding new key files for the changes to take effect."
}
size_t build-forced-rebuild-timeout = 600
{
"",
"Time to wait before considering a package for a forced rebuild. Must
be specified in seconds. Default is 10 minutes."
}
size_t build-soft-rebuild-timeout = 86400
{
"",
"Time to wait before considering a package for a soft rebuild (only to
be performed if the build environment or any of the package
dependencies have changed). Must be specified in seconds. The special
zero value disables soft rebuilds. Default is 24 hours"
}
size_t build-alt-soft-rebuild-timeout
{
"",
"Alternative package soft rebuild timeout to use instead of the soft
rebuild timeout (see \cb{build-soft-rebuild-timeout} for details)
during the time interval specified with the
\cb{build-alt-soft-rebuild-start} and
\cb{build-alt-soft-rebuild-stop} options. Must be specified in
seconds. Default is the time interval length plus
\c{(\b{build-soft-rebuild-timeout} - 24h)} if soft rebuild timeout is
greater than 24 hours (thus the rebuild is only triggered within the
last 24 hours of the \cb{build-soft-rebuild-timeout} expiration)."
}
duration build-alt-soft-rebuild-start
{
":",
"The start time of the alternative package soft rebuild timeout (see
\cb{build-alt-soft-rebuild-timeout} for details). Must be specified
as a time of day in the local timezone. The
\cb{build-alt-soft-rebuild-start} and
\cb{build-alt-soft-rebuild-stop} options must be either both
specified or absent. If unspecified, then no alternative rebuild
timeout will be used."
}
duration build-alt-soft-rebuild-stop
{
":",
"The end time of the alternative package soft rebuild timeout (see
\cb{build-alt-soft-rebuild-timeout} for details). Must be specified
as a time of day in the local timezone. If it is less than the
\cb{build-alt-soft-rebuild-start} option value, then the time
interval extends through midnight. The
\cb{build-alt-soft-rebuild-start} and
\cb{build-alt-soft-rebuild-stop} options must be either both
specified or absent. If unspecified, then no alternative rebuild
timeout will be used."
}
size_t build-hard-rebuild-timeout = 604800
{
"",
"Time to wait before considering a package for a hard rebuild (to be
performed unconditionally). Must be specified in seconds. The special
zero value disables hard rebuilds. Default is 7 days."
}
size_t build-alt-hard-rebuild-timeout
{
"",
"Alternative package hard rebuild timeout. The semantics is the
same as for the \cb{build-alt-soft-rebuild-timeout} option but
for the \cb{build-hard-rebuild-timeout} option."
}
duration build-alt-hard-rebuild-start
{
":",
"The start time of the alternative package hard rebuild timeout (see
\cb{build-alt-hard-rebuild-timeout} for details). The semantics is
the same as for the \cb{build-alt-soft-rebuild-start} option but
for the \cb{build-hard-rebuild-timeout} option."
}
duration build-alt-hard-rebuild-stop
{
":",
"The end time of the alternative package hard rebuild timeout (see
\cb{build-alt-hard-rebuild-timeout} for details). The semantics is
the same as for the \cb{build-alt-soft-rebuild-stop} option but
for the \cb{build-hard-rebuild-timeout} option."
}
};
class build_db
{
string build-db-user
{
"",
"Build database login user name. If not specified, then operating
system (login) name is used. See also \c{build-db-role}."
}
string build-db-role = "brep"
{
"",
"Build database execution user name. If not empty then the login
user will be switched (with \c{SET ROLE}) to this user prior to
executing any statements. If not specified, then \cb{brep} is used."
}
string build-db-password
{
"",
"Build database password. If not specified, then login without
password is expected to work."
}
string build-db-name = "brep_build"
{
"",
"Build database name. If not specified, then \cb{brep_build} is used
by default."
}
string build-db-host
{
"",
"Build database host name, address, or socket. If not specified, then
connect to \cb{localhost} using the operating system-default
mechanism (Unix-domain socket, etc)."
}
uint16_t build-db-port = 0
{
"",
"Build database port number. If not specified, the default port is
used."
}
size_t build-db-max-connections = 5
{
"",
"The maximum number of concurrent build database connections per web
server process. If 0, then no limitation is applied. The default is
5."
}
size_t build-db-retry = 10
{
"",
"The maximum number of times to retry build database transactions in
the face of recoverable failures (deadlock, loss of connection, etc).
The default is 10."
}
};
class page
{
web::xhtml::fragment logo
{
"",
"Web page logo. It is displayed in the page header aligned to the left
edge. The value is treated as an XHTML5 fragment."
}
vector menu
{
"",
"Regular expressions for transforming the interactive build login
information, for example, into the actual command that can be used
by the user. The regular expressions are matched against the
\"\ \" string containing the respective
task request manifest values. The first matching expression is used
for the transformation. If no expression matches, then the task
request is considered invalid, unless no expressions are specified.
Repeat this option to specify multiple expressions."
}
};
class build_result: build, package_db, build_db, handler
{
size_t build-result-request-max-size = 10240000
{
"",
"The maximum size of the build result manifest accepted. Note that the
HTTP POST request body is cached to retry database transactions in the
face of recoverable failures (deadlock, loss of connection, etc). The
default is 10M."
}
};
class build_log: build, build_db, handler
{
};
class build_force: build, build_db, handler
{
};
class builds: build, build_db, page, handler
{
uint16_t build-page-entries = 20
{
"",
"Number of builds per page. The default is 20."
}
uint16_t build-pages = 5
{
"",
"Number of pages in navigation (pager). The default is 5."
}
};
class build_configs: build, page, handler
{
uint16_t build-config-page-entries = 20
{
"",
"Number of build configurations per page. The default is 20."
}
uint16_t build-config-pages = 5
{
"",
"Number of pages in navigation (pager). The default is 5."
}
};
class submit: page, handler
{
dir_path submit-data
{
"",
"The directory to save final submission data to. If unspecified, the
package submission functionality will be disabled. If specified,
then \cb{submit-temp} must be specified as well. See \l{brep The
\cb{build2} Repository Interface Manual} for more information on
package submission.
Note that the directory path must be absolute and the directory
itself must exist and have read, write, and execute permissions
granted to the user that runs the web server."
}
dir_path submit-temp
{
"",
"The directory to save temporary submission data to. Must be specified
if the package submission functionality is enabled.
Note that this directory must be on the same filesystem and satisfy
the same requirements as \cb{submit-data}. It is also the user's
responsibility to clean it up after an unclean web server shutdown."
}
size_t submit-max-size = 10485760
{
"",
"The maximum size of the submission data accepted. Note that currently
the entire submission request is read into memory. The default is
10M."
}
path submit-form
{
"",
"The package submission form fragment. If specified, then its contents
are treated as an XHTML5 fragment that is inserted into the
element of the submission page. If unspecified, then no submission
page will be displayed. Note that the file path must be absolute."
}
string submit-email
{
"",
"The package submission email. If specified, the submission request
and result manifests will be sent to this address. See \l{brep The
\cb{build2} Repository Interface Manual} for more information."
}
path submit-handler
{
"",
"The handler program to be executed on package submission. The handler
is executed as part of the HTTP request and is passed additional
arguments that can be specified with \cb{submit-handler-argument}
followed by the absolute path to the submission directory. See
\l{brep The \cb{build2} Repository Interface Manual} for more
information. Note that the program path must be absolute."
}
strings submit-handler-argument
{
"",
"Additional arguments to be passed to the submission handler program
(see \cb{submit-handler} for details). Repeat this option to specify
multiple arguments."
}
size_t submit-handler-timeout
{
"",
"The submission handler program timeout in seconds. If specified and
the handler does not exit in the allotted time, then it is killed and
its termination is treated as abnormal."
}
};
class ci: page, handler
{
dir_path ci-data
{
"",
"The directory to save CI request data to. If unspecified, the
package CI functionality will be disabled. See \l{brep The
\cb{build2} Repository Interface Manual} for more information on
package CI.
Note that the directory path must be absolute and the directory
itself must exist and have read, write, and execute permissions
granted to the user that runs the web server."
}
path ci-form
{
"",
"The package CI form fragment. If specified, then its contents are
treated as an XHTML5 fragment that is inserted into the
element of the CI page. If unspecified, then no CI page will be
displayed. Note that the file path must be absolute."
}
string ci-email
{
"",
"The package CI email. If specified, the CI request and result
manifests will be sent to this address. See \l{brep The \cb{build2}
Repository Interface Manual} for more information."
}
path ci-handler
{
"",
"The handler program to be executed on CI request. The handler is
executed as part of the HTTP request and is passed additional
arguments that can be specified with \cb{ci-handler-argument}
followed by the absolute path to the CI request directory. See
\l{brep The \cb{build2} Repository Interface Manual} for more
information. Note that the program path must be absolute."
}
strings ci-handler-argument
{
"",
"Additional arguments to be passed to the CI handler program (see
\cb{ci-handler} for details). Repeat this option to specify multiple
arguments."
}
size_t ci-handler-timeout
{
"",
"The CI handler program timeout in seconds. If specified and the
handler does not exit in the allotted time, then it is killed and
its termination is treated as abnormal."
}
};
class repository_root: handler
{
string root-global-view = "packages"
{
"",
"The default view to display for the global repository root. The
argument is one of the supported services (\c{packages},
\c{builds}, \c{submit}, \c{ci}, etc). The default service is
packages."
}
string root-tenant-view = "packages"
{
"",
"The default view to display for the tenant repository root. The
argument is one of the supported services (\c{packages},
\c{builds}, \c{submit}, \c{ci}, etc). The default service is
packages."
}
};
}
// Web handler HTTP request parameters.
//
namespace params
{
// Use parameters long names in the C++ code, short aliases (if present)
// in HTTP URL.
//
class packages
{
// Display package search result list starting from this page.
//
uint16_t page | p;
// Package search criteria.
//
// Note that the packages parameter is renamed to '_' by the root
// handler (see the request_proxy class for details).
//
string q | _;
};
class package_details
{
// Display package version search result list starting from this page.
//
uint16_t page | p;
// Package version search criteria.
//
string query | q;
// Page form.
//
page_form form | f = page_form::brief;
};
class package_version_details
{
// Page form.
//
page_form form | f = page_form::brief;
};
class repository_details
{
// No parameters so far.
//
};
class build_task
{
// Package repository canonical name (note: including pkg: type).
//
vector repository | r;
};
class build_result
{
// No parameters so far.
//
};
class build_log
{
// No parameters so far.
//
};
// All parameters are non-optional.
//
class build_force
{
// Package name.
//
string package | pn;
// Package version. May not be url-encoded, in which case the plus
// character is considered literally (rather than as the encoded space
// character). In other words, after url-decoding the space character is
// treated the same way as the plus character.
//
// @@ Make it of the version type? Maybe after it get moved to
// libbpkg/types.hxx or at least the second use case appear.
//
string version | pv;
// Package build configuration.
//
string configuration | cf;
// Toolchain name.
//
string toolchain_name | tn;
// Toolchain version. May not be url-encoded (see above).
//
string toolchain_version | tv;
// Package rebuild reason. Must not be empty.
//
string reason;
};
class builds
{
// Display packages build configurations list starting from this page.
//
uint16_t page | p;
// Package builds query filter options.
//
// Package name wildcard. An empty value is treated the same way as *.
//
// We used to generate URLs like:
//
// https://cppget.org/?builds&pn=bbot
//
// This looked a bit verbose, so now we produce URLs like:
//
// https://cppget.org/?builds=bbot
//
// To support the already distributed URLs the name_legacy (pn) parameter
// overrides the name (builds) parameter, if present. Note that the
// builds parameter is renamed to '_' by the root handler (see the
// request_proxy class for details).
//
string name | _;
string name_legacy | pn;
// Package version. If empty or *, then no version constraint is applied.
// Otherwise the build package version must match the value exactly.
//
string version | pv;
// Package build toolchain in the - form. If *, then no
// toolchain constraint is applied. Otherwise the build toolchain name
// and version must match the value exactly.
//
string toolchain | tc = "*";
// Package build configuration name wildcard. An empty value is treated
// the same way as *.
//
string configuration | cf;
// Package build machine name wildcard. An empty value is treated the
// same way as *.
//
string machine | mn;
// Package build target wildcard. An empty value is treated the same way
// as *.
//
string target | tg;
// Package build result. If *, then no build result constraint is
// applied. Otherwise the value is supposed to be the one of the
// following (ordered) statuses: pending, building, success, warning,
// error, abort, abnormal. The first 3 statuses are checked for equality,
// the rest - for being greater or equal.
//
string result | rs = "*";
};
class build_configs
{
// Note that the build-configs parameter is renamed to '_' by the root
// handler (see the request_proxy class for details).
//
string class_name | _ = "all";
// Display build configurations list starting from this page.
//
uint16_t page | p;
};
// Parameters, except simulate, must either be all present (actual
// submission) or absent (submission form request).
//
// Note also that besides these parameters there can be others. We don't
// recognize their semantics and just save them to the submission request
// manifest.
//
class submit
{
// Package archive file name. Must be .
//
// Note that it can potentially be not just a name but a file path and
// in the client's form (e.g., Windows).
//
string archive;
// Package archive file SHA256 checksum.
//
string sha256sum;
// Submission simulation outcome.
//
string simulate;
};
// Parameters, except simulate, must either be all present (actual CI
// request) or absent (CI form request).
//
// Note also that besides these parameters there can be others. We don't
// recognize their semantics and just save them to the CI request
// manifest.
//
class ci
{
// Package repository location.
//
// Note that the ci parameter is renamed to '_' by the root handler (see
// the request_proxy class for details).
//
bpkg::repository_location repository | _;
// Package names/versions.
//
strings package;
// Overrides file name. Must be .
//
// Note that we don't really need this name and only check if this
// parameter is specified to detect presence of the upload.
//
string overrides;
// Interactive build execution breakpoint.
//
string interactive;
// Submission simulation outcome.
//
string simulate;
};
}
}