Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package apko for openSUSE:Factory checked in 
at 2024-11-01 21:06:21
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/apko (Old)
 and      /work/SRC/openSUSE:Factory/.apko.new.2020 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "apko"

Fri Nov  1 21:06:21 2024 rev:21 rq:1219967 version:0.19.7

Changes:
--------
--- /work/SRC/openSUSE:Factory/apko/apko.changes        2024-10-30 
17:34:26.764281828 +0100
+++ /work/SRC/openSUSE:Factory/.apko.new.2020/apko.changes      2024-11-01 
21:06:42.364275206 +0100
@@ -1,0 +2,7 @@
+Thu Oct 31 20:05:38 UTC 2024 - [email protected]
+
+- Update to version 0.19.7:
+  * Drop errgroup.WithContext and add withCause (#1380)
+  * Allow multiauthenticator to try all authenticators (#1379)
+
+-------------------------------------------------------------------

Old:
----
  apko-0.19.6.obscpio

New:
----
  apko-0.19.7.obscpio

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ apko.spec ++++++
--- /var/tmp/diff_new_pack.L06EeX/_old  2024-11-01 21:06:44.324357203 +0100
+++ /var/tmp/diff_new_pack.L06EeX/_new  2024-11-01 21:06:44.340357872 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           apko
-Version:        0.19.6
+Version:        0.19.7
 Release:        0
 Summary:        Build OCI images from APK packages directly without Dockerfile
 License:        Apache-2.0

++++++ _service ++++++
--- /var/tmp/diff_new_pack.L06EeX/_old  2024-11-01 21:06:44.536366072 +0100
+++ /var/tmp/diff_new_pack.L06EeX/_new  2024-11-01 21:06:44.580367913 +0100
@@ -3,7 +3,7 @@
     <param name="url">https://github.com/chainguard-dev/apko</param>
     <param name="scm">git</param>
     <param name="exclude">.git</param>
-    <param name="revision">v0.19.6</param>
+    <param name="revision">v0.19.7</param>
     <param name="versionformat">@PARENT_TAG@</param>
     <param name="changesgenerate">enable</param>
     <param name="versionrewrite-pattern">v(.*)</param>

++++++ _servicedata ++++++
--- /var/tmp/diff_new_pack.L06EeX/_old  2024-11-01 21:06:44.700372933 +0100
+++ /var/tmp/diff_new_pack.L06EeX/_new  2024-11-01 21:06:44.744374774 +0100
@@ -1,6 +1,6 @@
 <servicedata>
 <service name="tar_scm">
                 <param 
name="url">https://github.com/chainguard-dev/apko</param>
-              <param 
name="changesrevision">6a3e0cb7b4c6351018b3f0d044749a3342146eea</param></service></servicedata>
+              <param 
name="changesrevision">c8b52a03eb1b6bb4285380c7b885ee660cb10349</param></service></servicedata>
 (No newline at EOF)
 

++++++ apko-0.19.6.obscpio -> apko-0.19.7.obscpio ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/apko-0.19.6/pkg/apk/apk/implementation.go 
new/apko-0.19.7/pkg/apk/apk/implementation.go
--- old/apko-0.19.6/pkg/apk/apk/implementation.go       2024-10-29 
20:33:26.000000000 +0100
+++ new/apko-0.19.7/pkg/apk/apk/implementation.go       2024-10-31 
19:23:06.000000000 +0100
@@ -518,7 +518,7 @@
        // TODO: Consider making this configurable option.
        jobs := runtime.GOMAXPROCS(0)
 
-       g, gctx := errgroup.WithContext(ctx)
+       var g errgroup.Group
        g.SetLimit(jobs + 1)
 
        resolved := make([]*APKResolved, len(allpkgs))
@@ -535,11 +535,11 @@
                i, pkg := i, pkg
 
                g.Go(func() error {
-                       r, err := a.FetchPackage(gctx, pkg)
+                       r, err := a.FetchPackage(ctx, pkg)
                        if err != nil {
                                return fmt.Errorf("fetching %s: %w", pkg.Name, 
err)
                        }
-                       res, err := ResolveApk(gctx, r)
+                       res, err := ResolveApk(ctx, r)
                        if err != nil {
                                return fmt.Errorf("resolving %s: %w", pkg.Name, 
err)
                        }
@@ -554,12 +554,22 @@
        }
 
        if err := g.Wait(); err != nil {
-               return nil, fmt.Errorf("installing packages: %w", err)
+               return nil, fmt.Errorf("calculating world: %w", withCause(ctx, 
err))
        }
 
        return resolved, nil
 }
 
+// Sometimes we get an opaque error about context cancellation, and it's 
unclear what caused it.
+// If we get something useful from ctx via context.Cause, we'll annotate err 
with it.
+func withCause(ctx context.Context, err error) error {
+       if cause := context.Cause(ctx); cause != nil {
+               return fmt.Errorf("%w: %w", err, cause)
+       }
+
+       return err
+}
+
 func (a *APK) ResolveAndCalculateWorld(ctx context.Context) ([]*APKResolved, 
error) {
        log := clog.FromContext(ctx)
        log.Debug("resolving and calculating 'world' (packages to install)")
@@ -625,7 +635,7 @@
        // TODO: Consider making this configurable option.
        jobs := runtime.GOMAXPROCS(0)
 
-       g, gctx := errgroup.WithContext(ctx)
+       var g errgroup.Group
        g.SetLimit(jobs + 1)
 
        expanded := make([]*expandapk.APKExpanded, len(allpkgs))
@@ -648,8 +658,8 @@
        g.Go(func() error {
                for i, ch := range done {
                        select {
-                       case <-gctx.Done():
-                               return gctx.Err()
+                       case <-ctx.Done():
+                               return ctx.Err()
                        case <-ch:
                                exp := expanded[i]
                                pkg := allpkgs[i]
@@ -670,7 +680,7 @@
                                }
                                infos[i] = pkgInfo
 
-                               installedFiles, err := a.installPackage(gctx, 
pkgInfo, exp, sourceDateEpoch)
+                               installedFiles, err := a.installPackage(ctx, 
pkgInfo, exp, sourceDateEpoch)
                                if err != nil {
                                        return fmt.Errorf("installing %s: %w", 
pkg, err)
                                }
@@ -688,7 +698,7 @@
                i, pkg := i, pkg
 
                g.Go(func() error {
-                       exp, err := a.expandPackage(gctx, pkg)
+                       exp, err := a.expandPackage(ctx, pkg)
                        if err != nil {
                                return fmt.Errorf("expanding %s: %w", pkg, err)
                        }
@@ -701,7 +711,7 @@
        }
 
        if err := g.Wait(); err != nil {
-               return fmt.Errorf("installing packages: %w", err)
+               return fmt.Errorf("installing packages: %w", withCause(ctx, 
err))
        }
 
        // update the installed file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/apko-0.19.6/pkg/apk/auth/auth.go 
new/apko-0.19.7/pkg/apk/auth/auth.go
--- old/apko-0.19.6/pkg/apk/auth/auth.go        2024-10-29 20:33:26.000000000 
+0100
+++ new/apko-0.19.7/pkg/apk/auth/auth.go        2024-10-31 19:23:06.000000000 
+0100
@@ -2,6 +2,7 @@
 
 import (
        "context"
+       "errors"
        "net/http"
        "os"
        "os/exec"
@@ -40,16 +41,23 @@
 type multiAuthenticator []Authenticator
 
 func (m multiAuthenticator) AddAuth(ctx context.Context, req *http.Request) 
error {
+       var merr error
        for _, a := range m {
                if _, _, ok := req.BasicAuth(); ok {
                        // The request has auth, so we can stop here.
                        return nil
                }
                if err := a.AddAuth(ctx, req); err != nil {
-                       return err
+                       merr = errors.Join(merr, err)
+                       continue
                }
        }
-       return nil
+
+       // One last check at the end to see if we added auth, else return the 
aggregated error.
+       if _, _, ok := req.BasicAuth(); ok {
+               return nil
+       }
+       return merr
 }
 
 // EnvAuth adds HTTP basic auth to the request if the request URL matches the
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/apko-0.19.6/pkg/apk/auth/auth_test.go 
new/apko-0.19.7/pkg/apk/auth/auth_test.go
--- old/apko-0.19.6/pkg/apk/auth/auth_test.go   1970-01-01 01:00:00.000000000 
+0100
+++ new/apko-0.19.7/pkg/apk/auth/auth_test.go   2024-10-31 19:23:06.000000000 
+0100
@@ -0,0 +1,72 @@
+package auth
+
+import (
+       "context"
+       "errors"
+       "net/http"
+       "testing"
+)
+
+type successAuth struct{}
+
+func (s successAuth) AddAuth(_ context.Context, req *http.Request) error {
+       req.SetBasicAuth("user", "pass")
+       return nil
+}
+
+type failAuth struct{}
+
+func (f failAuth) AddAuth(_ context.Context, req *http.Request) error {
+       return errors.New("failed to add auth")
+}
+
+func TestMultiAuthenticator(t *testing.T) {
+       tests := []struct {
+               name       string
+               auths      []Authenticator
+               expectAuth bool
+               expectErr  bool
+       }{
+               {
+                       name:       "success auth first",
+                       auths:      []Authenticator{successAuth{}, failAuth{}},
+                       expectAuth: true,
+                       expectErr:  false,
+               },
+               {
+                       name:       "fail auth first",
+                       auths:      []Authenticator{failAuth{}, successAuth{}},
+                       expectAuth: true,
+                       expectErr:  false,
+               },
+               {
+                       name:       "all fail auth",
+                       auths:      []Authenticator{failAuth{}, failAuth{}},
+                       expectAuth: false,
+                       expectErr:  true,
+               },
+       }
+
+       for _, tt := range tests {
+               t.Run(tt.name, func(t *testing.T) {
+                       multiAuth := MultiAuthenticator(tt.auths...)
+                       req, _ := http.NewRequest("GET", "http://example.com";, 
nil)
+                       err := multiAuth.AddAuth(context.Background(), req)
+
+                       if tt.expectErr && err == nil {
+                               t.Errorf("expected error but got none")
+                       }
+                       if !tt.expectErr && err != nil {
+                               t.Errorf("did not expect error but got: %v", 
err)
+                       }
+
+                       user, pass, ok := req.BasicAuth()
+                       if tt.expectAuth && !ok {
+                               t.Errorf("expected auth but got none")
+                       }
+                       if !tt.expectAuth && ok {
+                               t.Errorf("did not expect auth but got user: %s, 
pass: %s", user, pass)
+                       }
+               })
+       }
+}

++++++ apko.obsinfo ++++++
--- /var/tmp/diff_new_pack.L06EeX/_old  2024-11-01 21:06:45.676413764 +0100
+++ /var/tmp/diff_new_pack.L06EeX/_new  2024-11-01 21:06:45.700414769 +0100
@@ -1,5 +1,5 @@
 name: apko
-version: 0.19.6
-mtime: 1730230406
-commit: 6a3e0cb7b4c6351018b3f0d044749a3342146eea
+version: 0.19.7
+mtime: 1730398986
+commit: c8b52a03eb1b6bb4285380c7b885ee660cb10349
 

++++++ vendor.tar.gz ++++++
/work/SRC/openSUSE:Factory/apko/vendor.tar.gz 
/work/SRC/openSUSE:Factory/.apko.new.2020/vendor.tar.gz differ: char 5, line 1

Reply via email to