1
0
Fork 0
mirror of https://github.com/imjasonh/kontain.me synced 2026-07-21 06:27:06 +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

@ -119,7 +119,7 @@ func (s *server) serveKanikoManifest(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
@ -223,7 +223,7 @@ func (s *server) prepareWorkspace() error {
}
func (s *server) fetchAndBuild(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 {