11package alpine
22
33import (
4+ "errors"
45 "fmt"
56 "net/url"
67 "os"
@@ -98,7 +99,8 @@ func (apkCmd *ApkCommand) ServerDetails() (*config.ServerDetails, error) {
9899func (apkCmd * ApkCommand ) Run () error {
99100 apkPath , err := exec .LookPath ("apk" )
100101 if err != nil {
101- return fmt .Errorf ("[ERROR] 'apk' binary not found. Is this an Alpine Linux environment?" )
102+ log .Error ("'apk' binary not found. Is this an Alpine Linux environment?" )
103+ return errors .New ("'apk' binary not found. Is this an Alpine Linux environment?" )
102104 }
103105
104106 needsAuth := buildInfoSubcmds [apkCmd .commandName ] || authOnlySubcmds [apkCmd .commandName ]
@@ -113,7 +115,7 @@ func (apkCmd *ApkCommand) Run() error {
113115 if needsBuildInfo {
114116 preSnapshot , err = biUtils .ListInstalledPackages ()
115117 if err != nil {
116- log .Warn ("[WARN] Cannot list installed packages — Build Info not captured:" , err )
118+ log .Warn ("Cannot list installed packages — Build Info not captured:" , err )
117119 needsBuildInfo = false
118120 }
119121 }
@@ -127,7 +129,7 @@ func (apkCmd *ApkCommand) Run() error {
127129 if needsBuildInfo {
128130 cacheDir , err = io .CreateTempDir ()
129131 if err != nil {
130- log .Warn ("[WARN] Could not create temp cache dir — checksums may be incomplete:" , err )
132+ log .Warn ("Could not create temp cache dir — checksums may be incomplete:" , err )
131133 } else {
132134 defer func () { _ = os .RemoveAll (cacheDir ) }()
133135 }
@@ -161,10 +163,9 @@ func (apkCmd *ApkCommand) buildSubprocessEnv(injectAuth bool) ([]string, error)
161163
162164 if apkCmd .serverDetails == nil {
163165 if apkCmd .username != "" || apkCmd .password != "" {
164- log .Warn ("[WARN] --user/--password provided but no server URL is known. " +
165- "Use --server-id to select a configured server so HTTP_AUTH can be injected." )
166+ log .Warn ("--user/--password provided but no server URL is known. Use --server-id to select a configured server so HTTP_AUTH can be injected." )
166167 } else {
167- log .Warn ("[WARN] No JFrog server configured — skipping HTTP_AUTH injection. Run: jf c add" )
168+ log .Warn ("No JFrog server configured — skipping HTTP_AUTH injection. Run: jf c add" )
168169 }
169170 return env , nil
170171 }
@@ -218,7 +219,7 @@ func emitSignatureHint(exitErr *exec.ExitError) {
218219 }
219220 for _ , pattern := range sigPatterns {
220221 if strings .Contains (stderr , pattern ) {
221- log .Warn ("[HINT] Signature verification failed. Fix: jf apk config --server-id <id> --repo <repo> --apply" )
222+ log .Warn ("Signature verification failed. Fix: jf apk config --server-id <id> --repo <repo> --apply" )
222223 return
223224 }
224225 }
@@ -239,7 +240,7 @@ func (apkCmd *ApkCommand) collectBuildInfo(preSnapshot []biUtils.AlpinePackage,
239240
240241 buildObj , err := buildUtils .PrepareBuildPrerequisites (apkCmd .buildConfiguration )
241242 if err != nil {
242- log .Warn ("[WARN] Build Info publish failed:" , err )
243+ log .Warn ("Build Info publish failed:" , err )
243244 return nil
244245 }
245246
@@ -252,7 +253,7 @@ func (apkCmd *ApkCommand) collectBuildInfo(preSnapshot []biUtils.AlpinePackage,
252253 alpineModule .SetCacheDir (cacheDir )
253254
254255 if err := alpineModule .CollectBuildInfo (); err != nil {
255- log .Warn ("[WARN] Build Info publish failed:" , err )
256+ log .Warn ("Build Info collection failed:" , err )
256257 }
257258 return nil
258259}
0 commit comments