summaryrefslogtreecommitdiffstats
path: root/src
AgeCommit message (Collapse)Author
2021-06-07Add package filtering for "db jobs" subcommandMatthias Beyer
Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
2021-06-07Add endpoint filtering in "db jobs" subcommandMatthias Beyer
Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
2021-06-07Add date-filtering to "db jobs" subcommandMatthias Beyer
Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
2021-06-07Refactor: Simplify query buildingMatthias Beyer
Simplify query building by making `sel` variable `mut` and not reassigning it in else cases. Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
2021-06-07Capitalize table headingsMatthias Beyer
Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
2021-06-07Remove database IDs from outputMatthias Beyer
The database IDs are an implementation detail and the user does not need to see them in any case. Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
2021-06-07Merge branch 'db-release-arg-date-filter'Matthias Beyer
2021-06-07Fix: Make patch path absoluteMatthias Beyer
This patch changes the patch-path collecting to make the pathes to patches absolute. This fixes a bug where executing butido from a sub directory of the package repository failed to find the patch files when loading the repository files. Signed-off-by: Matthias Beyer <matthias.beyer@atos.net> Tested-by: Matthias Beyer <matthias.beyer@atos.net>
2021-06-02Fix: Wrong wording in metrics outputMatthias Beyer
Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
2021-06-02Add support for filtering releases by package name and versionMatthias Beyer
Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
2021-06-02Remove conflict between newer-than and older-than argumentMatthias Beyer
So they can be specified both. Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
2021-06-02Try to parse time with " 00:00:00" appendedMatthias Beyer
This makes it a bit easier to only specify a date. If the parsing fails (e.g. with "2020-01-01"), this patch adds another step of parsing by adding " 00:00:00" to the commandline argument and trying again to parse. This way, the CLI argument can be "2020-01-01" and the time does not have to be specified. Signed-off-by: Matthias Beyer <matthias.beyer@atos.net> Tested-by: Matthias Beyer <matthias.beyer@atos.net>
2021-06-02Subcommand "db releases" add date filterMatthias Beyer
Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
2021-06-02Add ability to specify point in time in date filter argumentMatthias Beyer
Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
2021-06-02Refactor: move get_date_filter() helper fn to commands:util moduleMatthias Beyer
Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
2021-06-02Fix: code styleMatthias Beyer
Fixes: 52bd280b4b95949cf130e4d7477c02ad2d2f81b3 ("Refactor: Database connection setup code") Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
2021-06-02Fix: About string should be settable for argument generator helper fnMatthias Beyer
Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
2021-05-31Fix: git commit hash/author information passingMatthias Beyer
This fixes the git commit hash and author information passing. The changes in 2d72cbed2495517dba84ec4d46e5f521ff46412b did not add the environment variables to the `find_artifact()` call when searching for replacement artifacts. Thus, calling the same build twice, with the staging directory from the first call added in the second call, resulted in a full rebuild, although the artifacts from the first call could be resused. With this patch applied, this issue is fixed by adding the environment variables to the environment passed to the `find_artifacts()` call. Fixes: 2d72cbed2495517dba84ec4d46e5f521ff46412b ("Add feature to pass git author and git commit information to container") Signed-off-by: Matthias Beyer <matthias.beyer@atos.net> Tested-by: Matthias Beyer <matthias.beyer@atos.net>
2021-05-31Merge branch 'fix-color-log-in-db'Matthias Beyer
2021-05-31Fix: Insert shouldn't be done with LogItem::display()Matthias Beyer
This fixes a nasty bug; because we used the LogItem::display() function to build the log string that was put into the database, the database contained _colorized_ log lines. Because of this, our parsing of the log text later (when reading historical data from the database) failed to parse whether the job was successfull or not. The issue was actually introduced in b3a6458ce34e3065192208826b2fc85edd4761f9, where we changed the `LogItem::display()` implementation. With this fix in place, the log text in the database is corrected again (only for new logs that get put into the database). Fixes: b3a6458ce34e3065192208826b2fc85edd4761f9 ("Add color support in LogItem::display() impl") Signed-off-by: Matthias Beyer <matthias.beyer@atos.net> Tested-by: Matthias Beyer <matthias.beyer@atos.net>
2021-05-31Fix typoMatthias Beyer
Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
2021-05-31Add trace outputMatthias Beyer
Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
2021-05-31Impl Debug for ParsedLogMatthias Beyer
Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
2021-05-31Add another successfullness test for log parserMatthias Beyer
Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
2021-05-31Make job-successfullness-check less boolishMatthias Beyer
This patch changes the interface from `-> Option<bool>` to something more explanatory. Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
2021-05-28Remove feature "PackageFlags"Matthias Beyer
This patch removes the `PackageFlags` type and the feature from the package definition struct, so a user cannot longer use the package flags. This feature was not used yet in our repository, so it seems that this is nothing that is valuable. Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
2021-05-26Add tests for job-successfullness-checkMatthias Beyer
Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
2021-05-25Fix: Error out if a dependency cannot be foundMatthias Beyer
This fixes a bug where dependencies were not found, but this was ignored. This happened even if there was a typo in the version of the dependency, for example. Signed-off-by: Matthias Beyer <mail@beyermatthias.de> Tested-by: Matthias Beyer <mail@beyermatthias.de>
2021-05-25Impl Display for PackageVersionConstraintMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2021-05-20Update dependency: indicatif 0.15 -> 0.16.1Matthias Beyer
0.16.1 has been published which fixes the bug introduced by 0.16.0, hence update this dependency. This reverts commit ddbd9629b3188c9f08d023829683c40ab9e1448b. Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
2021-05-18Fix typo in fn nameMatthias Beyer
Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
2021-05-18Fix: Counting should not use helper fnMatthias Beyer
By using the helper function is_job_successfull(), we resulted in bogus output when there was no successfull and no failed job, because jobs can have an "unknown" state as well. This patch fixes this by counting properly. Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
2021-05-18Preallocate a reasonable large bufferMatthias Beyer
This patch changes the LogReceiver to preallocate a reasonable large buffer for holding logs in memory. Because of the fact that we have to write the log _in one piece_ to the database (there might be a way to append to the log field, but that's optimization of a problem we shouldn't have - we rather should use another approach for storing logs), we have to keep the log in memory until the job is finished. For keeping the log of a job in memory, we use a `Vec`. After consulting the documentation https://doc.rust-lang.org/stable/std/collections/index.html#when-should-you-use-which-collection https://doc.rust-lang.org/stable/std/collections/index.html#sequences we found that `Vec` should be appropriate here, although `VecDeque` might be an option as well because of O(1) insertion time (and we're only inserting). Still, because `Vec` has amortized constant time for adding elements at the end, this should be sufficient. Preallocating a reasonable large amount of elements could yield big benefits with only minor disadvantage. If the job fails early (after only a few lines of log output), there's memory wasted. Also, if we have a large number of jobs, we allocate a huge amount of memory before filling it up. Because we need to have that memory anyways (considering all jobs succeed), that is not really a disadvantage. Now, what is "reasonable large"? This value might be changed later on, but for now, I took this value from experience we had when using butido in practice: select AVG(length.l), MAX(length.l), MIN(length.l) FROM ( SELECT LENGTH(log_text) - LENGTH(REPLACE(log_text, chr(10), '')) AS l FROM jobs ) AS length +-----------------------+--------+-------+ | avg | max | min | |-----------------------+--------+-------| | 2863.0497427101200686 | 165213 | 11 | +-----------------------+--------+-------+ The max and min values seem to be extreme. Now, the values contain a lot of failed jobs and the maximum value (165k log lines is _huge_!) was also a bogus setup. Removing these from the equation, using only the successful jobs, gives us a not-so-different number: SELECT AVG(l.len), MAX(l.len), MIN(l.len) FROM ( SELECT LENGTH(log_text) - LENGTH(REPLACE(log_text, CHR(10), '')) AS len, STRPOS(log_text, 'BUTIDO:STATE:OK') AS okpos FROM JOBS ) AS l WHERE l.okpos != 0 AND l.len != 165213 +-----------------------+-------+-------+ | avg | max | min | |-----------------------+-------+-------| | 2661.7306791569086651 | 55422 | 66 | +-----------------------+-------+-------+ Using the average (arithmetic mean) as a baseline, we decided to go for 4096 (2^12) preallocated elements in the buffer, which should be reasonable. Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
2021-05-18Make normal about message more consise, detailed about in long messageMatthias Beyer
Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
2021-05-18Remove angle brackets for readability and consistencyMatthias Beyer
Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
2021-05-18Remove unnecessary linebreakMatthias Beyer
Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
2021-05-18Move detailed about text to long aboutMatthias Beyer
Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
2021-05-17Fix typo in help messageMatthias Beyer
Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
2021-05-17Fix: Check whether environments are equalMatthias Beyer
This change fixes a bug where two submits that differed only in an environment variable where considered equal: butido build pkg butido build pkg -E FOO=1 the second build reused the artifacts from the first one, which is a bug. Signed-off-by: Matthias Beyer <mail@beyermatthias.de> Tested-by: Matthias Beyer <mail@beyermatthias.de>
2021-05-17Fix: Do not print database password in debug logMatthias Beyer
We have to manually implement Debug here, because otherwise we would print the database password in the debug output, which is CLEARLY a bad idea. Hence, change the debug!() call in the establish_connection() function to (debug-)print `self` and hand-implement the `Debug` trait. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2021-05-17Revert "Update dependency: indicatif 0.15 -> 0.16"Matthias Beyer
This reverts the dependency update because indicatif 0.16 introduced a reachable `unreachable!()` statement in their sourcecode that we actually hit if we `--hide-bars`. This reverts commit 6ceccb679d9c2d19389c6c6eef792d8db9086f31. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2021-05-17Add "db setup" subcommandMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2021-05-17Refactor: Return Cow instead of StringMatthias Beyer
This results in less overhead in the or-else case by now allocating a String object. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2021-05-17Merge branch 'no-pager'Matthias Beyer
2021-05-17Merge branch 'download-graceful-error-reporting'Matthias Beyer
2021-05-17Merge branch 'download-fail-slow'Matthias Beyer
2021-05-12Fix: Helptext is for downloadingMatthias Beyer
Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
2021-05-12Report download errors gracefullyMatthias Beyer
This patch changes the implementation of the "source download" subcommand so that download errors are reported in the progress bar message, instead of dropping the bar silently (which resulted in errors not being that visible to the user). Signed-off-by: Matthias Beyer <matthias.beyer@atos.net> Tested-by: Matthias Beyer <matthias.beyer@atos.net>
2021-05-12Report URL of finished download in bar finish messageMatthias Beyer
Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
2021-05-12Fix: Consume all items before failingMatthias Beyer
This patch changes the download implementation so that one failing download does not fail the whole process, but errors are collected instead and reported after all other downloads are finished. This is the simple case implementation where only one error is reported, though multiple could have happened. Tested-by: Matthias Beyer <matthias.beyer@atos.net> Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>