mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
refactor: Allow provisioner jobs to be disconnected from projects (#194)
* Nest jobs under an organization * Rename project parameter to parameter schema * Update references when computing project parameters * Add files endpoint * Allow one-off project import jobs * Allow variables to be injected that are not defined by the schema * Update API to use jobs first * Fix CLI tests * Fix linting * Fix hex length for files table * Reduce memory allocation for windows
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-chi/chi/v5"
|
||||
"github.com/google/uuid"
|
||||
|
||||
"github.com/coder/coder/database"
|
||||
"github.com/coder/coder/httpapi"
|
||||
@@ -36,10 +37,16 @@ func ExtractProjectVersionParam(db database.Store) func(http.Handler) http.Handl
|
||||
})
|
||||
return
|
||||
}
|
||||
projectVersion, err := db.GetProjectVersionByProjectIDAndName(r.Context(), database.GetProjectVersionByProjectIDAndNameParams{
|
||||
ProjectID: project.ID,
|
||||
Name: projectVersionName,
|
||||
})
|
||||
var projectVersion database.ProjectVersion
|
||||
uuid, err := uuid.Parse(projectVersionName)
|
||||
if err == nil {
|
||||
projectVersion, err = db.GetProjectVersionByID(r.Context(), uuid)
|
||||
} else {
|
||||
projectVersion, err = db.GetProjectVersionByProjectIDAndName(r.Context(), database.GetProjectVersionByProjectIDAndNameParams{
|
||||
ProjectID: project.ID,
|
||||
Name: projectVersionName,
|
||||
})
|
||||
}
|
||||
if errors.Is(err, sql.ErrNoRows) {
|
||||
httpapi.Write(rw, http.StatusNotFound, httpapi.Response{
|
||||
Message: fmt.Sprintf("project version %q does not exist", projectVersionName),
|
||||
|
||||
Reference in New Issue
Block a user