Monorepo for Tangled
0

Configure Feed

Select the types of activity you want to include in your feed.

lexicons,spindle,appview: give ci pipeline its own nsid

Signed-off-by: dawn <dawn@tangled.org>

authored by

dawn and committed by
Tangled
(Jul 4, 2026, 8:12 AM +0300) dd7a27b1 9a648815

+260 -224
+27 -27
api/tangled/cbor_gen.go
··· 662 662 663 663 return nil 664 664 } 665 - func (t *CiDefs_Pipeline) MarshalCBOR(w io.Writer) error { 665 + func (t *CiPipeline) MarshalCBOR(w io.Writer) error { 666 666 if t == nil { 667 667 _, err := w.Write(cbg.CborNull) 668 668 return err ··· 761 761 return err 762 762 } 763 763 764 - // t.Trigger (tangled.CiDefs_Pipeline_Trigger) (struct) 764 + // t.Trigger (tangled.CiPipeline_Trigger) (struct) 765 765 if len("trigger") > 1000000 { 766 766 return xerrors.Errorf("Value in field \"trigger\" was too long") 767 767 } ··· 809 809 } 810 810 } 811 811 812 - // t.Workflows ([]*tangled.CiDefs_Workflow) (slice) 812 + // t.Workflows ([]*tangled.CiPipeline_Workflow) (slice) 813 813 if len("workflows") > 1000000 { 814 814 return xerrors.Errorf("Value in field \"workflows\" was too long") 815 815 } ··· 837 837 return nil 838 838 } 839 839 840 - func (t *CiDefs_Pipeline) UnmarshalCBOR(r io.Reader) (err error) { 841 - *t = CiDefs_Pipeline{} 840 + func (t *CiPipeline) UnmarshalCBOR(r io.Reader) (err error) { 841 + *t = CiPipeline{} 842 842 843 843 cr := cbg.NewCborReader(r) 844 844 ··· 857 857 } 858 858 859 859 if extra > cbg.MaxLength { 860 - return fmt.Errorf("CiDefs_Pipeline: map struct too large (%d)", extra) 860 + return fmt.Errorf("CiPipeline: map struct too large (%d)", extra) 861 861 } 862 862 863 863 n := extra ··· 921 921 922 922 t.Commit = string(sval) 923 923 } 924 - // t.Trigger (tangled.CiDefs_Pipeline_Trigger) (struct) 924 + // t.Trigger (tangled.CiPipeline_Trigger) (struct) 925 925 case "trigger": 926 926 927 927 { ··· 934 934 if err := cr.UnreadByte(); err != nil { 935 935 return err 936 936 } 937 - t.Trigger = new(CiDefs_Pipeline_Trigger) 937 + t.Trigger = new(CiPipeline_Trigger) 938 938 if err := t.Trigger.UnmarshalCBOR(cr); err != nil { 939 939 return xerrors.Errorf("unmarshaling t.Trigger pointer: %w", err) 940 940 } ··· 962 962 t.CreatedAt = (*string)(&sval) 963 963 } 964 964 } 965 - // t.Workflows ([]*tangled.CiDefs_Workflow) (slice) 965 + // t.Workflows ([]*tangled.CiPipeline_Workflow) (slice) 966 966 case "workflows": 967 967 968 968 maj, extra, err = cr.ReadHeader() ··· 979 979 } 980 980 981 981 if extra > 0 { 982 - t.Workflows = make([]*CiDefs_Workflow, extra) 982 + t.Workflows = make([]*CiPipeline_Workflow, extra) 983 983 } 984 984 985 985 for i := 0; i < int(extra); i++ { ··· 1001 1001 if err := cr.UnreadByte(); err != nil { 1002 1002 return err 1003 1003 } 1004 - t.Workflows[i] = new(CiDefs_Workflow) 1004 + t.Workflows[i] = new(CiPipeline_Workflow) 1005 1005 if err := t.Workflows[i].UnmarshalCBOR(cr); err != nil { 1006 1006 return xerrors.Errorf("unmarshaling t.Workflows[i] pointer: %w", err) 1007 1007 } ··· 1022 1022 1023 1023 return nil 1024 1024 } 1025 - func (t *CiDefs_Pipeline_Trigger) MarshalCBOR(w io.Writer) error { 1025 + func (t *CiPipeline_Trigger) MarshalCBOR(w io.Writer) error { 1026 1026 if t == nil { 1027 1027 _, err := w.Write(cbg.CborNull) 1028 1028 return err ··· 1084 1084 return nil 1085 1085 } 1086 1086 1087 - func (t *CiDefs_Pipeline_Trigger) UnmarshalCBOR(r io.Reader) (err error) { 1088 - *t = CiDefs_Pipeline_Trigger{} 1087 + func (t *CiPipeline_Trigger) UnmarshalCBOR(r io.Reader) (err error) { 1088 + *t = CiPipeline_Trigger{} 1089 1089 1090 1090 cr := cbg.NewCborReader(r) 1091 1091 ··· 1104 1104 } 1105 1105 1106 1106 if extra > cbg.MaxLength { 1107 - return fmt.Errorf("CiDefs_Pipeline_Trigger: map struct too large (%d)", extra) 1107 + return fmt.Errorf("CiPipeline_Trigger: map struct too large (%d)", extra) 1108 1108 } 1109 1109 1110 1110 n := extra ··· 1196 1196 1197 1197 return nil 1198 1198 } 1199 - func (t *CiDefs_Workflow) MarshalCBOR(w io.Writer) error { 1199 + func (t *CiPipeline_Workflow) MarshalCBOR(w io.Writer) error { 1200 1200 if t == nil { 1201 1201 _, err := w.Write(cbg.CborNull) 1202 1202 return err ··· 1388 1388 return nil 1389 1389 } 1390 1390 1391 - func (t *CiDefs_Workflow) UnmarshalCBOR(r io.Reader) (err error) { 1392 - *t = CiDefs_Workflow{} 1391 + func (t *CiPipeline_Workflow) UnmarshalCBOR(r io.Reader) (err error) { 1392 + *t = CiPipeline_Workflow{} 1393 1393 1394 1394 cr := cbg.NewCborReader(r) 1395 1395 ··· 1408 1408 } 1409 1409 1410 1410 if extra > cbg.MaxLength { 1411 - return fmt.Errorf("CiDefs_Workflow: map struct too large (%d)", extra) 1411 + return fmt.Errorf("CiPipeline_Workflow: map struct too large (%d)", extra) 1412 1412 } 1413 1413 1414 1414 n := extra ··· 1536 1536 1537 1537 return nil 1538 1538 } 1539 - func (t *CiPipelineSubscribeLogs_Control) MarshalCBOR(w io.Writer) error { 1539 + func (t *CiSubscribePipelineLogs_Control) MarshalCBOR(w io.Writer) error { 1540 1540 if t == nil { 1541 1541 _, err := w.Write(cbg.CborNull) 1542 1542 return err ··· 1750 1750 return nil 1751 1751 } 1752 1752 1753 - func (t *CiPipelineSubscribeLogs_Control) UnmarshalCBOR(r io.Reader) (err error) { 1754 - *t = CiPipelineSubscribeLogs_Control{} 1753 + func (t *CiSubscribePipelineLogs_Control) UnmarshalCBOR(r io.Reader) (err error) { 1754 + *t = CiSubscribePipelineLogs_Control{} 1755 1755 1756 1756 cr := cbg.NewCborReader(r) 1757 1757 ··· 1770 1770 } 1771 1771 1772 1772 if extra > cbg.MaxLength { 1773 - return fmt.Errorf("CiPipelineSubscribeLogs_Control: map struct too large (%d)", extra) 1773 + return fmt.Errorf("CiSubscribePipelineLogs_Control: map struct too large (%d)", extra) 1774 1774 } 1775 1775 1776 1776 n := extra ··· 1924 1924 1925 1925 return nil 1926 1926 } 1927 - func (t *CiPipelineSubscribeLogs_Data) MarshalCBOR(w io.Writer) error { 1927 + func (t *CiSubscribePipelineLogs_Data) MarshalCBOR(w io.Writer) error { 1928 1928 if t == nil { 1929 1929 _, err := w.Write(cbg.CborNull) 1930 1930 return err ··· 2052 2052 return nil 2053 2053 } 2054 2054 2055 - func (t *CiPipelineSubscribeLogs_Data) UnmarshalCBOR(r io.Reader) (err error) { 2056 - *t = CiPipelineSubscribeLogs_Data{} 2055 + func (t *CiSubscribePipelineLogs_Data) UnmarshalCBOR(r io.Reader) (err error) { 2056 + *t = CiSubscribePipelineLogs_Data{} 2057 2057 2058 2058 cr := cbg.NewCborReader(r) 2059 2059 ··· 2072 2072 } 2073 2073 2074 2074 if extra > cbg.MaxLength { 2075 - return fmt.Errorf("CiPipelineSubscribeLogs_Data: map struct too large (%d)", extra) 2075 + return fmt.Errorf("CiSubscribePipelineLogs_Data: map struct too large (%d)", extra) 2076 2076 } 2077 2077 2078 2078 n := extra
+34
api/tangled/cicancelPipeline.go
··· 1 + // Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. 2 + 3 + package tangled 4 + 5 + // schema: sh.tangled.ci.cancelPipeline 6 + 7 + import ( 8 + "context" 9 + 10 + "github.com/bluesky-social/indigo/lex/util" 11 + ) 12 + 13 + const ( 14 + CiCancelPipelineNSID = "sh.tangled.ci.cancelPipeline" 15 + ) 16 + 17 + // CiCancelPipeline_Input is the input argument to a sh.tangled.ci.cancelPipeline call. 18 + type CiCancelPipeline_Input struct { 19 + // pipeline: pipeline TID 20 + Pipeline string `json:"pipeline" cborgen:"pipeline"` 21 + // repo: git repository DID 22 + Repo string `json:"repo" cborgen:"repo"` 23 + // workflows: Workflow names to filter. When not provided, entire pipeline will be canceled. 24 + Workflows []string `json:"workflows,omitempty" cborgen:"workflows,omitempty"` 25 + } 26 + 27 + // CiCancelPipeline calls the XRPC method "sh.tangled.ci.cancelPipeline". 28 + func CiCancelPipeline(ctx context.Context, c util.LexClient, input *CiCancelPipeline_Input) error { 29 + if err := c.LexDo(ctx, util.Procedure, "application/json", "sh.tangled.ci.cancelPipeline", nil, input, nil); err != nil { 30 + return err 31 + } 32 + 33 + return nil 34 + }
+15 -11
api/tangled/cidefs.go api/tangled/cipipeline.go
··· 2 2 3 3 package tangled 4 4 5 - // schema: sh.tangled.ci.defs 5 + // schema: sh.tangled.ci.pipeline 6 6 7 7 import ( 8 8 "encoding/json" ··· 11 11 "github.com/bluesky-social/indigo/lex/util" 12 12 ) 13 13 14 - const () 14 + const ( 15 + CiPipelineNSID = "sh.tangled.ci.pipeline" 16 + ) 15 17 16 - // CiDefs_Pipeline is a "pipeline" in the sh.tangled.ci.defs schema. 17 - type CiDefs_Pipeline struct { 18 + // CiPipeline is a "main" in the sh.tangled.ci.pipeline schema. 19 + // 20 + // A CI pipeline. Record-like, but owned by the spindle rather than a PDS. 21 + type CiPipeline struct { 18 22 // commit: Commit Id this pipeline is running on 19 23 Commit string `json:"commit" cborgen:"commit"` 20 24 CreatedAt *string `json:"createdAt,omitempty" cborgen:"createdAt,omitempty"` ··· 23 27 // repo: Repository DID 24 28 Repo *string `json:"repo,omitempty" cborgen:"repo,omitempty"` 25 29 // trigger: Trigger event metadata 26 - Trigger *CiDefs_Pipeline_Trigger `json:"trigger" cborgen:"trigger"` 30 + Trigger *CiPipeline_Trigger `json:"trigger" cborgen:"trigger"` 27 31 // workflows: Triggered workflows 28 - Workflows []*CiDefs_Workflow `json:"workflows" cborgen:"workflows"` 32 + Workflows []*CiPipeline_Workflow `json:"workflows" cborgen:"workflows"` 29 33 } 30 34 31 35 // Trigger event metadata 32 - type CiDefs_Pipeline_Trigger struct { 36 + type CiPipeline_Trigger struct { 33 37 CiTrigger_Push *CiTrigger_Push 34 38 CiTrigger_PullRequest *CiTrigger_PullRequest 35 39 CiTrigger_Manual *CiTrigger_Manual 36 40 } 37 41 38 - func (t *CiDefs_Pipeline_Trigger) MarshalJSON() ([]byte, error) { 42 + func (t *CiPipeline_Trigger) MarshalJSON() ([]byte, error) { 39 43 if t.CiTrigger_Push != nil { 40 44 t.CiTrigger_Push.LexiconTypeID = "sh.tangled.ci.trigger#push" 41 45 return json.Marshal(t.CiTrigger_Push) ··· 50 54 } 51 55 return nil, fmt.Errorf("cannot marshal empty enum") 52 56 } 53 - func (t *CiDefs_Pipeline_Trigger) UnmarshalJSON(b []byte) error { 57 + func (t *CiPipeline_Trigger) UnmarshalJSON(b []byte) error { 54 58 typ, err := util.TypeExtract(b) 55 59 if err != nil { 56 60 return err ··· 72 76 } 73 77 } 74 78 75 - // CiDefs_Workflow is a "workflow" in the sh.tangled.ci.defs schema. 76 - type CiDefs_Workflow struct { 79 + // CiPipeline_Workflow is a "workflow" in the sh.tangled.ci.pipeline schema. 80 + type CiPipeline_Workflow struct { 77 81 Error *string `json:"error,omitempty" cborgen:"error,omitempty"` 78 82 FinishedAt *string `json:"finishedAt,omitempty" cborgen:"finishedAt,omitempty"` 79 83 // id: Spindle-local workflow id. Unique per pipeline, usually same as name.
+2 -2
api/tangled/cigetPipeline.go
··· 17 17 // CiGetPipeline calls the XRPC method "sh.tangled.ci.getPipeline". 18 18 // 19 19 // pipeline: Spindle-local pipeline id 20 - func CiGetPipeline(ctx context.Context, c util.LexClient, pipeline string) (*CiDefs_Pipeline, error) { 21 - var out CiDefs_Pipeline 20 + func CiGetPipeline(ctx context.Context, c util.LexClient, pipeline string) (*CiPipeline, error) { 21 + var out CiPipeline 22 22 23 23 params := map[string]interface{}{} 24 24 params["pipeline"] = pipeline
+2 -2
api/tangled/ciqueryPipelines.go
··· 16 16 17 17 // CiQueryPipelines_Output is the output of a sh.tangled.ci.queryPipelines call. 18 18 type CiQueryPipelines_Output struct { 19 - Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` 20 - Pipelines []*CiDefs_Pipeline `json:"pipelines" cborgen:"pipelines"` 19 + Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` 20 + Pipelines []*CiPipeline `json:"pipelines" cborgen:"pipelines"` 21 21 // total: Maximum number of pipelines 22 22 Total int64 `json:"total" cborgen:"total"` 23 23 }
+43
api/tangled/citriggerPipeline.go
··· 1 + // Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. 2 + 3 + package tangled 4 + 5 + // schema: sh.tangled.ci.triggerPipeline 6 + 7 + import ( 8 + "context" 9 + 10 + "github.com/bluesky-social/indigo/lex/util" 11 + ) 12 + 13 + const ( 14 + CiTriggerPipelineNSID = "sh.tangled.ci.triggerPipeline" 15 + ) 16 + 17 + // CiTriggerPipeline_Input is the input argument to a sh.tangled.ci.triggerPipeline call. 18 + type CiTriggerPipeline_Input struct { 19 + // ref: optional ref the SHA was resolved from, for display 20 + Ref *string `json:"ref,omitempty" cborgen:"ref,omitempty"` 21 + // repo: AT-URI of the sh.tangled.repo record 22 + Repo string `json:"repo" cborgen:"repo"` 23 + // sha: commit SHA to run the pipeline at 24 + Sha string `json:"sha" cborgen:"sha"` 25 + // workflows: Workflow names to run. When not provided, every dispatchable workflow is run. 26 + Workflows []string `json:"workflows,omitempty" cborgen:"workflows,omitempty"` 27 + } 28 + 29 + // CiTriggerPipeline_Output is the output of a sh.tangled.ci.triggerPipeline call. 30 + type CiTriggerPipeline_Output struct { 31 + // pipeline: AT-URI of the created pipeline 32 + Pipeline string `json:"pipeline" cborgen:"pipeline"` 33 + } 34 + 35 + // CiTriggerPipeline calls the XRPC method "sh.tangled.ci.triggerPipeline". 36 + func CiTriggerPipeline(ctx context.Context, c util.LexClient, input *CiTriggerPipeline_Input) (*CiTriggerPipeline_Output, error) { 37 + var out CiTriggerPipeline_Output 38 + if err := c.LexDo(ctx, util.Procedure, "application/json", "sh.tangled.ci.triggerPipeline", nil, input, &out); err != nil { 39 + return nil, err 40 + } 41 + 42 + return &out, nil 43 + }
+1 -1
api/tangled/pipelinestatus.go
··· 15 15 func init() { 16 16 util.RegisterType("sh.tangled.pipeline.status", &PipelineStatus{}) 17 17 } // 18 - // DEPRECATED: use sh.tangled.ci.defs#pipeline instead 18 + // DEPRECATED: use sh.tangled.ci.pipeline instead 19 19 // 20 20 // RECORDTYPE: PipelineStatus 21 21 type PipelineStatus struct {
+6 -6
api/tangled/pipelinesubscribeLogs.go api/tangled/cisubscribePipelineLogs.go
··· 2 2 3 3 package tangled 4 4 5 - // schema: sh.tangled.ci.pipeline.subscribeLogs 5 + // schema: sh.tangled.ci.subscribePipelineLogs 6 6 7 7 const ( 8 - CiPipelineSubscribeLogsNSID = "sh.tangled.ci.pipeline.subscribeLogs" 8 + CiSubscribePipelineLogsNSID = "sh.tangled.ci.subscribePipelineLogs" 9 9 ) 10 10 11 - // CiPipelineSubscribeLogs_Control is a "control" in the sh.tangled.ci.pipeline.subscribeLogs schema. 12 - type CiPipelineSubscribeLogs_Control struct { 11 + // CiSubscribePipelineLogs_Control is a "control" in the sh.tangled.ci.subscribePipelineLogs schema. 12 + type CiSubscribePipelineLogs_Control struct { 13 13 // command: Step command 14 14 Command *string `json:"command,omitempty" cborgen:"command,omitempty"` 15 15 Content string `json:"content" cborgen:"content"` ··· 24 24 Workflow string `json:"workflow" cborgen:"workflow"` 25 25 } 26 26 27 - // CiPipelineSubscribeLogs_Data is a "data" in the sh.tangled.ci.pipeline.subscribeLogs schema. 28 - type CiPipelineSubscribeLogs_Data struct { 27 + // CiSubscribePipelineLogs_Data is a "data" in the sh.tangled.ci.subscribePipelineLogs schema. 28 + type CiSubscribePipelineLogs_Data struct { 29 29 Content string `json:"content" cborgen:"content"` 30 30 // step: Step ID 31 31 Step int64 `json:"step" cborgen:"step"`
+11 -11
api/tangled/pipelinesubscribeLogs_ext.go api/tangled/cisubscribePipelineLogs_ext.go
··· 1 - // extending code generated from sh.tangled.ci.pipeline.subscribeLogs 1 + // extending code generated from sh.tangled.ci.subscribePipelineLogs 2 2 3 3 package tangled 4 4 ··· 14 14 ) 15 15 16 16 // TODO: generate codes below from lexicon 17 - type CiPipelineSubscribeLogs_Event struct { 17 + type CiSubscribePipelineLogs_Event struct { 18 18 Error *events.ErrorFrame 19 - Control *CiPipelineSubscribeLogs_Control 20 - Data *CiPipelineSubscribeLogs_Data 19 + Control *CiSubscribePipelineLogs_Control 20 + Data *CiSubscribePipelineLogs_Data 21 21 22 22 // some private fields for internal routing perf 23 23 Preserialized []byte `json:"-" cborgen:"-"` 24 24 } 25 25 26 - func (xevt *CiPipelineSubscribeLogs_Event) Serialize(wc io.Writer) error { 26 + func (xevt *CiSubscribePipelineLogs_Event) Serialize(wc io.Writer) error { 27 27 header := events.EventHeader{Op: events.EvtKindMessage} 28 28 var obj lexutil.CBOR 29 29 ··· 48 48 return obj.MarshalCBOR(cborWriter) 49 49 } 50 50 51 - func (xevt *CiPipelineSubscribeLogs_Event) Deserialize(r io.Reader) error { 51 + func (xevt *CiSubscribePipelineLogs_Event) Deserialize(r io.Reader) error { 52 52 var header events.EventHeader 53 53 if err := header.UnmarshalCBOR(r); err != nil { 54 54 return fmt.Errorf("reading header: %w", err) ··· 57 57 case events.EvtKindMessage: 58 58 switch header.MsgType { 59 59 case "#control": 60 - var evt CiPipelineSubscribeLogs_Control 60 + var evt CiSubscribePipelineLogs_Control 61 61 if err := evt.UnmarshalCBOR(r); err != nil { 62 62 return fmt.Errorf("reading repoCommit event: %w", err) 63 63 } 64 64 xevt.Control = &evt 65 65 case "#data": 66 - var evt CiPipelineSubscribeLogs_Data 66 + var evt CiSubscribePipelineLogs_Data 67 67 if err := evt.UnmarshalCBOR(r); err != nil { 68 68 return fmt.Errorf("reading repoSync event: %w", err) 69 69 } ··· 81 81 return nil 82 82 } 83 83 84 - func CiPipelineSubscribeLogs(ctx context.Context, c extlexutil.LexClient, pipeline string, workflows []string, sched extlexutil.Scheduler[CiPipelineSubscribeLogs_Event]) error { 84 + func CiSubscribePipelineLogs(ctx context.Context, c extlexutil.LexClient, pipeline string, workflows []string, sched extlexutil.Scheduler[CiSubscribePipelineLogs_Event]) error { 85 85 defer sched.Shutdown() 86 86 87 87 params := map[string]any{} 88 88 params["pipeline"] = pipeline 89 89 params["workflows"] = workflows 90 90 91 - return c.LexDo(ctx, extlexutil.Subscription, "", CiPipelineSubscribeLogsNSID, params, nil, func(ctx context.Context, cr *cbg.CborReader) error { 92 - var evt CiPipelineSubscribeLogs_Event 91 + return c.LexDo(ctx, extlexutil.Subscription, "", CiSubscribePipelineLogsNSID, params, nil, func(ctx context.Context, cr *cbg.CborReader) error { 92 + var evt CiSubscribePipelineLogs_Event 93 93 if err := evt.Deserialize(cr); err != nil { 94 94 return err 95 95 }
-43
api/tangled/pipelinetriggerPipeline.go
··· 1 - // Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. 2 - 3 - package tangled 4 - 5 - // schema: sh.tangled.ci.pipeline.triggerPipeline 6 - 7 - import ( 8 - "context" 9 - 10 - "github.com/bluesky-social/indigo/lex/util" 11 - ) 12 - 13 - const ( 14 - CiPipelineTriggerPipelineNSID = "sh.tangled.ci.pipeline.triggerPipeline" 15 - ) 16 - 17 - // CiPipelineTriggerPipeline_Input is the input argument to a sh.tangled.ci.pipeline.triggerPipeline call. 18 - type CiPipelineTriggerPipeline_Input struct { 19 - // ref: optional ref the SHA was resolved from, for display 20 - Ref *string `json:"ref,omitempty" cborgen:"ref,omitempty"` 21 - // repo: AT-URI of the sh.tangled.repo record 22 - Repo string `json:"repo" cborgen:"repo"` 23 - // sha: commit SHA to run the pipeline at 24 - Sha string `json:"sha" cborgen:"sha"` 25 - // workflows: Workflow names to run. When not provided, every dispatchable workflow is run. 26 - Workflows []string `json:"workflows,omitempty" cborgen:"workflows,omitempty"` 27 - } 28 - 29 - // CiPipelineTriggerPipeline_Output is the output of a sh.tangled.ci.pipeline.triggerPipeline call. 30 - type CiPipelineTriggerPipeline_Output struct { 31 - // pipeline: AT-URI of the created pipeline 32 - Pipeline string `json:"pipeline" cborgen:"pipeline"` 33 - } 34 - 35 - // CiPipelineTriggerPipeline calls the XRPC method "sh.tangled.ci.pipeline.triggerPipeline". 36 - func CiPipelineTriggerPipeline(ctx context.Context, c util.LexClient, input *CiPipelineTriggerPipeline_Input) (*CiPipelineTriggerPipeline_Output, error) { 37 - var out CiPipelineTriggerPipeline_Output 38 - if err := c.LexDo(ctx, util.Procedure, "application/json", "sh.tangled.ci.pipeline.triggerPipeline", nil, input, &out); err != nil { 39 - return nil, err 40 - } 41 - 42 - return &out, nil 43 - }
+1 -1
api/tangled/tangledpipeline.go
··· 15 15 func init() { 16 16 util.RegisterType("sh.tangled.pipeline", &Pipeline{}) 17 17 } // 18 - // DEPRECATED: use sh.tangled.ci.defs#pipeline instead 18 + // DEPRECATED: use sh.tangled.ci.pipeline instead 19 19 // 20 20 // RECORDTYPE: Pipeline 21 21 type Pipeline struct {
+2 -2
appview/oauth/scopes.go
··· 31 31 32 32 "rpc:sh.tangled.knot.addMember?aud=*", 33 33 "rpc:sh.tangled.knot.removeMember?aud=*", 34 - "rpc:sh.tangled.ci.pipeline.triggerPipeline?aud=*", 35 - "rpc:sh.tangled.pipeline.cancelPipeline?aud=*", 34 + "rpc:sh.tangled.ci.triggerPipeline?aud=*", 35 + "rpc:sh.tangled.ci.cancelPipeline?aud=*", 36 36 "rpc:sh.tangled.repo.addCollaborator?aud=*", 37 37 "rpc:sh.tangled.repo.addSecret?aud=*", 38 38 "rpc:sh.tangled.repo.create?aud=*",
+10 -10
appview/pipelines/pipelines.go
··· 142 142 143 143 var pipelines []types.Pipeline 144 144 for _, pipeline := range out.Pipelines { 145 - pipelines = append(pipelines, types.Pipeline{CiDefs_Pipeline: pipeline}) 145 + pipelines = append(pipelines, types.Pipeline{CiPipeline: pipeline}) 146 146 } 147 147 148 148 p.pages.Pipelines(w, pages.PipelinesParams{ ··· 222 222 p.pages.Workflow(w, pages.WorkflowParams{ 223 223 BaseParams: pages.BaseParamsFromContext(r.Context()), 224 224 RepoInfo: p.repoResolver.GetRepoInfo(r, user), 225 - Pipeline: types.Pipeline{CiDefs_Pipeline: out}, 225 + Pipeline: types.Pipeline{CiPipeline: out}, 226 226 Workflow: workflowName, 227 227 }) 228 228 } ··· 233 233 } 234 234 235 235 type webLogScheduler struct { 236 - ch chan *tangled.CiPipelineSubscribeLogs_Event 236 + ch chan *tangled.CiSubscribePipelineLogs_Event 237 237 } 238 238 239 - var _ lexutil.Scheduler[tangled.CiPipelineSubscribeLogs_Event] = (*webLogScheduler)(nil) 239 + var _ lexutil.Scheduler[tangled.CiSubscribePipelineLogs_Event] = (*webLogScheduler)(nil) 240 240 241 241 // AddWork implements [lexutil.Scheduler]. 242 - func (w *webLogScheduler) AddWork(ctx context.Context, _ string, val *tangled.CiPipelineSubscribeLogs_Event) error { 242 + func (w *webLogScheduler) AddWork(ctx context.Context, _ string, val *tangled.CiSubscribePipelineLogs_Event) error { 243 243 select { 244 244 case w.ch <- val: 245 245 return nil ··· 296 296 return 297 297 } 298 298 299 - evChan := make(chan *tangled.CiPipelineSubscribeLogs_Event, 100) 299 + evChan := make(chan *tangled.CiSubscribePipelineLogs_Event, 100) 300 300 done := make(chan error, 1) 301 301 sched := &webLogScheduler{ch: evChan} 302 302 xrpcc := &lexutil.Client{Client: indigoxrpc.Client{Host: spindleUrl}} 303 303 go func() { 304 - done <- tangled.CiPipelineSubscribeLogs(ctx, xrpcc, pipelineId.String(), []string{workflowName}, sched) 304 + done <- tangled.CiSubscribePipelineLogs(ctx, xrpcc, pipelineId.String(), []string{workflowName}, sched) 305 305 }() 306 306 307 307 var lastWriteLk sync.Mutex ··· 570 570 } 571 571 redirectWf := workflows[0] 572 572 573 - spindleClient, err := p.spindleServiceClient(r, f.Spindle, tangled.CiPipelineTriggerPipelineNSID) 573 + spindleClient, err := p.spindleServiceClient(r, f.Spindle, tangled.CiTriggerPipelineNSID) 574 574 if err != nil { 575 575 fail("failed to authorize with spindle", err) 576 576 return 577 577 } 578 578 579 - out, err := tangled.CiPipelineTriggerPipeline( 579 + out, err := tangled.CiTriggerPipeline( 580 580 r.Context(), 581 581 spindleClient, 582 - &tangled.CiPipelineTriggerPipeline_Input{ 582 + &tangled.CiTriggerPipeline_Input{ 583 583 Repo: string(f.RepoAt()), 584 584 Sha: orig.Commit, 585 585 Workflows: workflows,
+2 -2
appview/pipelines/ssh/cihelpers.go
··· 8 8 9 9 // helper functions against generated code 10 10 11 - func workflowElapsed(wf *tangled.CiDefs_Workflow, now time.Time) time.Duration { 11 + func workflowElapsed(wf *tangled.CiPipeline_Workflow, now time.Time) time.Duration { 12 12 if wf.StartedAt == nil { 13 13 return 0 14 14 } ··· 33 33 "success": true, 34 34 } 35 35 36 - func pipelineFinished(p *tangled.CiDefs_Pipeline) bool { 36 + func pipelineFinished(p *tangled.CiPipeline) bool { 37 37 for _, wf := range p.Workflows { 38 38 if !finishedStatuses[wf.Status] { 39 39 return false
+5 -5
appview/pipelines/ssh/logstream.go
··· 22 22 } 23 23 24 24 type logEventMsg struct { 25 - ev *tangled.CiPipelineSubscribeLogs_Event 26 - events chan *tangled.CiPipelineSubscribeLogs_Event 25 + ev *tangled.CiSubscribePipelineLogs_Event 26 + events chan *tangled.CiSubscribePipelineLogs_Event 27 27 done chan error 28 28 } 29 29 30 30 type eventScheduler struct { 31 - ch chan *tangled.CiPipelineSubscribeLogs_Event 31 + ch chan *tangled.CiSubscribePipelineLogs_Event 32 32 } 33 33 34 34 func newEventScheduler() *eventScheduler { 35 - return &eventScheduler{ch: make(chan *tangled.CiPipelineSubscribeLogs_Event, 1024)} 35 + return &eventScheduler{ch: make(chan *tangled.CiSubscribePipelineLogs_Event, 1024)} 36 36 } 37 37 38 - func (s *eventScheduler) AddWork(ctx context.Context, _ string, v *tangled.CiPipelineSubscribeLogs_Event) error { 38 + func (s *eventScheduler) AddWork(ctx context.Context, _ string, v *tangled.CiSubscribePipelineLogs_Event) error { 39 39 select { 40 40 case s.ch <- v: 41 41 return nil
+7 -7
appview/pipelines/ssh/tui.go
··· 25 25 type tickMsg time.Time 26 26 27 27 type statusUpdateMsg struct { 28 - pipeline *tangled.CiDefs_Pipeline 28 + pipeline *tangled.CiPipeline 29 29 } 30 30 31 31 type statusUpdateErrMsg struct{ err error } ··· 33 33 type pipelineModel struct { 34 34 renderer *lipgloss.Renderer 35 35 xrpcc *extlexutil.Client 36 - pipeline *tangled.CiDefs_Pipeline 36 + pipeline *tangled.CiPipeline 37 37 selected int 38 38 logs map[string]*workflowLogs 39 39 ··· 55 55 ready bool 56 56 } 57 57 58 - func newPipelineModel(renderer *lipgloss.Renderer, xrpcc *extlexutil.Client, pipeline *tangled.CiDefs_Pipeline, width, height int) *pipelineModel { 58 + func newPipelineModel(renderer *lipgloss.Renderer, xrpcc *extlexutil.Client, pipeline *tangled.CiPipeline, width, height int) *pipelineModel { 59 59 logs := make(map[string]*workflowLogs, len(pipeline.Workflows)) 60 60 for _, wf := range pipeline.Workflows { 61 61 logs[wf.Name] = &workflowLogs{stepIndex: make(map[int64]int)} ··· 95 95 96 96 pipelineId := m.pipeline.Id 97 97 go func() { 98 - err := tangled.CiPipelineSubscribeLogs(ctx, m.xrpcc, pipelineId, nil, sched) 98 + err := tangled.CiSubscribePipelineLogs(ctx, m.xrpcc, pipelineId, nil, sched) 99 99 done <- err 100 100 }() 101 101 102 102 return readEventCmd(sched.ch, done) 103 103 } 104 104 105 - func readEventCmd(events chan *tangled.CiPipelineSubscribeLogs_Event, done chan error) tea.Cmd { 105 + func readEventCmd(events chan *tangled.CiSubscribePipelineLogs_Event, done chan error) tea.Cmd { 106 106 return func() tea.Msg { 107 107 ev, ok := <-events 108 108 if !ok { ··· 295 295 } 296 296 297 297 // applyEvent routes a decoded subscribeLogs event into the matching workflow. 298 - func (m *pipelineModel) applyEvent(ev *tangled.CiPipelineSubscribeLogs_Event) { 298 + func (m *pipelineModel) applyEvent(ev *tangled.CiSubscribePipelineLogs_Event) { 299 299 switch { 300 300 case ev.Error != nil: 301 301 if ev.Error.Message != "" { ··· 447 447 return sha 448 448 } 449 449 450 - func triggerLine(r *lipgloss.Renderer, t *tangled.CiDefs_Pipeline_Trigger, sha string) string { 450 + func triggerLine(r *lipgloss.Renderer, t *tangled.CiPipeline_Trigger, sha string) string { 451 451 hash := shortSha(sha) 452 452 dim := r.NewStyle().Faint(true) 453 453 if t == nil {
+1 -1
appview/pulls/list.go
··· 286 286 if pipeline == nil { 287 287 continue 288 288 } 289 - m[pipeline.Commit] = types.Pipeline{CiDefs_Pipeline: pipeline} 289 + m[pipeline.Commit] = types.Pipeline{CiPipeline: pipeline} 290 290 } 291 291 return m 292 292 }(r.Context(), shas)
+1 -1
appview/pulls/single.go
··· 182 182 if pipeline == nil { 183 183 continue 184 184 } 185 - m[pipeline.Commit] = types.Pipeline{CiDefs_Pipeline: pipeline} 185 + m[pipeline.Commit] = types.Pipeline{CiPipeline: pipeline} 186 186 } 187 187 return m 188 188 }(r.Context())
+1 -1
appview/repo/repo_util.go
··· 116 116 } 117 117 118 118 for _, p := range out.Pipelines { 119 - m[p.Commit] = types.Pipeline{CiDefs_Pipeline: p} 119 + m[p.Commit] = types.Pipeline{CiPipeline: p} 120 120 } 121 121 122 122 return m, nil
+5 -5
cmd/cborgen/cborgen.go
··· 15 15 "api/tangled/cbor_gen.go", 16 16 "tangled", 17 17 tangled.ActorProfile{}, 18 - tangled.CiDefs_Pipeline{}, 19 - tangled.CiDefs_Pipeline_Trigger{}, 20 - tangled.CiDefs_Workflow{}, 21 - tangled.CiPipelineSubscribeLogs_Control{}, 22 - tangled.CiPipelineSubscribeLogs_Data{}, 18 + tangled.CiPipeline{}, 19 + tangled.CiPipeline_Trigger{}, 20 + tangled.CiPipeline_Workflow{}, 21 + tangled.CiSubscribePipelineLogs_Control{}, 22 + tangled.CiSubscribePipelineLogs_Data{}, 23 23 tangled.CiTrigger_Manual{}, 24 24 tangled.CiTrigger_PullRequest{}, 25 25 tangled.CiTrigger_Push{},
+9 -12
eventconsumer/upgrade_test.go
··· 22 22 return store 23 23 } 24 24 25 - func drainProcessed(t *testing.T, store cursor.Store, source Source) []int64 { 25 + func drainProcessed(t *testing.T, store cursor.Store, source Source, expected int) []int64 { 26 26 t.Helper() 27 27 28 28 var mu sync.Mutex ··· 43 43 }) 44 44 45 45 ctx, cancel := context.WithCancel(context.Background()) 46 - t.Cleanup(cancel) 46 + defer cancel() 47 47 c.Start(ctx) 48 48 c.AddSource(ctx, source) 49 49 50 50 deadline := time.Now().Add(3 * time.Second) 51 - last, stable := -1, 0 52 51 for time.Now().Before(deadline) { 53 - time.Sleep(100 * time.Millisecond) 54 52 mu.Lock() 55 53 n := len(seen) 56 54 mu.Unlock() 57 - if n == last { 58 - if stable++; stable >= 3 && n > 0 { 59 - break 60 - } 61 - } else { 62 - last, stable = n, 0 55 + if n >= expected { 56 + break 63 57 } 58 + time.Sleep(20 * time.Millisecond) 64 59 } 65 60 61 + c.Stop() 62 + 66 63 mu.Lock() 67 64 defer mu.Unlock() 68 65 return append([]int64(nil), seen...) ··· 78 75 store := sqliteCursorStore(t) 79 76 store.Set(source.Host, 5) 80 77 81 - seen := drainProcessed(t, store, source) 78 + seen := drainProcessed(t, store, source, 8) 82 79 83 80 if len(seen) != 8 { 84 81 t.Fatalf("orphaned bare-host cursor processed %d events, want a full replay of 8: %v", len(seen), seen) ··· 97 94 98 95 MigrateLegacyCursor(store, source) 99 96 100 - seen := drainProcessed(t, store, source) 97 + seen := drainProcessed(t, store, source, 3) 101 98 102 99 if len(seen) != 3 { 103 100 t.Fatalf("migrated cursor processed %d events, want a resume of 3: %v", len(seen), seen)
+3 -2
lexicons/ci/defs.json lexicons/ci/pipeline.json
··· 1 1 { 2 2 "lexicon": 1, 3 - "id": "sh.tangled.ci.defs", 3 + "id": "sh.tangled.ci.pipeline", 4 4 "defs": { 5 - "pipeline": { 5 + "main": { 6 6 "type": "object", 7 + "description": "A CI pipeline. Record-like, but owned by the spindle rather than a PDS.", 7 8 "required": ["id", "trigger", "commit", "workflows"], 8 9 "properties": { 9 10 "id": {
+1 -1
lexicons/ci/getPipeline.json
··· 19 19 "encoding": "application/json", 20 20 "schema": { 21 21 "type": "ref", 22 - "ref": "sh.tangled.ci.defs#pipeline" 22 + "ref": "sh.tangled.ci.pipeline" 23 23 } 24 24 }, 25 25 "errors": [
+1 -1
lexicons/ci/pipeline/cancelPipeline.json lexicons/ci/cancelPipeline.json
··· 1 1 { 2 2 "lexicon": 1, 3 - "id": "sh.tangled.ci.pipeline.cancelPipeline", 3 + "id": "sh.tangled.ci.cancelPipeline", 4 4 "defs": { 5 5 "main": { 6 6 "type": "procedure",
+1 -1
lexicons/ci/pipeline/subscribeLogs.json lexicons/ci/subscribePipelineLogs.json
··· 1 1 { 2 2 "lexicon": 1, 3 - "id": "sh.tangled.ci.pipeline.subscribeLogs", 3 + "id": "sh.tangled.ci.subscribePipelineLogs", 4 4 "defs": { 5 5 "main": { 6 6 "type": "subscription",
+1 -1
lexicons/ci/pipeline/triggerPipeline.json lexicons/ci/triggerPipeline.json
··· 1 1 { 2 2 "lexicon": 1, 3 - "id": "sh.tangled.ci.pipeline.triggerPipeline", 3 + "id": "sh.tangled.ci.triggerPipeline", 4 4 "defs": { 5 5 "main": { 6 6 "type": "procedure",
+1 -1
lexicons/ci/queryPipelines.json
··· 48 48 }, 49 49 "pipelines": { 50 50 "type": "array", 51 - "items": { "type": "ref", "ref": "sh.tangled.ci.defs#pipeline" } 51 + "items": { "type": "ref", "ref": "sh.tangled.ci.pipeline" } 52 52 } 53 53 } 54 54 }
+1 -1
lexicons/pipeline/cancelPipeline.json
··· 4 4 "defs": { 5 5 "main": { 6 6 "type": "procedure", 7 - "description": "DEPRECATED: use sh.tangled.ci.pipeline.cancelPipeline instead - Cancel a running pipeline", 7 + "description": "DEPRECATED: use sh.tangled.ci.cancelPipeline instead - Cancel a running pipeline", 8 8 "input": { 9 9 "encoding": "application/json", 10 10 "schema": {
+1 -1
lexicons/pipeline/pipeline.json
··· 9 9 "key": "tid", 10 10 "record": { 11 11 "type": "object", 12 - "description": "DEPRECATED: use sh.tangled.ci.defs#pipeline instead", 12 + "description": "DEPRECATED: use sh.tangled.ci.pipeline instead", 13 13 "required": [ 14 14 "triggerMetadata", 15 15 "workflows"
+1 -1
lexicons/pipeline/status.json
··· 9 9 "key": "tid", 10 10 "record": { 11 11 "type": "object", 12 - "description": "DEPRECATED: use sh.tangled.ci.defs#pipeline instead", 12 + "description": "DEPRECATED: use sh.tangled.ci.pipeline instead", 13 13 "required": ["pipeline", "workflow", "status", "createdAt"], 14 14 "properties": { 15 15 "pipeline": {
+10 -10
spindle/db/pipelines.go
··· 11 11 "tangled.org/core/spindle/models" 12 12 ) 13 13 14 - func (d *DB) QueryPipelines(ctx context.Context, repoDid string, commits []string, cursor string, limit int) ([]*tangled.CiDefs_Pipeline, string, int64, error) { 14 + func (d *DB) QueryPipelines(ctx context.Context, repoDid string, commits []string, cursor string, limit int) ([]*tangled.CiPipeline, string, int64, error) { 15 15 if limit <= 0 { 16 16 limit = 30 17 17 } ··· 59 59 } 60 60 defer rows.Close() 61 61 62 - var pipelines []*tangled.CiDefs_Pipeline 62 + var pipelines []*tangled.CiPipeline 63 63 var lastCreated int64 64 64 65 65 for rows.Next() { ··· 75 75 continue 76 76 } 77 77 78 - p, err := d.mapToCiDefsPipeline(ctx, rkey, created, rawPipeline) 78 + p, err := d.mapToCiPipeline(ctx, rkey, created, rawPipeline) 79 79 if err != nil { 80 80 return nil, "", 0, err 81 81 } ··· 90 90 return pipelines, nextCursor, total, nil 91 91 } 92 92 93 - func (d *DB) GetPipeline(ctx context.Context, rkey string) (*tangled.CiDefs_Pipeline, error) { 93 + func (d *DB) GetPipeline(ctx context.Context, rkey string) (*tangled.CiPipeline, error) { 94 94 var eventJson string 95 95 var created int64 96 96 err := d.QueryRowContext(ctx, ··· 113 113 return nil, err 114 114 } 115 115 116 - return d.mapToCiDefsPipeline(ctx, rkey, created, rawPipeline) 116 + return d.mapToCiPipeline(ctx, rkey, created, rawPipeline) 117 117 } 118 118 119 - func (d *DB) mapToCiDefsPipeline(ctx context.Context, rkey string, created int64, raw tangled.Pipeline) (*tangled.CiDefs_Pipeline, error) { 119 + func (d *DB) mapToCiPipeline(ctx context.Context, rkey string, created int64, raw tangled.Pipeline) (*tangled.CiPipeline, error) { 120 120 createdAtStr := time.Unix(0, created).Format(time.RFC3339) 121 121 122 122 var repoDidStr string ··· 129 129 } 130 130 131 131 commitSha := "" 132 - var trigger tangled.CiDefs_Pipeline_Trigger 132 + var trigger tangled.CiPipeline_Trigger 133 133 134 134 if raw.TriggerMetadata != nil { 135 135 switch raw.TriggerMetadata.Kind { ··· 160 160 } 161 161 } 162 162 163 - var workflows []*tangled.CiDefs_Workflow 163 + var workflows []*tangled.CiPipeline_Workflow 164 164 for _, wf := range raw.Workflows { 165 165 status := "pending" 166 166 var startedAt, finishedAt, wfError *string ··· 182 182 } 183 183 } 184 184 185 - workflows = append(workflows, &tangled.CiDefs_Workflow{ 185 + workflows = append(workflows, &tangled.CiPipeline_Workflow{ 186 186 Id: wf.Name, 187 187 Name: wf.Name, 188 188 Status: status, ··· 192 192 }) 193 193 } 194 194 195 - return &tangled.CiDefs_Pipeline{ 195 + return &tangled.CiPipeline{ 196 196 Id: rkey, 197 197 Commit: commitSha, 198 198 Repo: &repoDidStr,
+5 -5
spindle/xrpc/ci_pipeline_subscribe_logs.go
··· 17 17 "tangled.org/core/spindle/models" 18 18 ) 19 19 20 - func (x *Xrpc) HandleCiPipelineSubscribeLogs(w http.ResponseWriter, r *http.Request) { 20 + func (x *Xrpc) HandleCiSubscribePipelineLogs(w http.ResponseWriter, r *http.Request) { 21 21 var ( 22 22 pipelineQuery = r.URL.Query().Get("pipeline") 23 23 workflows = r.URL.Query()["workflows"] ··· 142 142 } 143 143 }() 144 144 145 - eventsChan := make(chan tangled.CiPipelineSubscribeLogs_Event, 128) 145 + eventsChan := make(chan tangled.CiSubscribePipelineLogs_Event, 128) 146 146 wg := sync.WaitGroup{} 147 147 148 148 // 4. start a tail reader goroutine for each workflow ··· 225 225 logLine = models.NewDataLogLine(0, line.Text, "stdout") 226 226 } 227 227 228 - var ev tangled.CiPipelineSubscribeLogs_Event 228 + var ev tangled.CiSubscribePipelineLogs_Event 229 229 timeStr := logLine.Time.Format(time.RFC3339) 230 230 if logLine.Time.IsZero() { 231 231 timeStr = time.Now().Format(time.RFC3339) ··· 236 236 if logLine.StepKind == models.StepKindSystem { 237 237 stepKindStr = "system" 238 238 } 239 - ev = tangled.CiPipelineSubscribeLogs_Event{Control: &tangled.CiPipelineSubscribeLogs_Control{ 239 + ev = tangled.CiSubscribePipelineLogs_Event{Control: &tangled.CiSubscribePipelineLogs_Control{ 240 240 Time: timeStr, 241 241 Workflow: wfName, 242 242 Step: int64(logLine.StepId), ··· 250 250 if streamType != "stdout" && streamType != "stderr" { 251 251 streamType = "stdout" 252 252 } 253 - ev = tangled.CiPipelineSubscribeLogs_Event{Data: &tangled.CiPipelineSubscribeLogs_Data{ 253 + ev = tangled.CiSubscribePipelineLogs_Event{Data: &tangled.CiSubscribePipelineLogs_Data{ 254 254 Time: timeStr, 255 255 Workflow: wfName, 256 256 Step: int64(logLine.StepId),
+2 -2
spindle/xrpc/ci_pipeline_trigger_pipeline.go
··· 30 30 return 31 31 } 32 32 33 - var input tangled.CiPipelineTriggerPipeline_Input 33 + var input tangled.CiTriggerPipeline_Input 34 34 if err := json.NewDecoder(r.Body).Decode(&input); err != nil { 35 35 fail(xrpcerr.GenericError(err)) 36 36 return ··· 62 62 return 63 63 } 64 64 65 - if err := writeJson(w, http.StatusOK, tangled.CiPipelineTriggerPipeline_Output{ 65 + if err := writeJson(w, http.StatusOK, tangled.CiTriggerPipeline_Output{ 66 66 Pipeline: pipelineAt.String(), 67 67 }); err != nil { 68 68 l.Error("failed to write response", "err", err)
+3 -3
spindle/xrpc/xrpc.go
··· 59 59 r.Post("/"+tangled.RepoAddSecretNSID, x.AddSecret) 60 60 r.Post("/"+tangled.RepoRemoveSecretNSID, x.RemoveSecret) 61 61 r.Get("/"+tangled.RepoListSecretsNSID, x.ListSecrets) 62 - r.Post("/"+tangled.CiPipelineCancelPipelineNSID, x.CancelPipeline) 63 - r.Post("/"+tangled.CiPipelineTriggerPipelineNSID, x.TriggerPipeline) 62 + r.Post("/"+tangled.CiCancelPipelineNSID, x.CancelPipeline) 63 + r.Post("/"+tangled.CiTriggerPipelineNSID, x.TriggerPipeline) 64 64 }) 65 65 66 66 // service query endpoints (no auth required) 67 67 r.Get("/"+tangled.OwnerNSID, x.Owner) 68 - r.Get("/"+tangled.CiPipelineSubscribeLogsNSID, x.HandleCiPipelineSubscribeLogs) 68 + r.Get("/"+tangled.CiSubscribePipelineLogsNSID, x.HandleCiSubscribePipelineLogs) 69 69 r.Get("/"+tangled.CiQueryPipelinesNSID, x.HandleCiQueryPipelines) 70 70 r.Get("/"+tangled.CiGetPipelineNSID, x.HandleCiGetPipeline) 71 71
+44 -44
types/pipeline.go
··· 31 31 } 32 32 33 33 type WorkflowStatus struct { 34 - *tangled.CiDefs_Workflow 34 + *tangled.CiPipeline_Workflow 35 35 PipelineCreatedAt *string 36 36 } 37 37 ··· 40 40 } 41 41 42 42 func (w WorkflowStatus) Error() string { 43 - if w.CiDefs_Workflow == nil || w.CiDefs_Workflow.Error == nil { 43 + if w.CiPipeline_Workflow == nil || w.CiPipeline_Workflow.Error == nil { 44 44 return "" 45 45 } 46 - return *w.CiDefs_Workflow.Error 46 + return *w.CiPipeline_Workflow.Error 47 47 } 48 48 49 49 func (w WorkflowStatus) Status() StatusKind { 50 - if w.CiDefs_Workflow == nil { 50 + if w.CiPipeline_Workflow == nil { 51 51 return "" 52 52 } 53 - return StatusKind(w.CiDefs_Workflow.Status) 53 + return StatusKind(w.CiPipeline_Workflow.Status) 54 54 } 55 55 56 56 func (w WorkflowStatus) TimeTaken() time.Duration { 57 - if w.CiDefs_Workflow == nil || w.StartedAt == nil || w.FinishedAt == nil || *w.StartedAt == "" || *w.FinishedAt == "" { 57 + if w.CiPipeline_Workflow == nil || w.StartedAt == nil || w.FinishedAt == nil || *w.StartedAt == "" || *w.FinishedAt == "" { 58 58 return 0 59 59 } 60 60 t1, err1 := time.Parse(time.RFC3339, *w.StartedAt) ··· 67 67 68 68 func (w WorkflowStatus) Created() time.Time { 69 69 var timeStr string 70 - if w.CiDefs_Workflow != nil && w.StartedAt != nil && *w.StartedAt != "" { 70 + if w.CiPipeline_Workflow != nil && w.StartedAt != nil && *w.StartedAt != "" { 71 71 timeStr = *w.StartedAt 72 - } else if w.CiDefs_Workflow != nil && w.FinishedAt != nil && *w.FinishedAt != "" { 72 + } else if w.CiPipeline_Workflow != nil && w.FinishedAt != nil && *w.FinishedAt != "" { 73 73 timeStr = *w.FinishedAt 74 74 } else if w.PipelineCreatedAt != nil && *w.PipelineCreatedAt != "" { 75 75 timeStr = *w.PipelineCreatedAt ··· 85 85 } 86 86 87 87 type Trigger struct { 88 - *tangled.CiDefs_Pipeline_Trigger 88 + *tangled.CiPipeline_Trigger 89 89 } 90 90 91 91 func (t Trigger) IsPush() bool { 92 - return t.CiDefs_Pipeline_Trigger != nil && t.CiDefs_Pipeline_Trigger.CiTrigger_Push != nil 92 + return t.CiPipeline_Trigger != nil && t.CiPipeline_Trigger.CiTrigger_Push != nil 93 93 } 94 94 95 95 func (t Trigger) IsPullRequest() bool { 96 - return t.CiDefs_Pipeline_Trigger != nil && t.CiDefs_Pipeline_Trigger.CiTrigger_PullRequest != nil 96 + return t.CiPipeline_Trigger != nil && t.CiPipeline_Trigger.CiTrigger_PullRequest != nil 97 97 } 98 98 99 99 func (t Trigger) IsManual() bool { 100 - return t.CiDefs_Pipeline_Trigger != nil && t.CiDefs_Pipeline_Trigger.CiTrigger_Manual != nil 100 + return t.CiPipeline_Trigger != nil && t.CiPipeline_Trigger.CiTrigger_Manual != nil 101 101 } 102 102 103 103 func (t Trigger) TargetRef() string { 104 - if t.CiDefs_Pipeline_Trigger == nil { 104 + if t.CiPipeline_Trigger == nil { 105 105 return "" 106 106 } 107 - if t.CiDefs_Pipeline_Trigger.CiTrigger_Push != nil { 108 - ref := t.CiDefs_Pipeline_Trigger.CiTrigger_Push.Ref 107 + if t.CiPipeline_Trigger.CiTrigger_Push != nil { 108 + ref := t.CiPipeline_Trigger.CiTrigger_Push.Ref 109 109 if strings.HasPrefix(ref, "refs/heads/") { 110 110 return strings.TrimPrefix(ref, "refs/heads/") 111 111 } ··· 114 114 } 115 115 return ref 116 116 } 117 - if t.CiDefs_Pipeline_Trigger.CiTrigger_PullRequest != nil { 118 - return t.CiDefs_Pipeline_Trigger.CiTrigger_PullRequest.TargetBranch 117 + if t.CiPipeline_Trigger.CiTrigger_PullRequest != nil { 118 + return t.CiPipeline_Trigger.CiTrigger_PullRequest.TargetBranch 119 119 } 120 120 return "" 121 121 } 122 122 123 123 func (t Trigger) PRSourceBranch() string { 124 - if t.CiDefs_Pipeline_Trigger == nil || t.CiDefs_Pipeline_Trigger.CiTrigger_PullRequest == nil { 124 + if t.CiPipeline_Trigger == nil || t.CiPipeline_Trigger.CiTrigger_PullRequest == nil { 125 125 return "" 126 126 } 127 - sb := t.CiDefs_Pipeline_Trigger.CiTrigger_PullRequest.SourceBranch 127 + sb := t.CiPipeline_Trigger.CiTrigger_PullRequest.SourceBranch 128 128 if sb == nil { 129 129 return "" 130 130 } ··· 132 132 } 133 133 134 134 type Pipeline struct { 135 - *tangled.CiDefs_Pipeline 135 + *tangled.CiPipeline 136 136 } 137 137 138 138 func (p Pipeline) Valid() bool { 139 - return p.CiDefs_Pipeline != nil 139 + return p.CiPipeline != nil 140 140 } 141 141 142 142 func (p Pipeline) Id() string { 143 - if p.CiDefs_Pipeline == nil { 143 + if p.CiPipeline == nil { 144 144 return "" 145 145 } 146 - return p.CiDefs_Pipeline.Id 146 + return p.CiPipeline.Id 147 147 } 148 148 149 149 func (p Pipeline) Statuses() map[string]WorkflowStatus { 150 150 m := make(map[string]WorkflowStatus) 151 - if p.CiDefs_Pipeline != nil { 152 - for _, w := range p.CiDefs_Pipeline.Workflows { 151 + if p.CiPipeline != nil { 152 + for _, w := range p.CiPipeline.Workflows { 153 153 m[w.Name] = WorkflowStatus{ 154 - CiDefs_Workflow: w, 155 - PipelineCreatedAt: p.CreatedAt, 154 + CiPipeline_Workflow: w, 155 + PipelineCreatedAt: p.CreatedAt, 156 156 } 157 157 } 158 158 } ··· 161 161 162 162 func (p Pipeline) Counts() map[string]int { 163 163 m := make(map[string]int) 164 - if p.CiDefs_Pipeline != nil { 165 - for _, w := range p.CiDefs_Pipeline.Workflows { 164 + if p.CiPipeline != nil { 165 + for _, w := range p.CiPipeline.Workflows { 166 166 m[w.Status]++ 167 167 } 168 168 } ··· 177 177 } 178 178 179 179 func (p Pipeline) ShortStatusSummary() string { 180 - if p.CiDefs_Pipeline == nil { 180 + if p.CiPipeline == nil { 181 181 return "" 182 182 } 183 183 counts := p.Counts() 184 - total := len(p.CiDefs_Pipeline.Workflows) 184 + total := len(p.CiPipeline.Workflows) 185 185 successes := counts["success"] 186 186 return fmt.Sprintf("%d/%d", successes, total) 187 187 } 188 188 189 189 func (p Pipeline) LongStatusSummary() string { 190 - if p.CiDefs_Pipeline == nil { 190 + if p.CiPipeline == nil { 191 191 return "" 192 192 } 193 193 counts := p.Counts() 194 - total := len(p.CiDefs_Pipeline.Workflows) 194 + total := len(p.CiPipeline.Workflows) 195 195 var parts []string 196 196 states := []string{"success", "failed", "timeout", "cancelled", "running", "pending"} 197 197 for _, state := range states { ··· 203 203 } 204 204 205 205 func (p Pipeline) TimeTaken() time.Duration { 206 - if p.CiDefs_Pipeline == nil { 206 + if p.CiPipeline == nil { 207 207 return 0 208 208 } 209 209 var s time.Duration 210 - for _, w := range p.CiDefs_Pipeline.Workflows { 211 - s += WorkflowStatus{CiDefs_Workflow: w}.TimeTaken() 210 + for _, w := range p.CiPipeline.Workflows { 211 + s += WorkflowStatus{CiPipeline_Workflow: w}.TimeTaken() 212 212 } 213 213 return s 214 214 } 215 215 216 216 func (p Pipeline) Created() time.Time { 217 - if p.CiDefs_Pipeline == nil || p.CreatedAt == nil || *p.CreatedAt == "" { 217 + if p.CiPipeline == nil || p.CreatedAt == nil || *p.CreatedAt == "" { 218 218 return time.Time{} 219 219 } 220 220 t, err := time.Parse(time.RFC3339, *p.CreatedAt) ··· 225 225 } 226 226 227 227 func (p Pipeline) Trigger() Trigger { 228 - if p.CiDefs_Pipeline == nil { 228 + if p.CiPipeline == nil { 229 229 return Trigger{nil} 230 230 } 231 - return Trigger{p.CiDefs_Pipeline.Trigger} 231 + return Trigger{p.CiPipeline.Trigger} 232 232 } 233 233 234 234 func (p Pipeline) IsResponding() bool { 235 - return p.CiDefs_Pipeline != nil && len(p.CiDefs_Pipeline.Workflows) > 0 235 + return p.CiPipeline != nil && len(p.CiPipeline.Workflows) > 0 236 236 } 237 237 238 238 func (p Pipeline) Sha() string { 239 - if p.CiDefs_Pipeline == nil { 239 + if p.CiPipeline == nil { 240 240 return "" 241 241 } 242 - return p.CiDefs_Pipeline.Commit 242 + return p.CiPipeline.Commit 243 243 } 244 244 245 245 func (p Pipeline) Workflows() []string { 246 246 var ws []string 247 - if p.CiDefs_Pipeline != nil { 248 - for _, w := range p.CiDefs_Pipeline.Workflows { 247 + if p.CiPipeline != nil { 248 + for _, w := range p.CiPipeline.Workflows { 249 249 ws = append(ws, w.Name) 250 250 } 251 251 }