6
6
set -o errexit
7
7
set -o nounset
8
8
set -o pipefail
9
+ set -e
9
10
10
11
STARTTIME=$( date +%s)
11
- S2I_ROOT=$( dirname " ${BASH_SOURCE} " ) /..
12
+ S2I_ROOT=$( dirname " ${BASH_SOURCE[0] } " ) /..
12
13
source " ${S2I_ROOT} /hack/common.sh"
13
14
source " ${S2I_ROOT} /hack/util.sh"
14
15
s2i::log::install_errexit
@@ -22,29 +23,21 @@ cd "${S2I_ROOT}"
22
23
echo " ++ Building openshift/sti-release"
23
24
$buildCmd build -q --tag openshift/sti-release " ${S2I_ROOT} /images/release"
24
25
25
- context=" ${S2I_ROOT} /_output/buildenv-context"
26
-
27
26
# Clean existing output.
28
27
rm -rf " ${S2I_LOCAL_RELEASEPATH} "
29
- rm -rf " ${context} "
30
- mkdir -p " ${context} "
31
28
mkdir -p " ${S2I_LOCAL_RELEASEPATH} "
32
29
33
30
# Generate version definitions.
34
31
# You can commit a specific version by specifying S2I_GIT_COMMIT="" prior to build
35
32
s2i::build::get_version_vars
36
- s2i::build::save_version_vars " ${context } /sti-version-defs"
33
+ s2i::build::save_version_vars " ${S2I_ROOT } /sti-version-defs"
37
34
38
35
echo " ++ Building release ${S2I_GIT_VERSION} "
39
36
40
- # Create the input archive.
41
- git archive --format=tar -o " ${context} /archive.tar" " ${S2I_GIT_COMMIT} "
42
- tar -rf " ${context} /archive.tar" -C " ${context} " sti-version-defs
43
- gzip -f " ${context} /archive.tar"
44
-
45
37
# Perform the build and release in podman or docker.
46
- cat " ${context} /archive.tar.gz" | $buildCmd run -i --cidfile=" ${context} /cid" -e RELEASE_LDFLAGS=" -w -s" openshift/sti-release
47
- $buildCmd cp $( cat ${context} /cid) :/go/src/github.com/openshift/source-to-image/_output/local/releases " ${S2I_OUTPUT} "
38
+ $buildCmd run --rm -it -e RELEASE_LDFLAGS=" -w -s" \
39
+ -v " ${S2I_ROOT} " :/go/src/github.com/openshift/source-to-image:z \
40
+ openshift/sti-release
48
41
echo " ${S2I_GIT_COMMIT} " > " ${S2I_LOCAL_RELEASEPATH} /.commit"
49
42
50
- ret=$? ; ENDTIME=$( date +%s) ; echo " $0 took $(( $ ENDTIME - $ STARTTIME)) seconds" ; exit " $ret "
43
+ ret=$? ; ENDTIME=$( date +%s) ; echo " $0 took $(( ENDTIME - STARTTIME)) seconds" ; exit " $ret "
0 commit comments