-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.justfile
68 lines (56 loc) · 1.57 KB
/
.justfile
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
set positional-arguments
mrconfig := justfile_directory() / ".mrconfig"
export GOBIN := justfile_directory() / "bin"
_default:
just --list
# Setup the repos. 𝟏 Run this first!
setup: && fetch
grep -q '{{mrconfig}}' ~/.mrtrust || echo '{{mrconfig}}' >> ~/.mrtrust
mr checkout
mkdir -p {{GOBIN}}
# Fetch all repos' remotes.
fetch:
mr -q fetch
# Update all repos to origin/main.
update:
mr -q run git reset --hard origin/main
# Build the commands in ./clair/cmd/ with any specified REFS. 𝟐 Then, build the commands.
build *REFS: fetch update && gobuild
#!/bin/sh
set -e
for arg in {{REFS}}; do
just checkout "$arg"
done
[private]
checkout $ARG:
#!/bin/sh
set -e
: "${ARG:?Missing argument}"
repo="${ARG%%:*}"
ref="${ARG#*:}"
git -C "${repo}" fetch --all
printf '%s: ' "${repo}"
git -C "${repo}" reset --hard "${ref}"
[private]
gobuild +pkg="github.com/quay/clair/v4/cmd/...":
go work sync
go install -trimpath {{pkg}}
# Test all modules with any specified REFS. 𝟑 Then, run all the tests.
test *REFS: fetch update && gotest
#!/bin/sh
set -e
for arg in "$@"; do
just _checkout "$arg"
done
[private]
gotest *$pkgs:
go test ${pkgs:-$(go list -m | sed 's,$,/...,')}
# Add a remote at URL to REPO, with the name NAME if supplied.
add-remote REPO URL *$NAME: && fetch
@echo git -C './{{REPO}}' remote add "${NAME:-$(basename $(dirname '{{URL}}'))}" '{{URL}}'
export CLAIR_CONF := "./etc/clair/config.yaml"
# Run `clairctl` with provided arguments, building if necesarry.
[no-exit-message]
clairctl *args="help":
test -e bin/clairctl || just build
./bin/clairctl "$@"