diff --git a/hack/jenkins/kicbase_auto_build.sh b/hack/jenkins/kicbase_auto_build.sh index f164c9ab3e..336c4ef7f2 100755 --- a/hack/jenkins/kicbase_auto_build.sh +++ b/hack/jenkins/kicbase_auto_build.sh @@ -23,12 +23,15 @@ yes|gcloud auth configure-docker # Setup variables now=$(date +%s) KV=$(egrep "Version =" pkg/drivers/kic/types.go | cut -d \" -f 2 | cut -d "-" -f 1) -KIC_REPO=gcr.io/k8s-minikube/kicbase-builds +GCR_REPO=gcr.io/k8s-minikube/kicbase-builds +DH_REPO=kicbase/build export KIC_VERSION=$KV-$now-$ghprbPullId -export KICBASE_IMAGE_REGISTRIES=$KIC_REPO:$KIC_VERSION +export KICBASE_IMAGE_REGISTRIES="${KIC_REPO}:${KIC_VERSION} ${DH_REPO}:${KIC_VERSION}" # Let's make sure we have the newest kicbase reference curl -L https://github.com/kubernetes/minikube/raw/master/pkg/drivers/kic/types.go --output types-head.go +# kicbase tags are of the form VERSION-TIMESTAMP-PR, so this grep finds that TIMESTAMP in the middle +# if it doesn't exist, it will just return VERSION, which is covered in the if statement below HEAD_KIC_TIMESTAMP=$(egrep "Version =" types-head.go | cut -d \" -f 2 | cut -d "-" -f 2) CURRENT_KIC_TS=$(egrep "Version =" pkg/drivers/kic/types.go | cut -d \" -f 2 | cut -d "-" -f 2) if [[ $HEAD_KIC_TIMESTAMP != v* ]] && [[ $CURRENT_KIC_TS != v* ]]; then @@ -59,7 +62,7 @@ fullsha=$(docker inspect --format='{{index .RepoDigests 0}}' $KICBASE_IMAGE_REGI sha=$(echo ${fullsha} | cut -d ":" -f 2) # Display the message to the user -message="Hi ${ghprbPullAuthorLoginMention},\\n\\nA new kicbase image is available, please update your PR with the new tag and SHA.\\nIn pkg/drivers/kic/types.go:\\n\\n\\t// Version is the current version of kic\\n\\tVersion = \\\"${KIC_VERSION}\\\"\\n\\t// SHA of the kic base image\\n\\tbaseImageSHA = \\\"${sha}\\\"\\n\\t// The name of the GCR kicbase repository\\n\\tgcrRepo = \\\"${KIC_REPO}\\\"\\nThen run \`make generate-docs\` to update our documentation to reference the new image.\n\nAlternatively, run the following command and commit the changes:\\n\`\`\`\\n sed 's|Version = .*|Version = \\\"${KIC_VERSION}\\\"|;s|baseImageSHA = .*|baseImageSHA = \\\"${sha}\\\"|;s|gcrRepo = .*|gcrRepo = \\\"${KIC_REPO}\\\"|' pkg/drivers/kic/types.go > new-types.go; mv new-types.go pkg/drivers/kic/types.go; make generate-docs\\n\`\`\`" +message="Hi ${ghprbPullAuthorLoginMention},\\n\\nA new kicbase image is available, please update your PR with the new tag and SHA.\\nIn pkg/drivers/kic/types.go:\\n\\n\\t// Version is the current version of kic\\n\\tVersion = \\\"${KIC_VERSION}\\\"\\n\\t// SHA of the kic base image\\n\\tbaseImageSHA = \\\"${sha}\\\"\\n\\t// The name of the GCR kicbase repository\\n\\tgcrRepo = \\\"${KIC_REPO}\\\"\\n\\t// The name of the Dockerhub kicbase repository\\n\\tdockerhubRepo = \\\"${DH_REPO}\\\"\\nThen run \`make generate-docs\` to update our documentation to reference the new image.\n\nAlternatively, run the following command and commit the changes:\\n\`\`\`\\n sed 's|Version = .*|Version = \\\"${KIC_VERSION}\\\"|;s|baseImageSHA = .*|baseImageSHA = \\\"${sha}\\\"|;s|gcrRepo = .*|gcrRepo = \\\"${KIC_REPO}\\\"|;s|dockerhubRepo = .*|dockerhubRepo = ${DH_REPO}|' pkg/drivers/kic/types.go > new-types.go; mv new-types.go pkg/drivers/kic/types.go; make generate-docs\\n\`\`\`" curl -s -H "Authorization: token ${access_token}" \ -H "Accept: application/vnd.github.v3+json" \ diff --git a/pkg/drivers/kic/types.go b/pkg/drivers/kic/types.go index d653970d24..27357a7473 100644 --- a/pkg/drivers/kic/types.go +++ b/pkg/drivers/kic/types.go @@ -1,7 +1,7 @@ /* Copyright 2019 The Kubernetes Authors All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); +Licensed under theApache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -29,6 +29,8 @@ const ( baseImageSHA = "1537fe47d39640aa11d6c819fe39cbba6e250872c8fe2bd7701c5171a32fbc4e" // The name of the GCR kicbase repository gcrRepo = "gcr.io/k8s-minikube/kicbase-builds" + // The name of the Dockerhub kicbase repository + dockerhubRepo = "kicbase/stable" ) var ( @@ -39,7 +41,7 @@ var ( FallbackImages = []string{ // the fallback of BaseImage in case gcr.io is not available. stored in docker hub // same image is push to https://github.com/kicbase/stable - fmt.Sprintf("kicbase/stable:%s@sha256:%s", Version, baseImageSHA), + fmt.Sprintf("%s:%s@sha256:%s", dockerhubRepo, Version, baseImageSHA), // the fallback of BaseImage in case gcr.io is not available. stored in github packages https://github.com/kubernetes/minikube/packages/206071 // github packages docker does _NOT_ support pulling by sha as mentioned in the docs: