hack/build-release.sh
7bdf8ffb
 #!/bin/bash
 
e3bb13a1
 # This script generates release zips into _output/releases. It requires the openshift/origin-release
 # image to be built prior to executing this command via hack/build-base-images.sh.
7bdf8ffb
 
 set -o errexit
 set -o nounset
 set -o pipefail
 
e3bb13a1
 OS_ROOT=$(dirname "${BASH_SOURCE}")/..
 source "${OS_ROOT}/hack/common.sh"
7bdf8ffb
 
 # Go to the top of the tree.
e3bb13a1
 cd "${OS_ROOT}"
7bdf8ffb
 
e3bb13a1
 context="${OS_ROOT}/_output/buildenv-context"
7bdf8ffb
 
794be1e2
 # Clean existing output.
e3bb13a1
 rm -rf "${OS_ROOT}/_output/local/releases"
6d679137
 rm -rf "${OS_ROOT}/_output/local/go/bin"
a4f33b1e
 rm -rf "${context}"
 mkdir -p "${context}"
e3bb13a1
 mkdir -p "${OS_ROOT}/_output/local"
7bdf8ffb
 
794be1e2
 # Generate version definitions.
e3bb13a1
 os::build::get_version_vars
 os::build::save_version_vars "${context}/os-version-defs"
7bdf8ffb
 
794be1e2
 # Create the input archive.
a4f33b1e
 git archive --format=tar -o "${context}/archive.tar" HEAD
 tar -rf "${context}/archive.tar" -C "${context}" os-version-defs
 gzip -f "${context}/archive.tar"
7bdf8ffb
 
794be1e2
 # Perform the build and release in Docker.
e3bb13a1
 cat "${context}/archive.tar.gz" | docker run -i --cidfile="${context}/cid" openshift/origin-release
 docker cp $(cat ${context}/cid):/go/src/github.com/openshift/origin/_output/local/releases "${OS_ROOT}/_output/local"
776b67b2
 echo "${OS_GIT_COMMIT}" > "${OS_ROOT}/_output/local/releases/.commit"
e3bb13a1
 
794be1e2
 # Copy the linux release archives release back to the local _output/local/go/bin directory.
 os::build::detect_local_release_tars "linux"
25328c4f
 
794be1e2
 mkdir -p "${OS_LOCAL_BINPATH}"
95594479
 tar mxzf "${OS_PRIMARY_RELEASE_TAR}" -C "${OS_LOCAL_BINPATH}"
794be1e2
 tar mxzf "${OS_IMAGE_RELEASE_TAR}" -C "${OS_LOCAL_BINPATH}"
25328c4f
 
 os::build::make_openshift_binary_symlinks