Skip to content

Commit

Permalink
Install preflight binary on Linux machines
Browse files Browse the repository at this point in the history
Adding preflight to the list of OpenShift binaries installed. For now,
this is only available on Linux machines and won't be added to anyone
using Darwin.
  • Loading branch information
pseudomuto committed Jun 13, 2022
1 parent c6172d4 commit 17a5811
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
10 changes: 10 additions & 0 deletions hack/bin/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@ genrule(
visibility = ["//visibility:public"],
)

genrule(
name = "fetch_preflight",
srcs = select({
":k8": ["@preflight_linux//file"],
}),
outs = ["preflight"],
cmd = "cp $(SRCS) $@",
visibility = ["//visibility:public"],
)

genrule(
name = "fetch_faq",
srcs = select({
Expand Down
19 changes: 19 additions & 0 deletions hack/bin/deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ OPENSHIFT_REPO = "https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/o

# filenames and versions from ${OPENSHIFT_REPO}/sha256sum.txt
OPENSHIFT_BINS = {
"preflight": {
# currently, preflight is only available on linux
"preflight_linux": {
"url": "https://github.com/redhat-openshift-ecosystem/openshift-preflight/releases/download/1.2.1/preflight-linux-amd64",
"sha": "e5754a81d4baae4f4956fc0842179a3daeac4778e202450f886a9afb05d218ba",
},
},
"oc": {
"oc_darwin": {
"url": "{}/openshift-client-mac-{}.tar.gz".format(OPENSHIFT_REPO, OPENSHIFT_VERSION),
Expand Down Expand Up @@ -71,6 +78,7 @@ def install():
install_operator_sdk()
install_opm()
install_openshift()
install_preflight()

# Install golang.org/x/build as kubernetes/repo-infra requires it for the
# build-tar bazel target.
Expand Down Expand Up @@ -413,6 +421,17 @@ filegroup(
"""
)

def install_preflight():
versions = OPENSHIFT_BINS["preflight"]

for k, v in versions.items():
http_file(
name = k,
executable = 1,
sha256 = v["sha"],
urls = [v["url"]]
)

## Fetch crdb used in our container
def install_crdb():
http_archive(
Expand Down
2 changes: 1 addition & 1 deletion pkg/resource/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ go_library(
go_test(
name = "go_default_test",
srcs = [
"cluster_test.go",
"certificate_test.go",
"cluster_test.go",
"discovery_service_test.go",
"pod_distruption_budget_test.go",
"public_service_test.go",
Expand Down

0 comments on commit 17a5811

Please sign in to comment.