Use int64 for IDs in woodpecker client lib (#2703)

Switch from int to int64 for IDs
This commit is contained in:
runephilosof-karnovgroup
2023-11-02 12:21:11 +01:00
committed by GitHub
parent c75068920c
commit dbed835b6d
13 changed files with 36 additions and 35 deletions

View File

@@ -216,7 +216,7 @@ func (c *client) RepoMove(repoID int64, newFullName string) error {
}
// Pipeline returns a repository pipeline by pipeline-id.
func (c *client) Pipeline(repoID int64, pipeline int) (*Pipeline, error) {
func (c *client) Pipeline(repoID, pipeline int64) (*Pipeline, error) {
out := new(Pipeline)
uri := fmt.Sprintf(pathPipeline, c.addr, repoID, pipeline)
err := c.get(uri, out)
@@ -259,7 +259,7 @@ func (c *client) PipelineQueue() ([]*Feed, error) {
}
// PipelineStart re-starts a stopped pipeline.
func (c *client) PipelineStart(repoID int64, pipeline int, params map[string]string) (*Pipeline, error) {
func (c *client) PipelineStart(repoID, pipeline int64, params map[string]string) (*Pipeline, error) {
out := new(Pipeline)
val := mapValues(params)
uri := fmt.Sprintf(pathPipeline, c.addr, repoID, pipeline)
@@ -268,14 +268,14 @@ func (c *client) PipelineStart(repoID int64, pipeline int, params map[string]str
}
// PipelineStop cancels the running step.
func (c *client) PipelineStop(repoID int64, pipeline int) error {
func (c *client) PipelineStop(repoID, pipeline int64) 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(repoID int64, pipeline int) (*Pipeline, error) {
func (c *client) PipelineApprove(repoID, pipeline int64) (*Pipeline, error) {
out := new(Pipeline)
uri := fmt.Sprintf(pathApprove, c.addr, repoID, pipeline)
err := c.post(uri, nil, out)
@@ -283,7 +283,7 @@ func (c *client) PipelineApprove(repoID int64, pipeline int) (*Pipeline, error)
}
// PipelineDecline declines a blocked pipeline.
func (c *client) PipelineDecline(repoID int64, pipeline int) (*Pipeline, error) {
func (c *client) PipelineDecline(repoID, pipeline int64) (*Pipeline, error) {
out := new(Pipeline)
uri := fmt.Sprintf(pathDecline, c.addr, repoID, pipeline)
err := c.post(uri, nil, out)
@@ -291,14 +291,14 @@ func (c *client) PipelineDecline(repoID int64, pipeline int) (*Pipeline, error)
}
// PipelineKill force kills the running pipeline.
func (c *client) PipelineKill(repoID int64, pipeline int) error {
func (c *client) PipelineKill(repoID, pipeline int64) 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(repoID int64, num, step int) ([]*LogEntry, error) {
func (c *client) StepLogEntries(repoID, num, step int64) ([]*LogEntry, error) {
uri := fmt.Sprintf(pathLogs, c.addr, repoID, num, step)
var out []*LogEntry
err := c.get(uri, &out)
@@ -307,7 +307,7 @@ func (c *client) StepLogEntries(repoID int64, num, step int) ([]*LogEntry, error
// Deploy triggers a deployment for an existing pipeline using the
// specified target environment.
func (c *client) Deploy(repoID int64, pipeline int, env string, params map[string]string) (*Pipeline, error) {
func (c *client) Deploy(repoID, pipeline int64, env string, params map[string]string) (*Pipeline, error) {
out := new(Pipeline)
val := mapValues(params)
val.Set("event", EventDeploy)
@@ -318,7 +318,7 @@ func (c *client) Deploy(repoID int64, pipeline int, env string, params map[strin
}
// LogsPurge purges the pipeline logs for the specified pipeline.
func (c *client) LogsPurge(repoID int64, pipeline int) error {
func (c *client) LogsPurge(repoID, pipeline int64) error {
uri := fmt.Sprintf(pathLogPurge, c.addr, repoID, pipeline)
err := c.delete(uri)
return err

View File

@@ -77,7 +77,7 @@ type Client interface {
RepoDel(repoID int64) error
// Pipeline returns a repository pipeline by number.
Pipeline(repoID int64, pipeline int) (*Pipeline, error)
Pipeline(repoID, pipeline int64) (*Pipeline, error)
// PipelineLast returns the latest repository pipeline by branch. An empty branch
// will result in the default branch.
@@ -94,29 +94,29 @@ type Client interface {
PipelineCreate(repoID int64, opts *PipelineOptions) (*Pipeline, error)
// PipelineStart re-starts a stopped pipeline.
PipelineStart(repoID int64, num int, params map[string]string) (*Pipeline, error)
PipelineStart(repoID, num int64, params map[string]string) (*Pipeline, error)
// PipelineStop stops the given pipeline.
PipelineStop(repoID int64, pipeline int) error
PipelineStop(repoID, pipeline int64) error
// PipelineApprove approves a blocked pipeline.
PipelineApprove(repoID int64, pipeline int) (*Pipeline, error)
PipelineApprove(repoID, pipeline int64) (*Pipeline, error)
// PipelineDecline declines a blocked pipeline.
PipelineDecline(repoID int64, pipeline int) (*Pipeline, error)
PipelineDecline(repoID, pipeline int64) (*Pipeline, error)
// PipelineKill force kills the running pipeline.
PipelineKill(repoID int64, pipeline int) error
PipelineKill(repoID, pipeline int64) error
// StepLogEntries returns the LogEntries for the given pipeline step
StepLogEntries(repoID int64, pipeline, stepID int) ([]*LogEntry, error)
StepLogEntries(repoID, pipeline, stepID int64) ([]*LogEntry, error)
// Deploy triggers a deployment for an existing pipeline using the specified
// target environment.
Deploy(repoID int64, pipeline int, env string, params map[string]string) (*Pipeline, error)
Deploy(repoID, pipeline int64, env string, params map[string]string) (*Pipeline, error)
// LogsPurge purges the pipeline logs for the specified pipeline.
LogsPurge(repoID int64, pipeline int) error
LogsPurge(repoID, pipeline int64) error
// Registry returns a registry by hostname.
Registry(repoID int64, hostname string) (*Registry, error)

View File

@@ -63,13 +63,14 @@ type (
// Pipeline defines a pipeline object.
Pipeline struct {
ID int64 `json:"id"`
Number int `json:"number"`
Parent int `json:"parent"`
Number int64 `json:"number"`
Parent int64 `json:"parent"`
Event string `json:"event"`
Status string `json:"status"`
Error string `json:"error"`
Enqueued int64 `json:"enqueued_at"`
Created int64 `json:"created_at"`
Updated int64 `json:"updated_at"`
Started int64 `json:"started_at"`
Finished int64 `json:"finished_at"`
Deploy string `json:"deploy_to"`