// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. package org_tangled // schema: org.tangled.ci.pipeline import ( "encoding/json" "fmt" "github.com/bluesky-social/indigo/lex/util" ) const ( CiPipelineNSID = "org.tangled.ci.pipeline" ) // CiPipeline is a "main" in the org.tangled.ci.pipeline schema. // // A CI pipeline. Record-like, but owned by the spindle rather than a PDS. type CiPipeline struct { // commit: Commit Id this pipeline is running on Commit string `json:"commit" cborgen:"commit"` CreatedAt *string `json:"createdAt,omitempty" cborgen:"createdAt,omitempty"` // id: Spindle-local pipeline id Id string `json:"id" cborgen:"id"` // repo: Repository DID Repo string `json:"repo" cborgen:"repo"` // sourceRepo: Repository DID that the commit was checked out from, if different from repo (e.g. a fork for a fork-based pull request) SourceRepo *string `json:"sourceRepo,omitempty" cborgen:"sourceRepo,omitempty"` // trigger: Trigger event that triggered this pipeline. Trigger *CiPipeline_Trigger `json:"trigger" cborgen:"trigger"` // workflows: Triggered workflows Workflows []*CiPipeline_Workflow `json:"workflows" cborgen:"workflows"` } // Trigger event that triggered this pipeline. type CiPipeline_Trigger struct { EventPush *EventPush EventPullRequest *EventPullRequest CiTriggerManual *CiTriggerManual Unknown json.RawMessage } func (t *CiPipeline_Trigger) MarshalJSON() ([]byte, error) { if t.EventPush != nil { t.EventPush.LexiconTypeID = "org.tangled.event.push" return json.Marshal(t.EventPush) } if t.EventPullRequest != nil { t.EventPullRequest.LexiconTypeID = "org.tangled.event.pullRequest" return json.Marshal(t.EventPullRequest) } if t.CiTriggerManual != nil { t.CiTriggerManual.LexiconTypeID = "org.tangled.ci.trigger.manual" return json.Marshal(t.CiTriggerManual) } if t.Unknown != nil { return t.Unknown, nil } return nil, fmt.Errorf("cannot marshal empty enum") } func (t *CiPipeline_Trigger) UnmarshalJSON(b []byte) error { typ, err := util.TypeExtract(b) if err != nil { return err } *t = CiPipeline_Trigger{} switch typ { case "org.tangled.event.push": t.EventPush = new(EventPush) return json.Unmarshal(b, t.EventPush) case "org.tangled.event.pullRequest": t.EventPullRequest = new(EventPullRequest) return json.Unmarshal(b, t.EventPullRequest) case "org.tangled.ci.trigger.manual": t.CiTriggerManual = new(CiTriggerManual) return json.Unmarshal(b, t.CiTriggerManual) default: t.Unknown = append(t.Unknown[:0], b...) return nil } } // CiPipeline_Workflow is a "workflow" in the org.tangled.ci.pipeline schema. type CiPipeline_Workflow struct { // definition: Workflow definition where this workflow run is originated from. Definition *CiWorkflow `json:"definition" cborgen:"definition"` Error *string `json:"error,omitempty" cborgen:"error,omitempty"` FinishedAt *string `json:"finishedAt,omitempty" cborgen:"finishedAt,omitempty"` // id: Pipeline-local workflow id, usually same as name. Id string `json:"id" cborgen:"id"` // name: Human-readable name of the workflow Name *string `json:"name,omitempty" cborgen:"name,omitempty"` StartedAt *string `json:"startedAt,omitempty" cborgen:"startedAt,omitempty"` // status: Workflow status Status string `json:"status" cborgen:"status"` }