diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index a8e94a8..21dff1e 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -13,6 +13,8 @@ * add support for `runs-on.labels` which is equivalent to `runs-on` followed by a list of labels * the expressions in the service `ports` and `volumes` values are evaluated * network aliases are only supported when the network is user specified, not when it is provided by the runner +* Fix compatibility issue with actions/{upload,download}-artifact@v4 +* If `[runner].insecure` is true in the configuration, insecure cloning actions is allowed ## 3.3.0 diff --git a/internal/app/cmd/exec.go b/internal/app/cmd/exec.go index ffd932c..30a8c76 100644 --- a/internal/app/cmd/exec.go +++ b/internal/app/cmd/exec.go @@ -486,7 +486,7 @@ func loadExecCmd(ctx context.Context) *cobra.Command { execCmd.PersistentFlags().BoolVarP(&execArg.noSkipCheckout, "no-skip-checkout", "", false, "Do not skip actions/checkout") execCmd.PersistentFlags().BoolVarP(&execArg.debug, "debug", "d", false, "enable debug log") execCmd.PersistentFlags().BoolVarP(&execArg.dryrun, "dryrun", "n", false, "dryrun mode") - execCmd.PersistentFlags().StringVarP(&execArg.image, "image", "i", "node:16-bullseye", "docker image to use") + execCmd.PersistentFlags().StringVarP(&execArg.image, "image", "i", "node:16-bullseye", "Docker image to use. Use \"-self-hosted\" to run directly on the host.") execCmd.PersistentFlags().StringVarP(&execArg.network, "network", "", "", "Specify the network to which the container will connect") execCmd.PersistentFlags().BoolVarP(&execArg.enableIPv6, "enable-ipv6", "6", false, "Create network with IPv6 enabled.") execCmd.PersistentFlags().StringVarP(&execArg.githubInstance, "gitea-instance", "", "", "Gitea instance to use.") diff --git a/internal/app/run/runner.go b/internal/app/run/runner.go index 0884c50..ee12165 100644 --- a/internal/app/run/runner.go +++ b/internal/app/run/runner.go @@ -81,6 +81,7 @@ func NewRunner(cfg *config.Config, reg *config.Registration, cli client.Client) // set artifact gitea api artifactGiteaAPI := strings.TrimSuffix(cli.Address(), "/") + "/api/actions_pipeline/" envs["ACTIONS_RUNTIME_URL"] = artifactGiteaAPI + envs["ACTIONS_RESULTS_URL"] = strings.TrimSuffix(cli.Address(), "/") // Set specific environments to distinguish between Gitea and GitHub envs["GITEA_ACTIONS"] = "true" @@ -169,8 +170,12 @@ func (r *Runner) run(ctx context.Context, task *runnerv1.Task, reporter *report. preset.Token = t } - // use task token to action api token - r.envs["ACTIONS_RUNTIME_TOKEN"] = preset.Token + giteaRuntimeToken := taskContext["gitea_runtime_token"].GetStringValue() + if giteaRuntimeToken == "" { + // use task token to action api token for previous Gitea Server Versions + giteaRuntimeToken = preset.Token + } + r.envs["ACTIONS_RUNTIME_TOKEN"] = giteaRuntimeToken eventJSON, err := json.Marshal(preset.Event) if err != nil { @@ -212,6 +217,7 @@ func (r *Runner) run(ctx context.Context, task *runnerv1.Task, reporter *report. PlatformPicker: r.labels.PickPlatform, Vars: task.Vars, ValidVolumes: r.cfg.Container.ValidVolumes, + InsecureSkipTLS: r.cfg.Runner.Insecure, } rr, err := runner.New(runnerConfig) diff --git a/internal/pkg/config/config.go b/internal/pkg/config/config.go index 540c82a..a7bb977 100644 --- a/internal/pkg/config/config.go +++ b/internal/pkg/config/config.go @@ -99,6 +99,9 @@ func LoadDefault(file string) (*Config, error) { if err != nil { return nil, fmt.Errorf("read env file %q: %w", cfg.Runner.EnvFile, err) } + if cfg.Runner.Envs == nil { + cfg.Runner.Envs = map[string]string{} + } for k, v := range envs { cfg.Runner.Envs[k] = v } diff --git a/internal/pkg/report/reporter.go b/internal/pkg/report/reporter.go index 7e9a2d5..0930e88 100644 --- a/internal/pkg/report/reporter.go +++ b/internal/pkg/report/reporter.go @@ -47,6 +47,9 @@ func NewReporter(ctx context.Context, cancel context.CancelFunc, client client.C if v := task.Context.Fields["token"].GetStringValue(); v != "" { oldnew = append(oldnew, v, "***") } + if v := task.Context.Fields["gitea_runtime_token"].GetStringValue(); v != "" { + oldnew = append(oldnew, v, "***") + } for _, v := range task.Secrets { oldnew = append(oldnew, v, "***") } @@ -111,6 +114,9 @@ func (r *Reporter) Fire(entry *log.Entry) error { for _, s := range r.state.Steps { if s.Result == runnerv1.Result_RESULT_UNSPECIFIED { s.Result = runnerv1.Result_RESULT_CANCELLED + if jobResult == runnerv1.Result_RESULT_SKIPPED { + s.Result = runnerv1.Result_RESULT_SKIPPED + } } } } @@ -418,7 +424,7 @@ func (r *Reporter) parseLogRow(entry *log.Entry) *runnerv1.LogRow { return &runnerv1.LogRow{ Time: timestamppb.New(entry.Time), - Content: content, + Content: strings.ToValidUTF8(content, "?"), } }