|
1 | 1 | package envbuilder |
2 | 2 |
|
3 | 3 | import ( |
| 4 | + "net/url" |
| 5 | + |
4 | 6 | "github.com/coder/coder/v2/codersdk" |
5 | 7 | "github.com/coder/serpent" |
6 | 8 | "github.com/go-git/go-billy/v5" |
@@ -44,6 +46,11 @@ type Options struct { |
44 | 46 | // Filesystem is the filesystem to use for all operations. |
45 | 47 | // Defaults to the host filesystem. |
46 | 48 | Filesystem billy.Filesystem |
| 49 | + // These options are specifically used when envbuilder |
| 50 | + // is invoked as part of a Coder workspace. |
| 51 | + CoderAgentURL *url.URL |
| 52 | + CoderAgentToken string |
| 53 | + CoderAgentSubsystem []string |
47 | 54 | } |
48 | 55 |
|
49 | 56 | // Generate CLI options for the envbuilder command. |
@@ -272,6 +279,28 @@ func (o *Options) CLI() serpent.OptionSet { |
272 | 279 | "is set, the specified InitCommand should check for the presence of " + |
273 | 280 | "this script and execute it after successful startup.", |
274 | 281 | }, |
| 282 | + { |
| 283 | + Flag: "coder-agent-url", |
| 284 | + Env: "CODER_AGENT_URL", |
| 285 | + Value: serpent.URLOf(o.CoderAgentURL), |
| 286 | + Description: "URL of the Coder deployment. If CODER_AGENT_TOKEN is also " + |
| 287 | + "set, logs from envbuilder will be forwarded here and will be " + |
| 288 | + "visible in the workspace build logs.", |
| 289 | + }, |
| 290 | + { |
| 291 | + Flag: "coder-agent-token", |
| 292 | + Env: "CODER_AGENT_TOKEN", |
| 293 | + Value: serpent.StringOf(&o.CoderAgentToken), |
| 294 | + Description: "Authentication token for a Coder agent. If this is set, " + |
| 295 | + "then CODER_AGENT_URL must also be set.", |
| 296 | + }, |
| 297 | + { |
| 298 | + Flag: "coder-agent-subsystem", |
| 299 | + Env: "CODER_AGENT_SUBSYSTEM", |
| 300 | + Value: serpent.StringArrayOf(&o.CoderAgentSubsystem), |
| 301 | + Description: "Coder agent subsystems to report when forwarding logs. " + |
| 302 | + "The envbuilder subsystem is always included.", |
| 303 | + }, |
275 | 304 | } |
276 | 305 | } |
277 | 306 |
|
|
0 commit comments