Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
7ccc0a4e
Commit
7ccc0a4e
authored
Jul 08, 2015
by
Brendan Burns
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #10910 from zmerlynn/redo_build_official_release
Add `build-official-release.sh` (take two)
parents
7bb9cdf6
d6386041
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
152 additions
and
22 deletions
+152
-22
build-official-release.sh
build/build-official-release.sh
+116
-0
common.sh
build/common.sh
+31
-22
push-official-release.sh
build/push-official-release.sh
+5
-0
No files found.
build/build-official-release.sh
0 → 100755
View file @
7ccc0a4e
#!/bin/bash
# Copyright 2015 The Kubernetes Authors All rights reserved.
#
# Licensed under the Apache 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Builds an official release based on a git tag, with instructions for
# how to proceed after the bits are built.
set
-o
errexit
set
-o
nounset
set
-o
pipefail
# Get the md5 (duplicated from common.sh, but don't want to pull in
# all of common.sh here)
function
md5
()
{
if
which md5
>
/dev/null 2>&1
;
then
md5
-q
"
$1
"
else
md5sum
"
$1
"
|
awk
'{ print $1 }'
fi
}
# Get the sha1 (duplicated from common.sh, but don't want to pull in
# all of common.sh here)
function
sha1
()
{
if
which shasum
>
/dev/null 2>&1
;
then
shasum
-a1
"
$1
"
|
awk
'{ print $1 }'
else
sha1sum
"
$1
"
|
awk
'{ print $1 }'
fi
}
declare
-r
KUBE_GITHUB
=
"https://github.com/GoogleCloudPlatform/kubernetes.git"
declare
-r
KUBE_RELEASE_VERSION
=
${
1
-
}
declare
-r
KUBE_RELEASE_UMASK
=
${
KUBE_RELEASE_UMASK
:-
022
}
VERSION_REGEX
=
"^v(0|[1-9][0-9]*)
\\
.(0|[1-9][0-9]*)
\\
.(0|[1-9][0-9]*)$"
[[
${
KUBE_RELEASE_VERSION
}
=
~
${
VERSION_REGEX
}
]]
||
{
echo
"!!! You must specify the version you are releasing in the form of '
${
VERSION_REGEX
}
'"
>
&2
exit
1
}
declare
-r
KUBE_BUILD_DIR
=
"/tmp/kubernetes-release-
${
KUBE_RELEASE_VERSION
}
-
$(
date
+%s
)
"
# Set the default umask for the release. This ensures consistency
# across our release builds.
umask
"
${
KUBE_RELEASE_UMASK
}
"
echo
"Cloning
${
KUBE_GITHUB
}
at
${
KUBE_RELEASE_VERSION
}
."
echo
echo
"NOTE: Ignore the deatched HEAD warning you're about to get. We want that."
echo
git clone
${
KUBE_GITHUB
}
-b
"
${
KUBE_RELEASE_VERSION
}
"
"
${
KUBE_BUILD_DIR
}
"
# !!! REMINDER !!!
#
# Past this point, you are dealing with a different release. Don't
# assume you're executing code from the same repo as this script is
# running in. This needs to be a version agnostic build.
echo
echo
"Cloned, building release."
echo
cd
"
${
KUBE_BUILD_DIR
}
"
export
KUBE_RELEASE_RUN_TESTS
=
n
export
KUBE_SKIP_CONFIRMATIONS
=
y
make release
if
${
KUBE_BUILD_DIR
}
/cluster/kubectl.sh version |
grep
Client |
grep
dirty
;
then
echo
"!!! Tag at invalid point, or something else is bad. Build is dirty. Don't push this build."
>
&2
exit
1
fi
ln
-s
${
KUBE_BUILD_DIR
}
/_output/release-tars/kubernetes.tar.gz
${
KUBE_BUILD_DIR
}
MD5
=
$(
md5
"
${
KUBE_BUILD_DIR
}
/kubernetes.tar.gz"
)
SHA1
=
$(
sha1
"
${
KUBE_BUILD_DIR
}
/kubernetes.tar.gz"
)
echo
""
echo
"Success! You must now do the following: (you may want to cut"
echo
" and paste these instructions elsewhere, step 1 can be spammy)"
echo
""
echo
" 1) (cd
${
KUBE_BUILD_DIR
}
; build/push-official-release.sh
${
KUBE_RELEASE_VERSION
}
)"
echo
" 2) Go to https://github.com/GoogleCloudPlatform/kubernetes/releases"
echo
" and create a new 'Release
${
KUBE_RELEASE_VERSION
}
Candidate' release"
echo
" with the
${
KUBE_RELEASE_VERSION
}
tag. Mark it as a pre-release."
echo
" 3) Upload the
${
KUBE_BUILD_DIR
}
/kubernetes.tar.gz to GitHub"
echo
" 4) Use this template for the release:"
echo
""
echo
"## [Documentation](http://releases.k8s.io/
${
KUBE_RELEASE_VERSION
}
/docs)"
echo
"## [Examples](http://releases.k8s.io/
${
KUBE_RELEASE_VERSION
}
/examples)"
echo
"## Changes since <last release> (last PR <last PR>)"
echo
""
echo
"<release notes>"
echo
""
echo
"binary | hash alg | hash"
echo
"------ | -------- | ----"
echo
"
\`
kubernetes.tar.gz
\`
| md5 |
\`
${
MD5
}
\`
"
echo
"
\`
kubernetes.tar.gz
\`
| sha1 |
\`
${
SHA1
}
\`
"
echo
""
echo
" We'll fill in the release notes in the next stage."
echo
" 5) Ensure all the binaries are in place on GitHub and GCS before cleaning."
echo
" 6) (cd
${
KUBE_BUILD_DIR
}
; make clean; cd -; rm -rf
${
KUBE_BUILD_DIR
}
)"
echo
""
build/common.sh
View file @
7ccc0a4e
...
@@ -118,6 +118,7 @@ readonly KUBE_DOCKER_WRAPPED_BINARIES=(
...
@@ -118,6 +118,7 @@ readonly KUBE_DOCKER_WRAPPED_BINARIES=(
# DOCKER_MOUNT_ARGS
# DOCKER_MOUNT_ARGS
function
kube::build::verify_prereqs
()
{
function
kube::build::verify_prereqs
()
{
kube::log::status
"Verifying Prerequisites...."
kube::log::status
"Verifying Prerequisites...."
kube::build::ensure_tar
if
[[
"
${
1
-
}
"
!=
"clean"
]]
;
then
if
[[
"
${
1
-
}
"
!=
"clean"
]]
;
then
if
[[
-z
"
$(
which docker
)
"
]]
;
then
if
[[
-z
"
$(
which docker
)
"
]]
;
then
...
@@ -194,6 +195,27 @@ function kube::build::is_osx() {
...
@@ -194,6 +195,27 @@ function kube::build::is_osx() {
[[
"
$(
uname
)
"
==
"Darwin"
]]
[[
"
$(
uname
)
"
==
"Darwin"
]]
}
}
function
kube::build::ensure_tar
()
{
if
[[
-n
"
${
TAR
:-}
"
]]
;
then
return
fi
# Find gnu tar if it is available, bomb out if not.
TAR
=
tar
if
which gtar &>/dev/null
;
then
TAR
=
gtar
else
if
which gnutar &>/dev/null
;
then
TAR
=
gnutar
fi
fi
if
!
"
${
TAR
}
"
--version
|
grep
-q
GNU
;
then
echo
" !!! Cannot find GNU tar. Build on Linux or install GNU tar"
echo
" on Mac OS X (brew install gnu-tar)."
return
1
fi
}
function
kube::build::clean_output
()
{
function
kube::build::clean_output
()
{
# Clean out the output directory if it exists.
# Clean out the output directory if it exists.
if
kube::build::has_docker
;
then
if
kube::build::has_docker
;
then
...
@@ -332,12 +354,14 @@ function kube::build::source_targets() {
...
@@ -332,12 +354,14 @@ function kube::build::source_targets() {
# Set up the context directory for the kube-build image and build it.
# Set up the context directory for the kube-build image and build it.
function
kube::build::build_image
()
{
function
kube::build::build_image
()
{
kube::build::ensure_tar
local
-r
build_context_dir
=
"
${
LOCAL_OUTPUT_IMAGE_STAGING
}
/
${
KUBE_BUILD_IMAGE
}
"
local
-r
build_context_dir
=
"
${
LOCAL_OUTPUT_IMAGE_STAGING
}
/
${
KUBE_BUILD_IMAGE
}
"
kube::build::build_image_cross
kube::build::build_image_cross
mkdir
-p
"
${
build_context_dir
}
"
mkdir
-p
"
${
build_context_dir
}
"
tar
czf
"
${
build_context_dir
}
/kube-source.tar.gz"
$(
kube::build::source_targets
)
"
${
TAR
}
"
czf
"
${
build_context_dir
}
/kube-source.tar.gz"
$(
kube::build::source_targets
)
kube::version::get_version_vars
kube::version::get_version_vars
kube::version::save_version_vars
"
${
build_context_dir
}
/kube-version-defs"
kube::version::save_version_vars
"
${
build_context_dir
}
/kube-version-defs"
...
@@ -760,29 +784,12 @@ function kube::release::package_full_tarball() {
...
@@ -760,29 +784,12 @@ function kube::release::package_full_tarball() {
# of the files to be packaged. This assumes that ${2}/kubernetes is what is
# of the files to be packaged. This assumes that ${2}/kubernetes is what is
# being packaged.
# being packaged.
function
kube::release::create_tarball
()
{
function
kube::release::create_tarball
()
{
kube::build::ensure_tar
local
tarfile
=
$1
local
tarfile
=
$1
local
stagingdir
=
$2
local
stagingdir
=
$2
# Find gnu tar if it is available
"
${
TAR
}
"
czf
"
${
tarfile
}
"
-C
"
${
stagingdir
}
"
kubernetes
--owner
=
0
--group
=
0
local tar
=
tar
if
which gtar &>/dev/null
;
then
tar
=
gtar
else
if
which gnutar &>/dev/null
;
then
tar
=
gnutar
fi
fi
local
tar_cmd
=(
"
$tar
"
"czf"
"
${
tarfile
}
"
"-C"
"
${
stagingdir
}
"
"kubernetes"
)
if
"
$tar
"
--version
|
grep
-q
GNU
;
then
tar_cmd
=(
"
${
tar_cmd
[@]
}
"
"--owner=0"
"--group=0"
)
else
echo
" !!! GNU tar not available. User names will be embedded in output and"
echo
" release tars are not official. Build on Linux or install GNU tar"
echo
" on Mac OS X (brew install gnu-tar)"
fi
"
${
tar_cmd
[@]
}
"
}
}
# ---------------------------------------------------------------------------
# ---------------------------------------------------------------------------
...
@@ -840,6 +847,8 @@ function kube::release::gcs::ensure_release_bucket() {
...
@@ -840,6 +847,8 @@ function kube::release::gcs::ensure_release_bucket() {
}
}
function
kube::release::gcs::stage_and_hash
()
{
function
kube::release::gcs::stage_and_hash
()
{
kube::build::ensure_tar
# Split the args into srcs... and dst
# Split the args into srcs... and dst
local
-r
args
=(
"
$@
"
)
local
-r
args
=(
"
$@
"
)
local
-r
split
=
$((${#
args
[@]
}
-
1
))
# Split point for src/dst args
local
-r
split
=
$((${#
args
[@]
}
-
1
))
# Split point for src/dst args
...
@@ -850,7 +859,7 @@ function kube::release::gcs::stage_and_hash() {
...
@@ -850,7 +859,7 @@ function kube::release::gcs::stage_and_hash() {
srcdir
=
$(
dirname
${
src
})
srcdir
=
$(
dirname
${
src
})
srcthing
=
$(
basename
${
src
})
srcthing
=
$(
basename
${
src
})
mkdir
-p
${
GCS_STAGE
}
/
${
dst
}
mkdir
-p
${
GCS_STAGE
}
/
${
dst
}
tar
c
-C
${
srcdir
}
${
srcthing
}
|
tar
x
-C
${
GCS_STAGE
}
/
${
dst
}
"
${
TAR
}
"
c
-C
${
srcdir
}
${
srcthing
}
|
"
${
TAR
}
"
x
-C
${
GCS_STAGE
}
/
${
dst
}
done
done
}
}
...
...
build/push-official-release.sh
View file @
7ccc0a4e
...
@@ -39,5 +39,10 @@ KUBE_GCS_LATEST_CONTENTS=${KUBE_RELEASE_VERSION}
...
@@ -39,5 +39,10 @@ KUBE_GCS_LATEST_CONTENTS=${KUBE_RELEASE_VERSION}
KUBE_ROOT
=
$(
dirname
"
${
BASH_SOURCE
}
"
)
/..
KUBE_ROOT
=
$(
dirname
"
${
BASH_SOURCE
}
"
)
/..
source
"
$KUBE_ROOT
/build/common.sh"
source
"
$KUBE_ROOT
/build/common.sh"
if
${
KUBE_ROOT
}
/cluster/kubectl.sh version |
grep
Client |
grep
dirty
;
then
echo
"!!! Tag at invalid point, or something else is bad. Build is dirty. Don't push this build."
>
&2
exit
1
fi
kube::release::gcs::release
kube::release::gcs::release
kube::release::gcs::publish_latest_official
kube::release::gcs::publish_latest_official
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment