Matthias Kruk [Sun, 1 Aug 2021 07:35:26 +0000 (16:35 +0900)]
include/msg: Remove "commit" property from message modules
The "commit" property has been removed from all but the message
specification of "commit" messages, so it must be removed from
modules that are used for constructing messages and accessing the
properties of messages.
This commit removes handling of the "commit" property from all
messages that this property has been removed from.
Matthias Kruk [Sun, 1 Aug 2021 07:27:32 +0000 (16:27 +0900)]
spec: Remove commit property from all message types (except commit)
Handling of the commit property makes the components of foundry more
complex without adding tangible value. Therefore it should be removed
and added again in case that it really becomes necessary.
This commit removes the commit property from all message types but
commit messages.
Matthias Kruk [Sun, 1 Aug 2021 07:01:18 +0000 (16:01 +0900)]
testbot: Remove handling of "commit" and "logs" message properties
The "commit" message property has been made optional, and the "logs"
property has been removed, making it necessary to change the way
testbots handle IPC messages.
This commit modifies testbot so that the "commit" property will be
ignored, and that testbots will not attempt to include testlogs
in sent messages.
Matthias Kruk [Sun, 1 Aug 2021 06:21:19 +0000 (15:21 +0900)]
testbot: Change default topic to "tests"
The default topic that testbot publishes test messages under is set
to "merges", which is not correct.
This commit changes the default topic for test results to "tests".
Matthias Kruk [Sun, 1 Aug 2021 06:19:24 +0000 (15:19 +0900)]
testbot: Add dependency on inst
Testbot calls functions from the inst module but it does not include
the module upon startup, making it impossible to start the bot.
This commit makes testbot include the "inst" module before entering
the main() function.
Matthias Kruk [Sun, 1 Aug 2021 05:44:31 +0000 (14:44 +0900)]
include/msg: Remove log-related functions from test and build modules
The "logs" property has been removed from the specification of the
test and build messages, so the functions in the respective modules
that access these properties must be removed as well.
This commit removes the foundry_msg_build_get_logs() and
foundry_msg_test_get_logs() functions and removes the logs parameter
from the foundry_msg_test_new() and foundry_msg_build_new() functions.
Matthias Kruk [Sun, 1 Aug 2021 05:07:56 +0000 (14:07 +0900)]
spec: Remove "logs" property from test and build messages
The test and build messages have a required property that the sender
must use to send the names of generated logfiles. However, since
processes will generally register log messages with the context, it
is not necessary to send the names of logfiles in an IPC message.
This commit removes the "logs" property from the specification of the
test and build messages.
Matthias Kruk [Sun, 1 Aug 2021 04:41:49 +0000 (13:41 +0900)]
dispatchbot: Send buildrequest upon receipt of a merge notification
When a merge into the master/stable branch of a repository has taken
place, foundry should trigger a build from the updated source code.
This commit modifies dispatchbot to watch the "merges" topic and send
a buildrequest to the buildbots whenever a merge to a master or stable
branch has been performed.
Matthias Kruk [Sun, 1 Aug 2021 04:37:31 +0000 (13:37 +0900)]
spec: Make commit field optional
The buildrequest and testrequest messages carry a commit property that
is used to specify the exact commit that should be tested. However, it
is not always desirable or possible to specify the exact commit, so
the property should be optional.
This commit removes the property from the list of required properties,
allowing senders to omit the property.
This commit adds testbot, a bot that listens for testrequest messages,
performs tests on the source tree specified in the request, and publishes
the result under the topic configured on the commandline.
foundry: Remove the need to explicitly configure process names
Foundry requires the process configurations to specify a process
name that is equal to the name of the configuration, otherwise
running processes are not correctly detected. Since the user is not
free to specify any name they want, it does not make sense to
require the user to configure the process name at all.
This commit changes the foundry implementation so that the name of
the config domain is used as the process name, doing away with the
need to explicitly configure the process name.
include/context: Move files when adding them to a context
When adding files (or logs) to a context, the files are placed in a
context-specific directory using cp. This causes copies of the files
to be left behind in the working directories of the generating
processes, requiring additional cleanup if the copies are not needed
anymore. However, in the majority of cases, the copy is not needed.
This commit modifies the foundry_context_add_file() and
foundry_context_add_log() functions so that mv is used to place the
files in the context's directory, doing away with the need to clean
up the working directories of the generating processes.
watchbot: Add --name parameter to facilitate process identification
The build system management script needs a way to identify individual
processes to make sure all configured processes are running.
This commit adds the --name parameter to watchbot, which is intended
to make the process identifiable as it shows up in the list output by
the --list parameter.
foundry: Implement process and endpoint monitoring
To ensure proper operation of the build system, the management script
must make sure that the individual processes of foundry are running,
and that the IPC endpoints that are used for messaging are existing.
This commit adds a process watchdog to foundry.sh which ensures that
all processes are running as configured.
Further, this commit adds code to ensure that IPC endpoints are
existing, and periodically logs the contents of the IPC endpoints'
queues to a file so the messages sent between components of the
buildsystem can be monitored by an administrator.
The component that starts and manages the buildsystem is called smelter,
however as it serves a very central purpose, it should be called foundry.
This commit renames the script from smelter.sh to foundry.sh.
Dispatchbot uses functions that are implemented by the inst module,
but it does not include the inst module at startup.
This commit modifies dispatchbot to include the inst module.
This commit adds smelter, a script for managing the individual
components of the foundry build system.
Once complete, smelter will act as a process watchdog and monitor
the state of the various IPC endpoints and pubsub topics that are
used by the buildsystem.
watchbot: Don't include foundry/msg/commit directly
Watchbot includes the commit submodule of foundry/msg directly, which
causes some of the methods not to work correctly.
This commit changes watchbot to include foundry/msg instead of
foundry/msg/commit.
watchbot: Rewrite watchbot to use new message format via pubsub
The current watchbot implementation does not use the new message
format. Furthermore, it sends messages to a single queue, making it
hard to receive notifications in multiple processes.
This commit rewrites watchbot to use the new foundry message
definitions on top of toolbox/ipc's pubsub implementation.
include/msg/*: Change name of "tid" field to "context"
The "tid" field was renamed to "context" in the specifications of all
message types, but the implementations still refer to the old name.
This commit changes the implementations of all message types to use
the correct field name.
The object that is used to corellate parts of a build transaction has
been renamed from transaction to context, and therefore the name
"transaction identifier" is not correct anymore.
This commit updates all message specifications so that the field that
stores the context identifier is called "context".
spec/commit: Remove timestamp field from commit messages
The commit message specification contains a timestamp flag that is
currently not implemented. Furthermore, the timestamp can also be
acquired from the enclosing ipc_msg, so it is not necessary to
duplicate the field in the higher layers.
This commit removes the timestamp field from the message specification.
include/context: Add module to keep track of build/test contexts
This commit adds the context module, which implements a set of functions
to track the state of a transaction across the buildsystem. This module
will be used to store the logs and artifacts associated with a context in
a central location, identified by the context identifier which is stored
in several of the IPC messages.
mergebot: Add bot for merging branches of a repository
This commit adds mergebot. Mergebot accepts merge request messages
and will attempt to merge the one branch into another. Currently,
this only works for merges that can be realised by fast-forwarding
the target branch.
dispatchbot: Add bot for issuing orders to other bots
This commit adds dispatchbot. Dispatchbot subscribes to all relevant
topics (such as "commit", "test", etc.) and emits orders to other bots
depending on the messages that it has seen.
include/msg/*: Place all foundry messages in a base message
To make foundry messages easily distinguishable, they should each be
placed in a base message that contains a property for the message type.
This commit modifies the modules for all of the foundry message types
so that they are enclosed in a base message.
Because the current foundry implementation transmits all message types
directly on top of the ipc layer, distinguishing message types is not
trivial.
This commit solves adds a base message type for foundry messages,
including an attribute that contains the message type, making it
making it possible for message types to be easily distinguished.
include/msg: Add modules for foundry IPC message handling
This commit adds modules providing a convenient interface to
generate and parse any of the message types that are used for
IPC between foundry components.
To make foundry more flexible and scalable, the next release will
implement a messaging-based IPC approach using JSON objects.
This commit adds JSON schemas for all message types that will be
used by foundry.
To make the progress of a build trackable, build ids are necessary.
This commit makes buildbot and distbot handle the build ids that are
assigned by the watchbots, and print them along with log output so
that printed messages can be associated with a specific build.
watchbot: Assign a buildid when a new build job is enqueued
When a repository change is detected, watchbot only places the path
and branch name in the queue. To track a build through the entire
build system, a build id should be assigned as well.
This commit modifies watchbot to also place a build id in the queue.
distbot: Check more thoroughly if the specified repository exists
Distbot assumes that the repository has been initialized if the
directory exists. This means that the repository won't be initialized
if an empty directory was passed to distbot.
This commit makes distbot check the specified repository a little more
thoroughly, to make sure empty directories will be initialized, too.
buildbot: Use dpkg-buildpackage -k instead of --sign-key
Older versions of dpkg-buildpackage don't understand the --sign-key
option. With such versions, the -k option has to be used instead.
This commit changes buildbot to pass the key to dpkg-buildpackage
using the -k option.
{watch,build,dist}bot: Make all bots use similar commandline options
Watchbot, buildbot, and distbot do not use the same options for inputs
and outputs such as queues or directories. This commit changes the
understood commandline arguments so that the same options have the same
meaning.
Further, this commit updates the three bots to use the opt module in a
way thats compatible with toolbox > 0.3.
distbot: Accept packages from a queue instead of a watch directory
Distbot currently monitors a watch directory and adds packages that
have been placed in this directory to the repository. This can be
greatly simplified by using queue instead.
This commit changes distbot to accept new packages from a queue. It
further simplifies the distbot code by using the inst module for
managing running instances.
buildbot: Allow multiple instances to run at a time
Buildbot is implemented as a singleton, even though this is neither
necessary nor desirable. In order to allow parallel builds, migrate
buildbot to use the inst module to manage running instances.
Watchbot currently allows only one instance to run at a time. However,
it might be desirable to have multiple watchbots running simultaneously,
watching one or more repositories at a time.
This commit implements support for multiple instances using the new inst
module.
buildbot,distbot,watchbot: Adapt to latest toolbox version
The latest toolbox implements the --verbose and --shush options inside
the opt module, so it's no longer necessary to implement them explicitly.
This commit removes the --verbose and --shush options from all bots.
buildbot: Pick up tasks from a queue and place built packages in another queue
This commit modifies buildbot to pick up tasks from a queue and place built debian
packages in another queue. This allows for very straightforward parallelization of
builds, once the start/stop mechanism has been changed.