feat: add support for coder_git_auth data source (#6334)

* Add git auth providers schema

* Pipe git auth providers to the schema

* Add git auth providers to the API

* Add gitauth endpoint to query authenticated state

* Add endpoint to query git state

* Use BroadcastChannel to automatically authenticate with Git

* Add error validation for submitting the create workspace form

* Fix panic on template dry-run

* Add tests for the template version Git auth endpoint

* Show error if no gitauth is configured

* Add gitauth to cliui

* Fix unused method receiver

* Fix linting errors

* Fix dbauthz querier test

* Fix make gen

* Add JavaScript test for git auth

* Fix bad error message

* Fix provisionerd test race

See https://github.com/coder/coder/actions/runs/4277960646/jobs/7447232814

* Fix requested changes

* Add comment to CreateWorkspacePageView
This commit is contained in:
Kyle Carberry
2023-02-27 10:18:19 -06:00
committed by GitHub
parent 3d8b77d6f1
commit 7f226d4f90
64 changed files with 2788 additions and 861 deletions

70
coderd/apidoc/docs.go generated
View File

@ -2485,6 +2485,44 @@ const docTemplate = `{
}
}
},
"/templateversions/{templateversion}/gitauth": {
"get": {
"security": [
{
"CoderSessionToken": []
}
],
"produces": [
"application/json"
],
"tags": [
"Templates"
],
"summary": "Get git auth by template version",
"operationId": "get-git-auth-by-template-version",
"parameters": [
{
"type": "string",
"format": "uuid",
"description": "Template version ID",
"name": "templateversion",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/codersdk.TemplateVersionGitAuth"
}
}
}
}
}
},
"/templateversions/{templateversion}/logs": {
"get": {
"security": [
@ -6612,6 +6650,21 @@ const docTemplate = `{
}
}
},
"codersdk.GitProvider": {
"type": "string",
"enum": [
"azure-devops",
"github",
"gitlab",
"bitbucket"
],
"x-enum-varnames": [
"GitProviderAzureDevops",
"GitProviderGitHub",
"GitProviderGitLab",
"GitProviderBitBucket"
]
},
"codersdk.GitSSHKey": {
"type": "object",
"properties": {
@ -7717,6 +7770,23 @@ const docTemplate = `{
}
}
},
"codersdk.TemplateVersionGitAuth": {
"type": "object",
"properties": {
"authenticate_url": {
"type": "string"
},
"authenticated": {
"type": "boolean"
},
"id": {
"type": "string"
},
"type": {
"$ref": "#/definitions/codersdk.GitProvider"
}
}
},
"codersdk.TemplateVersionParameter": {
"type": "object",
"properties": {