refactor!: separate runtime releases from panel source

This commit is contained in:
2026-10-14 15:05:10 +08:00
parent 20635ffaec
commit a2dd6ee27d
51 changed files with 221 additions and 2017 deletions
+3 -12
View File
@@ -189,24 +189,15 @@ func (c *Client) Logs(ctx context.Context, id string) (string, error) {
return output.String(), nil
}
func (c *Client) Build(ctx context.Context, tar io.Reader, version, tag string, onLog func(string)) (string, error) {
return c.build(ctx, tar, version, tag, nil, onLog)
}
func (c *Client) BuildRelease(ctx context.Context, tar io.Reader, version, tag, releaseID, repository, commit string, onLog func(string)) (string, error) {
return c.build(ctx, tar, version, tag, map[string]string{"dsh-mgr.release": releaseID, "dsh-mgr.source": repository, "dsh-mgr.commit": commit}, onLog)
}
func (c *Client) build(ctx context.Context, tar io.Reader, version, tag string, labels map[string]string, onLog func(string)) (string, error) {
labels := map[string]string{"dsh-mgr.release": releaseID, "dsh-mgr.source": repository, "dsh-mgr.commit": commit}
args, err := json.Marshal(map[string]string{"DSH_VERSION": version})
if err != nil {
return "", err
}
query := url.Values{"t": {tag}, "buildargs": {string(args)}, "rm": {"1"}}
if labels != nil {
data, _ := json.Marshal(labels)
query.Set("labels", string(data))
}
data, _ := json.Marshal(labels)
query.Set("labels", string(data))
resp, err := c.Stream(ctx, http.MethodPost, "/build?"+query.Encode(), tar, "application/x-tar")
if err != nil {
return "", err