go test -cover -coverprofile coverage.txt -v ./internal/pkg/report/...
go tool cover -html=coverage.txt -o coverage.html
xdg-open coverage.html
$ go run github.com/gregoryv/uncover/cmd/uncover@latest coverage.txt ReportLog
total: (statements) 100.0%
- do not try to mask a secret when a log line is received
- try to mask secrets before before sending a batch of log
lines to the Forgejo instance (every second)
- if masking a multiline secret needs more log lines to decide
if it needs to be masked, do not attempt to send anything to
the Forgejo instance, just wait until there are more log lines
Closesforgejo/runner#57
r.logOffset = ack
ack < r.logOffset+len(rows)
can be simplified as
len(rows) > 0
which is only false if there were no rows to send. It follows
that
if noMore && ack < r.logOffset+len(rows) {
is can be simplified as
if noMore {
is always true if rows were sent.
The intent was apparently to return on error and retry if only
part of the rows were sent but not all of them. To achieve that
the expression is replaced with:
if noMore && len(r.logRows) > 0 {
- the longest secret is masked first
- multiline secrets are masked before single line secrets
- O(multiline * log rows) to not degrade performances when there are
no multiline secrets
and it is kind of useless anyway because invalid workflows are currently failing in very inconsistent and unpredictable ways.
Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/664
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
the context sent from the Forgejo instance is expected to have
gitea_default_actions_url
gitea_runtime_token
add support for
forgejo_default_actions_url
forgejo_runtime_token
as well so that future Forgejo versions can make the change.
--add-host name not work depending on the network mode chosen.
Closesforgejo/runner#213
Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/630
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
Hi!
~~ba2fc1273ce5cb04d96cfdbb47ebad929dcbd96f goes in tandem with https://code.forgejo.org/forgejo/act/pulls/135 and adapts to the API changes for `runner.Config.`~~
I dropped the act interface changes according to https://code.forgejo.org/forgejo/act/pulls/135#issuecomment-40695, but kept the CLI changes here - as they are not breaking here.
Other three commits just fix up some typos around the tree - bit of a pet peeve of mine, sorry :^)
Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/576
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Christoph Heiss <christoph@c8h4.io>
Co-committed-by: Christoph Heiss <christoph@c8h4.io>
- Forgejo (since v8, 38ea77ebbe) does not use the value of this header, it was [introduced in v1.20](371520d7ab).
- Older forgejo version than v8 handle it gracefully if this value is not sent.
Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/496
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-committed-by: Gusted <postmaster@gusted.xyz>
This is the forgejo-runner-side patch for a partial overhaul of the cache system to fix some access control issues with caches.
This code depends on changes in act which are being reviewed here: forgejo/act#107
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/502
Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/503
Reviewed-by: Gusted <gusted@noreply.code.forgejo.org>
Co-authored-by: Kwonunn <kwonunnx@gmail.com>
Co-committed-by: Kwonunn <kwonunnx@gmail.com>
As commented here https://code.forgejo.org/forgejo/runner/issues/422, this PR aims to allow a new type of one shot execution compatible with autoscaling features and other job types.
Co-authored-by: jaime merino <jaime.merino_mora@mail.schwarzª>
Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/423
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: cobak78 <cobak78@noreply.code.forgejo.org>
Co-committed-by: cobak78 <cobak78@noreply.code.forgejo.org>
From: 1735b26e66
Don't log job output when debug logging is not enabled
We wanted the ability to disable outputting the logs from the individual job to the console. This changes the logging so that job logs are only output to the console whenever debug logging is enabled in `act_runner`, while still allowing the `Reporter` to receive these logs and forward them to Gitea when debug logging is not enabled.
Signed-off-by: Kwonunn <kwonunnx@gmail.com>
bufbuild/connect-go was archived with maintenance transferred to the
ConnectRPC organization. Gitea's protobuf library for actions now uses
the ConnectRPC dependency as of v0.4.0, removing the need to continue
using the dead package.
When receiving a signal (INT or TERM) wait for running jobs to
complete instead of terminating them right away.
The new shutdown_timeout configuration setting can be used to force
the termination after a grace delay. If not specified or zero it will
shutdown immediately, for backward compatibility. It will be the case
with existing configuration files or when a configuration file is not
specified.
The config.yml created with the generate-config subcommand will
however default shutdown_timeout to 3h (same as timeout) because it is
likely what a new admin would expect: shutting down waits for jobs to
complete and not abort them.
This is a somewhat "hacky" way; it copies the inputs from the "event"
object's "inputs" field when the event is a "workflow_dispatch".
But this way we do not need to change the protobuf powered runner
protocol to also include the inputs. Espc. since they're also present
inside the event anyway.