forked from paritytech/srtool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
justfile
80 lines (66 loc) · 2.49 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
69
70
71
72
73
74
75
76
77
78
79
80
set positional-arguments
export RUSTC_VERSION:=`cat RUSTC_VERSION`
export REGISTRY:="docker.io"
export REPO:="paritytech/srtool"
export TAG:=`cat VERSION`
export COMMIT:=`git rev-parse --short HEAD`
_default:
@just --choose --chooser "fzf +s -x --tac --cycle"
# Runs a system prune to ensure we have the resources to build the image
cleanup:
podman system prune -f
# Build the container image
build:
@echo Building $REPO:$RUSTC_VERSION
@echo If you encounter issues, try running `just cleanup` and try building again.
@echo Any arg you pass is forward to 'podman build'... You can pass'`--no-cache' for instance
$ENGINE build $@ --build-arg RUSTC_VERSION=$RUSTC_VERSION \
-t $REGISTRY/chevdor/srtool:$RUSTC_VERSION-$TAG-$COMMIT \
-t $REGISTRY/$REPO:$RUSTC_VERSION-$TAG \
-t $REGISTRY/$REPO \
-t $REGISTRY/${REPO#*/} \
.
$ENGINE images | grep srtool
# Build and Publish the container image
publish: build
@echo Pushing podman image $REPO:$RUSTC_VERSION
$ENGINE push $REGISTRY/$REPO:$RUSTC_VERSION
# Set a git tag
tag:
@echo Tagging v$TAG
@git tag v$TAG -f
@git tag | sort --version-sort -r | head
# Push git tag
tag_push:
@echo Pushing tag v$TAG
@git push origin v$TAG -f
# Generate the readme as .md
md:
asciidoctor -b docbook -a leveloffset=+1 -o - README_src.adoc | pandoc --markdown-headings=atx --wrap=preserve -t markdown_strict -f docbook - > README.md
# Show version
info:
@echo RUSTC_VERSION=$RUSTC_VERSION
@echo REPO=$REPO
@echo TAG=$TAG
# Quick test
test_quick *args='':
container-structure-test test --image $REPO:$RUSTC_VERSION-$TAG --config tests/quick.yaml --verbosity debug "$@"
# Test ACL
test_acl *args='':
container-structure-test test --image $REPO:$RUSTC_VERSION-$TAG --config tests/acl.yaml --verbosity debug "$@"
# Container test that takes longer
test_long *args='':
container-structure-test test --image $REPO:$RUSTC_VERSION-$TAG --config tests/long.yaml --verbosity debug "$@"
# Test commands
test_commands *args='':
container-structure-test test --image $REPO:$RUSTC_VERSION-$TAG --config tests/commands.yaml --verbosity debug "$@"
# Test all
test_all:
#!/usr/bin/env bash
TESTS=$(find tests -type f | sed -e 's/^/ --config /g' | tr -d '\n')
container-structure-test test --image srtool --verbosity info ${TESTS}
# Scan the srtool image for vuln
scan:
#!/usr/bin/env bash
echo "scanning $REPO:$RUSTC_VERSION-$TAG"
trivy image $REPO:$RUSTC_VERSION-$TAG