Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RELEASE_INFRA_PUSH related code to support pushes from kubernetes/release. #28922

Merged
merged 1 commit into from
Jul 15, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 24 additions & 5 deletions hack/jenkins/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,11 @@ export KUBE_SKIP_CONFIRMATIONS=y
# Skip gcloud update checking
export CLOUDSDK_COMPONENT_MANAGER_DISABLE_UPDATE_CHECK=true

# FEDERATION?
: ${FEDERATION:="false"}
: ${RELEASE_INFRA_PUSH:="false"}
: ${KUBE_RELEASE_RUN_TESTS:="n"}
export KUBE_RELEASE_RUN_TESTS
export KUBE_RELEASE_RUN_TESTS RELEASE_INFRA_PUSH FEDERATION

# Clean stuff out. Assume the last build left the tree in an odd
# state.
Expand All @@ -54,9 +57,25 @@ git clean -fdx
# Build
go run ./hack/e2e.go -v --build

[[ ${KUBE_SKIP_PUSH_GCS:-} =~ ^[yY]$ ]] || {
# Push to GCS
./build/push-ci-build.sh
}
# Push to GCS?
if [[ ${KUBE_SKIP_PUSH_GCS:-} =~ ^[yY]$ ]]; then
echo "Not pushed to GCS..."
elif $RELEASE_INFRA_PUSH; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[[ -n "${RELEASE_INFRA_PUSH:-}" ]]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well RELEASE_INFRA_PUSH is a convenient true or false bool so we can code it so it reads nice like that.
The other (unsightly) option is:
if [[ "${RELEASE_INFRA_PUSH:-}" == "true" ]]
But -n will always be true unless we change the default.

Copy link
Contributor Author

@david-mcmahon david-mcmahon Jul 13, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another nice option in bash is to use 0 or 1 for your bool values and take advantage of the double paren eval. Both are certainly more Go or Python like than the overly decorated expression above (== true):

So both read nicely:

RELEASE_INFRA_PUSH=1
if ((RELEASE_INFRA_PUSH)); then

Or:

RELEASE_INFRA_PUSH=true
if $RELEASE_INFRA_PUSH; then

I have started to prefer the former in the past couple of years, but since most of this infra uses true/false, I thought I'd stick with that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, seems reasonable. It's just different from the norm in this repo.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor nit - scripts in this repo generally use ${VAR} rather than $VAR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed. Will correct next iteration.

git clone https://github.com/kubernetes/release $WORKSPACE/release
readonly release_infra_clone=$WORKSPACE/release

if [[ ! -x $release_infra_clone/push-ci-build.sh ]]; then
echo "FATAL: Something went wrong." \
"$release_infra_clone/push-ci-build.sh isn't available. Exiting..." >&2
exit 1
fi

$FEDERATION && federation_flag="--federation"
# Use --nomock to do the real thing
#$release_infra_clone/push-ci-build.sh --nomock ${federation_flag-}
$release_infra_clone/push-ci-build.sh ${federation_flag-}
else
./build/push-ci-build.sh
fi

sha256sum _output/release-tars/kubernetes*.tar.gz