Skip to content

Commit 9cdafe7

Browse files
authored
chore(cli): move action package to pkg (#2442)
Signed-off-by: Miguel Martinez <miguel@chainloop.dev>
1 parent d445e44 commit 9cdafe7

135 files changed

Lines changed: 157 additions & 166 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

app/cli/cmd/artifact_download.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ package cmd
1818
import (
1919
"errors"
2020

21-
"github.com/chainloop-dev/chainloop/app/cli/internal/action"
21+
"github.com/chainloop-dev/chainloop/app/cli/pkg/action"
2222
pb "github.com/chainloop-dev/chainloop/app/controlplane/api/controlplane/v1"
2323
"github.com/spf13/cobra"
2424
"google.golang.org/grpc"
@@ -39,7 +39,7 @@ func newArtifactDownloadCmd() *cobra.Command {
3939
}
4040

4141
// Retrieve temporary credentials for uploading
42-
artifactCASConn, err = wrappedArtifactConn(actionOpts.CPConnection,
42+
artifactCASConn, err = wrappedArtifactConn(ActionOpts.CPConnection,
4343
pb.CASCredentialsServiceGetRequest_ROLE_DOWNLOADER, digest)
4444
if err != nil {
4545
return err
@@ -49,7 +49,7 @@ func newArtifactDownloadCmd() *cobra.Command {
4949
},
5050
RunE: func(cmd *cobra.Command, args []string) error {
5151
opts := &action.ArtifactDownloadOpts{
52-
ActionsOpts: actionOpts,
52+
ActionsOpts: ActionOpts,
5353
ArtifactsCASConn: artifactCASConn,
5454
Stdout: cmd.OutOrStdout(),
5555
}

app/cli/cmd/artifact_upload.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
package cmd
1717

1818
import (
19-
"github.com/chainloop-dev/chainloop/app/cli/internal/action"
19+
"github.com/chainloop-dev/chainloop/app/cli/pkg/action"
2020
pb "github.com/chainloop-dev/chainloop/app/controlplane/api/controlplane/v1"
2121
"github.com/spf13/cobra"
2222
"google.golang.org/grpc"
@@ -33,7 +33,7 @@ func newArtifactUploadCmd() *cobra.Command {
3333
var err error
3434

3535
// Retrieve temporary credentials for uploading
36-
artifactCASConn, err = wrappedArtifactConn(actionOpts.CPConnection, pb.CASCredentialsServiceGetRequest_ROLE_UPLOADER, "")
36+
artifactCASConn, err = wrappedArtifactConn(ActionOpts.CPConnection, pb.CASCredentialsServiceGetRequest_ROLE_UPLOADER, "")
3737
if err != nil {
3838
return err
3939
}
@@ -42,7 +42,7 @@ func newArtifactUploadCmd() *cobra.Command {
4242
},
4343
RunE: func(cmd *cobra.Command, args []string) error {
4444
opts := &action.ArtifactUploadOpts{
45-
ActionsOpts: actionOpts,
45+
ActionsOpts: ActionOpts,
4646
ArtifactsCASConn: artifactCASConn,
4747
}
4848

app/cli/cmd/attached_integration_add.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ package cmd
1717

1818
import (
1919
"github.com/chainloop-dev/chainloop/app/cli/cmd/output"
20-
"github.com/chainloop-dev/chainloop/app/cli/internal/action"
20+
"github.com/chainloop-dev/chainloop/app/cli/pkg/action"
2121
"github.com/spf13/cobra"
2222
)
2323

@@ -36,13 +36,13 @@ func newAttachedIntegrationAttachCmd() *cobra.Command {
3636
chainloop integration attached add --workflow deadbeef --project my-project --integration dependency-track --opt projectName=MyProject --opt filter="environment=prod,team=security"`,
3737
RunE: func(_ *cobra.Command, _ []string) error {
3838
// Find the integration to extract the kind of integration we care about
39-
integration, err := action.NewRegisteredIntegrationDescribe(actionOpts).Run(integrationName)
39+
integration, err := action.NewRegisteredIntegrationDescribe(ActionOpts).Run(integrationName)
4040
if err != nil {
4141
return err
4242
}
4343

4444
// Retrieve schema for validation and options marshaling
45-
item, err := action.NewAvailableIntegrationDescribe(actionOpts).Run(integration.Kind)
45+
item, err := action.NewAvailableIntegrationDescribe(ActionOpts).Run(integration.Kind)
4646
if err != nil {
4747
return err
4848
}
@@ -57,7 +57,7 @@ func newAttachedIntegrationAttachCmd() *cobra.Command {
5757
return err
5858
}
5959

60-
res, err := action.NewAttachedIntegrationAdd(actionOpts).Run(integrationName, workflowName, projectName, opts)
60+
res, err := action.NewAttachedIntegrationAdd(ActionOpts).Run(integrationName, workflowName, projectName, opts)
6161
if err != nil {
6262
return err
6363
}

app/cli/cmd/attached_integration_delete.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
package cmd
1717

1818
import (
19-
"github.com/chainloop-dev/chainloop/app/cli/internal/action"
19+
"github.com/chainloop-dev/chainloop/app/cli/pkg/action"
2020
"github.com/spf13/cobra"
2121
)
2222

@@ -28,7 +28,7 @@ func newAttachedIntegrationDeleteCmd() *cobra.Command {
2828
Aliases: []string{"detach"},
2929
Short: "Detach an integration that's attached to a workflow",
3030
RunE: func(cmd *cobra.Command, args []string) error {
31-
if err := action.NewAttachedIntegrationDelete(actionOpts).Run(attachmentID); err != nil {
31+
if err := action.NewAttachedIntegrationDelete(ActionOpts).Run(attachmentID); err != nil {
3232
return err
3333
}
3434

app/cli/cmd/attached_integration_list.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
"time"
2222

2323
"github.com/chainloop-dev/chainloop/app/cli/cmd/output"
24-
"github.com/chainloop-dev/chainloop/app/cli/internal/action"
24+
"github.com/chainloop-dev/chainloop/app/cli/pkg/action"
2525
"github.com/jedib0t/go-pretty/v6/table"
2626
"github.com/spf13/cobra"
2727
"golang.org/x/exp/maps"
@@ -34,7 +34,7 @@ func newAttachedIntegrationListCmd() *cobra.Command {
3434
Aliases: []string{"ls"},
3535
Short: "List integrations attached to workflows",
3636
RunE: func(cmd *cobra.Command, args []string) error {
37-
res, err := action.NewAttachedIntegrationList(actionOpts).Run(projectName, workflowName)
37+
res, err := action.NewAttachedIntegrationList(ActionOpts).Run(projectName, workflowName)
3838
if err != nil {
3939
return err
4040
}

app/cli/cmd/attestation_add.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import (
2727
"google.golang.org/grpc"
2828

2929
"github.com/chainloop-dev/chainloop/app/cli/cmd/output"
30-
"github.com/chainloop-dev/chainloop/app/cli/internal/action"
30+
"github.com/chainloop-dev/chainloop/app/cli/pkg/action"
3131
schemaapi "github.com/chainloop-dev/chainloop/app/controlplane/api/workflowcontract/v1"
3232
"github.com/chainloop-dev/chainloop/pkg/resourceloader"
3333
)
@@ -68,7 +68,7 @@ func newAttestationAddCmd() *cobra.Command {
6868
RunE: func(cmd *cobra.Command, _ []string) error {
6969
a, err := action.NewAttestationAdd(
7070
&action.AttestationAddOpts{
71-
ActionsOpts: actionOpts,
71+
ActionsOpts: ActionOpts,
7272
CASURI: viper.GetString(confOptions.CASAPI.viperKey),
7373
CASCAPath: viper.GetString(confOptions.CASCA.viperKey),
7474
ConnectionInsecure: apiInsecure(),

app/cli/cmd/attestation_init.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"fmt"
2121

2222
"github.com/chainloop-dev/chainloop/app/cli/cmd/output"
23-
"github.com/chainloop-dev/chainloop/app/cli/internal/action"
23+
"github.com/chainloop-dev/chainloop/app/cli/pkg/action"
2424
"github.com/spf13/cobra"
2525
)
2626

@@ -72,7 +72,7 @@ func newAttestationInitCmd() *cobra.Command {
7272
RunE: func(cmd *cobra.Command, _ []string) error {
7373
a, err := action.NewAttestationInit(
7474
&action.AttestationInitOpts{
75-
ActionsOpts: actionOpts,
75+
ActionsOpts: ActionOpts,
7676
DryRun: attestationDryRun,
7777
Force: force,
7878
UseRemoteState: useAttestationRemoteState,
@@ -112,7 +112,7 @@ func newAttestationInitCmd() *cobra.Command {
112112
logger.Info().Msg("Attestation initialized! now you can check its status or add materials to it")
113113

114114
// Show the status information
115-
statusAction, err := action.NewAttestationStatus(&action.AttestationStatusOpts{ActionsOpts: actionOpts, UseAttestationRemoteState: useAttestationRemoteState, LocalStatePath: attestationLocalStatePath})
115+
statusAction, err := action.NewAttestationStatus(&action.AttestationStatusOpts{ActionsOpts: ActionOpts, UseAttestationRemoteState: useAttestationRemoteState, LocalStatePath: attestationLocalStatePath})
116116
if err != nil {
117117
return newGracefulError(err)
118118
}

app/cli/cmd/attestation_push.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
"google.golang.org/grpc/status"
2626

2727
"github.com/chainloop-dev/chainloop/app/cli/cmd/output"
28-
"github.com/chainloop-dev/chainloop/app/cli/internal/action"
28+
"github.com/chainloop-dev/chainloop/app/cli/pkg/action"
2929
)
3030

3131
func newAttestationPushCmd() *cobra.Command {
@@ -68,7 +68,7 @@ func newAttestationPushCmd() *cobra.Command {
6868
return fmt.Errorf("getting executable information: %w", err)
6969
}
7070
a, err := action.NewAttestationPush(&action.AttestationPushOpts{
71-
ActionsOpts: actionOpts, KeyPath: pkPath, BundlePath: bundle,
71+
ActionsOpts: ActionOpts, KeyPath: pkPath, BundlePath: bundle,
7272
CLIVersion: info.Version, CLIDigest: info.Digest,
7373
LocalStatePath: attestationLocalStatePath,
7474
SignServerOpts: &action.SignServerOpts{

app/cli/cmd/attestation_reset.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919
"errors"
2020
"fmt"
2121

22-
"github.com/chainloop-dev/chainloop/app/cli/internal/action"
22+
"github.com/chainloop-dev/chainloop/app/cli/pkg/action"
2323
"github.com/spf13/cobra"
2424
)
2525

@@ -41,7 +41,7 @@ func newAttestationResetCmd() *cobra.Command {
4141
return nil
4242
},
4343
RunE: func(cmd *cobra.Command, args []string) error {
44-
a, err := action.NewAttestationReset(&action.AttestationResetOpts{ActionsOpts: actionOpts, LocalStatePath: attestationLocalStatePath})
44+
a, err := action.NewAttestationReset(&action.AttestationResetOpts{ActionsOpts: ActionOpts, LocalStatePath: attestationLocalStatePath})
4545
if err != nil {
4646
return fmt.Errorf("failed to load action: %w", err)
4747
}

app/cli/cmd/attestation_status.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import (
2929
"github.com/spf13/cobra"
3030

3131
"github.com/chainloop-dev/chainloop/app/cli/cmd/output"
32-
"github.com/chainloop-dev/chainloop/app/cli/internal/action"
32+
"github.com/chainloop-dev/chainloop/app/cli/pkg/action"
3333
"github.com/chainloop-dev/chainloop/pkg/attestation/renderer/chainloop"
3434
)
3535

@@ -46,7 +46,7 @@ func newAttestationStatusCmd() *cobra.Command {
4646
a, err := action.NewAttestationStatus(
4747
&action.AttestationStatusOpts{
4848
UseAttestationRemoteState: attestationID != "",
49-
ActionsOpts: actionOpts,
49+
ActionsOpts: ActionOpts,
5050
LocalStatePath: attestationLocalStatePath,
5151
},
5252
)

0 commit comments

Comments
 (0)