2021-02-13 00:54:06 +03:00
|
|
|
SHELL := /bin/bash
|
2021-05-17 22:20:28 +03:00
|
|
|
GINKGO := ginkgo
|
2021-08-12 23:46:06 +03:00
|
|
|
GIT_HASH := $(shell git rev-parse HEAD)
|
2021-10-26 20:22:22 +03:00
|
|
|
GIT_VERSION ?= $(shell git describe --tags --always --dirty)
|
|
|
|
SOURCE_DATE_EPOCH=$(shell git log --date=iso8601-strict -1 --pretty=%ct)
|
2021-05-17 22:20:28 +03:00
|
|
|
GOLANGGCI_LINT := golangci-lint
|
|
|
|
PROTOC_GEN_GO := protoc-gen-go
|
2021-11-13 01:16:22 +03:00
|
|
|
MOCKGEN := mockgen
|
2021-05-15 23:58:01 +03:00
|
|
|
PROTOC := $(shell which protoc)
|
2021-11-23 19:56:21 +03:00
|
|
|
GORELEASER := goreleaser
|
2021-02-24 22:46:41 +03:00
|
|
|
IMAGE_NAME = scorecard
|
2021-02-25 22:51:57 +03:00
|
|
|
OUTPUT = output
|
2021-11-08 18:55:58 +03:00
|
|
|
PLATFORM="linux/amd64,linux/arm64,linux/386,linux/arm"
|
2021-10-25 22:30:13 +03:00
|
|
|
LDFLAGS=$(shell ./scripts/version-ldflags)
|
2022-02-18 23:27:24 +03:00
|
|
|
KOCACHE_PATH=/tmp/ko
|
|
|
|
|
|
|
|
define create_kocache_path
|
|
|
|
mkdir -p $(KOCACHE_PATH)
|
|
|
|
endef
|
|
|
|
|
|
|
|
|
2021-07-27 20:37:27 +03:00
|
|
|
|
2021-05-15 23:58:01 +03:00
|
|
|
############################### make help #####################################
|
2021-02-22 02:35:39 +03:00
|
|
|
.PHONY: help
|
|
|
|
help: ## Display this help
|
2022-01-31 05:23:40 +03:00
|
|
|
@awk 'BEGIN {FS = ":.*##"; \
|
|
|
|
printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ \
|
|
|
|
{ printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } \
|
|
|
|
/^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
|
|
|
|
|
2021-05-15 23:58:01 +03:00
|
|
|
###############################################################################
|
|
|
|
|
2022-01-31 05:23:40 +03:00
|
|
|
##@ Development
|
2021-05-15 23:58:01 +03:00
|
|
|
################################ make install #################################
|
|
|
|
.PHONY: install
|
|
|
|
install: ## Installs all dependencies needed to compile Scorecard
|
2021-06-09 02:55:43 +03:00
|
|
|
install: | $(PROTOC)
|
2021-09-06 20:34:17 +03:00
|
|
|
@echo Installing tools from tools/tools.go
|
|
|
|
cd tools; cat tools.go | grep _ | awk -F'"' '{print $$2}' | xargs -tI % go install %
|
2020-12-23 00:43:24 +03:00
|
|
|
|
2021-05-15 23:58:01 +03:00
|
|
|
$(PROTOC):
|
|
|
|
ifeq (,$(PROTOC))
|
|
|
|
$(error download and install protobuf compiler package - https://developers.google.com/protocol-buffers/docs/downloads)
|
|
|
|
endif
|
|
|
|
###############################################################################
|
|
|
|
|
2022-01-31 05:23:40 +03:00
|
|
|
##@ Build
|
2021-05-15 23:58:01 +03:00
|
|
|
################################## make all ###################################
|
2021-02-22 02:35:39 +03:00
|
|
|
all: ## Runs build, test and verify
|
2022-02-17 02:54:22 +03:00
|
|
|
all-targets = build check-linter check-osv validate-docs add-projects validate-projects
|
2021-12-02 23:20:27 +03:00
|
|
|
.PHONY: all all-targets-update-dependencies $(all-targets) update-dependencies tree-status
|
|
|
|
all-targets-update-dependencies: $(all-targets) | update-dependencies
|
|
|
|
all: update-dependencies all-targets-update-dependencies tree-status
|
2021-05-15 23:58:01 +03:00
|
|
|
|
|
|
|
update-dependencies: ## Update go dependencies for all modules
|
|
|
|
# Update root go modules
|
|
|
|
go mod tidy && go mod verify
|
2021-09-06 20:34:17 +03:00
|
|
|
cd tools
|
|
|
|
go mod tidy && go mod verify
|
2021-05-15 23:58:01 +03:00
|
|
|
|
2021-05-17 22:20:28 +03:00
|
|
|
$(GOLANGGCI_LINT): install
|
2021-05-15 23:58:01 +03:00
|
|
|
check-linter: ## Install and run golang linter
|
2021-05-17 22:20:28 +03:00
|
|
|
check-linter: $(GOLANGGCI_LINT)
|
2021-05-15 23:58:01 +03:00
|
|
|
# Run golangci-lint linter
|
2021-05-20 04:45:23 +03:00
|
|
|
golangci-lint run -c .golangci.yml
|
2021-05-15 23:58:01 +03:00
|
|
|
|
2021-09-22 23:41:56 +03:00
|
|
|
check-osv: ## Checks osv.dev for any vulnerabilities
|
|
|
|
check-osv: $(install)
|
|
|
|
# Run stunning-tribble for checking the dependencies have any OSV
|
|
|
|
go list -m -f '{{if not (or .Main)}}{{.Path}}@{{.Version}}_{{.Replace}}{{end}}' all \
|
2021-12-02 23:20:27 +03:00
|
|
|
| stunning-tribble
|
2021-09-22 23:41:56 +03:00
|
|
|
# Checking the tools which also has go.mod
|
|
|
|
cd tools
|
|
|
|
go list -m -f '{{if not (or .Main)}}{{.Path}}@{{.Version}}_{{.Replace}}{{end}}' all \
|
2021-10-04 22:41:00 +03:00
|
|
|
| stunning-tribble
|
2021-09-22 23:41:56 +03:00
|
|
|
|
2021-06-10 23:24:33 +03:00
|
|
|
add-projects: ## Adds new projects to ./cron/data/projects.csv
|
|
|
|
add-projects: ./cron/data/projects.csv | build-add-script
|
|
|
|
# Add new projects to ./cron/data/projects.csv
|
2021-07-19 03:33:45 +03:00
|
|
|
./cron/data/add/add ./cron/data/projects.csv ./cron/data/projects.new.csv
|
2021-06-19 02:00:08 +03:00
|
|
|
mv ./cron/data/projects.new.csv ./cron/data/projects.csv
|
2021-06-10 23:24:33 +03:00
|
|
|
|
2021-06-03 00:27:09 +03:00
|
|
|
validate-projects: ## Validates ./cron/data/projects.csv
|
2021-06-10 23:24:33 +03:00
|
|
|
validate-projects: ./cron/data/projects.csv | build-validate-script
|
2021-06-03 00:27:09 +03:00
|
|
|
# Validate ./cron/data/projects.csv
|
2021-07-19 03:33:45 +03:00
|
|
|
./cron/data/validate/validate ./cron/data/projects.csv
|
2021-02-22 02:35:39 +03:00
|
|
|
|
2021-12-02 23:20:27 +03:00
|
|
|
tree-status: | all-targets-update-dependencies ## Verify tree is clean and all changes are committed
|
2021-05-15 23:58:01 +03:00
|
|
|
# Verify the tree is clean and all changes are commited
|
|
|
|
./scripts/tree-status
|
2021-05-17 22:20:28 +03:00
|
|
|
|
2021-05-15 23:58:01 +03:00
|
|
|
###############################################################################
|
|
|
|
|
2021-06-10 23:24:33 +03:00
|
|
|
################################## make build #################################
|
2021-10-21 23:08:56 +03:00
|
|
|
## Build all cron-related targets
|
2021-11-18 20:04:07 +03:00
|
|
|
build-cron: build-controller build-worker build-cii-worker \
|
|
|
|
build-shuffler build-bq-transfer build-github-server \
|
|
|
|
build-webhook build-add-script build-validate-script build-update-script
|
2021-10-21 23:08:56 +03:00
|
|
|
|
2022-02-15 19:31:08 +03:00
|
|
|
build-targets = generate-mocks generate-docs build-proto build-scorecard build-cron
|
2021-05-15 23:58:01 +03:00
|
|
|
.PHONY: build $(build-targets)
|
2021-09-04 18:39:10 +03:00
|
|
|
build: ## Build all binaries and images in the repo.
|
2021-05-15 23:58:01 +03:00
|
|
|
build: $(build-targets)
|
|
|
|
|
|
|
|
build-proto: ## Compiles and generates all required protobufs
|
2021-11-12 22:11:06 +03:00
|
|
|
build-proto: cron/data/request.pb.go cron/data/metadata.pb.go
|
2021-05-17 22:20:28 +03:00
|
|
|
cron/data/request.pb.go: cron/data/request.proto | $(PROTOC)
|
2021-05-15 23:58:01 +03:00
|
|
|
protoc --go_out=../../../ cron/data/request.proto
|
2021-08-06 21:07:42 +03:00
|
|
|
cron/data/metadata.pb.go: cron/data/metadata.proto | $(PROTOC)
|
|
|
|
protoc --go_out=../../../ cron/data/metadata.proto
|
2021-05-15 23:58:01 +03:00
|
|
|
|
2021-11-13 01:16:22 +03:00
|
|
|
generate-mocks: ## Compiles and generates all mocks using mockgen.
|
2022-01-03 04:43:38 +03:00
|
|
|
generate-mocks: clients/mockclients/repo_client.go clients/mockclients/repo.go clients/mockclients/cii_client.go checks/mockclients/vulnerabilities.go
|
2021-11-15 05:46:41 +03:00
|
|
|
clients/mockclients/repo_client.go: clients/repo_client.go
|
2021-11-13 01:16:22 +03:00
|
|
|
# Generating MockRepoClient
|
2021-11-15 05:46:41 +03:00
|
|
|
$(MOCKGEN) -source=clients/repo_client.go -destination=clients/mockclients/repo_client.go -package=mockrepo -copyright_file=clients/mockclients/license.txt
|
|
|
|
clients/mockclients/repo.go: clients/repo.go
|
|
|
|
# Generating MockRepo
|
|
|
|
$(MOCKGEN) -source=clients/repo.go -destination=clients/mockclients/repo.go -package=mockrepo -copyright_file=clients/mockclients/license.txt
|
|
|
|
clients/mockclients/cii_client.go: clients/cii_client.go
|
|
|
|
# Generating MockCIIClient
|
|
|
|
$(MOCKGEN) -source=clients/cii_client.go -destination=clients/mockclients/cii_client.go -package=mockrepo -copyright_file=clients/mockclients/license.txt
|
2022-01-03 04:43:38 +03:00
|
|
|
checks/mockclients/vulnerabilities.go: clients/vulnerabilities.go
|
|
|
|
# Generating MockCIIClient
|
|
|
|
$(MOCKGEN) -source=clients/vulnerabilities.go -destination=clients/mockclients/vulnerabilities.go -package=mockrepo -copyright_file=clients/mockclients/license.txt
|
2021-11-13 01:16:22 +03:00
|
|
|
|
2021-05-15 23:58:01 +03:00
|
|
|
generate-docs: ## Generates docs
|
2021-11-10 19:56:44 +03:00
|
|
|
generate-docs: validate-docs docs/checks.md
|
2021-09-10 01:09:39 +03:00
|
|
|
docs/checks.md: docs/checks/internal/checks.yaml docs/checks/internal/*.go docs/checks/internal/generate/*.go
|
2021-05-15 23:58:01 +03:00
|
|
|
# Generating checks.md
|
2021-09-10 18:26:27 +03:00
|
|
|
go run ./docs/checks/internal/generate/main.go docs/checks.md
|
2021-05-15 23:58:01 +03:00
|
|
|
|
2021-11-10 19:56:44 +03:00
|
|
|
validate-docs: docs/checks/internal/generate/main.go
|
|
|
|
# Validating checks.yaml
|
|
|
|
go run ./docs/checks/internal/validate/main.go
|
|
|
|
|
2021-05-15 23:58:01 +03:00
|
|
|
build-scorecard: ## Runs go build on repo
|
|
|
|
# Run go build and generate scorecard executable
|
2021-09-29 01:02:58 +03:00
|
|
|
CGO_ENABLED=0 go build -trimpath -a -tags netgo -ldflags '$(LDFLAGS)'
|
2020-12-23 00:43:24 +03:00
|
|
|
|
2021-11-23 19:56:21 +03:00
|
|
|
build-releaser: ## Runs goreleaser on the repo
|
|
|
|
# Run go releaser on the Scorecard repo
|
|
|
|
$(GORELEASER) check
|
|
|
|
VERSION_LDFLAGS="$(LDFLAGS)" $(GORELEASER) release --snapshot --rm-dist --skip-publish --skip-sign
|
|
|
|
|
2021-11-18 20:04:07 +03:00
|
|
|
build-controller: ## Runs go build on the cron PubSub controller
|
|
|
|
# Run go build on the cron PubSub controller
|
2021-09-29 01:02:58 +03:00
|
|
|
cd cron/controller && CGO_ENABLED=0 go build -trimpath -a -ldflags '$(LDFLAGS)' -o controller
|
2021-11-18 20:04:07 +03:00
|
|
|
|
|
|
|
build-worker: ## Runs go build on the cron PubSub worker
|
|
|
|
# Run go build on the cron PubSub worker
|
2021-09-29 01:02:58 +03:00
|
|
|
cd cron/worker && CGO_ENABLED=0 go build -trimpath -a -ldflags '$(LDFLAGS)' -o worker
|
2021-05-19 01:18:08 +03:00
|
|
|
|
2021-11-16 07:23:00 +03:00
|
|
|
build-cii-worker: ## Runs go build on the CII worker
|
|
|
|
# Run go build on the CII worker
|
|
|
|
cd cron/cii && CGO_ENABLED=0 go build -trimpath -a -ldflags '$(LDFLAGS)' -o cii-worker
|
|
|
|
|
2021-11-18 20:04:07 +03:00
|
|
|
build-shuffler: ## Runs go build on the cron shuffle script
|
|
|
|
# Run go build on the cron shuffle script
|
|
|
|
cd cron/shuffle && CGO_ENABLED=0 go build -trimpath -a -ldflags '$(LDFLAGS)' -o shuffle
|
|
|
|
|
2021-06-15 02:25:32 +03:00
|
|
|
build-bq-transfer: ## Runs go build on the BQ transfer cron job
|
|
|
|
build-bq-transfer: ./cron/bq/*.go
|
|
|
|
# Run go build on the Copier cron job
|
2021-09-29 01:02:58 +03:00
|
|
|
cd cron/bq && CGO_ENABLED=0 go build -trimpath -a -ldflags '$(LDFLAGS)' -o data-transfer
|
2021-06-15 02:25:32 +03:00
|
|
|
|
2021-10-15 06:03:51 +03:00
|
|
|
build-github-server: ## Runs go build on the GitHub auth server
|
|
|
|
build-github-server: ./clients/githubrepo/roundtripper/tokens/*
|
|
|
|
# Run go build on the GitHub auth server
|
|
|
|
cd clients/githubrepo/roundtripper/tokens/server && \
|
|
|
|
CGO_ENABLED=0 go build -trimpath -a -ldflags '$(LDFLAGS)' -o github-auth-server
|
|
|
|
|
2021-08-11 04:45:01 +03:00
|
|
|
build-webhook: ## Runs go build on the cron webhook
|
|
|
|
# Run go build on the cron webhook
|
2021-09-29 01:02:58 +03:00
|
|
|
cd cron/webhook && CGO_ENABLED=0 go build -trimpath -a -ldflags '$(LDFLAGS)' -o webhook
|
2021-08-11 04:45:01 +03:00
|
|
|
|
2021-06-10 23:24:33 +03:00
|
|
|
build-add-script: ## Runs go build on the add script
|
|
|
|
build-add-script: cron/data/add/add
|
2021-10-29 19:07:46 +03:00
|
|
|
cron/data/add/add: cron/data/add/*.go cron/data/*.go cron/data/projects.csv
|
2021-06-10 23:24:33 +03:00
|
|
|
# Run go build on the add script
|
2021-09-29 01:02:58 +03:00
|
|
|
cd cron/data/add && CGO_ENABLED=0 go build -trimpath -a -ldflags '$(LDFLAGS)' -o add
|
2021-06-10 23:24:33 +03:00
|
|
|
|
2021-06-09 02:55:43 +03:00
|
|
|
build-validate-script: ## Runs go build on the validate script
|
|
|
|
build-validate-script: cron/data/validate/validate
|
2021-06-19 02:00:08 +03:00
|
|
|
cron/data/validate/validate: cron/data/validate/*.go cron/data/*.go cron/data/projects.csv
|
2021-06-09 02:55:43 +03:00
|
|
|
# Run go build on the validate script
|
2021-09-29 01:02:58 +03:00
|
|
|
cd cron/data/validate && CGO_ENABLED=0 go build -trimpath -a -ldflags '$(LDFLAGS)' -o validate
|
2021-06-09 02:55:43 +03:00
|
|
|
|
|
|
|
build-update-script: ## Runs go build on the update script
|
|
|
|
build-update-script: cron/data/update/projects-update
|
|
|
|
cron/data/update/projects-update: cron/data/update/*.go cron/data/*.go
|
|
|
|
# Run go build on the update script
|
2021-09-29 01:02:58 +03:00
|
|
|
cd cron/data/update && CGO_ENABLED=0 go build -trimpath -a -tags netgo -ldflags '$(LDFLAGS)' -o projects-update
|
2020-12-23 00:43:24 +03:00
|
|
|
|
2021-12-02 23:20:27 +03:00
|
|
|
ko-targets = scorecard-ko cron-controller-ko cron-worker-ko cron-cii-worker-ko cron-bq-transfer-ko cron-webhook-ko cron-github-server-ko
|
|
|
|
.PHONY: ko-build-everything $(ko-targets)
|
|
|
|
ko-build-everything: $(ko-targets)
|
|
|
|
|
|
|
|
scorecard-ko:
|
2022-02-18 23:27:24 +03:00
|
|
|
$(call create_kocache_path)
|
2021-12-15 19:35:07 +03:00
|
|
|
KO_DATA_DATE_EPOCH=$(SOURCE_DATE_EPOCH) KO_DOCKER_REPO=${KO_PREFIX}/scorecard LDFLAGS="$(LDFLAGS)" \
|
2022-02-18 23:27:24 +03:00
|
|
|
KO_CACHE=$(KOCACHE_PATH) ko build -B \
|
2021-11-08 18:55:58 +03:00
|
|
|
--push=false \
|
2022-02-18 23:27:24 +03:00
|
|
|
--sbom=none \
|
2021-12-15 19:35:07 +03:00
|
|
|
--platform=$(PLATFORM)\
|
2022-01-12 22:49:01 +03:00
|
|
|
--tags latest,$(GIT_VERSION),$(GIT_HASH) github.com/ossf/scorecard/v4
|
2021-12-02 23:20:27 +03:00
|
|
|
cron-controller-ko:
|
2022-02-18 23:27:24 +03:00
|
|
|
$(call_create_kocache_path)
|
2021-12-15 19:35:07 +03:00
|
|
|
KO_DATA_DATE_EPOCH=$(SOURCE_DATE_EPOCH) KO_DOCKER_REPO=${KO_PREFIX}/$(IMAGE_NAME)-batch-controller LDFLAGS="$(LDFLAGS)" \
|
2022-02-18 23:27:24 +03:00
|
|
|
KOCACHE=$(KOCACHE_PATH) ko build -B \
|
2021-11-08 18:55:58 +03:00
|
|
|
--push=false \
|
2022-02-18 23:27:24 +03:00
|
|
|
--sbom=none \
|
2021-12-15 19:35:07 +03:00
|
|
|
--platform=$(PLATFORM)\
|
2022-01-12 22:49:01 +03:00
|
|
|
--tags latest,$(GIT_VERSION),$(GIT_HASH) github.com/ossf/scorecard/v4/cron/controller
|
2021-12-02 23:20:27 +03:00
|
|
|
cron-worker-ko:
|
2022-02-18 23:27:24 +03:00
|
|
|
$(call_create_kocache_path)
|
2021-12-15 19:35:07 +03:00
|
|
|
KO_DATA_DATE_EPOCH=$(SOURCE_DATE_EPOCH) KO_DOCKER_REPO=${KO_PREFIX}/$(IMAGE_NAME)-batch-worker LDFLAGS="$(LDFLAGS)" \
|
2022-02-18 23:27:24 +03:00
|
|
|
KOCACHE=$(KOCACHE_PATH) ko build -B \
|
2021-11-08 18:55:58 +03:00
|
|
|
--push=false \
|
2022-02-18 23:27:24 +03:00
|
|
|
--sbom=none \
|
2021-12-15 19:35:07 +03:00
|
|
|
--platform=$(PLATFORM)\
|
2022-01-12 22:49:01 +03:00
|
|
|
--tags latest,$(GIT_VERSION),$(GIT_HASH) github.com/ossf/scorecard/v4/cron/worker
|
2021-12-02 23:20:27 +03:00
|
|
|
cron-cii-worker-ko:
|
2022-02-18 23:27:24 +03:00
|
|
|
$(call_create_kocache_path)
|
2021-12-15 19:35:07 +03:00
|
|
|
KO_DATA_DATE_EPOCH=$(SOURCE_DATE_EPOCH) KO_DOCKER_REPO=${KO_PREFIX}/$(IMAGE_NAME)-cii-worker LDFLAGS="$(LDFLAGS)" \
|
2022-02-18 23:27:24 +03:00
|
|
|
KOCACHE=$(KOCACHE_PATH) ko build -B \
|
2021-11-16 07:23:00 +03:00
|
|
|
--push=false \
|
2022-02-18 23:27:24 +03:00
|
|
|
--sbom=none \
|
2021-12-15 19:35:07 +03:00
|
|
|
--platform=$(PLATFORM)\
|
2022-01-12 22:49:01 +03:00
|
|
|
--tags latest,$(GIT_VERSION),$(GIT_HASH) github.com/ossf/scorecard/v4/cron/cii
|
2021-12-02 23:20:27 +03:00
|
|
|
cron-bq-transfer-ko:
|
2022-02-18 23:27:24 +03:00
|
|
|
$(call_create_kocache_path)
|
2021-12-15 19:35:07 +03:00
|
|
|
KO_DATA_DATE_EPOCH=$(SOURCE_DATE_EPOCH) KO_DOCKER_REPO=${KO_PREFIX}/$(IMAGE_NAME)-bq-transfer LDFLAGS="$(LDFLAGS)" \
|
2022-02-18 23:27:24 +03:00
|
|
|
KOCACHE=$(KOCACHE_PATH) ko build -B \
|
2021-11-08 18:55:58 +03:00
|
|
|
--push=false \
|
2022-02-18 23:27:24 +03:00
|
|
|
--sbom=none \
|
2021-12-15 19:35:07 +03:00
|
|
|
--platform=$(PLATFORM)\
|
2022-01-12 22:49:01 +03:00
|
|
|
--tags latest,$(GIT_VERSION),$(GIT_HASH) github.com/ossf/scorecard/v4/cron/bq
|
2021-12-02 23:20:27 +03:00
|
|
|
cron-webhook-ko:
|
2022-02-18 23:27:24 +03:00
|
|
|
$(call_create_kocache_path)
|
2021-12-15 19:35:07 +03:00
|
|
|
KO_DATA_DATE_EPOCH=$(SOURCE_DATE_EPOCH) KO_DOCKER_REPO=${KO_PREFIX}/$(IMAGE_NAME)-cron-webhook LDFLAGS="$(LDFLAGS)" \
|
2022-02-18 23:27:24 +03:00
|
|
|
KOCACHE=$(KOCACHE_PATH) ko build -B \
|
2021-11-08 18:55:58 +03:00
|
|
|
--push=false \
|
2022-02-18 23:27:24 +03:00
|
|
|
--sbom=none \
|
2021-12-15 19:35:07 +03:00
|
|
|
--platform=$(PLATFORM)\
|
2022-01-12 22:49:01 +03:00
|
|
|
--tags latest,$(GIT_VERSION),$(GIT_HASH) github.com/ossf/scorecard/v4/cron/webhook
|
2021-12-02 23:20:27 +03:00
|
|
|
cron-github-server-ko:
|
2022-02-18 23:27:24 +03:00
|
|
|
$(call_create_kocache_path)
|
2021-12-15 19:35:07 +03:00
|
|
|
KO_DATA_DATE_EPOCH=$(SOURCE_DATE_EPOCH) KO_DOCKER_REPO=${KO_PREFIX}/$(IMAGE_NAME)-github-server LDFLAGS="$(LDFLAGS)" \
|
2022-02-18 23:27:24 +03:00
|
|
|
KOCACHE=$(KOCACHE_PATH) ko build -B \
|
2021-11-08 18:55:58 +03:00
|
|
|
--push=false \
|
2022-02-18 23:27:24 +03:00
|
|
|
--sbom=none \
|
2021-12-15 19:35:07 +03:00
|
|
|
--platform=$(PLATFORM)\
|
2022-01-12 22:49:01 +03:00
|
|
|
--tags latest,$(GIT_VERSION),$(GIT_HASH) github.com/ossf/scorecard/v4/clients/githubrepo/roundtripper/tokens/server
|
2021-12-02 23:20:27 +03:00
|
|
|
|
|
|
|
docker-targets = scorecard-docker cron-controller-docker cron-worker-docker cron-cii-worker-docker cron-bq-transfer-docker cron-webhook-docker cron-github-server-docker
|
|
|
|
.PHONY: dockerbuild $(docker-targets)
|
|
|
|
dockerbuild: $(docker-targets)
|
|
|
|
|
|
|
|
scorecard-docker:
|
2021-05-15 23:58:01 +03:00
|
|
|
DOCKER_BUILDKIT=1 docker build . --file Dockerfile --tag $(IMAGE_NAME)
|
2021-12-02 23:20:27 +03:00
|
|
|
cron-controller-docker:
|
2021-09-27 22:42:39 +03:00
|
|
|
DOCKER_BUILDKIT=1 docker build . --file cron/controller/Dockerfile --tag $(IMAGE_NAME)-batch-controller
|
2021-12-02 23:20:27 +03:00
|
|
|
cron-worker-docker:
|
2021-09-27 22:42:39 +03:00
|
|
|
DOCKER_BUILDKIT=1 docker build . --file cron/worker/Dockerfile --tag $(IMAGE_NAME)-batch-worker
|
2021-12-02 23:20:27 +03:00
|
|
|
cron-cii-worker-docker:
|
2021-11-16 07:23:00 +03:00
|
|
|
DOCKER_BUILDKIT=1 docker build . --file cron/cii/Dockerfile --tag $(IMAGE_NAME)-cii-worker
|
2021-12-02 23:20:27 +03:00
|
|
|
cron-bq-transfer-docker:
|
2021-06-15 02:25:32 +03:00
|
|
|
DOCKER_BUILDKIT=1 docker build . --file cron/bq/Dockerfile --tag $(IMAGE_NAME)-bq-transfer
|
2021-12-02 23:20:27 +03:00
|
|
|
cron-webhook-docker:
|
2021-08-11 04:45:01 +03:00
|
|
|
DOCKER_BUILDKIT=1 docker build . --file cron/webhook/Dockerfile --tag ${IMAGE_NAME}-webhook
|
2021-12-02 23:20:27 +03:00
|
|
|
cron-github-server-docker:
|
2021-10-15 06:03:51 +03:00
|
|
|
DOCKER_BUILDKIT=1 docker build . --file clients/githubrepo/roundtripper/tokens/server/Dockerfile --tag ${IMAGE_NAME}-github-server
|
2021-05-15 23:58:01 +03:00
|
|
|
###############################################################################
|
2020-12-23 00:43:24 +03:00
|
|
|
|
2022-01-31 05:23:40 +03:00
|
|
|
##@ Tests
|
2021-05-15 23:58:01 +03:00
|
|
|
################################# make test ###################################
|
2021-09-27 22:42:39 +03:00
|
|
|
test-targets = unit-test e2e ci-e2e
|
2021-05-15 23:58:01 +03:00
|
|
|
.PHONY: test $(test-targets)
|
|
|
|
test: $(test-targets)
|
2020-12-23 00:43:24 +03:00
|
|
|
|
2021-05-15 23:58:01 +03:00
|
|
|
unit-test: ## Runs unit test without e2e
|
|
|
|
# Run unit tests, ignoring e2e tests
|
2022-01-20 00:52:45 +03:00
|
|
|
# run the go tests and gen the file coverage-all used to do the integration with codecov
|
2022-02-16 02:38:23 +03:00
|
|
|
SKIP_GINKGO=1 go test -race -covermode=atomic -coverprofile=unit-coverage.out `go list ./...`
|
2021-02-13 00:54:06 +03:00
|
|
|
|
2021-05-17 22:20:28 +03:00
|
|
|
$(GINKGO): install
|
|
|
|
|
2021-05-15 23:58:01 +03:00
|
|
|
check-env:
|
|
|
|
ifndef GITHUB_AUTH_TOKEN
|
|
|
|
$(error GITHUB_AUTH_TOKEN is undefined)
|
|
|
|
endif
|
2022-02-15 22:27:45 +03:00
|
|
|
|
|
|
|
e2e: ## Runs e2e tests. Requires GITHUB_AUTH_TOKEN env var to be set to GitHub personal access token
|
|
|
|
e2e: build-scorecard check-env | $(GINKGO)
|
|
|
|
# Run e2e tests. GITHUB_AUTH_TOKEN with personal access token must be exported to run this
|
|
|
|
$(GINKGO) --race -p -v -cover -coverprofile=e2e-coverage.out ./...
|
2021-05-15 23:58:01 +03:00
|
|
|
###############################################################################
|