Skip to content

Commit

Permalink
feat: Make support services include spiffe in buildtime from Makefile
Browse files Browse the repository at this point in the history
- Add another variable flag for support services in makefile
- make support services use the default enabled delayed start in build time

Closes: #3968

Signed-off-by: Jim Wang <[email protected]>
  • Loading branch information
jim-wang-intel committed Apr 14, 2022
1 parent 0af1624 commit 60964b6
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 10 deletions.
18 changes: 12 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@

.PHONY: build clean unittest hadolint lint test docker run

# change the following boolean flag to include or exclude the delayed start libs for builds
INCLUDE_DELAYED_START_BUILD:="false"
# change the following boolean flag to include or exclude the delayed start libs for builds for most of core services except support services
INCLUDE_DELAYED_START_BUILD_CORE:="false"
# change the following boolean flag to include or exclude the delayed start libs for builds for support services exculsively
INCLUDE_DELAYED_START_BUILD_SUPPORT:="true"

GO=CGO_ENABLED=0 GO111MODULE=on go

Expand Down Expand Up @@ -65,11 +67,15 @@ GIT_SHA=$(shell git rev-parse HEAD)

ARCH=$(shell uname -m)

# DO NOT change the following flag, as it is automatically set based on the boolean switch INCLUDE_DELAYED_START_BUILD
# DO NOT change the following flag, as it is automatically set based on the boolean switch INCLUDE_DELAYED_START_BUILD_CORE
NON_DELAYED_START_GO_BUILD_TAG:=non_delayedstart
ifeq ($(INCLUDE_DELAYED_START_BUILD),"true")
ifeq ($(INCLUDE_DELAYED_START_BUILD_CORE),"true")
NON_DELAYED_START_GO_BUILD_TAG:=
endif
NON_DELAYED_START_GO_BUILD_TAG_FOR_SUPPORT:=
ifeq ($(INCLUDE_DELAYED_START_BUILD_SUPPORT),"false")
NON_DELAYED_START_GO_BUILD_TAG_FOR_SUPPORT:=non_delayedstart
endif

NO_MESSAGEBUS_GO_BUILD_TAG:=no_messagebus

Expand All @@ -89,7 +95,7 @@ cmd/core-command/core-command:
$(GO) build -tags "$(NO_MESSAGEBUS_GO_BUILD_TAG) $(NON_DELAYED_START_GO_BUILD_TAG)" $(GOFLAGS) -o $@ ./cmd/core-command

cmd/support-notifications/support-notifications:
$(GO) build -tags "$(NO_MESSAGEBUS_GO_BUILD_TAG) $(NON_DELAYED_START_GO_BUILD_TAG)" $(GOFLAGS) -o $@ ./cmd/support-notifications
$(GO) build -tags "$(NO_MESSAGEBUS_GO_BUILD_TAG) $(NON_DELAYED_START_GO_BUILD_TAG_FOR_SUPPORT)" $(GOFLAGS) -o $@ ./cmd/support-notifications

cmd/sys-mgmt-executor/sys-mgmt-executor:
$(GO) build -tags "$(NO_MESSAGEBUS_GO_BUILD_TAG) $(NON_DELAYED_START_GO_BUILD_TAG)" $(GOFLAGS) -o $@ ./cmd/sys-mgmt-executor
Expand All @@ -98,7 +104,7 @@ cmd/sys-mgmt-agent/sys-mgmt-agent:
$(GO) build -tags "$(NO_MESSAGEBUS_GO_BUILD_TAG) $(NON_DELAYED_START_GO_BUILD_TAG)" $(GOFLAGS) -o $@ ./cmd/sys-mgmt-agent

cmd/support-scheduler/support-scheduler:
$(GO) build -tags "$(NO_MESSAGEBUS_GO_BUILD_TAG) $(NON_DELAYED_START_GO_BUILD_TAG)" $(GOFLAGS) -o $@ ./cmd/support-scheduler
$(GO) build -tags "$(NO_MESSAGEBUS_GO_BUILD_TAG) $(NON_DELAYED_START_GO_BUILD_TAG_FOR_SUPPORT)" $(GOFLAGS) -o $@ ./cmd/support-scheduler

cmd/security-proxy-setup/security-proxy-setup:
$(GO) build -tags "$(NO_MESSAGEBUS_GO_BUILD_TAG) $(NON_DELAYED_START_GO_BUILD_TAG)" $(GOFLAGS) -o ./cmd/security-proxy-setup/security-proxy-setup ./cmd/security-proxy-setup
Expand Down
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,17 @@ make docker

#### Delayed Start Go Builds For Developers

Currently for EdgeX core services, the delayed start feature from the dependency go-mod-bootstrap / go-mod-secrets modules are excluded in go builds.
If you want to **include** the delayed start feature in the builds, please change the [Makefile in this directory](Makefile). In particular, change the following boolean flag from `false` to `true` before the whole docker builds.
Currently for EdgeX core services except support services (support-notification and support-scheduler services), the delayed start feature from the dependency go-mod-bootstrap / go-mod-secrets modules are excluded in go builds by default.
If you want to **include** the delayed start feature in the builds for these services, please change the [Makefile in this directory](Makefile). In particular, change the following boolean flag from `false` to `true` before the whole docker builds.

```text
INCLUDE_DELAYED_START_BUILD:="false"
INCLUDE_DELAYED_START_BUILD_CORE:="false"
```

For support services, the delayed start feature is included by default as the default behavior of them are not started right away in Snap. Similarly, you can change the default and **exclude** it by modifying the boolean flag from `true` to `false` in the Makefile:

```text
INCLUDE_DELAYED_START_BUILD_SUPPORT:="true"
```

#### Run
Expand Down
2 changes: 1 addition & 1 deletion cmd/security-spire-config/seed_builtin_entries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ echo "SPIFFE_SERVER_SOCKET=${SPIFFE_SERVER_SOCKET}"
echo "SPIFFE_EDGEX_SVID_BASE=${SPIFFE_EDGEX_SVID_BASE}"

# add pre-authorized services into spire server entry
for service in security-spiffe-token-provider \
for service in security-spiffe-token-provider notifications scheduler \
device-bacnet device-camera device-grove device-modbus device-mqtt device-rest device-snmp \
device-virtual device-rfid-llrp device-coap device-gpio \
app-service-http-export app-service-mqtt-export app-service-sample app-rfid-llrp-inventory \
Expand Down

0 comments on commit 60964b6

Please sign in to comment.