mirror of
https://github.com/imjasonh/kontain.me
synced 2026-07-08 09:04:54 +00:00
md5ify cache keys
This commit is contained in:
parent
06e4bad278
commit
42d9b1af1b
6 changed files with 12 additions and 10 deletions
|
|
@ -2,6 +2,7 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"crypto/md5"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
|
@ -168,7 +169,8 @@ func (s *server) serveBuildpackManifest(w http.ResponseWriter, r *http.Request)
|
||||||
}
|
}
|
||||||
|
|
||||||
func cacheKey(path, revision string) string {
|
func cacheKey(path, revision string) string {
|
||||||
return fmt.Sprintf("kaniko-%s-%s", strings.ReplaceAll(path, "/", "_"), revision)
|
ck := []byte(fmt.Sprintf("%s-%s", strings.ReplaceAll(path, "/", "_"), revision))
|
||||||
|
return fmt.Sprintf("buildpack-%x", md5.Sum(ck))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resolves a ref (branch, tag, PR, commit) into its SHA.
|
// Resolves a ref (branch, tag, PR, commit) into its SHA.
|
||||||
|
|
|
||||||
|
|
@ -71,9 +71,7 @@ func (s *server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func cacheKey(orig string) string {
|
func cacheKey(orig string) string { return fmt.Sprintf("flatten-%s", orig) }
|
||||||
return fmt.Sprintf("flatten-%s", orig)
|
|
||||||
}
|
|
||||||
|
|
||||||
// flatten.kontain.me/ubuntu -> flatten ubuntu and serve
|
// flatten.kontain.me/ubuntu -> flatten ubuntu and serve
|
||||||
func (s *server) serveFlattenManifest(w http.ResponseWriter, r *http.Request) {
|
func (s *server) serveFlattenManifest(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
|
||||||
|
|
@ -162,7 +162,8 @@ func (s *server) serveKanikoManifest(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func cacheKey(path, revision string) string {
|
func cacheKey(path, revision string) string {
|
||||||
return fmt.Sprintf("buildpack-%s-%s", strings.ReplaceAll(path, "/", "_"), revision)
|
ck := fmt.Sprintf("%s-%s", strings.ReplaceAll(path, "/", "_"), revision)
|
||||||
|
return fmt.Sprintf("kaniko-%x", ck)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resolves a ref (branch, tag, PR, commit) into its SHA.
|
// Resolves a ref (branch, tag, PR, commit) into its SHA.
|
||||||
|
|
|
||||||
|
|
@ -70,8 +70,8 @@ func (s *server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func cacheKey(name string) string {
|
func cacheKey(name string) string {
|
||||||
ck := []byte(fmt.Sprintf("wait-%s", strings.ReplaceAll(name, "/", "_")))
|
ck := []byte(strings.ReplaceAll(name, "/", "_"))
|
||||||
return fmt.Sprintf("%x", md5.Sum(ck))
|
return fmt.Sprintf("wait-%x", md5.Sum(ck))
|
||||||
}
|
}
|
||||||
|
|
||||||
// wait.kontain.me/(name):5s -> enqueue task to generate random manifest in 5s
|
// wait.kontain.me/(name):5s -> enqueue task to generate random manifest in 5s
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ resource "google_project_service" "datastore" {
|
||||||
service = "datastore.googleapis.com"
|
service = "datastore.googleapis.com"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deploy image to each region.
|
// Deploy each service with its image.
|
||||||
resource "google_cloud_run_service" "services" {
|
resource "google_cloud_run_service" "services" {
|
||||||
for_each = var.services
|
for_each = var.services
|
||||||
name = each.key
|
name = each.key
|
||||||
|
|
|
||||||
5
test.sh
5
test.sh
|
|
@ -4,6 +4,7 @@ set -euxo pipefail
|
||||||
|
|
||||||
### buildpack
|
### buildpack
|
||||||
|
|
||||||
|
time crane validate --remote=buildpack.kontain.me/googlecloudplatform/buildpack-samples/sample-go:ed393d
|
||||||
time crane validate --remote=buildpack.kontain.me/googlecloudplatform/buildpack-samples/sample-go:ed393d
|
time crane validate --remote=buildpack.kontain.me/googlecloudplatform/buildpack-samples/sample-go:ed393d
|
||||||
|
|
||||||
### flatten
|
### flatten
|
||||||
|
|
@ -18,8 +19,8 @@ time crane validate --remote=kaniko.kontain.me/dockersamples/node-bulletin-board
|
||||||
|
|
||||||
### ko
|
### ko
|
||||||
|
|
||||||
time crane validate --remote=ko.kontain.me/github.com/google/ko/cmd/ko
|
#time crane validate --remote=ko.kontain.me/github.com/google/ko/cmd/ko
|
||||||
time crane validate --remote=ko.kontain.me/github.com/google/ko/cmd/ko
|
#time crane validate --remote=ko.kontain.me/github.com/google/ko/cmd/ko
|
||||||
|
|
||||||
### mirror
|
### mirror
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue