diff --git a/cmd/flux/build_artifact.go b/cmd/flux/build_artifact.go index ea8c2cd7..23ac154e 100644 --- a/cmd/flux/build_artifact.go +++ b/cmd/flux/build_artifact.go @@ -46,12 +46,14 @@ type buildArtifactFlags struct { ignorePaths []string } +var excludeOCI = append(strings.Split(sourceignore.ExcludeVCS, ","), strings.Split(sourceignore.ExcludeExt, ",")...) + var buildArtifactArgs buildArtifactFlags func init() { buildArtifactCmd.Flags().StringVar(&buildArtifactArgs.path, "path", "", "Path to the directory where the Kubernetes manifests are located.") buildArtifactCmd.Flags().StringVarP(&buildArtifactArgs.output, "output", "o", "artifact.tgz", "Path to where the artifact tgz file should be written.") - buildArtifactCmd.Flags().StringSliceVar(&buildArtifactArgs.ignorePaths, "ignore-paths", strings.Split(sourceignore.ExcludeVCS, ","), "set paths to ignore (can specify multiple paths with commas: path1,path2)") + buildArtifactCmd.Flags().StringSliceVar(&buildArtifactArgs.ignorePaths, "ignore-paths", excludeOCI, "set paths to ignore in .gitignore format") buildCmd.AddCommand(buildArtifactCmd) } @@ -68,7 +70,6 @@ func buildArtifactCmdRun(cmd *cobra.Command, args []string) error { logger.Actionf("building artifact from %s", buildArtifactArgs.path) ociClient := oci.NewLocalClient() - logger.Successf("%v", buildArtifactArgs.ignorePaths) if err := ociClient.Build(buildArtifactArgs.output, buildArtifactArgs.path, buildArtifactArgs.ignorePaths); err != nil { return fmt.Errorf("bulding artifact failed, error: %w", err) } diff --git a/cmd/flux/push_artifact.go b/cmd/flux/push_artifact.go index 52e545a5..75ad0a4e 100644 --- a/cmd/flux/push_artifact.go +++ b/cmd/flux/push_artifact.go @@ -19,13 +19,10 @@ package main import ( "context" "fmt" - "os" - "strings" - "github.com/spf13/cobra" + "os" oci "github.com/fluxcd/pkg/oci/client" - "github.com/fluxcd/pkg/sourceignore" ) var pushArtifactCmd = &cobra.Command{ @@ -63,7 +60,7 @@ func init() { pushArtifactCmd.Flags().StringVar(&pushArtifactArgs.path, "path", "", "path to the directory where the Kubernetes manifests are located") pushArtifactCmd.Flags().StringVar(&pushArtifactArgs.source, "source", "", "the source address, e.g. the Git URL") pushArtifactCmd.Flags().StringVar(&pushArtifactArgs.revision, "revision", "", "the source revision in the format '/'") - pushArtifactCmd.Flags().StringSliceVar(&pushArtifactArgs.ignorePaths, "ignore-paths", strings.Split(sourceignore.ExcludeVCS, ","), "set paths to ignore (can specify multiple paths with commas: path1,path2)") + pushArtifactCmd.Flags().StringSliceVar(&pushArtifactArgs.ignorePaths, "ignore-paths", excludeOCI, "set paths to ignore in .gitignore format") pushCmd.AddCommand(pushArtifactCmd) } diff --git a/go.mod b/go.mod index 653c97ec..e968ebe0 100644 --- a/go.mod +++ b/go.mod @@ -14,8 +14,9 @@ require ( github.com/fluxcd/notification-controller/api v0.25.1 github.com/fluxcd/pkg/apis/meta v0.14.2 github.com/fluxcd/pkg/kustomize v0.5.2 - github.com/fluxcd/pkg/oci v0.4.0 + github.com/fluxcd/pkg/oci v0.4.1 github.com/fluxcd/pkg/runtime v0.16.2 + github.com/fluxcd/pkg/sourceignore v0.1.0 github.com/fluxcd/pkg/ssa v0.17.0 github.com/fluxcd/pkg/ssh v0.5.0 github.com/fluxcd/pkg/untar v0.1.0 @@ -86,7 +87,6 @@ require ( github.com/fatih/color v1.13.0 // indirect github.com/fluxcd/pkg/apis/acl v0.0.3 // indirect github.com/fluxcd/pkg/apis/kustomize v0.4.2 // indirect - github.com/fluxcd/pkg/sourceignore v0.1.0 // indirect github.com/fsnotify/fsnotify v1.5.1 // indirect github.com/go-errors/errors v1.0.1 // indirect github.com/go-git/gcfg v1.5.0 // indirect diff --git a/go.sum b/go.sum index f1c4f773..0754b908 100644 --- a/go.sum +++ b/go.sum @@ -289,8 +289,8 @@ github.com/fluxcd/pkg/apis/meta v0.14.2 h1:/Hf7I/Vz01vv3m7Qx7DtQvrzAL1oVt0MJcLb/ github.com/fluxcd/pkg/apis/meta v0.14.2/go.mod h1:ijZ61VG/8T3U17gj0aFL3fdtZL+mulD6V8VrLLUCAgM= github.com/fluxcd/pkg/kustomize v0.5.2 h1:Nhaw/Tqwt588Cp4PYa83nj45t3mGgojMl23zhq/t/fM= github.com/fluxcd/pkg/kustomize v0.5.2/go.mod h1:X3Uls1l13giFPwig1NDoXvrF53yyXUemSyR3nYGw28s= -github.com/fluxcd/pkg/oci v0.4.0 h1:cUNPffT/lvdVmFUe8nhPQhRNIWs1Oa2/ODI+rWikqcI= -github.com/fluxcd/pkg/oci v0.4.0/go.mod h1:eOnW+Ce3Z8AmQ+X9tf1BCv+qxwro+rPM/VKca1E9Ka0= +github.com/fluxcd/pkg/oci v0.4.1 h1:gx63SW9BymuJydDbu/8xzlMP85Tpc9FBnHZXsckgC7U= +github.com/fluxcd/pkg/oci v0.4.1/go.mod h1:eOnW+Ce3Z8AmQ+X9tf1BCv+qxwro+rPM/VKca1E9Ka0= github.com/fluxcd/pkg/runtime v0.16.2 h1:CexfMmJK+r12sHTvKWyAax0pcPomjd6VnaHXcxjUrRY= github.com/fluxcd/pkg/runtime v0.16.2/go.mod h1:OHSKsrO+T+Ym8WZRS2oidrnauWRARuE2nfm8ewevm7M= github.com/fluxcd/pkg/sourceignore v0.1.0 h1:v36Rqp6FDB7Ntjy7NakdwscOfxFPk14peKa+VMBNugo=