Skip to content

[WIP] chore: add schedule workflow to repush for push failed images. #286

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions scripts/repush_not_exist.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

# Traverse the k8s directory under kcl-artifacthub
find $(pwd) -mindepth 1 -maxdepth 2 -type d | while read -r dir; do
# Check if the .mod file exists in the current directory
if [ -f "$dir/kcl.mod" ]; then
echo "Contents of $dir/kcl.mod:"

# Extract and print the 'name' field
name=$(grep -m 1 '^name' "$dir/kcl.mod" | awk -F '=' '{print $2}' | xargs)
# Extract and print the 'version' field
version=$(grep -m 1 '^version' "$dir/kcl.mod" | awk -F '=' '{print $2}' | xargs)

IMAGE_EXIST=`oras manifest fetch ghcr.io/kcl-lang/$name:$version | grep mediaType | wc -l `
if [ $IMAGE_EXIST -eq 1 ]; then
echo ""
else
echo "$name:$version is not exist!"
./scripts/push_pkg_from.sh $dir/kcl.mod
fi
fi
done