Skip to content

Commit

Permalink
Merge pull request #160 from nokia/fix-seg-fault-during-new-revision-…
Browse files Browse the repository at this point in the history
…of-pkg

fix for sporadic porch crash during new package revision
  • Loading branch information
kispaljr authored Dec 16, 2024
2 parents 102bc1b + 93acdfe commit 40d57bb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2023 The kpt and Nephio Authors
// Copyright 2023-2024 The kpt and Nephio Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022 The kpt and Nephio Authors
// Copyright 2023-2024 The kpt and Nephio Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -596,7 +596,15 @@ func (r *PackageVariantReconciler) deletePackageRevision(ctx context.Context, pr

// determine if the downstream PR needs to be updated
func (r *PackageVariantReconciler) isUpToDate(pv *api.PackageVariant, downstream *porchapi.PackageRevision) bool {
if downstream.Status.UpstreamLock == nil {
klog.Warningf("status.upstreamLock field is empty/missing in downstream PackageRevision: %s", pv.ObjectMeta.Name)
return true
}
upstreamLock := downstream.Status.UpstreamLock
if upstreamLock.Git == nil || upstreamLock.Git.Ref == "" {
klog.Warningf("status.upstreamLock.git or status.upstreamLock.git.ref field is empty/missing in downstream PackageRevision: %s", pv.ObjectMeta.Name)
return true
}
lastIndex := strings.LastIndex(upstreamLock.Git.Ref, "/")
if strings.HasPrefix(upstreamLock.Git.Ref, "drafts") {
// The current upstream is a draft, and the target upstream
Expand Down

0 comments on commit 40d57bb

Please sign in to comment.