Skip to content

Commit a0989ba

Browse files
committed
update dependencies
1 parent 8b38dbb commit a0989ba

4 files changed

Lines changed: 395 additions & 429 deletions

File tree

Makefile

Lines changed: 45 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -275,41 +275,9 @@ help:
275275
@echo "GOPATH=$(GOPATH)"
276276
@echo "The following commands are available:"
277277
@echo ""
278-
@echo " make apitest : Execute API tests"
279-
@echo " make buildall : Full build and test sequence"
280-
@echo " make build : Compile the application"
281-
@echo " make clean : Remove any build artifact"
282-
@echo " make confcheck : Check the configuration files"
283-
@echo " make coverage : Generate the coverage report"
284-
@echo " make dbuild : Build everything inside a Docker container"
285-
@echo " make deb : Build a DEB package"
286-
@echo " make deps : Get dependencies"
287-
@echo " make docker : Build a scratch docker container to run this service"
288-
@echo " make dockerpromote : Promote docker image from DEV to PROD reporitory"
289-
@echo " make dockerpush : Push docker container to a remote repository"
290-
@echo " make dockertest : Test the newly built docker container"
291-
@echo " make format : Format the source code"
292-
@echo " make generate : Generate go code automatically"
293-
@echo " make gendoc : Generate static documentation from /doc/src"
294-
@echo " make install : Install this application"
295-
@echo " make linter : Check code against multiple linters"
296-
@echo " make mod : Download dependencies"
297-
@echo " make openapitest : Test the OpenAPI specification"
298-
@echo " make qa : Run all tests and static analysis tools"
299-
@echo " make rpm : Build an RPM package"
300-
@echo " make tag : Tag the Git repository"
301-
@echo " make test : Run unit tests"
302-
@echo " make updateall : Update everything"
303-
@echo " make updatego : Update Go version"
304-
@echo " make updatelint : Update golangci-lint version"
305-
@echo " make updatemod : Update dependencies"
306-
@echo " make versionup : Increase the patch number in the VERSION file"
278+
@awk '/^## /{desc=substr($$0,4)} /^\.PHONY:/{if(NF>1) {target=$$2; if(desc) printf " make %-15s: %s\n",target,desc; desc=""}}' Makefile
307279
@echo ""
308-
@echo "Use DEVMODE=LOCAL for human friendly output."
309-
@echo ""
310-
@echo "To test and build everything from scratch:"
311-
@echo " DEVMODE=LOCAL make format clean mod deps gendoc generate qa build docker dockertest"
312-
@echo "or use the shortcut:"
280+
@echo "To test and build everything from scratch, use the shortcut:"
313281
@echo " make x"
314282
@echo ""
315283

@@ -321,18 +289,16 @@ all: help
321289
x:
322290
DEVMODE=LOCAL make format clean mod deps gendoc generate qa build docker dockertest
323291

324-
# Run venom tests (https://github.com/ovh/venom)
292+
## Run venom tests (https://github.com/ovh/venom)
325293
.PHONY: apitest
326294
apitest:
327295
$(MAKE) venomtest API_TEST_DIR=monitoring API_TEST_URL=${RPISTAT_MONITORING_URL} API_TEST_FILE=api.yaml
328296

329-
# Full build and test sequence
330-
# You may want to change this and remove the options you don't need
331-
#buildall: deps qa rpm deb bz2 crossbuild
297+
## Full build and test sequence
332298
.PHONY: buildall
333299
buildall: build qa docker
334300

335-
# Compile the application
301+
## Compile and build the application
336302
.PHONY: build
337303
build:
338304
CGO_ENABLED=0 $(GOBUILDENV) \
@@ -341,23 +307,23 @@ build:
341307
-ldflags '-w -s -X main.programVersion=${VERSION} -X main.programRelease=${RELEASE} -extldflags "-fno-PIC ${STATIC_FLAG}"' \
342308
-o ./target/${BINPATH}$(PROJECT) $(CMDDIR)
343309

344-
# Remove any build artifact
310+
## Remove any build artifact
345311
.PHONY: clean
346312
clean:
347313
rm -rf $(TARGETDIR)
348314

349-
# Validate JSON configuration files against the JSON schema
315+
## Validate JSON configuration files against the JSON schema
350316
.PHONY: confcheck
351317
confcheck:
352318
${CONFCHECKCMD} resources/test/etc/${PROJECT}/config.json
353319
${CONFCHECKCMD} resources/etc/${PROJECT}/config.json
354320

355-
# Generate the coverage report
321+
## Generate the coverage report
356322
.PHONY: coverage
357323
coverage: ensuretarget
358324
$(GO) tool cover -html=$(TARGETDIR)/report/coverage.out -o $(TARGETDIR)/report/coverage.html
359325

360-
# Build everything inside a Docker container
326+
## Build everything inside a Docker container
361327
.PHONY: dbuild
362328
dbuild: dockerdev
363329
@mkdir -p $(TARGETDIR)
@@ -366,7 +332,7 @@ dbuild: dockerdev
366332
CVSPATH=$(CVSPATH) VENDOR=$(LCVENDOR) PROJECT=$(PROJECT) MAKETARGET='$(MAKETARGET)' DOCKERTAG='$(DOCKERTAG)' $(CURRENTDIR)dockerbuild.sh
367333
@exit `cat $(TARGETDIR)/make.exit`
368334

369-
# Build the DEB package for Debian-like Linux distributions
335+
## Build the DEB package for Debian-like Linux distributions
370336
.PHONY: deb
371337
deb:
372338
rm -rf $(PATHDEBPKG)
@@ -402,31 +368,31 @@ endif
402368
echo "embedded-library $(BINPATH)$(PROJECT): libyaml" >> $(PATHDEBPKG)/$(PKGNAME)-$(VERSION)/debian/$(PKGNAME).lintian-overrides
403369
cd $(PATHDEBPKG)/$(PKGNAME)-$(VERSION) && debuild -us -uc
404370

405-
# Get the test dependencies
371+
## Get the test dependencies
406372
.PHONY: deps
407373
deps: ensuretarget
408374
curl --silent --show-error --fail --location https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(BINUTIL) $(GOLANGCILINTVERSION)
409375

410-
# Build a docker container to run this service
376+
## Build a docker container to run this service
411377
.PHONY: docker
412378
docker: dockerdir dockerbuild
413379

414-
# Build the docker container in the target/DOCKER directory
380+
## Build the docker container in the target/DOCKER directory
415381
.PHONY: dockerbuild
416382
dockerbuild:
417383
$(DOCKER) build --no-cache --tag=${LCVENDOR}/${PROJECT}$(DOCKERSUFFIX):latest $(PATHDOCKERPKG)
418384

419-
# Delete the Docker image
385+
## Delete the Docker image
420386
.PHONY: dockerdelete
421387
dockerdelete:
422388
$(DOCKER) rmi -f `docker images "${LCVENDOR}/${PROJECT}$(DOCKERSUFFIX)" -q`
423389

424-
# Build a base development Docker image
390+
## Build a base development Docker image
425391
.PHONY: dockerdev
426392
dockerdev:
427393
$(DOCKER) build --pull --tag ${LCVENDOR}/dev_${PROJECT}:dev --file ./resources/docker/Dockerfile.dev ./resources/docker/
428394

429-
# Create the directory with docker files to be packaged
395+
## Create the directory with docker files to be packaged
430396
.PHONY: dockerdir
431397
dockerdir:
432398
ifneq ($(GOOSARCH),linuxamd64)
@@ -440,7 +406,7 @@ endif
440406
$(MAKE) installssl DESTDIR=$(PATHDOCKERPKG)
441407
cp resources/docker/Dockerfile.run $(PATHDOCKERPKG)/Dockerfile
442408

443-
# Login into Docker AWS ECR
409+
## Login into Docker AWS ECR
444410
.PHONY: ecrlogin
445411
ecrlogin:
446412
ifeq ($(ECR_REGISTRY),)
@@ -454,7 +420,7 @@ else
454420
endif
455421
endif
456422

457-
# Promote docker image from DEV to PROD
423+
## Promote docker image from DEV to PROD
458424
.PHONY: dockerpromote
459425
dockerpromote:
460426
$(shell eval ${DOCKER_LOGIN_PULL})
@@ -463,7 +429,7 @@ dockerpromote:
463429
$(shell eval ${DOCKER_LOGIN_PUSH})
464430
$(DOCKER) push "${DOCKER_REGISTRY_PUSH}/${DOCKERPREFIX}${PROJECT}$(DOCKERSUFFIX):$(DOCKERTAG)"
465431

466-
# Push docker container to the remote repository
432+
## Push docker container to the remote repository
467433
.PHONY: dockerpush
468434
dockerpush:
469435
$(shell eval ${DOCKER_LOGIN_PUSH})
@@ -472,6 +438,7 @@ dockerpush:
472438
$(DOCKER) tag "${LCVENDOR}/${PROJECT}$(DOCKERSUFFIX):latest" "${DOCKER_REGISTRY_PUSH}/${DOCKERPREFIX}${PROJECT}$(DOCKERSUFFIX):latest"
473439
$(DOCKER) push "${DOCKER_REGISTRY_PUSH}/${DOCKERPREFIX}${PROJECT}$(DOCKERSUFFIX):latest"
474440

441+
## Test docker container
475442
.PHONY: dockertest
476443
dockertest: dockertestenv dockerdev
477444
test -f "$(BINUTIL)/dockerize" || curl --silent --show-error --fail --location https://github.com/jwilder/dockerize/releases/download/${DOCKERIZEVERSION}/dockerize-linux-amd64-${DOCKERIZEVERSION}.tar.gz | tar -xz -C $(BINUTIL)
@@ -482,32 +449,32 @@ dockertest: dockertestenv dockerdev
482449
$(DOCKERCOMPOSECMD) down --rmi local --volumes --remove-orphans || true
483450
@exit `cat $(TARGETDIR)/make.exit`
484451

485-
# Run the integration tests; locally we need to execute 'build' and 'docker' targets first
452+
## Run the integration tests
486453
.PHONY: dockertestenv
487454
dockertestenv: ensuretarget
488455
@echo "RPISTAT_REMOTECONFIGPROVIDER=envvar" > $(TARGETDIR)/rpistat.integration.env
489456
@echo "RPISTAT_REMOTECONFIGDATA=$(shell cat resources/test/integration/rpistat/config.json | base64 | tr -d \\n)" >> $(TARGETDIR)/rpistat.integration.env
490457

491-
# Create the trget directories if missing
458+
## Create the trget directories if missing
492459
.PHONY: ensuretarget
493460
ensuretarget:
494461
@mkdir -p $(TARGETDIR)/test
495462
@mkdir -p $(TARGETDIR)/report
496463
@mkdir -p $(BINUTIL)
497464

498-
# Format the source code
465+
## Format the source code
499466
.PHONY: format
500467
format:
501468
@find $(CMDDIR) -type f -name "*.go" -exec $(GOFMT) -s -w {} \;
502469
@find $(SRCDIR) -type f -name "*.go" -exec $(GOFMT) -s -w {} \;
503470

504-
# Generate test mocks
471+
## Generate test mocks
505472
.PHONY: generate
506473
generate:
507474
rm -f internal/mocks/*.go
508475
$(GO) generate $(GOPKGS)
509476

510-
# Generate static documentation
477+
## Generate static documentation
511478
.PHONY: gendoc
512479
gendoc:
513480
yq --input-format yaml --output-format json < doc/src/config.yaml . > doc/src/config.json
@@ -521,7 +488,7 @@ gendoc:
521488
--file ./doc/src/README.tmpl \
522489
--out README.md
523490

524-
# Install this application
491+
## Install this application
525492
.PHONY: install
526493
install: uninstall
527494
mkdir -p $(PATHINSTBIN)
@@ -561,7 +528,7 @@ ifneq ($(strip $(MANPATH)),)
561528
endif
562529
echo 'nonroot:*:65532:65532:nonroot:/nonexistent:/bin/false' > $(DESTDIR)/etc/passwd
563530

564-
# Install TLS root CA certificates
531+
## Install TLS root CA certificates
565532
.PHONY: installssl
566533
installssl:
567534
ifneq ($(strip $(SSLCONFIGPATH)),)
@@ -580,38 +547,38 @@ ifneq ($(strip $(SSLCONFIGPATH)),)
580547
find $(PATHINSTSSLCFG) -type f -exec chmod 644 {} \;
581548
endif
582549

583-
# Execute multiple linter tools
550+
## Execute multiple linter tools
584551
.PHONY: linter
585552
linter:
586553
@echo -e "\n\n>>> START: Static code analysis <<<\n\n"
587554
$(GOLANGCILINT) run $(CMDDIR)/... $(SRCDIR)/...
588555
@echo -e "\n\n>>> END: Static code analysis <<<\n\n"
589556

590-
# Download dependencies
557+
## Download dependencies
591558
.PHONY: mod
592559
mod: gotools
593560
$(GO) mod download all
594561

595-
# Test the OpenAPI specification against the real deployed service
562+
## Test the OpenAPI specification against the real deployed service
596563
.PHONY: openapitest
597564
openapitest:
598565
$(MAKE) schemathesistest API_TEST_URL=${RPISTAT_MONITORING_URL} OPENAPI_FILE=openapi_monitoring.yaml
599566

600-
# Ping the deployed service to check if the correct deployed container is alive
567+
## Ping the deployed service to check if the correct deployed container is alive
601568
.PHONY: ping
602569
ping:
603570
if [ "200_$(VERSION)_$(RELEASE)_" != "$(shell curl --silent --insecure '$(RPISTAT_MONITORING_URL)/ping' | jq -r '.code,.version,.release' | tr '\n' '_')" ]; then exit 1; fi
604571

605-
# Run all tests and static analysis tools
572+
## Run all tests and static analysis tools
606573
.PHONY: qa
607574
qa: linter confcheck test coverage
608575

609-
# Retry the ping command automatically (try 60 times every 5 sec = 5 min max)
576+
## Retry the ping command automatically (try 60 times every 5 sec = 5 min max)
610577
.PHONY: rping
611578
rping:
612579
$(call make_retry,ping,60,5)
613580

614-
# Build the RPM package for RedHat-like Linux distributions
581+
## Build the RPM package for RedHat-like Linux distributions
615582
.PHONY: rpm
616583
rpm:
617584
rm -rf $(PATHRPMPKG)
@@ -631,7 +598,7 @@ rpm:
631598
--define "_manpath /$(MANPATH)" \
632599
-bb resources/rpm/rpm.spec
633600

634-
# Test the OpenAPI specification against the real deployed service
601+
## Test the OpenAPI specification against the real deployed service
635602
.PHONY: schemathesistest
636603
schemathesistest:
637604
schemathesis run \
@@ -641,13 +608,13 @@ schemathesistest:
641608
--url='${API_TEST_URL}' \
642609
${OPENAPI_FILE}
643610

644-
# Tag the Git repository
611+
## Tag the Git repository
645612
.PHONY: tag
646613
tag:
647614
git tag -a "v$(VERSION)" -m "Version $(VERSION)" && \
648615
git push origin --tags
649616

650-
# Run the unit tests
617+
## Run the unit tests
651618
.PHONY: test
652619
test: ensuretarget
653620
@echo -e "\n\n>>> START: Unit Tests <<<\n\n"
@@ -662,7 +629,7 @@ test: ensuretarget
662629
-v $(GOPKGS) $(TESTEXTRACMD)
663630
@echo -e "\n\n>>> END: Unit Tests <<<\n\n"
664631

665-
# Get the go tools
632+
## Get the go tools
666633
.PHONY: gotools
667634
gotools:
668635
$(GO) get -tool go.uber.org/mock/mockgen@latest
@@ -671,37 +638,37 @@ gotools:
671638
$(GO) install github.com/mikefarah/yq/v4@latest
672639
$(GO) install github.com/santhosh-tekuri/jsonschema/cmd/jv@latest
673640

674-
# Remove all installed files (excluding configuration files)
641+
## Remove all installed files (excluding configuration files)
675642
.PHONY: uninstall
676643
uninstall:
677644
rm -rf $(PATHINSTBIN)$(PROJECT)
678645
rm -rf $(PATHINSTDOC)
679646

680-
# Update everything
647+
## Update everything
681648
.PHONY: updateall
682649
updateall: updatego updatelint updatemod
683650

684-
# Update go version
651+
## Update go version
685652
.PHONY: updatego
686653
updatego:
687654
$(eval LAST_GO_TOOLCHAIN=$(shell curl -s https://go.dev/dl/ | grep -oE 'go[0-9]+\.[0-9]+\.[0-9]+\.linux-amd64\.tar\.gz' | head -n 1 | grep -oE 'go[0-9]+\.[0-9]+\.[0-9]+'))
688655
$(eval LAST_GO_VERSION=$(shell echo ${LAST_GO_TOOLCHAIN} | grep -oE '[0-9]+\.[0-9]+'))
689656
sed $(SEDINPLACE) "s|^go [0-9]*\.[0-9]*.*$$|go ${LAST_GO_VERSION}|g" go.mod
690657
sed $(SEDINPLACE) "s|^toolchain go[0-9]*\.[0-9]*\.[0-9]*$$|toolchain ${LAST_GO_TOOLCHAIN}|g" go.mod
691658

692-
# Update linter version
659+
## Update linter version
693660
.PHONY: updatelint
694661
updatelint:
695662
$(eval LAST_GOLANGCILINT_VERSION=$(shell curl -sL https://github.com/golangci/golangci-lint/releases/latest | sed -n 's/.*<title>Release \(v[0-9]*\.[0-9]*\.[0-9]*\).*/\1/p'))
696663
sed $(SEDINPLACE) "s|^GOLANGCILINTVERSION=v[0-9]*\.[0-9]*\.[0-9]*$$|GOLANGCILINTVERSION=${LAST_GOLANGCILINT_VERSION}|g" Makefile
697664

698-
# Update dependencies
665+
## Update dependencies
699666
.PHONY: updatemod
700667
updatemod: mod
701668
$(GO) get -t -u ./... && \
702669
$(GO) mod tidy -compat=$(shell sed -n -E 's/^go ([0-9]+\.[0-9]+).*/\1/p' go.mod)
703670

704-
# Run venom tests (https://github.com/ovh/venom)
671+
## Run venom tests (https://github.com/ovh/venom)
705672
.PHONY: venomtest
706673
venomtest:
707674
@mkdir -p $(TARGETDIR)/report/${DEPLOY_ENV}/venom/$(API_TEST_DIR)
@@ -713,7 +680,7 @@ venomtest:
713680
--output-dir=$(TARGETDIR)/report/${DEPLOY_ENV}/venom/$(API_TEST_DIR) \
714681
resources/test/venom/$(API_TEST_DIR)/$(API_TEST_FILE)
715682

716-
# Increase the patch number in the VERSION file
683+
## Increase the patch number in the VERSION file
717684
.PHONY: versionup
718685
versionup:
719686
echo ${VERSION} | gawk -F. '{printf("%d.%d.%d\n",$$1,$$2,(($$3+1)));}' > VERSION

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.2.17
1+
3.2.18

0 commit comments

Comments
 (0)