This repository has been archived by the owner on Feb 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
84 lines (70 loc) · 2.47 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
SHELL :=/bin/bash
export GO111MODULE=on
unexport GOPATH
CONTAINER_COMMAND = $(shell if [ -x "$(shell which podman)" ];then echo "podman" ; else echo "docker";fi)
IMAGE := $(or ${IMAGE},quay.io/redhat_ztp/openshift-ai-image-backup:latest)
GIT_REVISION := $(shell git rev-parse HEAD)
CONTAINER_BUILD_PARAMS = --label git_revision=${GIT_REVISION}
all: build build-image
.PHONY: all
# Include the library makefile
include $(addprefix ./vendor/github.com/openshift/build-machinery-go/make/, \
golang.mk \
targets/openshift/deps-gomod.mk \
targets/openshift/bindata.mk \
targets/openshift/images.mk \
)
# This will call a macro called "add-bindata" which will generate bindata specific targets based on the parameters:
# $0 - macro name
# $1 - target suffix
# $2 - input dirs
# $3 - prefix
# $4 - pkg
# $5 - output
# It will generate targets {update,verify}-bindata-$(1) logically grouping them in unsuffixed versions of these targets
# and also hooked into {update,verify}-generated for broader integration.
$(call add-bindata,recovery,./bindata/recovery/...,bindata,recovery_assets,internal/recovery_assets/bindata.go)
build:
hack/build-go.sh
.PHONY: build
build-image: build
$(CONTAINER_COMMAND) build $(CONTAINER_BUILD_PARAMS) -f Dockerfile . -t $(IMAGE)
.PHONY:
push-image: build-image
$(CONTAINER_COMMAND) push ${IMAGE}
.PHONY: build
check: | verify golangci-lint check-shellcheck check-bashate check-markdownlint
.PHONY: check
golangci-lint:
golangci-lint run --verbose --print-resources-usage --modules-download-mode=vendor --timeout=5m0s
.PHONY: golangci-lint
ifeq ($(shell which shellcheck 2>/dev/null),)
check-shellcheck:
@echo "Skipping shellcheck: Not installed"
else
check-shellcheck:
find . -name '*.sh' -not -path './vendor/*' -not -path './git/*' -print0 \
| xargs -0 --no-run-if-empty shellcheck
endif
.PHONY: check-shellcheck
ifeq ($(shell which bashate 2>/dev/null),)
check-bashate:
@echo "Skipping bashate: Not installed"
else
# Ignored bashate errors/warnings:
# E006 Line too long
check-bashate:
find . -name '*.sh' -not -path './vendor/*' -not -path './git/*' -print0 \
| xargs -0 --no-run-if-empty bashate -e 'E*' -i E006
endif
.PHONY: check-bashate
ifeq ($(shell which markdownlint 2>/dev/null),)
check-markdownlint:
@echo "Skipping markdownlint: Not installed"
else
check-markdownlint:
find . -name '*.md' -not -path './vendor/*' -not -path './git/*' -print0 \
| xargs -0 --no-run-if-empty markdownlint
endif
.PHONY: check-markdownlint
GO_TEST_PACKAGES :=./pkg/... ./cmd/...