mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-30 08:06:52 +02:00
fix route for proc logs
This commit is contained in:
parent
f43e1e6c33
commit
7d245e7b27
20
.drone.yml
20
.drone.yml
@ -46,16 +46,6 @@ pipeline:
|
||||
branch: master
|
||||
event: push
|
||||
|
||||
publish_agent:
|
||||
image: plugins/docker
|
||||
repo: drone/agent
|
||||
dockerfile: Dockerfile.agent
|
||||
secrets: [ docker_username, docker_password ]
|
||||
tag: [ latest ]
|
||||
when:
|
||||
branch: master
|
||||
event: push
|
||||
|
||||
publish_agent_arm:
|
||||
image: plugins/docker
|
||||
repo: drone/agent
|
||||
@ -76,6 +66,16 @@ pipeline:
|
||||
branch: master
|
||||
event: push
|
||||
|
||||
publish_agent_amd64:
|
||||
image: plugins/docker
|
||||
repo: drone/agent
|
||||
dockerfile: Dockerfile.agent
|
||||
secrets: [ docker_username, docker_password ]
|
||||
tag: [ latest ]
|
||||
when:
|
||||
branch: master
|
||||
event: push
|
||||
|
||||
release_server:
|
||||
image: plugins/docker
|
||||
repo: drone/drone
|
||||
|
@ -80,7 +80,8 @@ func Load(mux *httptreemux.ContextMux, middleware ...gin.HandlerFunc) http.Handl
|
||||
repo.GET("", server.GetRepo)
|
||||
repo.GET("/builds", server.GetBuilds)
|
||||
repo.GET("/builds/:number", server.GetBuild)
|
||||
repo.GET("/logs/:number/:ppid/:proc", server.GetBuildLogs)
|
||||
repo.GET("/logs/:number/:pid", server.GetProcLogs)
|
||||
repo.GET("/logs/:number/:pid/:proc", server.GetBuildLogs)
|
||||
|
||||
repo.GET("/files/:number", server.FileList)
|
||||
repo.GET("/files/:number/:proc/*file", server.FileGet)
|
||||
|
@ -79,7 +79,7 @@ func GetBuildLogs(c *gin.Context) {
|
||||
// parse the build number and job sequence number from
|
||||
// the repquest parameter.
|
||||
num, _ := strconv.Atoi(c.Params.ByName("number"))
|
||||
ppid, _ := strconv.Atoi(c.Params.ByName("ppid"))
|
||||
ppid, _ := strconv.Atoi(c.Params.ByName("pid"))
|
||||
name := c.Params.ByName("proc")
|
||||
|
||||
build, err := store.GetBuildNumber(c, repo, num)
|
||||
@ -106,6 +106,38 @@ func GetBuildLogs(c *gin.Context) {
|
||||
io.Copy(c.Writer, rc)
|
||||
}
|
||||
|
||||
func GetProcLogs(c *gin.Context) {
|
||||
repo := session.Repo(c)
|
||||
|
||||
// parse the build number and job sequence number from
|
||||
// the repquest parameter.
|
||||
num, _ := strconv.Atoi(c.Params.ByName("number"))
|
||||
pid, _ := strconv.Atoi(c.Params.ByName("pid"))
|
||||
|
||||
build, err := store.GetBuildNumber(c, repo, num)
|
||||
if err != nil {
|
||||
c.AbortWithError(404, err)
|
||||
return
|
||||
}
|
||||
|
||||
proc, err := store.FromContext(c).ProcFind(build, pid)
|
||||
if err != nil {
|
||||
c.AbortWithError(404, err)
|
||||
return
|
||||
}
|
||||
|
||||
rc, err := store.FromContext(c).LogFind(proc)
|
||||
if err != nil {
|
||||
c.AbortWithError(404, err)
|
||||
return
|
||||
}
|
||||
|
||||
defer rc.Close()
|
||||
|
||||
c.Header("Content-Type", "application/json")
|
||||
io.Copy(c.Writer, rc)
|
||||
}
|
||||
|
||||
func DeleteBuild(c *gin.Context) {
|
||||
repo := session.Repo(c)
|
||||
|
||||
|
@ -187,7 +187,7 @@ func DeleteRepo(c *gin.Context) {
|
||||
}
|
||||
|
||||
remote.Deactivate(user, repo, httputil.GetURL(c.Request))
|
||||
c.Writer.WriteHeader(http.StatusOK)
|
||||
c.JSON(200, repo)
|
||||
}
|
||||
|
||||
func RepairRepo(c *gin.Context) {
|
||||
|
Loading…
Reference in New Issue
Block a user