Skip to content

Commit bfdf55d

Browse files
jupdecjaydeokar
andauthored
To pick up EKS CVE patched container plugin binaries for internal builds (#3571)
* To pick up EKS CVE patched contain plugin binaries for internal builds --------- Co-authored-by: Jay Deokar <[email protected]>
1 parent a374b95 commit bfdf55d

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

Makefile

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -293,17 +293,23 @@ plugins: FETCH_VERSION=1.7.1
293293
plugins: FETCH_URL=https://github.com/containernetworking/plugins/archive/refs/tags/v$(FETCH_VERSION).tar.gz
294294
plugins: VISIT_URL=https://github.com/containernetworking/plugins/tree/v$(FETCH_VERSION)/plugins/
295295
plugins: ## Fetch the CNI plugins
296-
@echo "Fetching Container networking plugins v$(FETCH_VERSION) from upstream release"
297-
@echo
298-
@echo "Visit upstream project for plugin details:"
299-
@echo "$(VISIT_URL)"
300-
@echo
301-
mkdir -p $(CORE_PLUGIN_DIR) $(CORE_PLUGIN_TMP)
302-
curl -s -L $(FETCH_URL) | tar xzf - -C $(CORE_PLUGIN_TMP)
303-
cd $(CORE_PLUGIN_TMP)/plugins-$(FETCH_VERSION) && ./build_linux.sh
304-
cp -a $(CORE_PLUGIN_TMP)/plugins-$(FETCH_VERSION)/LICENSE $(CORE_PLUGIN_DIR)
305-
cp -a $(CORE_PLUGIN_TMP)/plugins-$(FETCH_VERSION)/bin/* $(CORE_PLUGIN_DIR)
306-
rm -rf $(CORE_PLUGIN_TMP)
296+
@if [ -d "$(CORE_PLUGIN_DIR)" ] && [ -n "$$(ls -A $(CORE_PLUGIN_DIR) 2>/dev/null)" ]; then \
297+
echo "Using existing plugin binaries from $(CORE_PLUGIN_DIR)"; \
298+
ls -lh $(CORE_PLUGIN_DIR); \
299+
else \
300+
echo "Fetching Container networking plugins v$(FETCH_VERSION) from upstream release"; \
301+
echo; \
302+
echo "Visit upstream project for plugin details:"; \
303+
echo "$(VISIT_URL)"; \
304+
echo; \
305+
mkdir -p $(CORE_PLUGIN_DIR) $(CORE_PLUGIN_TMP) || exit 1; \
306+
curl -fsSL $(FETCH_URL) | tar xzf - -C $(CORE_PLUGIN_TMP) || { echo "Error: Failed to download plugins"; rm -rf $(CORE_PLUGIN_TMP); exit 1; }; \
307+
cd $(CORE_PLUGIN_TMP)/plugins-$(FETCH_VERSION) && ./build_linux.sh || { echo "Error: Failed to build plugins"; rm -rf $(CORE_PLUGIN_TMP); exit 1; }; \
308+
cp -a $(CORE_PLUGIN_TMP)/plugins-$(FETCH_VERSION)/LICENSE $(CORE_PLUGIN_DIR) && \
309+
cp -a $(CORE_PLUGIN_TMP)/plugins-$(FETCH_VERSION)/bin/* $(CORE_PLUGIN_DIR) && \
310+
rm -rf $(CORE_PLUGIN_TMP) && \
311+
echo "Successfully built and installed CNI plugins"; \
312+
fi
307313

308314
##@ Debug script
309315

0 commit comments

Comments
 (0)