This repository has been archived by the owner on Mar 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
120 lines (101 loc) · 3.49 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# Copyright 2023 VMware, Inc.
#
# This product is licensed to you under the BSD-2 license (the "License").
# You may not use this product except in compliance with the BSD-2 License.
# This product may include a number of subcomponents with separate copyright
# notices and license terms. Your use of these subcomponents is subject to
# the terms and conditions of the subcomponent's license, as noted in the
# LICENSE file.
#
# SPDX-License-Identifier: BSD-2-Clause
# We want to use bash
SHELL:=/bin/bash
# Set environment variables
CLIS:=tuf-client # tuf
# Default target
.PHONY: default
default: build
#####################
# build section
#####################
# Build
.PHONY: build
build: $(addprefix build-, $(CLIS))
# Target for building a Go binary
.PHONY: build-%
build-%:
@echo "Building $*"
@go build -o $* examples/cli/$*/main.go
#####################
# test section
#####################
# Test target
.PHONY: test
test:
go test -race -covermode atomic ./...
#####################
# lint section
#####################
.PHONY: lint
lint:
golangci-lint run
.PHONY: fmt
fmt:
go fmt ./...
#####################
# examples section
#####################
# Target for running all examples
.PHONY: example-all
example-all: example-client example-repository example-multirepo example-tuf-client-cli example-root-signing
# Target for demoing the examples/client/client_example.go
.PHONY: example-client
example-client:
@echo "Executing the following example - client/client_example.go"
@cd examples/client/ && go run .
# Target for demoing the examples/repository/basic_repository.go
.PHONY: example-repository
example-repository:
@echo "Executing the following example - repository/basic_repository.go"
@cd examples/repository/ && go run .
# Target for demoing the examples/multirepo/client/client_example.go
.PHONY: example-multirepo
example-multirepo:
@echo "Executing the following example - multirepo/client/client_example.go"
@cd examples/multirepo/client/ && go run .
# Target for demoing the tuf-client cli
.PHONY: example-tuf-client-cli
example-tuf-client-cli: build-tuf-client
@echo "Clearing any leftover artifacts..."
./tuf-client reset --force
@echo "Initializing the following https://jku.github.io/tuf-demo/ TUF repository"
@sleep 2
./tuf-client init --url https://jku.github.io/tuf-demo/metadata
@echo "Downloading the following target file - rdimitrov/artifact-example.md"
@sleep 2
./tuf-client get --url https://jku.github.io/tuf-demo/metadata --turl https://jku.github.io/tuf-demo/targets rdimitrov/artifact-example.md
# Target for demoing the tuf-client cli with root-signing repo
.PHONY: example-root-signing
example-root-signing: build-tuf-client
@echo "Clearing any leftover artifacts..."
./tuf-client reset --force
@echo "Downloading the initial root of trust"
@curl -L "https://tuf-repo-cdn.sigstore.dev/5.root.json" > root.json
@echo "Initializing the following https://tuf-repo-cdn.sigstore.dev TUF repository"
@sleep 2
./tuf-client init --url https://tuf-repo-cdn.sigstore.dev --file root.json
@echo "Downloading the following target file - rekor.pub"
@sleep 2
./tuf-client get --url https://tuf-repo-cdn.sigstore.dev --turl https://tuf-repo-cdn.sigstore.dev/targets rekor.pub
# Clean target
.PHONY: clean
clean:
@rm -rf examples/multirepo/client/bootstrap/
@rm -rf examples/multirepo/client/download/
@rm -rf examples/multirepo/client/metadata/
@rm -rf examples/repository/tmp*
@rm -rf examples/client/tmp*
@rm -rf tuf_download
@rm -rf tuf_metadata
@rm -f tuf-client
@rm -f root.json