Skip to content

Commit 4cc02b7

Browse files
authored
feat(api): support set workflow visibility on creation (#640)
Signed-off-by: Miguel Martinez Trivino <[email protected]>
1 parent 27e1a74 commit 4cc02b7

File tree

8 files changed

+115
-84
lines changed

8 files changed

+115
-84
lines changed

app/cli/cmd/workflow_create.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525

2626
func newWorkflowCreateCmd() *cobra.Command {
2727
var workflowName, description, project, team, contract string
28-
var skipRACreate bool
28+
var skipRACreate, public bool
2929

3030
cmd := &cobra.Command{
3131
Use: "create",
@@ -58,6 +58,7 @@ func newWorkflowCreateCmd() *cobra.Command {
5858

5959
opts := &action.NewWorkflowCreateOpts{
6060
Name: workflowName, Team: team, Project: project, ContractID: contract, Description: description,
61+
Public: public,
6162
}
6263

6364
workflow, err := action.NewWorkflowCreate(actionOpts).Run(opts)
@@ -115,6 +116,7 @@ func newWorkflowCreateCmd() *cobra.Command {
115116
cmd.Flags().StringVar(&contract, "contract", "", "the ID of an existing contract or the path/URL to a contract file. If not provided an empty one will be created.")
116117

117118
cmd.Flags().BoolVarP(&skipRACreate, "skip-robot-account-create", "s", false, "Skip creating a Robot Account for this workflow.")
119+
cmd.Flags().BoolVar(&public, "public", false, "is the workflow public")
118120

119121
cmd.Flags().SortFlags = false
120122

app/cli/internal/action/workflow_create.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Copyright 2023 The Chainloop Authors.
2+
// Copyright 2024 The Chainloop Authors.
33
//
44
// Licensed under the Apache License, Version 2.0 (the "License");
55
// you may not use this file except in compliance with the License.
@@ -31,13 +31,15 @@ func NewWorkflowCreate(cfg *ActionsOpts) *WorkflowCreate {
3131

3232
type NewWorkflowCreateOpts struct {
3333
Name, Description, Project, Team, ContractID string
34+
Public bool
3435
}
3536

3637
func (action *WorkflowCreate) Run(opts *NewWorkflowCreateOpts) (*WorkflowItem, error) {
3738
client := pb.NewWorkflowServiceClient(action.cfg.CPConnection)
3839
resp, err := client.Create(context.Background(), &pb.WorkflowServiceCreateRequest{
3940
Name: opts.Name, Project: opts.Project, Team: opts.Team, SchemaId: opts.ContractID,
4041
Description: opts.Description,
42+
Public: opts.Public,
4143
})
4244
if err != nil {
4345
return nil, err

app/controlplane/api/controlplane/v1/workflow.pb.go

Lines changed: 89 additions & 80 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/controlplane/api/controlplane/v1/workflow.pb.validate.go

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/controlplane/api/controlplane/v1/workflow.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ message WorkflowServiceCreateRequest {
3737
string schema_id = 3;
3838
string team = 4;
3939
string description = 5;
40+
bool public = 6;
4041
}
4142

4243
message WorkflowServiceUpdateRequest {

app/controlplane/api/gen/frontend/controlplane/v1/workflow.ts

Lines changed: 15 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/controlplane/internal/biz/workflow.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Copyright 2023 The Chainloop Authors.
2+
// Copyright 2024 The Chainloop Authors.
33
//
44
// Licensed under the Apache License, Version 2.0 (the "License");
55
// you may not use this file except in compliance with the License.

app/controlplane/internal/service/workflow.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ func (s *WorkflowService) Create(ctx context.Context, req *pb.WorkflowServiceCre
5151
Team: req.GetTeam(),
5252
ContractID: req.GetSchemaId(),
5353
Description: req.GetDescription(),
54+
Public: req.GetPublic(),
5455
}
5556

5657
p, err := s.useCase.Create(ctx, createOpts)

0 commit comments

Comments
 (0)