aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bdep/ci.cli25
-rw-r--r--bdep/ci.cxx26
-rw-r--r--tests/ci.testscript36
3 files changed, 76 insertions, 11 deletions
diff --git a/bdep/ci.cli b/bdep/ci.cli
index c3f8825..5ffcd2f 100644
--- a/bdep/ci.cli
+++ b/bdep/ci.cli
@@ -87,15 +87,17 @@ namespace bdep
builds build-{include,exclude}
*-builds *-build-{include,exclude}
*-build-config
+ *-build-email *-build-{warning,error}-email
\
- For the package configuration-specific build constraint overrides the
- corresponding configuration must exist in the package manifest. In
- contrast, the package configuration override (\cb{*-build-config}) adds a
- new configuration if it doesn't exist and updates the arguments of the
- existing configuration otherwise. In the former case, all the potential
- build constraint overrides for such a newly added configuration must
- follow the corresponding \cb{*-build-config} override.
+ For the package configuration-specific build constraint and email
+ overrides the corresponding configuration must exist in the package
+ manifest. In contrast, the package configuration override
+ (\cb{*-build-config}) adds a new configuration if it doesn't exist and
+ updates the arguments of the existing configuration otherwise. In the
+ former case, all the potential build constraint and email overrides for
+ such a newly added configuration must follow the corresponding
+ \cb{*-build-config} override.
Note that the build constraints group values (both common and build
package configuration-specific) are overridden hierarchically so that the
@@ -109,6 +111,15 @@ namespace bdep
constraints are overridden, then for the remaining configurations the
build constraints are reset to \cb{builds:\ none}.
+ Similar to the build constraints groups, the common and build package
+ configuration-specific build emails group value overrides are mutually
+ exclusive. If the common build emails are overridden, then all the
+ configuration-specific emails are removed. Otherwise, if any
+ configuration-specific emails are overridden, then for the remaining
+ configurations the build emails are reset to the empty values and the
+ build warning and error emails are removed (which effectively disables
+ email notifications for such configurations).
+
If supported by the CI service, a package can be tested interactively
in a specific build configuration using the \c{\b{--interactive}|\b{-i}}
option. In this mode the CI service provides the login information for
diff --git a/bdep/ci.cxx b/bdep/ci.cxx
index 473a5fa..74cfd7a 100644
--- a/bdep/ci.cxx
+++ b/bdep/ci.cxx
@@ -213,10 +213,6 @@ namespace bdep
0, 0, 0}); // File positions.
};
- // Add the default overrides.
- //
- override ("build-email", "", origin::build_email);
-
// Append the overrides specified by --override, --overrides-file,
// --build-email, and --builds which are all handled by
// cli::parser<cmd_ci_override>. But first verify that they don't clash
@@ -229,6 +225,8 @@ namespace bdep
(o.interactive_specified () &&
o.interactive ().find ('/') != string::npos));
+ bool build_email_ovr (false);
+
if (o.overrides_specified ())
{
const char* co (o.target_config_specified () ? "--target-config" :
@@ -258,10 +256,25 @@ namespace bdep
n == "builds" ||
n == "build-include" ||
n == "build-exclude"))
+ {
fail << "invalid " << to_string (static_cast<origin> (nv.name_line))
<< ": " << "'" << n << "' override specified together with "
<< co <<
info << "override: " << n << ": " << nv.value;
+ }
+
+ if (n == "build-email" ||
+ n == "build-warning-email" ||
+ n == "build-error-email" ||
+ (n.size () > 12 &&
+ n.compare (n.size () - 12, 12, "-build-email") == 0) ||
+ (n.size () > 20 &&
+ n.compare (n.size () - 20, 20, "-build-warning-email") == 0) ||
+ (n.size () > 18 &&
+ n.compare (n.size () - 18, 18, "-build-error-email") == 0))
+ {
+ build_email_ovr = true;
+ }
}
overrides.insert (overrides.end (),
@@ -269,6 +282,11 @@ namespace bdep
o.overrides ().end ());
}
+ // Add the default overrides.
+ //
+ if (!build_email_ovr)
+ override ("build-email", "", origin::build_email);
+
// Append the overrides specified by --target-config, but first verify
// that they don't clash with the other build constraints-related options.
//
diff --git a/tests/ci.testscript b/tests/ci.testscript
index d604aa7..9b365d3 100644
--- a/tests/ci.testscript
+++ b/tests/ci.testscript
@@ -200,6 +200,42 @@ windows = ($cxx.target.class == 'windows')
EOE
}
+ : package-build-emails
+ :
+ {
+ $clone_prj;
+
+ $* --override 'default-build-email: foo@example.com' \
+ --override 'default-build-warning-email: bar@example.com' 2>>~%EOE%
+ %CI request is queued.*%
+ %reference: .+%
+ EOE
+ }
+
+ : common-package-build-emails
+ :
+ {
+ $clone_prj;
+
+ $* --build-email 'foo@example.com' \
+ --override 'default-build-warning-email: bar@example.com' 2>>EOE != 0
+ error: invalid --override option value: 'default-build-warning-email' override specified together with 'build-email' override
+ info: override: default-build-warning-email: bar@example.com
+ EOE
+ }
+
+ : package-build-common-emails
+ :
+ {
+ $clone_prj;
+
+ $* --override 'default-build-warning-email: foo@example.com' \
+ --override 'build-error-email: bar@example.com' 2>>EOE != 0
+ error: invalid --override option value: 'build-error-email' override specified together with 'default-build-warning-email' override
+ info: override: build-error-email: bar@example.com
+ EOE
+ }
+
: build-configs-constraints
:
{