Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions app/cli/cmd/attestation_add.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ func displayMaterialInfo(status *action.AttestationStatusMaterial, policyEvaluat

mt := output.NewTableWriter()

mt.AppendRow(table.Row{"Name", status.Material.Name})
mt.AppendRow(table.Row{"Type", status.Material.Type})
mt.AppendRow(table.Row{"Name", status.Name})
mt.AppendRow(table.Row{"Type", status.Type})
mt.AppendRow(table.Row{"Required", hBool(status.Required)})

if status.IsOutput {
Expand All @@ -191,9 +191,9 @@ func displayMaterialInfo(status *action.AttestationStatusMaterial, policyEvaluat
mt.AppendRow(table.Row{"Digest", status.Hash})
}

if len(status.Material.Annotations) > 0 {
if len(status.Annotations) > 0 {
mt.AppendRow(table.Row{"Annotations", "------"})
for _, a := range status.Material.Annotations {
for _, a := range status.Annotations {
value := a.Value
if value == "" {
value = NotSet
Expand Down
3 changes: 3 additions & 0 deletions app/cli/cmd/attestation_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,9 @@ func materialsTable(status *action.AttestationStatusResult, w io.Writer, full bo
if m.IsOutput {
mt.AppendRow(table.Row{"Is output", "Yes"})
}
if m.SkipUpload {
mt.AppendRow(table.Row{"Skip upload", "Yes"})
}

if full {
if m.Value != "" {
Expand Down
4 changes: 2 additions & 2 deletions app/cli/pkg/action/attestation_add.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ var ErrAttestationNotInitialized = errors.New("attestation not yet initialized")

func (action *AttestationAdd) Run(ctx context.Context, attestationID, materialName, materialValue, materialType string, annotations map[string]string) (*AttestationStatusMaterial, error) {
// initialize the crafter. If attestation-id is provided we assume the attestation is performed using remote state
crafter, err := newCrafter(&newCrafterStateOpts{enableRemoteState: (attestationID != ""), localStatePath: action.localStatePath}, action.CPConnection, action.newCrafterOpts.opts...)
crafter, err := newCrafter(&newCrafterStateOpts{enableRemoteState: (attestationID != ""), localStatePath: action.localStatePath}, action.CPConnection, action.opts...)
if err != nil {
return nil, fmt.Errorf("failed to load crafter: %w", err)
}
Expand Down Expand Up @@ -183,7 +183,7 @@ func (action *AttestationAdd) Run(ctx context.Context, attestationID, materialNa

// GetPolicyEvaluations is a Wrapper around the getPolicyEvaluations
func (action *AttestationAdd) GetPolicyEvaluations(ctx context.Context, attestationID string) (map[string][]*PolicyEvaluation, error) {
crafter, err := newCrafter(&newCrafterStateOpts{enableRemoteState: (attestationID != ""), localStatePath: action.localStatePath}, action.CPConnection, action.newCrafterOpts.opts...)
crafter, err := newCrafter(&newCrafterStateOpts{enableRemoteState: (attestationID != ""), localStatePath: action.localStatePath}, action.CPConnection, action.opts...)
if err != nil {
return nil, fmt.Errorf("failed to load crafter: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion app/cli/pkg/action/attestation_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func (action *AttestationInit) Run(ctx context.Context, opts *AttestationInitRun
}

action.Logger.Debug().Msg("Retrieving attestation definition")
client := pb.NewAttestationServiceClient(action.ActionsOpts.CPConnection)
client := pb.NewAttestationServiceClient(action.CPConnection)

req := &pb.FindOrCreateWorkflowRequest{
ProjectName: opts.ProjectName,
Expand Down
2 changes: 1 addition & 1 deletion app/cli/pkg/action/attestation_push.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func NewAttestationPush(cfg *AttestationPushOpts) (*AttestationPush, error) {
func (action *AttestationPush) Run(ctx context.Context, attestationID string, runtimeAnnotations map[string]string, bypassPolicyCheck bool) (*AttestationResult, error) {
useRemoteState := attestationID != ""
// initialize the crafter. If attestation-id is provided we assume the attestation is performed using remote state
crafter, err := newCrafter(&newCrafterStateOpts{enableRemoteState: useRemoteState, localStatePath: action.localStatePath}, action.CPConnection, action.newCrafterOpts.opts...)
crafter, err := newCrafter(&newCrafterStateOpts{enableRemoteState: useRemoteState, localStatePath: action.localStatePath}, action.CPConnection, action.opts...)
if err != nil {
return nil, fmt.Errorf("failed to load crafter: %w", err)
}
Expand Down
7 changes: 4 additions & 3 deletions app/cli/pkg/action/attestation_reset.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func NewAttestationReset(cfg *AttestationResetOpts) (*AttestationReset, error) {

func (action *AttestationReset) Run(ctx context.Context, attestationID, trigger, reason string) error {
// initialize the crafter. If attestation-id is provided we assume the attestation is performed using remote state
crafter, err := newCrafter(&newCrafterStateOpts{enableRemoteState: attestationID != "", localStatePath: action.localStatePath}, action.CPConnection, action.newCrafterOpts.opts...)
crafter, err := newCrafter(&newCrafterStateOpts{enableRemoteState: attestationID != "", localStatePath: action.localStatePath}, action.CPConnection, action.opts...)
if err != nil {
return fmt.Errorf("failed to load crafter: %w", err)
}
Expand Down Expand Up @@ -81,9 +81,10 @@ func (action *AttestationReset) Run(ctx context.Context, attestationID, trigger,
}

func parseTrigger(in string) pb.AttestationServiceCancelRequest_TriggerType {
if in == AttestationResetTriggerFailed {
switch in {
case AttestationResetTriggerFailed:
return pb.AttestationServiceCancelRequest_TRIGGER_TYPE_FAILURE
} else if in == AttestationResetTriggerCancelled {
case AttestationResetTriggerCancelled:
return pb.AttestationServiceCancelRequest_TRIGGER_TYPE_CANCELLATION
}

Expand Down
4 changes: 2 additions & 2 deletions app/cli/pkg/action/attestation_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ type AttestationStatusWorkflowMeta struct {

type AttestationStatusMaterial struct {
*Material
Set, IsOutput, Required bool
Set, IsOutput, Required, SkipUpload bool
}

func NewAttestationStatus(cfg *AttestationStatusOpts) (*AttestationStatus, error) {
Expand Down Expand Up @@ -264,7 +264,7 @@ func populateContractMaterials(inputSchemaMaterials []*pbc.CraftingSchema_Materi
Name: m.Name, Type: m.Type.String(),
Annotations: pbAnnotationsToAction(m.Annotations),
},
IsOutput: m.Output, Required: !m.Optional,
IsOutput: m.Output, Required: !m.Optional, SkipUpload: m.SkipUpload,
}

if cm, found := attsMaterial[m.Name]; found {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading