@@ -124,7 +124,7 @@ TOOLS += operator-sdk=v1.34.1
124124# https://pkg.go.dev/github.com/cli/cli/v2?tab=versions
125125TOOLS += gh=v2.47.0
126126# https:///github.com/redhat-openshift-ecosystem/openshift-preflight/releases
127- TOOLS += preflight=1.9.1
127+ TOOLS += preflight=1.9.2
128128
129129# https://pkg.go.dev/k8s.io/code-generator/cmd?tab=versions
130130K8S_CODEGEN_VERSION =v0.29.1
@@ -167,22 +167,11 @@ $(bin_dir)/scratch/%_VERSION: FORCE | $(bin_dir)/scratch
167167# --retry-connrefused = retry even if the initial connection was refused
168168CURL = curl --silent --show-error --fail --location --retry 10 --retry-connrefused
169169
170- # In Prow, the pod has the folder "$(bin_dir)/downloaded" mounted into the
171- # container. For some reason, even though the permissions are correct,
172- # binaries that are mounted with hostPath can't be executed. When in CI, we
173- # copy the binaries to work around that. Using $(LN) is only required when
174- # dealing with binaries. Other files and folders can be symlinked.
175- #
176- # Details on how "$(bin_dir)/downloaded" gets cached are available in the
177- # description of the PR https://github.com/jetstack/testing/pull/651.
178- #
179- # We use "printenv CI" instead of just "ifeq ($(CI),)" because otherwise we
180- # would get "warning: undefined variable 'CI'".
181- ifeq ($(shell printenv CI) ,)
182- LN := ln -f -s
183- else
184- LN := cp -f -r
185- endif
170+ # LN is expected to be an atomic action, meaning that two Make processes
171+ # can run the "link $(DOWNLOAD_DIR)/tools/xxx@$(XXX_VERSION)_$(HOST_OS)_$(HOST_ARCH)
172+ # to $(bin_dir)/tools/xxx" operation simulatiously without issues (both
173+ # will perform the action and the second time the link will be overwritten).
174+ LN := ln -fs
186175
187176UC = $(shell echo '$1' | tr a-z A-Z)
188177LC = $(shell echo '$1' | tr A-Z a-z)
@@ -204,8 +193,8 @@ TOOL_NAMES :=
204193# in targets or in scripts, because it is agnostic to the
205194# working directory
206195# - an unversioned target $(bin_dir)/tools/xxx is generated that
207- # creates a copy/ link to the corresponding versioned target:
208- # $(bin_dir )/tools/xxx@$(XXX_VERSION)_$(HOST_OS)_$(HOST_ARCH)
196+ # creates a link to the corresponding versioned target:
197+ # $(DOWNLOAD_DIR )/tools/xxx@$(XXX_VERSION)_$(HOST_OS)_$(HOST_ARCH)
209198define tool_defs
210199TOOL_NAMES += $1
211200
@@ -275,7 +264,6 @@ $(bin_dir)/tools/go: $(bin_dir)/scratch/VENDORED_GO_VERSION | $(bin_dir)/tools/g
275264
276265# The "_" in "_bin" prevents "go mod tidy" from trying to tidy the vendored goroot.
277266$(bin_dir ) /tools/goroot : $(bin_dir ) /scratch/VENDORED_GO_VERSION | $(GOVENDOR_DIR ) /go@$(VENDORED_GO_VERSION ) _$(HOST_OS ) _$(HOST_ARCH ) /goroot $(bin_dir ) /tools
278- @rm -rf $(bin_dir ) /tools/goroot
279267 @cd $(dir $@ ) && $(LN ) $(patsubst $(bin_dir ) /% ,../% ,$(word 1,$|) ) $(notdir $@ )
280268 @touch $@ # making sure the target of the symlink is newer than *_VERSION
281269
@@ -324,7 +312,6 @@ GO_DEPENDENCIES += golangci-lint=github.com/golangci/golangci-lint/cmd/golangci-
324312GO_DEPENDENCIES += govulncheck=golang.org/x/vuln/cmd/govulncheck
325313GO_DEPENDENCIES += operator-sdk=github.com/operator-framework/operator-sdk/cmd/operator-sdk
326314GO_DEPENDENCIES += gh=github.com/cli/cli/v2/cmd/gh
327- GO_DEPENDENCIES += preflight=github.com/redhat-openshift-ecosystem/openshift-preflight/cmd/preflight
328315
329316# ################
330317# go build tags #
@@ -560,6 +547,29 @@ $(DOWNLOAD_DIR)/tools/rclone@$(RCLONE_VERSION)_$(HOST_OS)_$(HOST_ARCH): | $(DOWN
560547 chmod +x $(outfile); \
561548 rm -f $(outfile).zip
562549
550+ PREFLIGHT_linux_amd64_SHA256SUM =20f31e4af2004e8e3407844afea4e973975069169d69794e0633f0cb91d45afd
551+ PREFLIGHT_linux_arm64_SHA256SUM =c42cf4132027d937da88da07760e8fd9b1a8836f9c7795a1b60513d99c6939fe
552+
553+ # Currently there are no offical releases for darwin, you cannot submit results
554+ # on non-official binaries, but we can still run tests.
555+ #
556+ # Once https://github.com/redhat-openshift-ecosystem/openshift-preflight/pull/942 is merged
557+ # we can remove this darwin specific hack
558+ .PRECIOUS : $(DOWNLOAD_DIR ) /tools/preflight@$(PREFLIGHT_VERSION ) _darwin_$(HOST_ARCH )
559+ $(DOWNLOAD_DIR ) /tools/preflight@$(PREFLIGHT_VERSION ) _darwin_$(HOST_ARCH ) : | $(DOWNLOAD_DIR ) /tools
560+ @source $(lock_script ) $@ ; \
561+ mkdir -p $(outfile ) .dir; \
562+ GOWORK=off GOBIN=$(outfile ) .dir $(GO ) install github.com/redhat-openshift-ecosystem/openshift-preflight/cmd/preflight@$(PREFLIGHT_VERSION ) ; \
563+ mv $(outfile ) .dir/preflight $(outfile ) ; \
564+ rm -rf $(outfile ) .dir
565+
566+ .PRECIOUS : $(DOWNLOAD_DIR ) /tools/preflight@$(PREFLIGHT_VERSION ) _linux_$(HOST_ARCH )
567+ $(DOWNLOAD_DIR ) /tools/preflight@$(PREFLIGHT_VERSION ) _linux_$(HOST_ARCH ) : | $(DOWNLOAD_DIR ) /tools
568+ @source $(lock_script ) $@ ; \
569+ $(CURL ) https://github.com/redhat-openshift-ecosystem/openshift-preflight/releases/download/$(PREFLIGHT_VERSION ) /preflight-linux-$(HOST_ARCH ) -o $(outfile ) ; \
570+ $(checkhash_script ) $(outfile ) $(PREFLIGHT_linux_$(HOST_ARCH ) _SHA256SUM ) ; \
571+ chmod +x $(outfile )
572+
563573# ################
564574# Other Targets #
565575# ################
0 commit comments