From 2e2c0400c850bb5c1b2f0d7234b853ae944ea914 Mon Sep 17 00:00:00 2001 From: Tomasz Duda Date: Tue, 20 Jun 2023 01:57:21 +0000 Subject: [PATCH] add --gitea-instance (#245) add --gitea-instance to let user specify address of endpoint of exec Related to https://gitea.com/gitea/act/pulls/68. Both can be merged independently though. Reviewed-on: https://gitea.com/gitea/act_runner/pulls/245 Reviewed-by: Jason Song Co-authored-by: Tomasz Duda Co-committed-by: Tomasz Duda --- internal/app/cmd/exec.go | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/internal/app/cmd/exec.go b/internal/app/cmd/exec.go index b85b67b..8764a44 100644 --- a/internal/app/cmd/exec.go +++ b/internal/app/cmd/exec.go @@ -58,6 +58,7 @@ type executeArgs struct { image string cacheHandler *artifactcache.Handler network string + githubInstance string } // WorkflowsPath returns path to workflow file(s) @@ -392,15 +393,15 @@ func runExec(ctx context.Context, execArgs *executeArgs) func(cmd *cobra.Command ContainerArchitecture: execArgs.containerArchitecture, ContainerDaemonSocket: execArgs.containerDaemonSocket, UseGitIgnore: execArgs.useGitIgnore, - // GitHubInstance: t.client.Address(), - ContainerCapAdd: execArgs.containerCapAdd, - ContainerCapDrop: execArgs.containerCapDrop, - ContainerOptions: execArgs.containerOptions, - AutoRemove: true, - ArtifactServerPath: execArgs.artifactServerPath, - ArtifactServerPort: execArgs.artifactServerPort, - ArtifactServerAddr: execArgs.artifactServerAddr, - NoSkipCheckout: execArgs.noSkipCheckout, + GitHubInstance: execArgs.githubInstance, + ContainerCapAdd: execArgs.containerCapAdd, + ContainerCapDrop: execArgs.containerCapDrop, + ContainerOptions: execArgs.containerOptions, + AutoRemove: true, + ArtifactServerPath: execArgs.artifactServerPath, + ArtifactServerPort: execArgs.artifactServerPort, + ArtifactServerAddr: execArgs.artifactServerAddr, + NoSkipCheckout: execArgs.noSkipCheckout, // PresetGitHubContext: preset, // EventJSON: string(eventJSON), ContainerNamePrefix: fmt.Sprintf("GITEA-ACTIONS-TASK-%s", eventName), @@ -477,6 +478,7 @@ func loadExecCmd(ctx context.Context) *cobra.Command { 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.network, "network", "", "", "Specify the network to which the container will connect") + execCmd.PersistentFlags().StringVarP(&execArg.githubInstance, "gitea-instance", "", "", "Gitea instance to use.") return execCmd }