Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add logger to packager.Publish #3259

Merged
merged 2 commits into from
Nov 21, 2024
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
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",
AustinAbro321 marked this conversation as resolved.
Show resolved Hide resolved
"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)
mkcp marked this conversation as resolved.
Show resolved Hide resolved

// 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