added step to get registry token
This commit is contained in:
@@ -23,6 +23,17 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
CI_RUNNER_TOKEN: ${{ secrets.CI_RUNNER_TOKEN }}
|
CI_RUNNER_TOKEN: ${{ secrets.CI_RUNNER_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
|
# Get a bearer token for authentication
|
||||||
|
REGISTRY_TOKEN=$(curl -s -X GET \
|
||||||
|
-u "${{ gitea.actor }}:${{ secrets.CI_RUNNER_TOKEN }}" \
|
||||||
|
"https://gitea.gt-proj.com/v2/token?service=container_registry&scope=repository:brian/mlflow-full:pull" \
|
||||||
|
| jq -r '.token // empty')
|
||||||
|
if [ -z "$REGISTRY_TOKEN" ]; then
|
||||||
|
echo "digest_found=false" >> $GITHUB_OUTPUT
|
||||||
|
echo "Failed to obtain registry token"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
# Inspect the manifest of the MLflow-full image
|
||||||
MANIFEST=$(docker manifest inspect "gitea.gt-proj.com/brian/mlflow-full:latest" 2>/dev/null || echo "{}")
|
MANIFEST=$(docker manifest inspect "gitea.gt-proj.com/brian/mlflow-full:latest" 2>/dev/null || echo "{}")
|
||||||
if [ "$MANIFEST" == "{}" ]; then
|
if [ "$MANIFEST" == "{}" ]; then
|
||||||
echo "digest_found=false" >> $GITHUB_OUTPUT
|
echo "digest_found=false" >> $GITHUB_OUTPUT
|
||||||
@@ -38,7 +49,7 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
# Get the manifest for the specific platform
|
# Get the manifest for the specific platform
|
||||||
PLATFORM_MANIFEST=$(curl -s -H "Accept: application/vnd.docker.distribution.manifest.v2+json" \
|
PLATFORM_MANIFEST=$(curl -s -H "Accept: application/vnd.docker.distribution.manifest.v2+json" \
|
||||||
-H "Authorization: Bearer $CI_RUNNER_TOKEN" \
|
-H "Authorization: Bearer $REGISTRY_TOKEN" \
|
||||||
"https://gitea.gt-proj.com/v2/brian/mlflow-full/manifests/$DIGEST" 2>/dev/null || echo "{}")
|
"https://gitea.gt-proj.com/v2/brian/mlflow-full/manifests/$DIGEST" 2>/dev/null || echo "{}")
|
||||||
if [ "$PLATFORM_MANIFEST" == "{}" ]; then
|
if [ "$PLATFORM_MANIFEST" == "{}" ]; then
|
||||||
echo "digest_found=false" >> $GITHUB_OUTPUT
|
echo "digest_found=false" >> $GITHUB_OUTPUT
|
||||||
|
|||||||
Reference in New Issue
Block a user