mirror of
https://github.com/harness/drone.git
synced 2025-04-28 22:04:44 +00:00
* Return empty summary/branch for now * Fix Lint Issues * feat: [ML-288]: API skeletons for Harness Intelligence * fix ai pipelines (#2659) * fix ai pipelines * Update pipeline name (#2658) * Update pipeline name * fix: [ML-288]: update remediation prompt and suggestions (#2652) * fix: [ML-288]: update remediation prompt and suggestions * fix: [ML-288]: update url for artifact registry (#2651) * fix: [ML-288]: update url for artifact registry * Add snippet to mark code as written by Harness Intelligence (#2628) * Add snippet to mark code as written by Harness Intelligence * Add snippet to mark code as written by Harness Intelligence (#2626) * Add snippet to mark code as written by Harness Intelligence * feat: [ML-288]: link to harness artifact registry (#2619) * some linting fixes * feat: [ML-288]: link to harness artifact registry * feat: [ML-286]: updating pipeline suggestions (#2620) * updating suggestions * feat: [ML-286]: updating pipeline suggestions * feat: [ML-288]: adding slackbot (#2603) * updating slack responses * prevent responding to any bot messages * feat: [ML-288]: adding slackbot * throw error for commit * commit stubbed * feat: [ML-286]: moving stubbed response earlier in execution (#2602) * feat: [ML-286]: moving stubbed response earlier in execution * feat: [ML-286]: adding stubbed response for analyze execution (#2600) * updating branch name * adding updated-main for analyse-execution endpoint * feat: [ML-286]: adding stubbed response for analyze execution * Update AnalyseExecutionOutput to contain multi file diff (#2592) * Create branch and commit changes on analyse * Simplify AnalyseExecutionOutput to contain only high level summary and branch * Update AnalyseExecutionOutput to contain multi file diff * updating endpoints for unscripted demo (#2594) * cleaning up code, adding suggested pipeline response * updating suggestions api * updating endpoints for unscripted demo * Stub out generate pipeline yaml
46 lines
1.3 KiB
Go
46 lines
1.3 KiB
Go
// Copyright 2023 Harness, Inc.
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
package aiagent
|
|
|
|
import (
|
|
"encoding/json"
|
|
"net/http"
|
|
|
|
"github.com/harness/gitness/app/api/controller/aiagent"
|
|
"github.com/harness/gitness/app/api/render"
|
|
)
|
|
|
|
func HandleUpdatePipeline(aiagentCtrl *aiagent.Controller) http.HandlerFunc {
|
|
return func(w http.ResponseWriter, r *http.Request) {
|
|
ctx := r.Context()
|
|
|
|
// TODO Question: how come we decode body here vs putting that logic in the request package?
|
|
in := new(aiagent.UpdatePipelineInput)
|
|
err := json.NewDecoder(r.Body).Decode(in)
|
|
if err != nil {
|
|
render.BadRequestf(ctx, w, "Invalid Request Body: %s.", err)
|
|
return
|
|
}
|
|
|
|
pipeline, err := aiagentCtrl.UpdatePipeline(ctx, in)
|
|
if err != nil {
|
|
render.TranslatedUserError(ctx, w, err)
|
|
return
|
|
}
|
|
|
|
render.JSON(w, http.StatusOK, pipeline)
|
|
}
|
|
}
|