chore(cli): replace clibase with external coder/serpent (#12252)

This commit is contained in:
Ammar Bandukwala
2024-03-15 11:24:38 -05:00
committed by GitHub
parent bed2545636
commit 496232446d
185 changed files with 3770 additions and 7221 deletions

418
coderd/apidoc/docs.go generated
View File

@ -8028,201 +8028,6 @@ const docTemplate = `{
}
}
},
"clibase.Annotations": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"clibase.Group": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"name": {
"type": "string"
},
"parent": {
"$ref": "#/definitions/clibase.Group"
},
"yaml": {
"type": "string"
}
}
},
"clibase.HostPort": {
"type": "object",
"properties": {
"host": {
"type": "string"
},
"port": {
"type": "string"
}
}
},
"clibase.Option": {
"type": "object",
"properties": {
"annotations": {
"description": "Annotations enable extensions to clibase higher up in the stack. It's useful for\nhelp formatting and documentation generation.",
"allOf": [
{
"$ref": "#/definitions/clibase.Annotations"
}
]
},
"default": {
"description": "Default is parsed into Value if set.",
"type": "string"
},
"description": {
"type": "string"
},
"env": {
"description": "Env is the environment variable used to configure this option. If unset,\nenvironment configuring is disabled.",
"type": "string"
},
"flag": {
"description": "Flag is the long name of the flag used to configure this option. If unset,\nflag configuring is disabled.",
"type": "string"
},
"flag_shorthand": {
"description": "FlagShorthand is the one-character shorthand for the flag. If unset, no\nshorthand is used.",
"type": "string"
},
"group": {
"description": "Group is a group hierarchy that helps organize this option in help, configs\nand other documentation.",
"allOf": [
{
"$ref": "#/definitions/clibase.Group"
}
]
},
"hidden": {
"type": "boolean"
},
"name": {
"type": "string"
},
"required": {
"description": "Required means this value must be set by some means. It requires\n` + "`" + `ValueSource != ValueSourceNone` + "`" + `\nIf ` + "`" + `Default` + "`" + ` is set, then ` + "`" + `Required` + "`" + ` is ignored.",
"type": "boolean"
},
"use_instead": {
"description": "UseInstead is a list of options that should be used instead of this one.\nThe field is used to generate a deprecation warning.",
"type": "array",
"items": {
"$ref": "#/definitions/clibase.Option"
}
},
"value": {
"description": "Value includes the types listed in values.go."
},
"value_source": {
"$ref": "#/definitions/clibase.ValueSource"
},
"yaml": {
"description": "YAML is the YAML key used to configure this option. If unset, YAML\nconfiguring is disabled.",
"type": "string"
}
}
},
"clibase.Regexp": {
"type": "object"
},
"clibase.Struct-array_codersdk_ExternalAuthConfig": {
"type": "object",
"properties": {
"value": {
"type": "array",
"items": {
"$ref": "#/definitions/codersdk.ExternalAuthConfig"
}
}
}
},
"clibase.Struct-array_codersdk_LinkConfig": {
"type": "object",
"properties": {
"value": {
"type": "array",
"items": {
"$ref": "#/definitions/codersdk.LinkConfig"
}
}
}
},
"clibase.URL": {
"type": "object",
"properties": {
"forceQuery": {
"description": "append a query ('?') even if RawQuery is empty",
"type": "boolean"
},
"fragment": {
"description": "fragment for references, without '#'",
"type": "string"
},
"host": {
"description": "host or host:port",
"type": "string"
},
"omitHost": {
"description": "do not emit empty host (authority)",
"type": "boolean"
},
"opaque": {
"description": "encoded opaque data",
"type": "string"
},
"path": {
"description": "path (relative paths may omit leading slash)",
"type": "string"
},
"rawFragment": {
"description": "encoded fragment hint (see EscapedFragment method)",
"type": "string"
},
"rawPath": {
"description": "encoded path hint (see EscapedPath method)",
"type": "string"
},
"rawQuery": {
"description": "encoded query values, without '?'",
"type": "string"
},
"scheme": {
"type": "string"
},
"user": {
"description": "username and password information",
"allOf": [
{
"$ref": "#/definitions/url.Userinfo"
}
]
}
}
},
"clibase.ValueSource": {
"type": "string",
"enum": [
"",
"flag",
"env",
"yaml",
"default"
],
"x-enum-varnames": [
"ValueSourceNone",
"ValueSourceFlag",
"ValueSourceEnv",
"ValueSourceYAML",
"ValueSourceDefault"
]
},
"coderd.SCIMUser": {
"type": "object",
"properties": {
@ -9536,7 +9341,7 @@ const docTemplate = `{
"type": "string"
},
"relay_url": {
"$ref": "#/definitions/clibase.URL"
"$ref": "#/definitions/serpent.URL"
},
"stun_addresses": {
"type": "array",
@ -9625,7 +9430,7 @@ const docTemplate = `{
"options": {
"type": "array",
"items": {
"$ref": "#/definitions/clibase.Option"
"$ref": "#/definitions/serpent.Option"
}
}
}
@ -9660,18 +9465,18 @@ const docTemplate = `{
"type": "object",
"properties": {
"access_url": {
"$ref": "#/definitions/clibase.URL"
"$ref": "#/definitions/serpent.URL"
},
"address": {
"description": "DEPRECATED: Use HTTPAddress or TLS.Address instead.",
"allOf": [
{
"$ref": "#/definitions/clibase.HostPort"
"$ref": "#/definitions/serpent.HostPort"
}
]
},
"agent_fallback_troubleshooting_url": {
"$ref": "#/definitions/clibase.URL"
"$ref": "#/definitions/serpent.URL"
},
"agent_stat_refresh_interval": {
"type": "integer"
@ -9716,7 +9521,7 @@ const docTemplate = `{
"type": "boolean"
},
"docs_url": {
"$ref": "#/definitions/clibase.URL"
"$ref": "#/definitions/serpent.URL"
},
"enable_terraform_debug_mode": {
"type": "boolean"
@ -9728,7 +9533,7 @@ const docTemplate = `{
}
},
"external_auth": {
"$ref": "#/definitions/clibase.Struct-array_codersdk_ExternalAuthConfig"
"$ref": "#/definitions/serpent.Struct-array_codersdk_ExternalAuthConfig"
},
"external_token_encryption_keys": {
"type": "array",
@ -10747,13 +10552,13 @@ const docTemplate = `{
"type": "object"
},
"group_regex_filter": {
"$ref": "#/definitions/clibase.Regexp"
"$ref": "#/definitions/serpent.Regexp"
},
"groups_field": {
"type": "string"
},
"icon_url": {
"$ref": "#/definitions/clibase.URL"
"$ref": "#/definitions/serpent.URL"
},
"ignore_email_verified": {
"type": "boolean"
@ -10939,7 +10744,7 @@ const docTemplate = `{
"type": "object",
"properties": {
"address": {
"$ref": "#/definitions/clibase.HostPort"
"$ref": "#/definitions/serpent.HostPort"
},
"enable": {
"type": "boolean"
@ -10950,7 +10755,7 @@ const docTemplate = `{
"type": "object",
"properties": {
"address": {
"$ref": "#/definitions/clibase.HostPort"
"$ref": "#/definitions/serpent.HostPort"
},
"aggregate_agent_stats_by": {
"type": "array",
@ -11642,7 +11447,7 @@ const docTemplate = `{
"type": "object",
"properties": {
"links": {
"$ref": "#/definitions/clibase.Struct-array_codersdk_LinkConfig"
"$ref": "#/definitions/serpent.Struct-array_codersdk_LinkConfig"
}
}
},
@ -11658,7 +11463,7 @@ const docTemplate = `{
"type": "object",
"properties": {
"address": {
"$ref": "#/definitions/clibase.HostPort"
"$ref": "#/definitions/serpent.HostPort"
},
"allow_insecure_ciphers": {
"type": "boolean"
@ -11714,7 +11519,7 @@ const docTemplate = `{
"type": "boolean"
},
"url": {
"$ref": "#/definitions/clibase.URL"
"$ref": "#/definitions/serpent.URL"
}
}
},
@ -14240,6 +14045,201 @@ const docTemplate = `{
}
}
},
"serpent.Annotations": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"serpent.Group": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"name": {
"type": "string"
},
"parent": {
"$ref": "#/definitions/serpent.Group"
},
"yaml": {
"type": "string"
}
}
},
"serpent.HostPort": {
"type": "object",
"properties": {
"host": {
"type": "string"
},
"port": {
"type": "string"
}
}
},
"serpent.Option": {
"type": "object",
"properties": {
"annotations": {
"description": "Annotations enable extensions to serpent higher up in the stack. It's useful for\nhelp formatting and documentation generation.",
"allOf": [
{
"$ref": "#/definitions/serpent.Annotations"
}
]
},
"default": {
"description": "Default is parsed into Value if set.",
"type": "string"
},
"description": {
"type": "string"
},
"env": {
"description": "Env is the environment variable used to configure this option. If unset,\nenvironment configuring is disabled.",
"type": "string"
},
"flag": {
"description": "Flag is the long name of the flag used to configure this option. If unset,\nflag configuring is disabled.",
"type": "string"
},
"flag_shorthand": {
"description": "FlagShorthand is the one-character shorthand for the flag. If unset, no\nshorthand is used.",
"type": "string"
},
"group": {
"description": "Group is a group hierarchy that helps organize this option in help, configs\nand other documentation.",
"allOf": [
{
"$ref": "#/definitions/serpent.Group"
}
]
},
"hidden": {
"type": "boolean"
},
"name": {
"type": "string"
},
"required": {
"description": "Required means this value must be set by some means. It requires\n` + "`" + `ValueSource != ValueSourceNone` + "`" + `\nIf ` + "`" + `Default` + "`" + ` is set, then ` + "`" + `Required` + "`" + ` is ignored.",
"type": "boolean"
},
"use_instead": {
"description": "UseInstead is a list of options that should be used instead of this one.\nThe field is used to generate a deprecation warning.",
"type": "array",
"items": {
"$ref": "#/definitions/serpent.Option"
}
},
"value": {
"description": "Value includes the types listed in values.go."
},
"value_source": {
"$ref": "#/definitions/serpent.ValueSource"
},
"yaml": {
"description": "YAML is the YAML key used to configure this option. If unset, YAML\nconfiguring is disabled.",
"type": "string"
}
}
},
"serpent.Regexp": {
"type": "object"
},
"serpent.Struct-array_codersdk_ExternalAuthConfig": {
"type": "object",
"properties": {
"value": {
"type": "array",
"items": {
"$ref": "#/definitions/codersdk.ExternalAuthConfig"
}
}
}
},
"serpent.Struct-array_codersdk_LinkConfig": {
"type": "object",
"properties": {
"value": {
"type": "array",
"items": {
"$ref": "#/definitions/codersdk.LinkConfig"
}
}
}
},
"serpent.URL": {
"type": "object",
"properties": {
"forceQuery": {
"description": "append a query ('?') even if RawQuery is empty",
"type": "boolean"
},
"fragment": {
"description": "fragment for references, without '#'",
"type": "string"
},
"host": {
"description": "host or host:port",
"type": "string"
},
"omitHost": {
"description": "do not emit empty host (authority)",
"type": "boolean"
},
"opaque": {
"description": "encoded opaque data",
"type": "string"
},
"path": {
"description": "path (relative paths may omit leading slash)",
"type": "string"
},
"rawFragment": {
"description": "encoded fragment hint (see EscapedFragment method)",
"type": "string"
},
"rawPath": {
"description": "encoded path hint (see EscapedPath method)",
"type": "string"
},
"rawQuery": {
"description": "encoded query values, without '?'",
"type": "string"
},
"scheme": {
"type": "string"
},
"user": {
"description": "username and password information",
"allOf": [
{
"$ref": "#/definitions/url.Userinfo"
}
]
}
}
},
"serpent.ValueSource": {
"type": "string",
"enum": [
"",
"flag",
"env",
"yaml",
"default"
],
"x-enum-varnames": [
"ValueSourceNone",
"ValueSourceFlag",
"ValueSourceEnv",
"ValueSourceYAML",
"ValueSourceDefault"
]
},
"tailcfg.DERPHomeParams": {
"type": "object",
"properties": {

View File

@ -7119,195 +7119,6 @@
}
}
},
"clibase.Annotations": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"clibase.Group": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"name": {
"type": "string"
},
"parent": {
"$ref": "#/definitions/clibase.Group"
},
"yaml": {
"type": "string"
}
}
},
"clibase.HostPort": {
"type": "object",
"properties": {
"host": {
"type": "string"
},
"port": {
"type": "string"
}
}
},
"clibase.Option": {
"type": "object",
"properties": {
"annotations": {
"description": "Annotations enable extensions to clibase higher up in the stack. It's useful for\nhelp formatting and documentation generation.",
"allOf": [
{
"$ref": "#/definitions/clibase.Annotations"
}
]
},
"default": {
"description": "Default is parsed into Value if set.",
"type": "string"
},
"description": {
"type": "string"
},
"env": {
"description": "Env is the environment variable used to configure this option. If unset,\nenvironment configuring is disabled.",
"type": "string"
},
"flag": {
"description": "Flag is the long name of the flag used to configure this option. If unset,\nflag configuring is disabled.",
"type": "string"
},
"flag_shorthand": {
"description": "FlagShorthand is the one-character shorthand for the flag. If unset, no\nshorthand is used.",
"type": "string"
},
"group": {
"description": "Group is a group hierarchy that helps organize this option in help, configs\nand other documentation.",
"allOf": [
{
"$ref": "#/definitions/clibase.Group"
}
]
},
"hidden": {
"type": "boolean"
},
"name": {
"type": "string"
},
"required": {
"description": "Required means this value must be set by some means. It requires\n`ValueSource != ValueSourceNone`\nIf `Default` is set, then `Required` is ignored.",
"type": "boolean"
},
"use_instead": {
"description": "UseInstead is a list of options that should be used instead of this one.\nThe field is used to generate a deprecation warning.",
"type": "array",
"items": {
"$ref": "#/definitions/clibase.Option"
}
},
"value": {
"description": "Value includes the types listed in values.go."
},
"value_source": {
"$ref": "#/definitions/clibase.ValueSource"
},
"yaml": {
"description": "YAML is the YAML key used to configure this option. If unset, YAML\nconfiguring is disabled.",
"type": "string"
}
}
},
"clibase.Regexp": {
"type": "object"
},
"clibase.Struct-array_codersdk_ExternalAuthConfig": {
"type": "object",
"properties": {
"value": {
"type": "array",
"items": {
"$ref": "#/definitions/codersdk.ExternalAuthConfig"
}
}
}
},
"clibase.Struct-array_codersdk_LinkConfig": {
"type": "object",
"properties": {
"value": {
"type": "array",
"items": {
"$ref": "#/definitions/codersdk.LinkConfig"
}
}
}
},
"clibase.URL": {
"type": "object",
"properties": {
"forceQuery": {
"description": "append a query ('?') even if RawQuery is empty",
"type": "boolean"
},
"fragment": {
"description": "fragment for references, without '#'",
"type": "string"
},
"host": {
"description": "host or host:port",
"type": "string"
},
"omitHost": {
"description": "do not emit empty host (authority)",
"type": "boolean"
},
"opaque": {
"description": "encoded opaque data",
"type": "string"
},
"path": {
"description": "path (relative paths may omit leading slash)",
"type": "string"
},
"rawFragment": {
"description": "encoded fragment hint (see EscapedFragment method)",
"type": "string"
},
"rawPath": {
"description": "encoded path hint (see EscapedPath method)",
"type": "string"
},
"rawQuery": {
"description": "encoded query values, without '?'",
"type": "string"
},
"scheme": {
"type": "string"
},
"user": {
"description": "username and password information",
"allOf": [
{
"$ref": "#/definitions/url.Userinfo"
}
]
}
}
},
"clibase.ValueSource": {
"type": "string",
"enum": ["", "flag", "env", "yaml", "default"],
"x-enum-varnames": [
"ValueSourceNone",
"ValueSourceFlag",
"ValueSourceEnv",
"ValueSourceYAML",
"ValueSourceDefault"
]
},
"coderd.SCIMUser": {
"type": "object",
"properties": {
@ -8521,7 +8332,7 @@
"type": "string"
},
"relay_url": {
"$ref": "#/definitions/clibase.URL"
"$ref": "#/definitions/serpent.URL"
},
"stun_addresses": {
"type": "array",
@ -8606,7 +8417,7 @@
"options": {
"type": "array",
"items": {
"$ref": "#/definitions/clibase.Option"
"$ref": "#/definitions/serpent.Option"
}
}
}
@ -8641,18 +8452,18 @@
"type": "object",
"properties": {
"access_url": {
"$ref": "#/definitions/clibase.URL"
"$ref": "#/definitions/serpent.URL"
},
"address": {
"description": "DEPRECATED: Use HTTPAddress or TLS.Address instead.",
"allOf": [
{
"$ref": "#/definitions/clibase.HostPort"
"$ref": "#/definitions/serpent.HostPort"
}
]
},
"agent_fallback_troubleshooting_url": {
"$ref": "#/definitions/clibase.URL"
"$ref": "#/definitions/serpent.URL"
},
"agent_stat_refresh_interval": {
"type": "integer"
@ -8697,7 +8508,7 @@
"type": "boolean"
},
"docs_url": {
"$ref": "#/definitions/clibase.URL"
"$ref": "#/definitions/serpent.URL"
},
"enable_terraform_debug_mode": {
"type": "boolean"
@ -8709,7 +8520,7 @@
}
},
"external_auth": {
"$ref": "#/definitions/clibase.Struct-array_codersdk_ExternalAuthConfig"
"$ref": "#/definitions/serpent.Struct-array_codersdk_ExternalAuthConfig"
},
"external_token_encryption_keys": {
"type": "array",
@ -9669,13 +9480,13 @@
"type": "object"
},
"group_regex_filter": {
"$ref": "#/definitions/clibase.Regexp"
"$ref": "#/definitions/serpent.Regexp"
},
"groups_field": {
"type": "string"
},
"icon_url": {
"$ref": "#/definitions/clibase.URL"
"$ref": "#/definitions/serpent.URL"
},
"ignore_email_verified": {
"type": "boolean"
@ -9847,7 +9658,7 @@
"type": "object",
"properties": {
"address": {
"$ref": "#/definitions/clibase.HostPort"
"$ref": "#/definitions/serpent.HostPort"
},
"enable": {
"type": "boolean"
@ -9858,7 +9669,7 @@
"type": "object",
"properties": {
"address": {
"$ref": "#/definitions/clibase.HostPort"
"$ref": "#/definitions/serpent.HostPort"
},
"aggregate_agent_stats_by": {
"type": "array",
@ -10516,7 +10327,7 @@
"type": "object",
"properties": {
"links": {
"$ref": "#/definitions/clibase.Struct-array_codersdk_LinkConfig"
"$ref": "#/definitions/serpent.Struct-array_codersdk_LinkConfig"
}
}
},
@ -10532,7 +10343,7 @@
"type": "object",
"properties": {
"address": {
"$ref": "#/definitions/clibase.HostPort"
"$ref": "#/definitions/serpent.HostPort"
},
"allow_insecure_ciphers": {
"type": "boolean"
@ -10588,7 +10399,7 @@
"type": "boolean"
},
"url": {
"$ref": "#/definitions/clibase.URL"
"$ref": "#/definitions/serpent.URL"
}
}
},
@ -12972,6 +12783,195 @@
}
}
},
"serpent.Annotations": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"serpent.Group": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"name": {
"type": "string"
},
"parent": {
"$ref": "#/definitions/serpent.Group"
},
"yaml": {
"type": "string"
}
}
},
"serpent.HostPort": {
"type": "object",
"properties": {
"host": {
"type": "string"
},
"port": {
"type": "string"
}
}
},
"serpent.Option": {
"type": "object",
"properties": {
"annotations": {
"description": "Annotations enable extensions to serpent higher up in the stack. It's useful for\nhelp formatting and documentation generation.",
"allOf": [
{
"$ref": "#/definitions/serpent.Annotations"
}
]
},
"default": {
"description": "Default is parsed into Value if set.",
"type": "string"
},
"description": {
"type": "string"
},
"env": {
"description": "Env is the environment variable used to configure this option. If unset,\nenvironment configuring is disabled.",
"type": "string"
},
"flag": {
"description": "Flag is the long name of the flag used to configure this option. If unset,\nflag configuring is disabled.",
"type": "string"
},
"flag_shorthand": {
"description": "FlagShorthand is the one-character shorthand for the flag. If unset, no\nshorthand is used.",
"type": "string"
},
"group": {
"description": "Group is a group hierarchy that helps organize this option in help, configs\nand other documentation.",
"allOf": [
{
"$ref": "#/definitions/serpent.Group"
}
]
},
"hidden": {
"type": "boolean"
},
"name": {
"type": "string"
},
"required": {
"description": "Required means this value must be set by some means. It requires\n`ValueSource != ValueSourceNone`\nIf `Default` is set, then `Required` is ignored.",
"type": "boolean"
},
"use_instead": {
"description": "UseInstead is a list of options that should be used instead of this one.\nThe field is used to generate a deprecation warning.",
"type": "array",
"items": {
"$ref": "#/definitions/serpent.Option"
}
},
"value": {
"description": "Value includes the types listed in values.go."
},
"value_source": {
"$ref": "#/definitions/serpent.ValueSource"
},
"yaml": {
"description": "YAML is the YAML key used to configure this option. If unset, YAML\nconfiguring is disabled.",
"type": "string"
}
}
},
"serpent.Regexp": {
"type": "object"
},
"serpent.Struct-array_codersdk_ExternalAuthConfig": {
"type": "object",
"properties": {
"value": {
"type": "array",
"items": {
"$ref": "#/definitions/codersdk.ExternalAuthConfig"
}
}
}
},
"serpent.Struct-array_codersdk_LinkConfig": {
"type": "object",
"properties": {
"value": {
"type": "array",
"items": {
"$ref": "#/definitions/codersdk.LinkConfig"
}
}
}
},
"serpent.URL": {
"type": "object",
"properties": {
"forceQuery": {
"description": "append a query ('?') even if RawQuery is empty",
"type": "boolean"
},
"fragment": {
"description": "fragment for references, without '#'",
"type": "string"
},
"host": {
"description": "host or host:port",
"type": "string"
},
"omitHost": {
"description": "do not emit empty host (authority)",
"type": "boolean"
},
"opaque": {
"description": "encoded opaque data",
"type": "string"
},
"path": {
"description": "path (relative paths may omit leading slash)",
"type": "string"
},
"rawFragment": {
"description": "encoded fragment hint (see EscapedFragment method)",
"type": "string"
},
"rawPath": {
"description": "encoded path hint (see EscapedPath method)",
"type": "string"
},
"rawQuery": {
"description": "encoded query values, without '?'",
"type": "string"
},
"scheme": {
"type": "string"
},
"user": {
"description": "username and password information",
"allOf": [
{
"$ref": "#/definitions/url.Userinfo"
}
]
}
}
},
"serpent.ValueSource": {
"type": "string",
"enum": ["", "flag", "env", "yaml", "default"],
"x-enum-varnames": [
"ValueSourceNone",
"ValueSourceFlag",
"ValueSourceEnv",
"ValueSourceYAML",
"ValueSourceDefault"
]
},
"tailcfg.DERPHomeParams": {
"type": "object",
"properties": {

View File

@ -10,7 +10,6 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/coder/coder/v2/cli/clibase"
"github.com/coder/coder/v2/coderd/audit"
"github.com/coder/coder/v2/coderd/coderdtest"
"github.com/coder/coder/v2/coderd/database"
@ -18,6 +17,7 @@ import (
"github.com/coder/coder/v2/coderd/database/dbtime"
"github.com/coder/coder/v2/codersdk"
"github.com/coder/coder/v2/testutil"
"github.com/coder/serpent"
)
func TestTokenCRUD(t *testing.T) {
@ -125,7 +125,7 @@ func TestTokenUserSetMaxLifetime(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
defer cancel()
dc := coderdtest.DeploymentValues(t)
dc.MaxTokenLifetime = clibase.Duration(time.Hour * 24 * 7)
dc.MaxTokenLifetime = serpent.Duration(time.Hour * 24 * 7)
client := coderdtest.New(t, &coderdtest.Options{
DeploymentValues: dc,
})
@ -165,7 +165,7 @@ func TestSessionExpiry(t *testing.T) {
//
// We don't support updating the deployment config after startup, but for
// this test it works because we don't copy the value (and we use pointers).
dc.SessionDuration = clibase.Duration(time.Second)
dc.SessionDuration = serpent.Duration(time.Second)
userClient, _ := coderdtest.CreateAnotherUser(t, adminClient, adminUser.OrganizationID)

View File

@ -40,7 +40,6 @@ import (
agentproto "github.com/coder/coder/v2/agent/proto"
"github.com/coder/coder/v2/buildinfo"
"github.com/coder/coder/v2/cli/clibase"
_ "github.com/coder/coder/v2/coderd/apidoc" // Used for swagger docs.
"github.com/coder/coder/v2/coderd/appearance"
"github.com/coder/coder/v2/coderd/audit"
@ -73,6 +72,7 @@ import (
"github.com/coder/coder/v2/provisionersdk"
"github.com/coder/coder/v2/site"
"github.com/coder/coder/v2/tailnet"
"github.com/coder/serpent"
)
// We must only ever instantiate one httpSwagger.Handler because of a data race
@ -169,7 +169,7 @@ type Options struct {
// contextual information about how the values were set.
// Do not use DeploymentOptions to retrieve values, use DeploymentValues instead.
// All secrets values are stripped.
DeploymentOptions clibase.OptionSet
DeploymentOptions serpent.OptionSet
UpdateCheckOptions *updatecheck.Options // Set non-nil to enable update checking.
// SSHConfig is the response clients use to configure config-ssh locally.

View File

@ -25,7 +25,6 @@ import (
"cdr.dev/slog/sloggers/slogtest"
"github.com/coder/coder/v2/buildinfo"
"github.com/coder/coder/v2/cli/clibase"
"github.com/coder/coder/v2/coderd/audit"
"github.com/coder/coder/v2/coderd/database"
"github.com/coder/coder/v2/coderd/database/dbgen"
@ -42,6 +41,7 @@ import (
"github.com/coder/coder/v2/provisionersdk"
sdkproto "github.com/coder/coder/v2/provisionersdk/proto"
"github.com/coder/coder/v2/testutil"
"github.com/coder/serpent"
)
func mockAuditor() *atomic.Pointer[audit.Auditor] {
@ -171,7 +171,7 @@ func TestAcquireJob(t *testing.T) {
// Set the max session token lifetime so we can assert we
// create an API key with an expiration within the bounds of the
// deployment config.
dv := &codersdk.DeploymentValues{MaxTokenLifetime: clibase.Duration(time.Hour)}
dv := &codersdk.DeploymentValues{MaxTokenLifetime: serpent.Duration(time.Hour)}
gitAuthProvider := &sdkproto.ExternalAuthProviderResource{
Id: "github",
}

View File

@ -10,6 +10,7 @@ import (
"github.com/coder/coder/v2/coderd"
"github.com/coder/coder/v2/coderd/coderdtest/oidctest"
"github.com/coder/serpent"
"github.com/golang-jwt/jwt/v4"
"github.com/google/uuid"
@ -18,7 +19,6 @@ import (
"golang.org/x/exp/slices"
"golang.org/x/sync/errgroup"
"github.com/coder/coder/v2/cli/clibase"
"github.com/coder/coder/v2/coderd/audit"
"github.com/coder/coder/v2/coderd/coderdtest"
"github.com/coder/coder/v2/coderd/database"
@ -218,7 +218,7 @@ func TestPostLogin(t *testing.T) {
})
require.NoError(t, err)
dc.DisablePasswordAuth = clibase.Bool(true)
dc.DisablePasswordAuth = serpent.Bool(true)
userClient := codersdk.New(client.URL)
_, err = userClient.LoginWithPassword(ctx, codersdk.LoginWithPasswordRequest{

View File

@ -9,7 +9,6 @@ import (
"github.com/stretchr/testify/require"
"github.com/coder/coder/v2/cli/clibase"
"github.com/coder/coder/v2/coderd/coderdtest"
"github.com/coder/coder/v2/coderd/database"
"github.com/coder/coder/v2/coderd/database/dbgen"
@ -19,6 +18,7 @@ import (
"github.com/coder/coder/v2/coderd/workspaceapps/apptest"
"github.com/coder/coder/v2/codersdk"
"github.com/coder/coder/v2/testutil"
"github.com/coder/serpent"
)
func TestGetAppHost(t *testing.T) {
@ -254,9 +254,9 @@ func TestWorkspaceApps(t *testing.T) {
apptest.Run(t, true, func(t *testing.T, opts *apptest.DeploymentOptions) *apptest.Deployment {
deploymentValues := coderdtest.DeploymentValues(t)
deploymentValues.DisablePathApps = clibase.Bool(opts.DisablePathApps)
deploymentValues.Dangerous.AllowPathAppSharing = clibase.Bool(opts.DangerousAllowPathAppSharing)
deploymentValues.Dangerous.AllowPathAppSiteOwnerAccess = clibase.Bool(opts.DangerousAllowPathAppSiteOwnerAccess)
deploymentValues.DisablePathApps = serpent.Bool(opts.DisablePathApps)
deploymentValues.Dangerous.AllowPathAppSharing = serpent.Bool(opts.DangerousAllowPathAppSharing)
deploymentValues.Dangerous.AllowPathAppSiteOwnerAccess = serpent.Bool(opts.DangerousAllowPathAppSiteOwnerAccess)
deploymentValues.Experiments = append(deploymentValues.Experiments, string(codersdk.ExperimentSharedPorts))
if opts.DisableSubdomainApps {