Skip to content

Commit

Permalink
debs: allow for fine grained version building
Browse files Browse the repository at this point in the history
  • Loading branch information
mikedanese committed Apr 26, 2017
1 parent ee84be6 commit a1feabf
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 5 deletions.
65 changes: 62 additions & 3 deletions debian/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ const (
ChannelStable ChannelType = "stable"
ChannelUnstable ChannelType = "unstable"
ChannelNightly ChannelType = "nightly"

cniVersion = "0.5.1"
)

type work struct {
Expand Down Expand Up @@ -60,6 +62,7 @@ var (
architectures = stringList{"amd64", "arm", "arm64", "ppc64le", "s390x"}
serverDistros = stringList{"xenial"}
allDistros = stringList{"xenial", "jessie", "precise", "sid", "stretch", "trusty", "utopic", "vivid", "wheezy", "wily", "yakkety"}
kubeVersion = ""

builtins = map[string]interface{}{
"date": func() string {
Expand All @@ -74,6 +77,7 @@ func init() {
flag.Var(&architectures, "arch", "Architectures to build for.")
flag.Var(&serverDistros, "server-distros", "Server distros to build for.")
flag.Var(&allDistros, "distros", "Distros to build for.")
flag.StringVar(&kubeVersion, "kube-version", "", "Distros to build for.")
}

func runCommand(pwd string, command string, cmdArgs ...string) error {
Expand Down Expand Up @@ -321,17 +325,17 @@ func main() {
Distros: serverDistros,
Versions: []version{
{
Version: "0.5.1",
Version: cniVersion,
Revision: "00",
Channel: ChannelStable,
},
{
Version: "0.5.1",
Version: cniVersion,
Revision: "00",
Channel: ChannelUnstable,
},
{
Version: "0.5.1",
Version: cniVersion,
Revision: "00",
Channel: ChannelNightly,
},
Expand Down Expand Up @@ -363,6 +367,61 @@ func main() {
},
}

if kubeVersion != "" {
getSpecifiedVersion := func() (string, error) {
return kubeVersion, nil
}
builds = []build{
{
Package: "kubectl",
Distros: allDistros,
Versions: []version{
{
GetVersion: getSpecifiedVersion,
Revision: "00",
Channel: ChannelStable,
GetDownloadLinkBase: getReleaseDownloadLinkBase,
},
},
},
{
Package: "kubelet",
Distros: serverDistros,
Versions: []version{
{
GetVersion: getSpecifiedVersion,
Revision: "00",
Channel: ChannelStable,
GetDownloadLinkBase: getReleaseDownloadLinkBase,
},
},
},
{
Package: "kubernetes-cni",
Distros: serverDistros,
Versions: []version{
{
Version: cniVersion,
Revision: "00",
Channel: ChannelStable,
},
},
},
{
Package: "kubeadm",
Distros: serverDistros,
Versions: []version{
{
GetVersion: getSpecifiedVersion,
Revision: "00",
Channel: ChannelStable,
GetDownloadLinkBase: getReleaseDownloadLinkBase,
},
},
},
}
}

if err := walkBuilds(builds, func(pkg, distro, arch string, v version) error {
c := cfg{
Package: pkg,
Expand Down
4 changes: 2 additions & 2 deletions debian/jenkins.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ declare -r BUILD_TAG="$(date '+%y%m%d%H%M%S')"
declare -r IMG_NAME="debian-builder:${BUILD_TAG}"
declare -r DEB_RELEASE_BUCKET="gs://kubernetes-release-dev/debian"

docker build -t "${IMG_NAME}" debian/
docker run --rm -v "${PWD}/bin:/src/bin" "${IMG_NAME}"
docker build -t "${IMG_NAME}" "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
docker run --rm -v "${PWD}/bin:/src/bin" "${IMG_NAME}" $@

gsutil -m cp -nrc bin "${DEB_RELEASE_BUCKET}/${BUILD_TAG}"
gsutil -m cp <(printf "${BUILD_TAG}") "${DEB_RELEASE_BUCKET}/latest"

0 comments on commit a1feabf

Please sign in to comment.