mirror of
https://github.com/coder/coder.git
synced 2025-07-18 14:17:22 +00:00
6
.github/workflows/coder-test-stability.yaml
vendored
6
.github/workflows/coder-test-stability.yaml
vendored
@ -14,9 +14,9 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
iterationCount:
|
iterationCount:
|
||||||
description: 'Iteration Count'
|
description: "Iteration Count"
|
||||||
required: false
|
required: false
|
||||||
default: '10'
|
default: "10"
|
||||||
|
|
||||||
# Cancel in-progress runs for pull requests when developers push
|
# Cancel in-progress runs for pull requests when developers push
|
||||||
# additional changes, and serialize builds in branches.
|
# additional changes, and serialize builds in branches.
|
||||||
@ -43,7 +43,7 @@ jobs:
|
|||||||
|
|
||||||
- uses: actions/setup-go@v2
|
- uses: actions/setup-go@v2
|
||||||
with:
|
with:
|
||||||
go-version: "^1.17"
|
go-version: "~1.18"
|
||||||
|
|
||||||
- uses: actions/cache@v3
|
- uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
|
8
.github/workflows/coder.yaml
vendored
8
.github/workflows/coder.yaml
vendored
@ -44,7 +44,7 @@ jobs:
|
|||||||
- name: golangci-lint
|
- name: golangci-lint
|
||||||
uses: golangci/golangci-lint-action@v3.1.0
|
uses: golangci/golangci-lint-action@v3.1.0
|
||||||
with:
|
with:
|
||||||
version: v1.43.0
|
version: v1.45.2
|
||||||
|
|
||||||
style-lint-typescript:
|
style-lint-typescript:
|
||||||
name: "style/lint/typescript"
|
name: "style/lint/typescript"
|
||||||
@ -201,7 +201,7 @@ jobs:
|
|||||||
|
|
||||||
- uses: actions/setup-go@v2
|
- uses: actions/setup-go@v2
|
||||||
with:
|
with:
|
||||||
go-version: "~1.17"
|
go-version: "~1.18"
|
||||||
|
|
||||||
- name: Echo Go Cache Paths
|
- name: Echo Go Cache Paths
|
||||||
id: go-cache-paths
|
id: go-cache-paths
|
||||||
@ -299,7 +299,7 @@ jobs:
|
|||||||
|
|
||||||
- uses: actions/setup-go@v2
|
- uses: actions/setup-go@v2
|
||||||
with:
|
with:
|
||||||
go-version: "~1.17"
|
go-version: "~1.18"
|
||||||
|
|
||||||
- name: Echo Go Cache Paths
|
- name: Echo Go Cache Paths
|
||||||
id: go-cache-paths
|
id: go-cache-paths
|
||||||
@ -362,7 +362,7 @@ jobs:
|
|||||||
# Go is required for uploading the test results to datadog
|
# Go is required for uploading the test results to datadog
|
||||||
- uses: actions/setup-go@v2
|
- uses: actions/setup-go@v2
|
||||||
with:
|
with:
|
||||||
go-version: "~1.17"
|
go-version: "~1.18"
|
||||||
|
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
|
2
.github/workflows/release.yaml
vendored
2
.github/workflows/release.yaml
vendored
@ -12,7 +12,7 @@ jobs:
|
|||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- uses: actions/setup-go@v2
|
- uses: actions/setup-go@v2
|
||||||
with:
|
with:
|
||||||
go-version: "^1.17"
|
go-version: "~1.18"
|
||||||
|
|
||||||
- name: Run GoReleaser
|
- name: Run GoReleaser
|
||||||
uses: goreleaser/goreleaser-action@v2.9.1
|
uses: goreleaser/goreleaser-action@v2.9.1
|
||||||
|
@ -154,7 +154,7 @@ linters-settings:
|
|||||||
- name: import-shadowing
|
- name: import-shadowing
|
||||||
- name: increment-decrement
|
- name: increment-decrement
|
||||||
- name: indent-error-flow
|
- name: indent-error-flow
|
||||||
- name: modifies-parameter
|
# - name: modifies-parameter
|
||||||
- name: modifies-value-receiver
|
- name: modifies-value-receiver
|
||||||
- name: package-comments
|
- name: package-comments
|
||||||
- name: range
|
- name: range
|
||||||
@ -185,6 +185,8 @@ linters-settings:
|
|||||||
- i
|
- i
|
||||||
- db
|
- db
|
||||||
- t
|
- t
|
||||||
|
- id
|
||||||
|
- wg
|
||||||
# Optional list of variable declarations that should be ignored completely. (defaults to empty list)
|
# Optional list of variable declarations that should be ignored completely. (defaults to empty list)
|
||||||
# Entries must be in the form of "<variable name> <type>" or "<variable name> *<type>" for
|
# Entries must be in the form of "<variable name> <type>" or "<variable name> *<type>" for
|
||||||
# variables, or "const <name>" for constants.
|
# variables, or "const <name>" for constants.
|
||||||
@ -193,6 +195,8 @@ linters-settings:
|
|||||||
- r *http.Request
|
- r *http.Request
|
||||||
- t testing.T
|
- t testing.T
|
||||||
- t testing.TB
|
- t testing.TB
|
||||||
|
- ok bool
|
||||||
|
- wg sync.WaitGroup
|
||||||
|
|
||||||
issues:
|
issues:
|
||||||
# Rules listed here: https://github.com/securego/gosec#available-rules
|
# Rules listed here: https://github.com/securego/gosec#available-rules
|
||||||
|
5
Makefile
5
Makefile
@ -88,3 +88,8 @@ site/out:
|
|||||||
# Restores GITKEEP files!
|
# Restores GITKEEP files!
|
||||||
git checkout HEAD site/out
|
git checkout HEAD site/out
|
||||||
.PHONY: site/out
|
.PHONY: site/out
|
||||||
|
|
||||||
|
lint:
|
||||||
|
@echo "--- golangci-lint"
|
||||||
|
golangci-lint run
|
||||||
|
.PHONY: lint
|
||||||
|
@ -35,12 +35,15 @@ func Select(cmd *cobra.Command, opts SelectOptions) (string, error) {
|
|||||||
Templates: &promptui.SelectTemplates{
|
Templates: &promptui.SelectTemplates{
|
||||||
FuncMap: template.FuncMap{
|
FuncMap: template.FuncMap{
|
||||||
"faint": func(value interface{}) string {
|
"faint": func(value interface{}) string {
|
||||||
|
//nolint:forcetypeassert
|
||||||
return Styles.Placeholder.Render(value.(string))
|
return Styles.Placeholder.Render(value.(string))
|
||||||
},
|
},
|
||||||
"subtle": func(value interface{}) string {
|
"subtle": func(value interface{}) string {
|
||||||
|
//nolint:forcetypeassert
|
||||||
return defaultStyles.Subtle.Render(value.(string))
|
return defaultStyles.Subtle.Render(value.(string))
|
||||||
},
|
},
|
||||||
"selected": func(value interface{}) string {
|
"selected": func(value interface{}) string {
|
||||||
|
//nolint:forcetypeassert
|
||||||
return defaultStyles.Keyword.Render("> " + value.(string))
|
return defaultStyles.Keyword.Render("> " + value.(string))
|
||||||
// return defaultStyles.SelectedMenuItem.Render("> " + value.(string))
|
// return defaultStyles.SelectedMenuItem.Render("> " + value.(string))
|
||||||
},
|
},
|
||||||
|
@ -138,5 +138,7 @@ func getFreePort() (port int, err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
defer listener.Close()
|
defer listener.Close()
|
||||||
|
// This is always a *net.TCPAddr.
|
||||||
|
// nolint:forcetypeassert
|
||||||
return listener.Addr().(*net.TCPAddr).Port, nil
|
return listener.Addr().(*net.TCPAddr).Port, nil
|
||||||
}
|
}
|
||||||
|
@ -72,6 +72,9 @@ func (p *pgPubsub) Subscribe(event string, listener Listener) (cancel func(), er
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *pgPubsub) Publish(event string, message []byte) error {
|
func (p *pgPubsub) Publish(event string, message []byte) error {
|
||||||
|
// This is safe because we are calling pq.QuoteLiteral. pg_notify doesn't
|
||||||
|
// support the first parameter being a prepared statement.
|
||||||
|
//nolint:gosec
|
||||||
_, err := p.db.ExecContext(context.Background(), `select pg_notify(`+pq.QuoteLiteral(event)+`, $1)`, message)
|
_, err := p.db.ExecContext(context.Background(), `select pg_notify(`+pq.QuoteLiteral(event)+`, $1)`, message)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("exec: %w", err)
|
return xerrors.Errorf("exec: %w", err)
|
||||||
|
@ -138,7 +138,9 @@ func (api *api) provisionerJobLogs(rw http.ResponseWriter, r *http.Request, job
|
|||||||
// See: https://canjs.com/doc/can-ndjson-stream.html
|
// See: https://canjs.com/doc/can-ndjson-stream.html
|
||||||
rw.Header().Set("Content-Type", "application/stream+json")
|
rw.Header().Set("Content-Type", "application/stream+json")
|
||||||
rw.WriteHeader(http.StatusOK)
|
rw.WriteHeader(http.StatusOK)
|
||||||
rw.(http.Flusher).Flush()
|
if flusher, ok := rw.(http.Flusher); ok {
|
||||||
|
flusher.Flush()
|
||||||
|
}
|
||||||
|
|
||||||
// The Go stdlib JSON encoder appends a newline character after message write.
|
// The Go stdlib JSON encoder appends a newline character after message write.
|
||||||
encoder := json.NewEncoder(rw)
|
encoder := json.NewEncoder(rw)
|
||||||
@ -161,7 +163,9 @@ func (api *api) provisionerJobLogs(rw http.ResponseWriter, r *http.Request, job
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
rw.(http.Flusher).Flush()
|
if flusher, ok := rw.(http.Flusher); ok {
|
||||||
|
flusher.Flush()
|
||||||
|
}
|
||||||
case <-ticker.C:
|
case <-ticker.C:
|
||||||
job, err := api.Database.GetProvisionerJobByID(r.Context(), job.ID)
|
job, err := api.Database.GetProvisionerJobByID(r.Context(), job.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -94,6 +94,7 @@ func readBodyAsError(res *http.Response) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//nolint:varnamelen
|
||||||
var m httpapi.Response
|
var m httpapi.Response
|
||||||
err := json.NewDecoder(res.Body).Decode(&m)
|
err := json.NewDecoder(res.Body).Decode(&m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
2
go.mod
2
go.mod
@ -1,6 +1,6 @@
|
|||||||
module github.com/coder/coder
|
module github.com/coder/coder
|
||||||
|
|
||||||
go 1.17
|
go 1.18
|
||||||
|
|
||||||
// Required until https://github.com/manifoldco/promptui/pull/169 is merged.
|
// Required until https://github.com/manifoldco/promptui/pull/169 is merged.
|
||||||
replace github.com/manifoldco/promptui => github.com/kylecarbs/promptui v0.8.1-0.20201231190244-d8f2159af2b2
|
replace github.com/manifoldco/promptui => github.com/kylecarbs/promptui v0.8.1-0.20201231190244-d8f2159af2b2
|
||||||
|
@ -192,6 +192,7 @@ func TestConn(t *testing.T) {
|
|||||||
_ = server.Serve(srv)
|
_ = server.Serve(srv)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
//nolint:forcetypeassert
|
||||||
defaultTransport := http.DefaultTransport.(*http.Transport).Clone()
|
defaultTransport := http.DefaultTransport.(*http.Transport).Clone()
|
||||||
var cch *peer.Channel
|
var cch *peer.Channel
|
||||||
defaultTransport.DialContext = func(ctx context.Context, network, addr string) (net.Conn, error) {
|
defaultTransport.DialContext = func(ctx context.Context, network, addr string) (net.Conn, error) {
|
||||||
|
Reference in New Issue
Block a user