Browse code

Use a consistent process for the official release

All components are now built using hack/release.sh

Clayton Coleman authored on 2016/08/08 07:29:33
Showing 3 changed files
... ...
@@ -99,7 +99,7 @@ update: build
99 99
 #
100 100
 # Example:
101 101
 #   make test-unit
102
-#   make test-unit WHAT=pkg/build GOFLAGS=-v
102
+#   make test-unit WHAT=pkg/build TESTFLAGS=-v
103 103
 test-unit:
104 104
 	TEST_KUBE=true GOTEST_FLAGS="$(TESTFLAGS)" hack/test-go.sh $(WHAT) $(TESTS)
105 105
 .PHONY: test-unit
... ...
@@ -141,7 +141,7 @@ test-tools:
141 141
 # Run assets tests.
142 142
 #
143 143
 # Example:
144
-#   make test-assets  
144
+#   make test-assets
145 145
 test-assets:
146 146
 ifeq ($(TEST_ASSETS),true)
147 147
 	hack/test-assets.sh
... ...
@@ -175,7 +175,7 @@ clean:
175 175
 	rm -rf $(OUT_DIR)
176 176
 .PHONY: clean
177 177
 
178
-# Build an official release of OpenShift, including the official images.
178
+# Build a release of OpenShift for linux/amd64 and the images that depend on it.
179 179
 #
180 180
 # Example:
181 181
 #   make release
... ...
@@ -194,7 +194,20 @@ release-binaries: clean
194 194
 	hack/extract-release.sh
195 195
 .PHONY: release-binaries
196 196
 
197
-# Release the integrated components for OpenShift, logging and metrics.
197
+# Release the integrated components for OpenShift, origin, logging, and metrics.
198
+# The current tag in the Origin release (the tag that points to HEAD) is used to
199
+# clone and build each component. Components must have a hack/release.sh script
200
+# which must accept env var OS_TAG as the tag to build. Each component should push
201
+# its own images. See hack/release.sh and hack/push-release.sh for an example of
202
+# the appropriate behavior.
203
+#
204
+# Prerequisites:
205
+# * you must be logged into the remote registry with the appropriate
206
+#   credentials to push.
207
+# * all repositories must have a Git tag equal to the current repositories tag of
208
+#   HEAD
209
+#
210
+# TODO: consider making hack/release.sh be a make target (make official-release).
198 211
 #
199 212
 # Example:
200 213
 #   make release-components
... ...
@@ -202,15 +215,6 @@ release-components: clean
202 202
 	hack/release-components.sh
203 203
 .PHONY: release-components
204 204
 
205
-# Perform an official release. Requires HEAD of the repository to have a matching
206
-# tag. Will push images that are tagged tagged with the latest release commit.
207
-#
208
-# Example:
209
-#   make perform-official-release
210
-perform-official-release: | release-binaries release-components
211
-	OS_PUSH_ALWAYS="1" OS_PUSH_TAG="HEAD" OS_PUSH_LOCAL="1" hack/push-release.sh
212
-.PHONY: perform-official-release
213
-
214 205
 # Build the cross compiled release binaries
215 206
 #
216 207
 # Example:
... ...
@@ -18,7 +18,7 @@ if [[ -z "${tag}" ]]; then
18 18
     echo "error: Specify OS_TAG or ensure the current git HEAD is tagged."
19 19
     exit 1
20 20
   fi
21
-  tag=":$( git tag --points-at HEAD )"
21
+  tag="$( git tag --points-at HEAD )"
22 22
 fi
23 23
 
24 24
 # release_component is the standard release pattern for subcomponents
... ...
@@ -28,11 +28,15 @@ function release_component() {
28 28
   mkdir -p "_output/components"
29 29
   (
30 30
     pushd _output/components/
31
-    git clone --recursive "$2" "$1" -b "${tag}"
31
+    git clone --recursive "$2" "$1"
32
+    pushd "$1"
33
+    git checkout "${tag}"
32 34
     OS_TAG="${tag}" hack/release.sh
33 35
   )
34 36
   local ENDTIME=$(date +%s); echo "--- $1 took $(($ENDTIME - $STARTTIME)) seconds ---"
37
+  rm -rf "_output/components/$1"
35 38
 }
36 39
 
37 40
 release_component logging https://github.com/openshift/origin-aggregated-logging
38
-release_component metrics https://github.com/openshift/origin-metrics
39 41
\ No newline at end of file
42
+release_component metrics https://github.com/openshift/origin-metrics
43
+release_component origin https://github.com/openshift/origin
40 44
\ No newline at end of file
... ...
@@ -12,19 +12,15 @@ source "${OS_ROOT}/hack/lib/init.sh"
12 12
 # Go to the top of the tree.
13 13
 cd "${OS_ROOT}"
14 14
 
15
-if [[ -z "${OS_TAG}" ]]; then
16
-  echo "You must specify the OS_TAG variable as the name of the tag to create, e.g. 'v1.0.1'."
17
-  exit 1
18
-fi
19
-tag="${OS_TAG}"
20
-
21
-if [[ "$(git name-rev --name-only --tags HEAD)" != "${tag}^0" ]]; then
22
-  if git rev-parse -q --short "${tag}" &>/dev/null; then
23
-    echo "Tag ${tag} already exists"
15
+tag="${OS_TAG:-}"
16
+if [[ -z "${tag}" ]]; then
17
+  if [[ "$( git tag --points-at HEAD | wc -l )" -ne 1 ]]; then
18
+    os::log::error "Specify OS_TAG or ensure the current git HEAD is tagged."
24 19
     exit 1
25
-  else
26
-    git tag "${tag}" -a -m "${tag}" HEAD
27 20
   fi
21
+  tag="$( git tag --points-at HEAD )"
22
+elif [[ "$( git rev-parse "${tag}" )" != "$( git rev-parse HEAD )" ]]; then
23
+  os::log::warning "You are running a version of hack/release.sh that does not match OS_TAG - images may not be build correctly"
28 24
 fi
29 25
 
30 26
 function removeimage() {
... ...
@@ -38,12 +34,13 @@ function removeimage() {
38 38
   done
39 39
 }
40 40
 
41
+# Ensure that the build is using the latest public base images
41 42
 removeimage openshift/origin-base openshift/origin-release openshift/origin-haproxy-router-base
42 43
 docker pull openshift/origin-base
43 44
 docker pull openshift/origin-release
44 45
 docker pull openshift/origin-haproxy-router-base
45 46
 
46
-hack/build-release.sh
47
+OS_GIT_COMMIT="${tag}" hack/build-release.sh
47 48
 hack/build-images.sh
48 49
 OS_PUSH_TAG="${tag}" OS_TAG="" OS_PUSH_LOCAL="1" hack/push-release.sh
49 50
 
... ...
@@ -51,5 +48,4 @@ echo
51 51
 echo "Pushed ${tag} to DockerHub"
52 52
 echo "1. Push tag to GitHub with: git push origin --tags # (ensure you have no extra tags in your environment)"
53 53
 echo "2. Create a new release on the releases page and upload the built binaries in _output/local/releases"
54
-echo "   Note: you should untar the Windows binary and recompress it as a zip"
55 54
 echo "3. Send an email"
56 55
\ No newline at end of file