@@ -2,15 +2,16 @@ package gitreceive
22
33import (
44 "bytes"
5+ ctx "context"
56 "encoding/json"
67 "fmt"
78 "io"
89 "io/ioutil"
910 "os"
1011 "os/exec"
1112 "path/filepath"
13+ "regexp"
1214 "strings"
13- ctx "context"
1415
1516 "github.com/docker/distribution/context"
1617 storagedriver "github.com/docker/distribution/registry/storage/driver"
@@ -23,9 +24,10 @@ import (
2324 "github.com/drycc/controller-sdk-go/hooks"
2425 "github.com/drycc/pkg/log"
2526 "gopkg.in/yaml.v2"
26- "k8s.io/client-go/kubernetes"
2727 corev1 "k8s.io/api/core/v1"
2828 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
29+ "k8s.io/client-go/kubernetes"
30+ "k8s.io/client-go/kubernetes/scheme"
2931)
3032
3133// repoCmd returns exec.Command(first, others...) with its current working directory repoDir
@@ -57,6 +59,9 @@ func build(
5759 builderKey ,
5860 rawGitSha string ) error {
5961
62+ // Rewrite regular expression, compatible with slug type
63+ storagedriver .PathRegexp = regexp .MustCompile (`^([A-Za-z0-9._:-]*(/[A-Za-z0-9._:-]+)*)+$` )
64+
6065 dockerBuilderImagePullPolicy , err := k8s .PullPolicyFromString (conf .DockerBuilderImagePullPolicy )
6166 if err != nil {
6267 return err
@@ -222,6 +227,7 @@ func build(
222227 }
223228
224229 log .Info ("Starting build... but first, coffee!" )
230+ log .Debug ("Use image %s: %s" , stack ["name" ], stack ["image" ])
225231 log .Debug ("Starting pod %s" , buildPodName )
226232 json , err := prettyPrintJSON (pod )
227233 if err == nil {
@@ -249,7 +255,7 @@ func build(
249255 req := kubeClient .CoreV1 ().RESTClient ().Get ().Namespace (newPod .Namespace ).Name (newPod .Name ).Resource ("pods" ).SubResource ("log" ).VersionedParams (
250256 & corev1.PodLogOptions {
251257 Follow : true ,
252- }, metav1 .ParameterCodec )
258+ }, scheme .ParameterCodec )
253259
254260 rc , err := req .Stream (ctx .TODO ())
255261 if err != nil {
0 commit comments