forked from LayerTwo-Labs/signet-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
55 lines (42 loc) · 1.72 KB
/
justfile
File metadata and controls
55 lines (42 loc) · 1.72 KB
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
compose-forknet *args="":
docker --context l2l-forknet compose \
--profile forknet \
-f docker-compose.yml \
-f docker-compose.forknet.yml {{ args }}
get-latest-image service:
#! /usr/bin/env bash
if ! which uv > /dev/null; then
echo "uv is not installed"
exit 1
fi
if ! which gh > /dev/null; then
echo "gh (GitHub CLI) is not installed"
exit 1
fi
all_services=$(uv tool run yq -r '.services | keys[]' docker-compose.yml )
if ! echo "$all_services" | grep -q "{{ service }}"; then
echo "service '{{ service }}' not found"
exit 1
fi
image=$(uv tool run yq -r '.services["{{ service }}"].image' docker-compose.yml)
# if it is not a ghcr.io image, exit
if ! [[ "$image" == ghcr.io/* ]]; then
echo "❌ Only GitHub Container Registry (ghcr.io) images are supported"
echo "This image is from a different registry and cannot be checked automatically"
exit 1
fi
# Extract repository name from image
repo=$(echo "$image" | cut -d':' -f1)
# Get the package name (last part after /)
package=$(echo "$repo" | sed 's/.*\///')
# Get the org/user (part between ghcr.io/ and last /)
org=$(echo "$repo" | sed 's/ghcr.io\///' | sed 's/\/[^\/]*$//')
# Fetch the sha tag of the "latest" tag
tag=$(gh api \
"orgs/$org/packages/container/$package/versions?state=active&per_page=10" | \
jq -r '.[] | select(.metadata.container.tags | contains(["latest"])) | .metadata.container.tags[] | select(startswith("sha-"))')
if [ -z "$tag" ]; then
echo "❌ No sha tag found for the 'latest' tag"
exit 1
fi
echo "$tag"