1
0
Fork 0
mirror of https://github.com/imjasonh/kontain.me synced 2026-07-22 07:39:59 +00:00

Support HEAD requests for mirror

This commit is contained in:
Jason Hall 2021-01-28 21:46:31 -05:00
parent abbb5079e1
commit fed10b0b5f
6 changed files with 40 additions and 12 deletions

View file

@ -126,7 +126,7 @@ func (s *server) serveBuildpackManifest(w http.ResponseWriter, r *http.Request)
// image tag.
if commitRE.MatchString(revision) {
ck := cacheKey(path, revision)
if err := s.storage.BlobExists(ctx, ck); err == nil {
if _, err := s.storage.BlobExists(ctx, ck); err == nil {
s.info.Println("serving cached manifest:", ck)
serve.Blob(w, r, ck)
return
@ -231,7 +231,7 @@ func (s *server) prepareWorkspace() (string, string, error) {
}
func (s *server) fetchAndBuild(src, layers, ghOwner, ghRepo, revision, path string) (string, error) {
image := fmt.Sprintf("gcr.io/%s/built-%d", projectID, time.Now().Unix)
image := fmt.Sprintf("gcr.io/%s/built-%d", projectID, time.Now().Unix())
source := fmt.Sprintf("https://github.com/%s/%s/archive/%s.tar.gz", ghOwner, ghRepo, revision)
if resp, err := http.Head(source); err != nil {