Skip to content
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .ci-operator.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
build_root_image:
name: release
namespace: openshift
tag: rhel-9-release-golang-1.25-openshift-4.22
tag: rhel-9-release-golang-1.26-openshift-5.0
4 changes: 2 additions & 2 deletions Dockerfile.rhel8
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.25-openshift-4.22 AS builder
FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.26-openshift-5.0 AS builder
WORKDIR /go/src/github.com/openshift/builder
COPY . .
RUN hack/build.sh

FROM registry.ci.openshift.org/ocp/4.22:base-rhel9
FROM registry.ci.openshift.org/ocp/5.0:base-rhel9
Comment thread
coderabbitai[bot] marked this conversation as resolved.
RUN . /etc/os-release && \
CONTAINER_RUNTIME=runc && \
# CentOS/RHEL 10 does not have runc as a package, so replace with crun
Expand Down
20 changes: 10 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module github.com/openshift/builder

go 1.22.8
go 1.26.0

toolchain go1.23.1
toolchain go1.26.7

require (
github.com/MakeNowJust/heredoc v1.0.0
Expand All @@ -25,7 +25,7 @@ require (
github.com/spf13/cobra v1.8.1
github.com/spf13/pflag v1.0.6
github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635
golang.org/x/sys v0.29.0
golang.org/x/sys v0.47.0
Comment thread
coderabbitai[bot] marked this conversation as resolved.
k8s.io/api v0.30.2
k8s.io/apimachinery v0.30.2
k8s.io/client-go v0.30.2
Expand Down Expand Up @@ -116,13 +116,13 @@ require (
github.com/xlab/treeprint v1.2.0 // indirect
go.opencensus.io v0.24.0 // indirect
go.starlark.net v0.0.0-20230525235612-a134d8f9ddca // indirect
golang.org/x/crypto v0.32.0 // indirect
golang.org/x/mod v0.22.0 // indirect
golang.org/x/net v0.34.0 // indirect
golang.org/x/oauth2 v0.25.0 // indirect
golang.org/x/sync v0.10.0 // indirect
golang.org/x/term v0.28.0 // indirect
golang.org/x/text v0.21.0 // indirect
golang.org/x/crypto v0.56.0 // indirect
golang.org/x/mod v0.38.0 // indirect
golang.org/x/net v0.57.0 // indirect
golang.org/x/oauth2 v0.36.0 // indirect
golang.org/x/sync v0.22.0 // indirect
golang.org/x/term v0.45.0 // indirect
golang.org/x/text v0.41.0 // indirect
golang.org/x/time v0.9.0 // indirect
google.golang.org/grpc v1.69.4 // indirect
google.golang.org/protobuf v1.36.2 // indirect
Expand Down
34 changes: 18 additions & 16 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,8 @@ golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliY
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
golang.org/x/crypto v0.30.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc=
golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc=
golang.org/x/crypto v0.56.0 h1:GUh5Ii4J5jtcseSMiRqr1jXCNHoxjeV9Fmekc2oLy6Y=
golang.org/x/crypto v0.56.0/go.mod h1:OMW5y6CY9l38uPLmxU6l6pwcXp1obtLo3e6gT7gQR2I=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20250103183323-7d7fa50e5329 h1:9kj3STMvgqy3YA4VQXBrN7925ICMxD5wzMRcgA30588=
golang.org/x/exp v0.0.0-20250103183323-7d7fa50e5329/go.mod h1:qj5a5QZpwLU2NLQudwIN5koi3beDhSAlJwa67PuM98c=
Expand All @@ -491,8 +491,8 @@ golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4=
golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
golang.org/x/mod v0.38.0 h1:MECBjubtXD7yj4HrhIUcywNaGeNVUdfVnxmPajOk4yk=
golang.org/x/mod v0.38.0/go.mod h1:V6Xz0pq8TQ3dGqVQ1FVHuelZpAL0uNhSkk9ogYP3c40=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
Expand All @@ -509,11 +509,11 @@ golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0=
golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k=
golang.org/x/net v0.57.0 h1:K5+3DljvIuDG9/Jv9rvyMywYNFCQ9RSUY6OOTTkT+tE=
golang.org/x/net v0.57.0/go.mod h1:KpXc8iv+r3XplLAG/f7Jsf9RPszJzdR0f58q9vGOuEU=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.25.0 h1:CY4y7XT9v0cRI9oupztF8AgiIu99L/ksR/Xp/6jrZ70=
golang.org/x/oauth2 v0.25.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
golang.org/x/oauth2 v0.36.0 h1:peZ/1z27fi9hUOFCAZaHyrpWG5lwe0RJEEEeH0ThlIs=
golang.org/x/oauth2 v0.36.0/go.mod h1:YDBUJMTkDnJS+A4BP4eZBjCqtokkg1hODuPjwiGPO7Q=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand All @@ -524,8 +524,9 @@ golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ=
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek=
golang.org/x/sync v0.22.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
Expand All @@ -547,8 +548,8 @@ golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU=
golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs=
golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
Expand All @@ -559,8 +560,8 @@ golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU=
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM=
golang.org/x/term v0.28.0 h1:/Ts8HFuMR2E6IP/jlo7QVLZHggjKQbhu/7H0LJFr3Gg=
golang.org/x/term v0.28.0/go.mod h1:Sw/lC2IAUZ92udQNf3WodGtn4k/XoLyZoh8v/8uiwek=
golang.org/x/term v0.45.0 h1:NwWyBmoJCbfTHpxrWoZ9C6/VxOf7ic219I8xZZFdrf0=
golang.org/x/term v0.45.0/go.mod h1:9aqxs0blBcrm/n0L9QW0aRVD+ktan8ssZromtqJC43w=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
Expand All @@ -569,8 +570,9 @@ golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
golang.org/x/text v0.41.0 h1:vz/seA0lnX87Othu2f/0L24RcgrXD9/YFTSuGjj3rH8=
golang.org/x/text v0.41.0/go.mod h1:jvf1O8ajNzZqhSrQBPbutR/EB83Cc0CFrezNQIwbb5M=
golang.org/x/time v0.9.0 h1:EsRrnYcQiGH+5FfbgvV4AP7qEZstoyrHB0DzarOQ4ZY=
golang.org/x/time v0.9.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
Expand All @@ -585,8 +587,8 @@ golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
golang.org/x/tools v0.28.0 h1:WuB6qZ4RPCQo5aP3WdKZS7i595EdWqWR8vqJTlwTVK8=
golang.org/x/tools v0.28.0/go.mod h1:dcIOrVd3mfQKTgrDVQHqCPMWy6lnhfhtX3hLXYVLfRw=
golang.org/x/tools v0.48.0 h1:3+hClM1aLL5mjMKm5ovokw9epgRXPuu2tILgismM6RE=
golang.org/x/tools v0.48.0/go.mod h1:08xX0orndb/F7jJxGDicx061tyd5pcMto75YMAXr6lk=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down
76 changes: 45 additions & 31 deletions pkg/build/builder/common_test.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package builder

import (
"encoding/hex"
"fmt"
"io/ioutil"
"math/rand"
"os"
"path/filepath"
"reflect"
"regexp"
"strings"
"testing"

Expand Down Expand Up @@ -74,52 +75,65 @@ func TestBuildInfo(t *testing.T) {
}

func TestRandomBuildTag(t *testing.T) {
tests := []struct {
namespace, name string
want string
}{
{"test", "build-1", "temp.builder.openshift.io/test/build-1:f1f85ff5"},
// For long build namespace + build name, the returned random build tag
// would be longer than the limit of reference.NameTotalLengthMax (255
// chars). We do not truncate the repository name because it could create an
// invalid repository name (e.g., namespace=abc, name=d, repo=abc/d,
// trucated=abc/ -> invalid), so we simply take a SHA1 hash of the
// repository name (which is guaranteed to be a valid repository name) and
// preserve the random tag.
{
"namespace" + strings.Repeat(".namespace", 20),
"name" + strings.Repeat(".name", 20),
"8a0f9d66cde28a0ebb1e3ee8ef9a484ce687afe0:f1f85ff5",
},
// Short namespace/name: should produce temp.builder.openshift.io/{ns}/{name}:{8hexchars}
tag := randomBuildTag("test", "build-1")
shortPattern := regexp.MustCompile(`^temp\.builder\.openshift\.io/test/build-1:([0-9a-f]{8})$`)
m := shortPattern.FindStringSubmatch(tag)
if m == nil {
t.Errorf("randomBuildTag(\"test\", \"build-1\") = %q, does not match expected format", tag)
} else if _, err := hex.DecodeString(m[1]); err != nil {
t.Errorf("suffix %q is not valid hex: %v", m[1], err)
}
for _, tt := range tests {
rand.Seed(0)
got := randomBuildTag(tt.namespace, tt.name)
if !reflect.DeepEqual(got, tt.want) {
t.Errorf("randomBuildTag(%q, %q) = %q, want %q", tt.namespace, tt.name, got, tt.want)
}

// Different inputs should produce different prefixes
tag2 := randomBuildTag("other-ns", "other-build")
if strings.Split(tag, ":")[0] == strings.Split(tag2, ":")[0] {
t.Errorf("different inputs produced the same prefix: %q vs %q", tag, tag2)
}

// Long namespace/name: repo should be SHA1-hashed, tag should still be 8 hex chars
longNs := "namespace" + strings.Repeat(".namespace", 20)
longName := "name" + strings.Repeat(".name", 20)
longTag := randomBuildTag(longNs, longName)
// When the repo is hashed, it becomes a 40-char hex SHA1 followed by :8hexchars
longPattern := regexp.MustCompile(`^[0-9a-f]{40}:([0-9a-f]{8})$`)
ml := longPattern.FindStringSubmatch(longTag)
if ml == nil {
t.Errorf("randomBuildTag with long input = %q, does not match expected hashed format", longTag)
}
if len(longTag) > 255 {
t.Errorf("randomBuildTag with long input produced tag of length %d, exceeding 255", len(longTag))
}
}

func TestRandomBuildTagNoDupes(t *testing.T) {
rand.Seed(0)
previous := make(map[string]struct{})
for i := 0; i < 100; i++ {
tag := randomBuildTag("test", "build-1")
_, exists := previous[tag]
if exists {
if _, exists := previous[tag]; exists {
t.Errorf("randomBuildTag returned a recently seen tag: %q", tag)
}
previous[tag] = struct{}{}
}
}

func TestContainerName(t *testing.T) {
rand.Seed(0)
got := containerName("test-strategy", "my-build", "ns", "hook")
want := "openshift_test-strategy-build_my-build_ns_hook_f1f85ff5"
if got != want {
t.Errorf("got %v, want %v", got, want)

// Format: openshift_{strategy}-build_{build}_{namespace}_{purpose}_{8hexchars}
pattern := regexp.MustCompile(`^openshift_test-strategy-build_my-build_ns_hook_([0-9a-f]{8})$`)
m := pattern.FindStringSubmatch(got)
if m == nil {
t.Errorf("containerName() = %q, does not match expected format", got)
} else if _, err := hex.DecodeString(m[1]); err != nil {
t.Errorf("suffix %q is not valid hex: %v", m[1], err)
}

// Verify the output contains expected components
for _, want := range []string{"openshift", "test-strategy", "my-build", "ns", "hook"} {
if !strings.Contains(got, want) {
t.Errorf("containerName() = %q, missing expected component %q", got, want)
}
}
}

Expand Down
30 changes: 15 additions & 15 deletions pkg/build/builder/daemonless_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ func coreTestSubscriptionDirMounts(t *testing.T, path string, fn appendFunc) {
for _, tc := range cases {
tmpDir, err := ioutil.TempDir(os.TempDir(), tc.name)
if err != nil {
t.Fatalf(err.Error())
t.Fatal(err)
}
defer os.RemoveAll(tmpDir)
if tc.exists {
Expand All @@ -440,39 +440,39 @@ func coreTestSubscriptionDirMounts(t *testing.T, path string, fn appendFunc) {
// regular file
_, err = os.Create(filepath.Join(tmpDir, path))
if err != nil {
t.Fatalf(err.Error())
t.Fatal(err)
}

case tc.mode&os.ModeDir != 0:
// dir
err = os.Mkdir(filepath.Join(tmpDir, path), 0777)
if err != nil {
t.Fatalf(err.Error())
t.Fatal(err)
}
_, err = os.Create(filepath.Join(tmpDir, path, "ca"))
if err != nil {
t.Fatalf(err.Error())
t.Fatal(err)
}
case tc.mode&os.ModeSymlink != 0:
// symlink
if tc.badLink {
_, err = os.Create(filepath.Join(tmpDir, path+"-link-destination"))
if err != nil {
t.Fatalf(err.Error())
t.Fatal(err)
}
} else {
err = os.Mkdir(filepath.Join(tmpDir, path+"-link-destination"), 0777)
if err != nil {
t.Fatalf(err.Error())
t.Fatal(err)
}
_, err = os.Create(filepath.Join(tmpDir, path+"-link-destination", "ca"))
if err != nil {
t.Fatalf(err.Error())
t.Fatal(err)
}
}
err = os.Symlink(filepath.Join(tmpDir, path+"-link-destination"), filepath.Join(tmpDir, path))
if err != nil {
t.Fatalf(err.Error())
t.Fatal(err)
}
}
mountsMap := make(TransientMounts)
Expand Down Expand Up @@ -500,7 +500,7 @@ func coreTestSubscriptionDirMounts(t *testing.T, path string, fn appendFunc) {
copyDir := splitMount[0]
files, err := ioutil.ReadDir(copyDir)
if err != nil {
t.Fatalf(err.Error())
t.Fatal(err)
}
found := false
for _, file := range files {
Expand Down Expand Up @@ -575,7 +575,7 @@ func TestRHRepoMount(t *testing.T) {
for _, tc := range cases {
tmpDir, err := ioutil.TempDir(os.TempDir(), tc.name)
if err != nil {
t.Fatalf(err.Error())
t.Fatal(err)
}
defer os.RemoveAll(tmpDir)
if tc.exists {
Expand All @@ -584,31 +584,31 @@ func TestRHRepoMount(t *testing.T) {
// regular file
_, err = os.Create(filepath.Join(tmpDir, path))
if err != nil {
t.Fatalf(err.Error())
t.Fatal(err)
}

case tc.mode&os.ModeDir != 0:
// dir
err = os.Mkdir(filepath.Join(tmpDir, path), 0777)
if err != nil {
t.Fatalf(err.Error())
t.Fatal(err)
}
case tc.mode&os.ModeSymlink != 0:
// symlink
if tc.badLink {
err = os.Mkdir(filepath.Join(tmpDir, path+"-link-destination"), 0777)
if err != nil {
t.Fatalf(err.Error())
t.Fatal(err)
}
} else {
_, err = os.Create(filepath.Join(tmpDir, path+"-link-destination"))
if err != nil {
t.Fatalf(err.Error())
t.Fatal(err)
}
}
err = os.Symlink(filepath.Join(tmpDir, path+"-link-destination"), filepath.Join(tmpDir, path))
if err != nil {
t.Fatalf(err.Error())
t.Fatal(err)
}
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/build/builder/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,10 @@ func checkRemoteGit(gitClient GitClient, url string, initialTimeout time.Duratio
log.V(4).Infof("git ls-remote --heads %s", url)
out, errOut, err = gitClient.TimedListRemote(timeout, url, "--heads")
if len(out) != 0 {
log.V(4).Infof(out)
log.V(4).Infof("%s", out)
}
if len(errOut) != 0 {
log.V(4).Infof(errOut)
log.V(4).Infof("%s", errOut)
}
if err != nil {
if _, ok := err.(*git.TimeoutError); ok {
Expand Down
Loading