Skip to content

Commit

Permalink
fix(contrib): exit when error on plugin build (#5984)
Browse files Browse the repository at this point in the history
  • Loading branch information
richardlt authored Oct 22, 2021
1 parent 156adb1 commit 1cfdf9d
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion contrib/integrations/arsenal/plugin-arsenal/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ build: $(TARGET_DIR)
if test "$$GOOS" = "windows" ; then EXTENSION=".exe"; fi; \
echo Compiling $(TARGET_DIR)/$(TARGET_NAME)-$$GOOS-$$GOARCH$$EXTENSION $(VERSION); \
FILENAME=$(TARGET_NAME)-$$GOOS-$$GOARCH$$EXTENSION; \
GOOS=$$GOOS GOARCH=$$GOARCH CGO_ENABLED=0 $(GO_BUILD) $(TARGET_LDFLAGS) -o $(TARGET_DIR)/$$FILENAME; \
GOOS=$$GOOS GOARCH=$$GOARCH CGO_ENABLED=0 $(GO_BUILD) $(TARGET_LDFLAGS) -o $(TARGET_DIR)/$$FILENAME || exit 1; \
echo "$$PLUGIN_MANIFEST_BINARY" > $(TARGET_DIR)/plugin-arsenal-$$GOOS-$$GOARCH.yml; \
perl -pi -e s,%os%,$$GOOS,g $(TARGET_DIR)/plugin-arsenal-$$GOOS-$$GOARCH.yml; \
perl -pi -e s,%arch%,$$GOARCH,g $(TARGET_DIR)/plugin-arsenal-$$GOOS-$$GOARCH.yml; \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ build: $(TARGET_DIR)
if test "$$GOOS" = "windows" ; then EXTENSION=".exe"; fi; \
echo Compiling $(TARGET_DIR)/$(TARGET_NAME)-$$GOOS-$$GOARCH$$EXTENSION $(VERSION); \
FILENAME=$(TARGET_NAME)-$$GOOS-$$GOARCH$$EXTENSION; \
GOOS=$$GOOS GOARCH=$$GOARCH CGO_ENABLED=0 $(GO_BUILD) $(TARGET_LDFLAGS) -o $(TARGET_DIR)/$$FILENAME; \
GOOS=$$GOOS GOARCH=$$GOARCH CGO_ENABLED=0 $(GO_BUILD) $(TARGET_LDFLAGS) -o $(TARGET_DIR)/$$FILENAME || exit 1; \
echo "$$PLUGIN_MANIFEST_BINARY" > $(TARGET_DIR)/plugin-artifactory-build-info-$$GOOS-$$GOARCH.yml; \
perl -pi -e s,%os%,$$GOOS,g $(TARGET_DIR)/plugin-artifactory-build-info-$$GOOS-$$GOARCH.yml; \
perl -pi -e s,%arch%,$$GOARCH,g $(TARGET_DIR)/plugin-artifactory-build-info-$$GOOS-$$GOARCH.yml; \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ build: $(TARGET_DIR)
if test "$$GOOS" = "windows" ; then EXTENSION=".exe"; fi; \
echo Compiling $(TARGET_DIR)/$(TARGET_NAME)-$$GOOS-$$GOARCH$$EXTENSION $(VERSION); \
FILENAME=$(TARGET_NAME)-$$GOOS-$$GOARCH$$EXTENSION; \
GOOS=$$GOOS GOARCH=$$GOARCH CGO_ENABLED=0 $(GO_BUILD) $(TARGET_LDFLAGS) -o $(TARGET_DIR)/$$FILENAME; \
GOOS=$$GOOS GOARCH=$$GOARCH CGO_ENABLED=0 $(GO_BUILD) $(TARGET_LDFLAGS) -o $(TARGET_DIR)/$$FILENAME || exit 1; \
echo "$$PLUGIN_MANIFEST_BINARY" > $(TARGET_DIR)/plugin-artifactory-download-artifact-$$GOOS-$$GOARCH.yml; \
perl -pi -e s,%os%,$$GOOS,g $(TARGET_DIR)/plugin-artifactory-download-artifact-$$GOOS-$$GOARCH.yml; \
perl -pi -e s,%arch%,$$GOARCH,g $(TARGET_DIR)/plugin-artifactory-download-artifact-$$GOOS-$$GOARCH.yml; \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ build: $(TARGET_DIR)
if test "$$GOOS" = "windows" ; then EXTENSION=".exe"; fi; \
echo Compiling $(TARGET_DIR)/$(TARGET_NAME)-$$GOOS-$$GOARCH$$EXTENSION $(VERSION); \
FILENAME=$(TARGET_NAME)-$$GOOS-$$GOARCH$$EXTENSION; \
GOOS=$$GOOS GOARCH=$$GOARCH CGO_ENABLED=0 $(GO_BUILD) $(TARGET_LDFLAGS) -o $(TARGET_DIR)/$$FILENAME; \
GOOS=$$GOOS GOARCH=$$GOARCH CGO_ENABLED=0 $(GO_BUILD) $(TARGET_LDFLAGS) -o $(TARGET_DIR)/$$FILENAME || exit 1; \
echo "$$PLUGIN_MANIFEST_BINARY" > $(TARGET_DIR)/plugin-artifactory-promote-$$GOOS-$$GOARCH.yml; \
perl -pi -e s,%os%,$$GOOS,g $(TARGET_DIR)/plugin-artifactory-promote-$$GOOS-$$GOARCH.yml; \
perl -pi -e s,%arch%,$$GOARCH,g $(TARGET_DIR)/plugin-artifactory-promote-$$GOOS-$$GOARCH.yml; \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ build: $(TARGET_DIR)
if test "$$GOOS" = "windows" ; then EXTENSION=".exe"; fi; \
echo Compiling $(TARGET_DIR)/$(TARGET_NAME)-$$GOOS-$$GOARCH$$EXTENSION $(VERSION); \
FILENAME=$(TARGET_NAME)-$$GOOS-$$GOARCH$$EXTENSION; \
GOOS=$$GOOS GOARCH=$$GOARCH CGO_ENABLED=0 $(GO_BUILD) $(TARGET_LDFLAGS) -o $(TARGET_DIR)/$$FILENAME; \
GOOS=$$GOOS GOARCH=$$GOARCH CGO_ENABLED=0 $(GO_BUILD) $(TARGET_LDFLAGS) -o $(TARGET_DIR)/$$FILENAME || exit 1; \
echo "$$PLUGIN_MANIFEST_BINARY" > $(TARGET_DIR)/plugin-artifactory-release-$$GOOS-$$GOARCH.yml; \
perl -pi -e s,%os%,$$GOOS,g $(TARGET_DIR)/plugin-artifactory-release-$$GOOS-$$GOARCH.yml; \
perl -pi -e s,%arch%,$$GOARCH,g $(TARGET_DIR)/plugin-artifactory-release-$$GOOS-$$GOARCH.yml; \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ build: $(TARGET_DIR)
if test "$$GOOS" = "windows" ; then EXTENSION=".exe"; fi; \
echo Compiling $(TARGET_DIR)/$(TARGET_NAME)-$$GOOS-$$GOARCH$$EXTENSION $(VERSION); \
FILENAME=$(TARGET_NAME)-$$GOOS-$$GOARCH$$EXTENSION; \
GOOS=$$GOOS GOARCH=$$GOARCH CGO_ENABLED=0 $(GO_BUILD) $(TARGET_LDFLAGS) -o $(TARGET_DIR)/$$FILENAME; \
GOOS=$$GOOS GOARCH=$$GOARCH CGO_ENABLED=0 $(GO_BUILD) $(TARGET_LDFLAGS) -o $(TARGET_DIR)/$$FILENAME || exit 1; \
echo "$$PLUGIN_MANIFEST_BINARY" > $(TARGET_DIR)/plugin-artifactory-upload-artifact-$$GOOS-$$GOARCH.yml; \
perl -pi -e s,%os%,$$GOOS,g $(TARGET_DIR)/plugin-artifactory-upload-artifact-$$GOOS-$$GOARCH.yml; \
perl -pi -e s,%arch%,$$GOARCH,g $(TARGET_DIR)/plugin-artifactory-upload-artifact-$$GOOS-$$GOARCH.yml; \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ build: $(TARGET_DIR)
if test "$$GOOS" = "windows" ; then EXTENSION=".exe"; fi; \
FILENAME=deployment-plugin-$(TARGET_NAME)-$$GOOS-$$GOARCH$$EXTENSION; \
echo Compiling $(TARGET_DIR)/$$FILENAME $(VERSION); \
GOOS=$$GOOS GOARCH=$$GOARCH $(GO_BUILD) $(TARGET_LDFLAGS) -o $(TARGET_DIR)/$$FILENAME; \
GOOS=$$GOOS GOARCH=$$GOARCH $(GO_BUILD) $(TARGET_LDFLAGS) -o $(TARGET_DIR)/$$FILENAME || exit 1; \
echo "$$PLUGIN_MANIFEST_BINARY" > $(TARGET_DIR)/plugin-kubernetes-$$GOOS-$$GOARCH.yml; \
perl -pi -e s,%os%,$$GOOS,g $(TARGET_DIR)/plugin-kubernetes-$$GOOS-$$GOARCH.yml; \
perl -pi -e s,%arch%,$$GOARCH,g $(TARGET_DIR)/plugin-kubernetes-$$GOOS-$$GOARCH.yml; \
Expand Down
2 changes: 1 addition & 1 deletion contrib/integrations/kubernetes/plugin-kubernetes/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ build: $(TARGET_DIR)
if test "$$GOOS" = "windows" ; then EXTENSION=".exe"; fi; \
echo Compiling $(TARGET_DIR)/$(TARGET_NAME)-$$GOOS-$$GOARCH$$EXTENSION $(VERSION); \
FILENAME=$(TARGET_NAME)-$$GOOS-$$GOARCH$$EXTENSION; \
GOOS=$$GOOS GOARCH=$$GOARCH CGO_ENABLED=0 $(GO_BUILD) $(TARGET_LDFLAGS) -o $(TARGET_DIR)/$$FILENAME; \
GOOS=$$GOOS GOARCH=$$GOARCH CGO_ENABLED=0 $(GO_BUILD) $(TARGET_LDFLAGS) -o $(TARGET_DIR)/$$FILENAME || exit 1; \
echo "$$PLUGIN_MANIFEST_BINARY" > $(TARGET_DIR)/$(TARGET_NAME)-$$GOOS-$$GOARCH.yml; \
perl -pi -e s,%os%,$$GOOS,g $(TARGET_DIR)/$(TARGET_NAME)-$$GOOS-$$GOARCH.yml; \
perl -pi -e s,%arch%,$$GOARCH,g $(TARGET_DIR)/$(TARGET_NAME)-$$GOOS-$$GOARCH.yml; \
Expand Down
4 changes: 2 additions & 2 deletions contrib/integrations/kubernetes/plugin-kubernetes/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,10 +244,10 @@ func executeK8s(q *integrationplugin.RunQuery) error {
}

if namespace != "" && namespace != apiv1.NamespaceDefault {
if _, err := clientset.CoreV1().Namespaces().Get(namespace, metav1.GetOptions{}); err != nil {
if _, err := clientset.CoreV1().Namespaces().Get(context.Background(), namespace, metav1.GetOptions{}); err != nil {
ns := apiv1.Namespace{}
ns.SetName(namespace)
if _, errC := clientset.CoreV1().Namespaces().Create(&ns); errC != nil {
if _, errC := clientset.CoreV1().Namespaces().Create(context.Background(), &ns, metav1.CreateOptions{}); errC != nil {
return fmt.Errorf("Cannot create namespace %s in kubernetes: %v", namespace, errC)
}
}
Expand Down

0 comments on commit 1cfdf9d

Please sign in to comment.