Chainguard command line tools
Chainctl
Find if an image is available using fuzzy search
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
function cgr-find {
if [ "${1}" = "-h" ]; then
echo "Usage: chainguard-search [image]"
echo "Search for an image by name with fzf."
return
fi
if [ "${1}" = "" ]; then
echo "Image name required."
return
fi
# set orgs
local privateorg="chainguard-private" # edit to your private registry
# private images
echo "---- private images ----"
chainctl img repos list --parent $privateorg -o json |\
jq -r '.items[].name' |\
fzf --filter="${1}" |\
sort
# public images
echo "---- public images ----"
chainctl img repos list --public -o json |\
jq -r '.items[].name' |\
fzf --filter="${1}" |\
sort
}
Get the Chainguard group ID of a given domain
1
2
3
4
5
6
7
8
9
10
11
12
13
14
function chainctl-id {
if [ "${1}" = "-h" ]; then
echo "Usage: chainctl-id [domain]"
echo "Get the Chainguard group ID of a given domain."
return
fi
if [ "${1}" = "" ]; then
echo "Domain name required."
return
fi
echo "Getting group ID for domain ${1} ..."
chainctl iam organizations list -o json |\
jq '.items[] | select(.name == '\"${1}\"') | .id'
}
This post is licensed under CC BY 4.0 by the author.