Skip to content

Commit 5829039

Browse files
Add a make perform-official-release target
1 parent 1455ab8 commit 5829039

File tree

3 files changed

+68
-7
lines changed

3 files changed

+68
-7
lines changed

Makefile

+17
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,23 @@ release-binaries: clean
174174
hack/extract-release.sh
175175
.PHONY: release-binaries
176176

177+
# Release the integrated components for OpenShift, logging and metrics.
178+
#
179+
# Example:
180+
# make release-components
181+
release-components: clean
182+
hack/release-components.sh
183+
.PHONY: release-components
184+
185+
# Perform an official release. Requires HEAD of the repository to have a matching
186+
# tag. Will push images that are tagged tagged with the latest release commit.
187+
#
188+
# Example:
189+
# make perform-official-release
190+
perform-official-release: | release-binaries release-components
191+
OS_PUSH_ALWAYS="1" OS_PUSH_TAG="HEAD" OS_PUSH_LOCAL="1" hack/push-release.sh
192+
.PHONY: perform-official-release
193+
177194
# Build the cross compiled release binaries
178195
#
179196
# Example:

hack/push-release.sh

+13-7
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,15 @@ cd "${OS_ROOT}"
2020
# Allow a release to be repushed with a tag
2121
tag="${OS_PUSH_TAG:-}"
2222
if [[ -n "${tag}" ]]; then
23-
tag=":${tag}"
23+
if [[ "${tag}" == "HEAD" ]]; then
24+
if [[ "$( git tag --points-at HEAD | wc -l )" -ne 1 ]]; then
25+
echo "error: There must be exactly one tag pointing to HEAD to use OS_PUSH_TAG=HEAD"
26+
exit 1
27+
fi
28+
tag=":$( git tag --points-at HEAD)"
29+
else
30+
tag=":${tag}"
31+
fi
2432
else
2533
tag=":latest"
2634
fi
@@ -77,24 +85,22 @@ fi
7785
# Pull latest in preparation for tagging
7886
if [[ "${tag}" != ":latest" ]]; then
7987
if [[ -z "${OS_PUSH_LOCAL-}" ]]; then
80-
set -e
8188
for image in "${images[@]}"; do
8289
docker pull "${OS_PUSH_BASE_REGISTRY-}${image}:${source_tag}"
8390
done
84-
set +e
8591
else
8692
echo "WARNING: Pushing local :${source_tag} images to ${OS_PUSH_BASE_REGISTRY-}*${tag}"
87-
echo " CTRL+C to cancel, or any other key to continue"
88-
read
93+
if [[ -z "${OS_PUSH_ALWAYS:-}" ]]; then
94+
echo " CTRL+C to cancel, or any other key to continue"
95+
read
96+
fi
8997
fi
9098
fi
9199

92100
if [[ "${OS_PUSH_BASE_REGISTRY-}" != "" || "${tag}" != "" ]]; then
93-
set -e
94101
for image in "${images[@]}"; do
95102
docker tag -f "${image}:${source_tag}" "${OS_PUSH_BASE_REGISTRY-}${image}${tag}"
96103
done
97-
set +e
98104
fi
99105

100106
for image in "${images[@]}"; do

hack/release-components.sh

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/bash
2+
3+
# This script builds and pushes a release to DockerHub.
4+
5+
set -o errexit
6+
set -o nounset
7+
set -o pipefail
8+
9+
OS_ROOT=$(dirname "${BASH_SOURCE}")/..
10+
source "${OS_ROOT}/hack/lib/init.sh"
11+
12+
# Go to the top of the tree.
13+
cd "${OS_ROOT}"
14+
15+
tag="${OS_TAG:-}"
16+
if [[ -z "${tag}" ]]; then
17+
if [[ "$( git tag --points-at HEAD | wc -l )" -ne 1 ]]; then
18+
echo "error: Specify OS_TAG or ensure the current git HEAD is tagged."
19+
exit 1
20+
fi
21+
tag=":$( git tag --points-at HEAD )"
22+
fi
23+
24+
# release_component is the standard release pattern for subcomponents
25+
function release_component() {
26+
local STARTTIME=$(date +%s)
27+
echo "--- $1 $2 ---"
28+
mkdir -p "_output/components"
29+
(
30+
pushd _output/components/
31+
git clone --recursive "$2" "$1" -b "${tag}"
32+
OS_TAG="${tag}" hack/release.sh
33+
)
34+
local ENDTIME=$(date +%s); echo "--- $1 took $(($ENDTIME - $STARTTIME)) seconds ---"
35+
}
36+
37+
release_component logging https://github.com/openshift/origin-aggregated-logging
38+
release_component metrics https://github.com/openshift/origin-metrics

0 commit comments

Comments
 (0)