Skip to content

Commit

Permalink
Merge pull request #964 from ernestojeda/vendor-lts-update
Browse files Browse the repository at this point in the history
ci: update app-service-template for LTS
  • Loading branch information
ernestojeda authored Oct 6, 2021
2 parents aa508a3 + e741b2a commit 1d59920
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,8 @@ test-sdk:
gofmt -l $$(find . -type f -name '*.go'| grep -v "/vendor/")
[ "`gofmt -l $$(find . -type f -name '*.go'| grep -v "/vendor/")`" = "" ]

test: build test-template test-sdk
test: build test-template test-sdk

vendor:
make -C ./app-service-template vendor
$(GO) mod vendor
6 changes: 2 additions & 4 deletions app-service-template/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,10 @@ RUN sed -e 's/dl-cdn[.]alpinelinux.org/nl.alpinelinux.org/g' -i~ /etc/apk/reposi
RUN apk add --update --no-cache ${ALPINE_PKG_BASE} ${ALPINE_PKG_EXTRA}
WORKDIR /app

COPY go.mod .

RUN go mod download

COPY . .

RUN [ ! -d "vendor" ] && go mod download all || echo "skipping..."

ARG MAKE="make build"
RUN $MAKE

Expand Down
9 changes: 5 additions & 4 deletions app-service-template/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ GOFLAGS=-ldflags "-X github.com/edgexfoundry/app-functions-sdk-go/v2/internal.SD
#GIT_SHA=$(shell git rev-parse HEAD)
GIT_SHA=no-sha

build: tidy
build:
$(GO) build $(GOFLAGS) -o $(MICROSERVICE)

tidy:
Expand All @@ -61,11 +61,12 @@ docker:
test:
$(GO) test -coverprofile=coverage.out ./...
$(GO) vet ./...
gofmt -l .
[ "`gofmt -l .`" = "" ]
gofmt -l $$(find . -type f -name '*.go'| grep -v "/vendor/")
[ "`gofmt -l $$(find . -type f -name '*.go'| grep -v "/vendor/")`" = "" ]
./bin/test-attribution-txt.sh

clean:
rm -f $(MICROSERVICE)


vendor:
$(GO) mod vendor
11 changes: 4 additions & 7 deletions app-service-template/bin/test-attribution-txt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ if [ -d vendor.bk ]; then
exit 1
fi

trap cleanup 1 2 3 6
trap cleanup 0 1 2 3 6

cleanup()
{
cd "$GIT_ROOT"
# restore the vendor dir
rm -r vendor
rm -rf vendor
if [ -d vendor.bk ]; then
mv vendor.bk vendor
fi
Expand All @@ -39,21 +39,18 @@ GO111MODULE=on go mod vendor
# anything in this loop
shopt -s nullglob


if [ ! -f Attribution.txt ]; then
echo "An Attribution.txt file for $cmd is missing, please add"
echo "An Attribution.txt file is missing, please add"
EXIT_CODE=1
else
# loop over every library in the modules.txt file in vendor
while IFS= read -r lib; do
if ! grep -q "$lib" Attribution.txt && [ "$lib" != "explicit" ]; then
echo "An attribution for $lib is missing from in $cmd Attribution.txt, please add"
echo "An attribution for $lib is missing from in Attribution.txt, please add"
# need to do this in a bash subshell, see SC2031
(( EXIT_CODE=1 ))
fi
done < <(grep '#' < "$GIT_ROOT/vendor/modules.txt" | awk '{print $2}')
fi

cd "$GIT_ROOT"

cleanup

0 comments on commit 1d59920

Please sign in to comment.