Skip to content

Commit

Permalink
feat: add logger to packager.Publish (#3259)
Browse files Browse the repository at this point in the history
Signed-off-by: Kit Patella <kit@defenseunicorns.com>
  • Loading branch information
mkcp authored Nov 21, 2024
1 parent 7aa3224 commit a7334b8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
11 changes: 11 additions & 0 deletions src/pkg/packager/publish.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"fmt"
"os"
"strings"
"time"

"github.com/defenseunicorns/pkg/helpers/v2"
"github.com/defenseunicorns/pkg/oci"
Expand All @@ -17,6 +18,7 @@ import (
"github.com/zarf-dev/zarf/src/api/v1alpha1"
"github.com/zarf-dev/zarf/src/config"
"github.com/zarf-dev/zarf/src/pkg/layout"
"github.com/zarf-dev/zarf/src/pkg/logger"
"github.com/zarf-dev/zarf/src/pkg/message"
"github.com/zarf-dev/zarf/src/pkg/packager/creator"
"github.com/zarf-dev/zarf/src/pkg/packager/filters"
Expand All @@ -27,6 +29,10 @@ import (

// Publish publishes the package to a registry
func (p *Packager) Publish(ctx context.Context) (err error) {
l := logger.From(ctx)
start := time.Now()
l.Debug("start publish")

_, isOCISource := p.source.(*sources.OCISource)
if isOCISource && p.cfg.PublishOpts.SigningKeyPath == "" {
// oci --> oci is a special case, where we will use oci.CopyPackage so that we can transfer the package
Expand Down Expand Up @@ -123,5 +129,10 @@ func (p *Packager) Publish(ctx context.Context) (err error) {
return err
}
}
l.Info("packaged successfully published",
"name", p.cfg.Pkg.Metadata.Name,
"ref", ref,
"duration", time.Since(start),
)
return nil
}
1 change: 0 additions & 1 deletion src/test/e2e/50_oci_publish_deploy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ func (suite *PublishDeploySuiteTestSuite) Test_0_Publish() {
ref := suite.Reference.String()
stdOut, stdErr, err := e2e.Zarf(suite.T(), "package", "publish", example, "oci://"+ref, "--plain-http")
suite.NoError(err, stdOut, stdErr)
suite.Contains(stdErr, "Published "+ref)

// Pull the package via OCI.
stdOut, stdErr, err = e2e.Zarf(suite.T(), "package", "pull", "oci://"+ref+"/helm-charts:0.0.1", "--plain-http")
Expand Down

0 comments on commit a7334b8

Please sign in to comment.