Skip to content

Commit d9d6478

Browse files
author
Jeff Peeler
committed
Teach build-local-images to build service-catalog
Building images from RPM takes quite a bit of time, so add service catalog to the local image build list. A prerequisite for this task is to have the service catalog binaries compiled, which is done with openshift#1: 1) cmd/service-catalog/go/src/github.com/kubernetes-incubator/service-catalog/hack/build-go.sh 2) hack/build-local-images service-catalog The first script uses the origin tooling to build in the same way as the RPMs are built. Note that a new "enable_default" key has been added to the image_config and set to False for service catalog so that it is not built unless directly specified (as indicated in openshift#2).
1 parent 01d9694 commit d9d6478

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

hack/build-local-images.py

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,18 @@
127127
"openshift": "/usr/bin/openshift"
128128
},
129129
"files": {}
130-
}
130+
},
131+
"service-catalog": {
132+
"directory": "service-catalog",
133+
"vendor_dir": "cmd/service-catalog/go/src/\
134+
github.com/kubernetes-incubator/service-catalog",
135+
"binaries": {
136+
"controller-manager": "/usr/bin/controller-manager",
137+
"apiserver": "/usr/bin/apiserver",
138+
},
139+
"files": {},
140+
"enable_default": False,
141+
},
131142
}
132143

133144

@@ -138,13 +149,11 @@ def image_rebuild_requested(image):
138149
suffix explicitly or does not provide
139150
any explicit requests.
140151
"""
141-
return len(sys.argv) == 1 or (
142-
len(sys.argv) > 1 and (
143-
image in sys.argv or
144-
full_name(image) in sys.argv
145-
)
146-
)
147-
152+
build_image = image_config[image].get("enable_default", True)
153+
if len(sys.argv) == 1:
154+
return build_image
155+
if image in sys.argv or full_name(image) in sys.argv:
156+
return True
148157

149158
def full_name(image):
150159
"""
@@ -185,7 +194,8 @@ def debug(message):
185194

186195

187196
os_root = abspath(join(dirname(__file__), ".."))
188-
os_bin_path = join(os_root, "_output", "local", "bin", "linux", "amd64")
197+
binary_dir_args = ["_output", "local", "bin", "linux", "amd64"]
198+
os_bin_path = join(os_root, *binary_dir_args)
189199
os_image_path = join(os_root, "images")
190200

191201
context_dir = mkdtemp()
@@ -207,6 +217,8 @@ def debug(message):
207217

208218
config = image_config[image]
209219
for binary in config.get("binaries", []):
220+
if "vendor_dir" in config:
221+
os_bin_path = join(os_root, config.get("vendor_dir"), *binary_dir_args)
210222
add_to_context(
211223
context_dir,
212224
source=join(os_bin_path, binary),

0 commit comments

Comments
 (0)