mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-10-22 05:43:37 +00:00
Access repos by their ids (#1691)
closes #1295 closes #648 # TODO - [x] add new routes with `:repoID` - [x] load repo in middleware using `:repoID` if present - [x] update UI routes `:owner/:name` to `:repoID` - [x] load repos using id in UI - [x] add lookup endpoint `:owner/:name` to `:repoID` - [x] redirect `:owner/:name` to `:repoID` in UI - [x] use badge with `:repoID` route in UI - [x] update `woodpecker-go` - [x] check cli - [x] add migrations / deprecation notes - [x] check if #648 got solved directly - [x] Test - [x] create repo - [x] repo pages - [x] ui redirects - [x] forge status links
This commit is contained in:
@@ -28,23 +28,24 @@ import (
|
||||
const (
|
||||
pathSelf = "%s/api/user"
|
||||
pathRepos = "%s/api/user/repos"
|
||||
pathRepo = "%s/api/repos/%s/%s"
|
||||
pathRepoMove = "%s/api/repos/%s/%s/move?to=%s"
|
||||
pathChown = "%s/api/repos/%s/%s/chown"
|
||||
pathRepair = "%s/api/repos/%s/%s/repair"
|
||||
pathPipelines = "%s/api/repos/%s/%s/pipelines"
|
||||
pathPipeline = "%s/api/repos/%s/%s/pipelines/%v"
|
||||
pathLogs = "%s/api/repos/%s/%s/logs/%d/%d"
|
||||
pathApprove = "%s/api/repos/%s/%s/pipelines/%d/approve"
|
||||
pathDecline = "%s/api/repos/%s/%s/pipelines/%d/decline"
|
||||
pathStop = "%s/api/repos/%s/%s/pipelines/%d/cancel"
|
||||
pathLogPurge = "%s/api/repos/%s/%s/logs/%d"
|
||||
pathRepoSecrets = "%s/api/repos/%s/%s/secrets"
|
||||
pathRepoSecret = "%s/api/repos/%s/%s/secrets/%s"
|
||||
pathRepoRegistries = "%s/api/repos/%s/%s/registry"
|
||||
pathRepoRegistry = "%s/api/repos/%s/%s/registry/%s"
|
||||
pathRepoCrons = "%s/api/repos/%s/%s/cron"
|
||||
pathRepoCron = "%s/api/repos/%s/%s/cron/%d"
|
||||
pathRepo = "%s/api/repos/%d"
|
||||
pathRepoLookup = "%s/api/repos/lookup/%s"
|
||||
pathRepoMove = "%s/api/repos/%d/move?to=%s"
|
||||
pathChown = "%s/api/repos/%d/chown"
|
||||
pathRepair = "%s/api/repos/%d/repair"
|
||||
pathPipelines = "%s/api/repos/%d/pipelines"
|
||||
pathPipeline = "%s/api/repos/%d/pipelines/%v"
|
||||
pathLogs = "%s/api/repos/%d/logs/%d/%d"
|
||||
pathApprove = "%s/api/repos/%d/pipelines/%d/approve"
|
||||
pathDecline = "%s/api/repos/%d/pipelines/%d/decline"
|
||||
pathStop = "%s/api/repos/%d/pipelines/%d/cancel"
|
||||
pathLogPurge = "%s/api/repos/%d/logs/%d"
|
||||
pathRepoSecrets = "%s/api/repos/%d/secrets"
|
||||
pathRepoSecret = "%s/api/repos/%d/secrets/%s"
|
||||
pathRepoRegistries = "%s/api/repos/%d/registry"
|
||||
pathRepoRegistry = "%s/api/repos/%d/registry/%s"
|
||||
pathRepoCrons = "%s/api/repos/%d/cron"
|
||||
pathRepoCron = "%s/api/repos/%d/cron/%d"
|
||||
pathOrgSecrets = "%s/api/orgs/%s/secrets"
|
||||
pathOrgSecret = "%s/api/orgs/%s/secrets/%s"
|
||||
pathGlobalSecrets = "%s/api/secrets"
|
||||
@@ -134,10 +135,18 @@ func (c *client) UserDel(login string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// Repo returns a repository by name.
|
||||
func (c *client) Repo(owner, name string) (*Repo, error) {
|
||||
// Repo returns a repository by id.
|
||||
func (c *client) Repo(repoID int64) (*Repo, error) {
|
||||
out := new(Repo)
|
||||
uri := fmt.Sprintf(pathRepo, c.addr, owner, name)
|
||||
uri := fmt.Sprintf(pathRepo, c.addr, repoID)
|
||||
err := c.get(uri, out)
|
||||
return out, err
|
||||
}
|
||||
|
||||
// RepoLookup returns a repository by name.
|
||||
func (c *client) RepoLookup(fullName string) (*Repo, error) {
|
||||
out := new(Repo)
|
||||
uri := fmt.Sprintf(pathRepoLookup, c.addr, fullName)
|
||||
err := c.get(uri, out)
|
||||
return out, err
|
||||
}
|
||||
@@ -161,60 +170,60 @@ func (c *client) RepoListOpts(sync, all bool) ([]*Repo, error) {
|
||||
}
|
||||
|
||||
// RepoPost activates a repository.
|
||||
func (c *client) RepoPost(owner, name string) (*Repo, error) {
|
||||
func (c *client) RepoPost(forgeRemoteID int64) (*Repo, error) {
|
||||
out := new(Repo)
|
||||
uri := fmt.Sprintf(pathRepo, c.addr, owner, name)
|
||||
uri := fmt.Sprintf(pathRepo, c.addr, forgeRemoteID)
|
||||
err := c.post(uri, nil, out)
|
||||
return out, err
|
||||
}
|
||||
|
||||
// RepoChown updates a repository owner.
|
||||
func (c *client) RepoChown(owner, name string) (*Repo, error) {
|
||||
func (c *client) RepoChown(repoID int64) (*Repo, error) {
|
||||
out := new(Repo)
|
||||
uri := fmt.Sprintf(pathChown, c.addr, owner, name)
|
||||
uri := fmt.Sprintf(pathChown, c.addr, repoID)
|
||||
err := c.post(uri, nil, out)
|
||||
return out, err
|
||||
}
|
||||
|
||||
// RepoRepair repairs the repository hooks.
|
||||
func (c *client) RepoRepair(owner, name string) error {
|
||||
uri := fmt.Sprintf(pathRepair, c.addr, owner, name)
|
||||
func (c *client) RepoRepair(repoID int64) error {
|
||||
uri := fmt.Sprintf(pathRepair, c.addr, repoID)
|
||||
return c.post(uri, nil, nil)
|
||||
}
|
||||
|
||||
// RepoPatch updates a repository.
|
||||
func (c *client) RepoPatch(owner, name string, in *RepoPatch) (*Repo, error) {
|
||||
func (c *client) RepoPatch(repoID int64, in *RepoPatch) (*Repo, error) {
|
||||
out := new(Repo)
|
||||
uri := fmt.Sprintf(pathRepo, c.addr, owner, name)
|
||||
uri := fmt.Sprintf(pathRepo, c.addr, repoID)
|
||||
err := c.patch(uri, in, out)
|
||||
return out, err
|
||||
}
|
||||
|
||||
// RepoDel deletes a repository.
|
||||
func (c *client) RepoDel(owner, name string) error {
|
||||
uri := fmt.Sprintf(pathRepo, c.addr, owner, name)
|
||||
func (c *client) RepoDel(repoID int64) error {
|
||||
uri := fmt.Sprintf(pathRepo, c.addr, repoID)
|
||||
err := c.delete(uri)
|
||||
return err
|
||||
}
|
||||
|
||||
// RepoMove moves a repository
|
||||
func (c *client) RepoMove(owner, name, newFullName string) error {
|
||||
uri := fmt.Sprintf(pathRepoMove, c.addr, owner, name, newFullName)
|
||||
func (c *client) RepoMove(repoID int64, newFullName string) error {
|
||||
uri := fmt.Sprintf(pathRepoMove, c.addr, repoID, newFullName)
|
||||
return c.post(uri, nil, nil)
|
||||
}
|
||||
|
||||
// Pipeline returns a repository pipeline by number.
|
||||
func (c *client) Pipeline(owner, name string, num int) (*Pipeline, error) {
|
||||
// Pipeline returns a repository pipeline by pipeline-id.
|
||||
func (c *client) Pipeline(repoID int64, pipeline int) (*Pipeline, error) {
|
||||
out := new(Pipeline)
|
||||
uri := fmt.Sprintf(pathPipeline, c.addr, owner, name, num)
|
||||
uri := fmt.Sprintf(pathPipeline, c.addr, repoID, pipeline)
|
||||
err := c.get(uri, out)
|
||||
return out, err
|
||||
}
|
||||
|
||||
// Pipeline returns the latest repository pipeline by branch.
|
||||
func (c *client) PipelineLast(owner, name, branch string) (*Pipeline, error) {
|
||||
func (c *client) PipelineLast(repoID int64, branch string) (*Pipeline, error) {
|
||||
out := new(Pipeline)
|
||||
uri := fmt.Sprintf(pathPipeline, c.addr, owner, name, "latest")
|
||||
uri := fmt.Sprintf(pathPipeline, c.addr, repoID, "latest")
|
||||
if len(branch) != 0 {
|
||||
uri += "?branch=" + branch
|
||||
}
|
||||
@@ -224,16 +233,16 @@ func (c *client) PipelineLast(owner, name, branch string) (*Pipeline, error) {
|
||||
|
||||
// PipelineList returns a list of recent pipelines for the
|
||||
// the specified repository.
|
||||
func (c *client) PipelineList(owner, name string) ([]*Pipeline, error) {
|
||||
func (c *client) PipelineList(repoID int64) ([]*Pipeline, error) {
|
||||
var out []*Pipeline
|
||||
uri := fmt.Sprintf(pathPipelines, c.addr, owner, name)
|
||||
uri := fmt.Sprintf(pathPipelines, c.addr, repoID)
|
||||
err := c.get(uri, &out)
|
||||
return out, err
|
||||
}
|
||||
|
||||
func (c *client) PipelineCreate(owner, name string, options *PipelineOptions) (*Pipeline, error) {
|
||||
func (c *client) PipelineCreate(repoID int64, options *PipelineOptions) (*Pipeline, error) {
|
||||
var out *Pipeline
|
||||
uri := fmt.Sprintf(pathPipelines, c.addr, owner, name)
|
||||
uri := fmt.Sprintf(pathPipelines, c.addr, repoID)
|
||||
err := c.post(uri, options, &out)
|
||||
return out, err
|
||||
}
|
||||
@@ -247,47 +256,47 @@ func (c *client) PipelineQueue() ([]*Activity, error) {
|
||||
}
|
||||
|
||||
// PipelineStart re-starts a stopped pipeline.
|
||||
func (c *client) PipelineStart(owner, name string, num int, params map[string]string) (*Pipeline, error) {
|
||||
func (c *client) PipelineStart(repoID int64, pipeline int, params map[string]string) (*Pipeline, error) {
|
||||
out := new(Pipeline)
|
||||
val := mapValues(params)
|
||||
uri := fmt.Sprintf(pathPipeline, c.addr, owner, name, num)
|
||||
uri := fmt.Sprintf(pathPipeline, c.addr, repoID, pipeline)
|
||||
err := c.post(uri+"?"+val.Encode(), nil, out)
|
||||
return out, err
|
||||
}
|
||||
|
||||
// PipelineStop cancels the running step.
|
||||
func (c *client) PipelineStop(owner, name string, pipeline int) error {
|
||||
uri := fmt.Sprintf(pathStop, c.addr, owner, name, pipeline)
|
||||
func (c *client) PipelineStop(repoID int64, pipeline int) error {
|
||||
uri := fmt.Sprintf(pathStop, c.addr, repoID, pipeline)
|
||||
err := c.post(uri, nil, nil)
|
||||
return err
|
||||
}
|
||||
|
||||
// PipelineApprove approves a blocked pipeline.
|
||||
func (c *client) PipelineApprove(owner, name string, num int) (*Pipeline, error) {
|
||||
func (c *client) PipelineApprove(repoID int64, pipeline int) (*Pipeline, error) {
|
||||
out := new(Pipeline)
|
||||
uri := fmt.Sprintf(pathApprove, c.addr, owner, name, num)
|
||||
uri := fmt.Sprintf(pathApprove, c.addr, repoID, pipeline)
|
||||
err := c.post(uri, nil, out)
|
||||
return out, err
|
||||
}
|
||||
|
||||
// PipelineDecline declines a blocked pipeline.
|
||||
func (c *client) PipelineDecline(owner, name string, num int) (*Pipeline, error) {
|
||||
func (c *client) PipelineDecline(repoID int64, pipeline int) (*Pipeline, error) {
|
||||
out := new(Pipeline)
|
||||
uri := fmt.Sprintf(pathDecline, c.addr, owner, name, num)
|
||||
uri := fmt.Sprintf(pathDecline, c.addr, repoID, pipeline)
|
||||
err := c.post(uri, nil, out)
|
||||
return out, err
|
||||
}
|
||||
|
||||
// PipelineKill force kills the running pipeline.
|
||||
func (c *client) PipelineKill(owner, name string, num int) error {
|
||||
uri := fmt.Sprintf(pathPipeline, c.addr, owner, name, num)
|
||||
func (c *client) PipelineKill(repoID int64, pipeline int) error {
|
||||
uri := fmt.Sprintf(pathPipeline, c.addr, repoID, pipeline)
|
||||
err := c.delete(uri)
|
||||
return err
|
||||
}
|
||||
|
||||
// PipelineLogs returns the pipeline logs for the specified step.
|
||||
func (c *client) StepLogEntries(owner, name string, num, step int) ([]*LogEntry, error) {
|
||||
uri := fmt.Sprintf(pathLogs, c.addr, owner, name, num, step)
|
||||
func (c *client) StepLogEntries(repoID int64, num, step int) ([]*LogEntry, error) {
|
||||
uri := fmt.Sprintf(pathLogs, c.addr, repoID, num, step)
|
||||
var out []*LogEntry
|
||||
err := c.get(uri, &out)
|
||||
return out, err
|
||||
@@ -295,96 +304,96 @@ func (c *client) StepLogEntries(owner, name string, num, step int) ([]*LogEntry,
|
||||
|
||||
// Deploy triggers a deployment for an existing pipeline using the
|
||||
// specified target environment.
|
||||
func (c *client) Deploy(owner, name string, num int, env string, params map[string]string) (*Pipeline, error) {
|
||||
func (c *client) Deploy(repoID int64, pipeline int, env string, params map[string]string) (*Pipeline, error) {
|
||||
out := new(Pipeline)
|
||||
val := mapValues(params)
|
||||
val.Set("event", EventDeploy)
|
||||
val.Set("deploy_to", env)
|
||||
uri := fmt.Sprintf(pathPipeline, c.addr, owner, name, num)
|
||||
uri := fmt.Sprintf(pathPipeline, c.addr, repoID, pipeline)
|
||||
err := c.post(uri+"?"+val.Encode(), nil, out)
|
||||
return out, err
|
||||
}
|
||||
|
||||
// LogsPurge purges the pipeline logs for the specified pipeline.
|
||||
func (c *client) LogsPurge(owner, name string, num int) error {
|
||||
uri := fmt.Sprintf(pathLogPurge, c.addr, owner, name, num)
|
||||
func (c *client) LogsPurge(repoID int64, pipeline int) error {
|
||||
uri := fmt.Sprintf(pathLogPurge, c.addr, repoID, pipeline)
|
||||
err := c.delete(uri)
|
||||
return err
|
||||
}
|
||||
|
||||
// Registry returns a registry by hostname.
|
||||
func (c *client) Registry(owner, name, hostname string) (*Registry, error) {
|
||||
func (c *client) Registry(repoID int64, hostname string) (*Registry, error) {
|
||||
out := new(Registry)
|
||||
uri := fmt.Sprintf(pathRepoRegistry, c.addr, owner, name, hostname)
|
||||
uri := fmt.Sprintf(pathRepoRegistry, c.addr, repoID, hostname)
|
||||
err := c.get(uri, out)
|
||||
return out, err
|
||||
}
|
||||
|
||||
// RegistryList returns a list of all repository registries.
|
||||
func (c *client) RegistryList(owner, name string) ([]*Registry, error) {
|
||||
func (c *client) RegistryList(repoID int64) ([]*Registry, error) {
|
||||
var out []*Registry
|
||||
uri := fmt.Sprintf(pathRepoRegistries, c.addr, owner, name)
|
||||
uri := fmt.Sprintf(pathRepoRegistries, c.addr, repoID)
|
||||
err := c.get(uri, &out)
|
||||
return out, err
|
||||
}
|
||||
|
||||
// RegistryCreate creates a registry.
|
||||
func (c *client) RegistryCreate(owner, name string, in *Registry) (*Registry, error) {
|
||||
func (c *client) RegistryCreate(repoID int64, in *Registry) (*Registry, error) {
|
||||
out := new(Registry)
|
||||
uri := fmt.Sprintf(pathRepoRegistries, c.addr, owner, name)
|
||||
uri := fmt.Sprintf(pathRepoRegistries, c.addr, repoID)
|
||||
err := c.post(uri, in, out)
|
||||
return out, err
|
||||
}
|
||||
|
||||
// RegistryUpdate updates a registry.
|
||||
func (c *client) RegistryUpdate(owner, name string, in *Registry) (*Registry, error) {
|
||||
func (c *client) RegistryUpdate(repoID int64, in *Registry) (*Registry, error) {
|
||||
out := new(Registry)
|
||||
uri := fmt.Sprintf(pathRepoRegistry, c.addr, owner, name, in.Address)
|
||||
uri := fmt.Sprintf(pathRepoRegistry, c.addr, repoID, in.Address)
|
||||
err := c.patch(uri, in, out)
|
||||
return out, err
|
||||
}
|
||||
|
||||
// RegistryDelete deletes a registry.
|
||||
func (c *client) RegistryDelete(owner, name, hostname string) error {
|
||||
uri := fmt.Sprintf(pathRepoRegistry, c.addr, owner, name, hostname)
|
||||
func (c *client) RegistryDelete(repoID int64, hostname string) error {
|
||||
uri := fmt.Sprintf(pathRepoRegistry, c.addr, repoID, hostname)
|
||||
return c.delete(uri)
|
||||
}
|
||||
|
||||
// Secret returns a secret by name.
|
||||
func (c *client) Secret(owner, name, secret string) (*Secret, error) {
|
||||
func (c *client) Secret(repoID int64, secret string) (*Secret, error) {
|
||||
out := new(Secret)
|
||||
uri := fmt.Sprintf(pathRepoSecret, c.addr, owner, name, secret)
|
||||
uri := fmt.Sprintf(pathRepoSecret, c.addr, repoID, secret)
|
||||
err := c.get(uri, out)
|
||||
return out, err
|
||||
}
|
||||
|
||||
// SecretList returns a list of all repository secrets.
|
||||
func (c *client) SecretList(owner, name string) ([]*Secret, error) {
|
||||
func (c *client) SecretList(repoID int64) ([]*Secret, error) {
|
||||
var out []*Secret
|
||||
uri := fmt.Sprintf(pathRepoSecrets, c.addr, owner, name)
|
||||
uri := fmt.Sprintf(pathRepoSecrets, c.addr, repoID)
|
||||
err := c.get(uri, &out)
|
||||
return out, err
|
||||
}
|
||||
|
||||
// SecretCreate creates a secret.
|
||||
func (c *client) SecretCreate(owner, name string, in *Secret) (*Secret, error) {
|
||||
func (c *client) SecretCreate(repoID int64, in *Secret) (*Secret, error) {
|
||||
out := new(Secret)
|
||||
uri := fmt.Sprintf(pathRepoSecrets, c.addr, owner, name)
|
||||
uri := fmt.Sprintf(pathRepoSecrets, c.addr, repoID)
|
||||
err := c.post(uri, in, out)
|
||||
return out, err
|
||||
}
|
||||
|
||||
// SecretUpdate updates a secret.
|
||||
func (c *client) SecretUpdate(owner, name string, in *Secret) (*Secret, error) {
|
||||
func (c *client) SecretUpdate(repoID int64, in *Secret) (*Secret, error) {
|
||||
out := new(Secret)
|
||||
uri := fmt.Sprintf(pathRepoSecret, c.addr, owner, name, in.Name)
|
||||
uri := fmt.Sprintf(pathRepoSecret, c.addr, repoID, in.Name)
|
||||
err := c.patch(uri, in, out)
|
||||
return out, err
|
||||
}
|
||||
|
||||
// SecretDelete deletes a secret.
|
||||
func (c *client) SecretDelete(owner, name, secret string) error {
|
||||
uri := fmt.Sprintf(pathRepoSecret, c.addr, owner, name, secret)
|
||||
func (c *client) SecretDelete(repoID int64, secret string) error {
|
||||
uri := fmt.Sprintf(pathRepoSecret, c.addr, repoID, secret)
|
||||
return c.delete(uri)
|
||||
}
|
||||
|
||||
@@ -488,33 +497,33 @@ func (c *client) SetLogLevel(in *LogLevel) (*LogLevel, error) {
|
||||
return out, err
|
||||
}
|
||||
|
||||
func (c *client) CronList(owner, repo string) ([]*Cron, error) {
|
||||
func (c *client) CronList(repoID int64) ([]*Cron, error) {
|
||||
out := make([]*Cron, 0, 5)
|
||||
uri := fmt.Sprintf(pathRepoCrons, c.addr, owner, repo)
|
||||
uri := fmt.Sprintf(pathRepoCrons, c.addr, repoID)
|
||||
return out, c.get(uri, &out)
|
||||
}
|
||||
|
||||
func (c *client) CronCreate(owner, repo string, in *Cron) (*Cron, error) {
|
||||
func (c *client) CronCreate(repoID int64, in *Cron) (*Cron, error) {
|
||||
out := new(Cron)
|
||||
uri := fmt.Sprintf(pathRepoCrons, c.addr, owner, repo)
|
||||
uri := fmt.Sprintf(pathRepoCrons, c.addr, repoID)
|
||||
return out, c.post(uri, in, out)
|
||||
}
|
||||
|
||||
func (c *client) CronUpdate(owner, repo string, in *Cron) (*Cron, error) {
|
||||
func (c *client) CronUpdate(repoID int64, in *Cron) (*Cron, error) {
|
||||
out := new(Cron)
|
||||
uri := fmt.Sprintf(pathRepoCron, c.addr, owner, repo, in.ID)
|
||||
uri := fmt.Sprintf(pathRepoCron, c.addr, repoID, in.ID)
|
||||
err := c.patch(uri, in, out)
|
||||
return out, err
|
||||
}
|
||||
|
||||
func (c *client) CronDelete(owner, repo string, cronID int64) error {
|
||||
uri := fmt.Sprintf(pathRepoCron, c.addr, owner, repo, cronID)
|
||||
func (c *client) CronDelete(repoID, cronID int64) error {
|
||||
uri := fmt.Sprintf(pathRepoCron, c.addr, repoID, cronID)
|
||||
return c.delete(uri)
|
||||
}
|
||||
|
||||
func (c *client) CronGet(owner, repo string, cronID int64) (*Cron, error) {
|
||||
func (c *client) CronGet(repoID, cronID int64) (*Cron, error) {
|
||||
out := new(Cron)
|
||||
uri := fmt.Sprintf(pathRepoCron, c.addr, owner, repo, cronID)
|
||||
uri := fmt.Sprintf(pathRepoCron, c.addr, repoID, cronID)
|
||||
return out, c.get(uri, out)
|
||||
}
|
||||
|
||||
|
@@ -45,7 +45,10 @@ type Client interface {
|
||||
UserDel(string) error
|
||||
|
||||
// Repo returns a repository by name.
|
||||
Repo(string, string) (*Repo, error)
|
||||
Repo(repoID int64) (*Repo, error)
|
||||
|
||||
// RepoLookup returns a repository id by the owner and name.
|
||||
RepoLookup(repoFullName string) (*Repo, error)
|
||||
|
||||
// RepoList returns a list of all repositories to which the user has explicit
|
||||
// access in the host system.
|
||||
@@ -56,94 +59,94 @@ type Client interface {
|
||||
RepoListOpts(bool, bool) ([]*Repo, error)
|
||||
|
||||
// RepoPost activates a repository.
|
||||
RepoPost(string, string) (*Repo, error)
|
||||
RepoPost(forgeRemoteID int64) (*Repo, error)
|
||||
|
||||
// RepoPatch updates a repository.
|
||||
RepoPatch(string, string, *RepoPatch) (*Repo, error)
|
||||
RepoPatch(repoID int64, repo *RepoPatch) (*Repo, error)
|
||||
|
||||
// RepoMove moves the repository
|
||||
RepoMove(string, string, string) error
|
||||
RepoMove(repoID int64, dst string) error
|
||||
|
||||
// RepoChown updates a repository owner.
|
||||
RepoChown(string, string) (*Repo, error)
|
||||
RepoChown(repoID int64) (*Repo, error)
|
||||
|
||||
// RepoRepair repairs the repository hooks.
|
||||
RepoRepair(string, string) error
|
||||
RepoRepair(repoID int64) error
|
||||
|
||||
// RepoDel deletes a repository.
|
||||
RepoDel(string, string) error
|
||||
RepoDel(repoID int64) error
|
||||
|
||||
// Pipeline returns a repository pipeline by number.
|
||||
Pipeline(string, string, int) (*Pipeline, error)
|
||||
Pipeline(repoID int64, pipeline int) (*Pipeline, error)
|
||||
|
||||
// PipelineLast returns the latest repository pipeline by branch. An empty branch
|
||||
// will result in the default branch.
|
||||
PipelineLast(string, string, string) (*Pipeline, error)
|
||||
PipelineLast(repoID int64, branch string) (*Pipeline, error)
|
||||
|
||||
// PipelineList returns a list of recent pipelines for the
|
||||
// the specified repository.
|
||||
PipelineList(string, string) ([]*Pipeline, error)
|
||||
PipelineList(repoID int64) ([]*Pipeline, error)
|
||||
|
||||
// PipelineQueue returns a list of enqueued pipelines.
|
||||
PipelineQueue() ([]*Activity, error)
|
||||
|
||||
// PipelineCreate returns creates a pipeline on specified branch.
|
||||
PipelineCreate(string, string, *PipelineOptions) (*Pipeline, error)
|
||||
PipelineCreate(repoID int64, opts *PipelineOptions) (*Pipeline, error)
|
||||
|
||||
// PipelineStart re-starts a stopped pipeline.
|
||||
PipelineStart(string, string, int, map[string]string) (*Pipeline, error)
|
||||
PipelineStart(repoID int64, num int, params map[string]string) (*Pipeline, error)
|
||||
|
||||
// PipelineStop stops the given pipeline.
|
||||
PipelineStop(string, string, int) error
|
||||
PipelineStop(repoID int64, pipeline int) error
|
||||
|
||||
// PipelineApprove approves a blocked pipeline.
|
||||
PipelineApprove(string, string, int) (*Pipeline, error)
|
||||
PipelineApprove(repoID int64, pipeline int) (*Pipeline, error)
|
||||
|
||||
// PipelineDecline declines a blocked pipeline.
|
||||
PipelineDecline(string, string, int) (*Pipeline, error)
|
||||
PipelineDecline(repoID int64, pipeline int) (*Pipeline, error)
|
||||
|
||||
// PipelineKill force kills the running pipeline.
|
||||
PipelineKill(string, string, int) error
|
||||
PipelineKill(repoID int64, pipeline int) error
|
||||
|
||||
// StepLogEntries returns the LogEntries for the given pipeline step
|
||||
StepLogEntries(string, string, int, int) ([]*LogEntry, error)
|
||||
StepLogEntries(repoID int64, pipeline, stepID int) ([]*LogEntry, error)
|
||||
|
||||
// Deploy triggers a deployment for an existing pipeline using the specified
|
||||
// target environment.
|
||||
Deploy(string, string, int, string, map[string]string) (*Pipeline, error)
|
||||
Deploy(repoID int64, pipeline int, env string, params map[string]string) (*Pipeline, error)
|
||||
|
||||
// LogsPurge purges the pipeline logs for the specified pipeline.
|
||||
LogsPurge(string, string, int) error
|
||||
LogsPurge(repoID int64, pipeline int) error
|
||||
|
||||
// Registry returns a registry by hostname.
|
||||
Registry(owner, name, hostname string) (*Registry, error)
|
||||
Registry(repoID int64, hostname string) (*Registry, error)
|
||||
|
||||
// RegistryList returns a list of all repository registries.
|
||||
RegistryList(owner, name string) ([]*Registry, error)
|
||||
RegistryList(repoID int64) ([]*Registry, error)
|
||||
|
||||
// RegistryCreate creates a registry.
|
||||
RegistryCreate(owner, name string, registry *Registry) (*Registry, error)
|
||||
RegistryCreate(repoID int64, registry *Registry) (*Registry, error)
|
||||
|
||||
// RegistryUpdate updates a registry.
|
||||
RegistryUpdate(owner, name string, registry *Registry) (*Registry, error)
|
||||
RegistryUpdate(repoID int64, registry *Registry) (*Registry, error)
|
||||
|
||||
// RegistryDelete deletes a registry.
|
||||
RegistryDelete(owner, name, hostname string) error
|
||||
RegistryDelete(repoID int64, hostname string) error
|
||||
|
||||
// Secret returns a secret by name.
|
||||
Secret(owner, name, secret string) (*Secret, error)
|
||||
Secret(repoID int64, secret string) (*Secret, error)
|
||||
|
||||
// SecretList returns a list of all repository secrets.
|
||||
SecretList(owner, name string) ([]*Secret, error)
|
||||
SecretList(repoID int64) ([]*Secret, error)
|
||||
|
||||
// SecretCreate creates a secret.
|
||||
SecretCreate(owner, name string, secret *Secret) (*Secret, error)
|
||||
SecretCreate(repoID int64, secret *Secret) (*Secret, error)
|
||||
|
||||
// SecretUpdate updates a secret.
|
||||
SecretUpdate(owner, name string, secret *Secret) (*Secret, error)
|
||||
SecretUpdate(repoID int64, secret *Secret) (*Secret, error)
|
||||
|
||||
// SecretDelete deletes a secret.
|
||||
SecretDelete(owner, name, secret string) error
|
||||
SecretDelete(repoID int64, secret string) error
|
||||
|
||||
// OrgSecret returns an organization secret by name.
|
||||
OrgSecret(owner, secret string) (*Secret, error)
|
||||
@@ -185,19 +188,19 @@ type Client interface {
|
||||
SetLogLevel(logLevel *LogLevel) (*LogLevel, error)
|
||||
|
||||
// CronList list all cron jobs of a repo
|
||||
CronList(owner, repo string) ([]*Cron, error)
|
||||
CronList(repoID int64) ([]*Cron, error)
|
||||
|
||||
// CronGet get a specific cron job of a repo by id
|
||||
CronGet(owner, repo string, cronID int64) (*Cron, error)
|
||||
CronGet(repoID, cronID int64) (*Cron, error)
|
||||
|
||||
// CronDelete delete a specific cron job of a repo by id
|
||||
CronDelete(owner, repo string, cronID int64) error
|
||||
CronDelete(repoID, cronID int64) error
|
||||
|
||||
// CronCreate create a new cron job in a repo
|
||||
CronCreate(owner, repo string, cron *Cron) (*Cron, error)
|
||||
CronCreate(repoID int64, cron *Cron) (*Cron, error)
|
||||
|
||||
// CronUpdate update an existing cron job of a repo
|
||||
CronUpdate(owner, repo string, cron *Cron) (*Cron, error)
|
||||
CronUpdate(repoID int64, cron *Cron) (*Cron, error)
|
||||
|
||||
// AgentList returns a list of all registered agents
|
||||
AgentList() ([]*Agent, error)
|
||||
|
@@ -27,23 +27,26 @@ type (
|
||||
|
||||
// Repo represents a repository.
|
||||
Repo struct {
|
||||
ID int64 `json:"id,omitempty"`
|
||||
Owner string `json:"owner"`
|
||||
Name string `json:"name"`
|
||||
FullName string `json:"full_name"`
|
||||
Avatar string `json:"avatar_url,omitempty"`
|
||||
Link string `json:"link_url,omitempty"`
|
||||
Kind string `json:"scm,omitempty"`
|
||||
Clone string `json:"clone_url,omitempty"`
|
||||
Branch string `json:"default_branch,omitempty"`
|
||||
Timeout int64 `json:"timeout,omitempty"`
|
||||
Visibility string `json:"visibility"`
|
||||
IsPrivate bool `json:"private,omitempty"`
|
||||
IsTrusted bool `json:"trusted"`
|
||||
IsStarred bool `json:"starred,omitempty"`
|
||||
IsGated bool `json:"gated"`
|
||||
AllowPull bool `json:"allow_pr"`
|
||||
Config string `json:"config_file"`
|
||||
ID int64 `json:"id,omitempty"`
|
||||
ForgeRemoteID string `json:"forge_remote_id"`
|
||||
Owner string `json:"owner"`
|
||||
Name string `json:"name"`
|
||||
FullName string `json:"full_name"`
|
||||
Avatar string `json:"avatar_url,omitempty"`
|
||||
Link string `json:"link_url,omitempty"`
|
||||
Clone string `json:"clone_url,omitempty"`
|
||||
DefaultBranch string `json:"default_branch,omitempty"`
|
||||
SCMKind string `json:"scm,omitempty"`
|
||||
Timeout int64 `json:"timeout,omitempty"`
|
||||
Visibility string `json:"visibility"`
|
||||
IsSCMPrivate bool `json:"private"`
|
||||
IsTrusted bool `json:"trusted"`
|
||||
IsGated bool `json:"gated"`
|
||||
IsActive bool `json:"active"`
|
||||
AllowPullRequests bool `json:"allow_pr"`
|
||||
Config string `json:"config_file"`
|
||||
CancelPreviousPipelineEvents []string `json:"cancel_previous_pipeline_events"`
|
||||
NetrcOnlyTrusted bool `json:"netrc_only_trusted"`
|
||||
}
|
||||
|
||||
// RepoPatch defines a repository patch request.
|
||||
|
Reference in New Issue
Block a user