diff --git a/.gitea/workflows/update.yml b/.gitea/workflows/update.yml index 6c94611..4fe00f8 100644 --- a/.gitea/workflows/update.yml +++ b/.gitea/workflows/update.yml @@ -23,6 +23,17 @@ jobs: env: CI_RUNNER_TOKEN: ${{ secrets.CI_RUNNER_TOKEN }} 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 "{}") if [ "$MANIFEST" == "{}" ]; then echo "digest_found=false" >> $GITHUB_OUTPUT @@ -38,7 +49,7 @@ jobs: fi # Get the manifest for the specific platform 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 "{}") if [ "$PLATFORM_MANIFEST" == "{}" ]; then echo "digest_found=false" >> $GITHUB_OUTPUT