Skip to content

update-fluidstack-catalog #1512

update-fluidstack-catalog

update-fluidstack-catalog #1512

name: "update-fluidstack-catalog"
on:
schedule:
- cron: "00 */7 * * *" # Every 7 hours (coprimes with 24)
# The frequency can be tuned for the trade-off between
# freshness of the price and github action cost/user downloading
# overhead of the update.
workflow_dispatch:
jobs:
update_fluidstack_catalog:
runs-on: ubuntu-latest
steps:
- name: Clone SkyPilot repo
uses: actions/checkout@v4
with:
fetch-depth: 0
repository: skypilot-org/skypilot
path: sky
- name: Clone Catalog repo
uses: actions/checkout@v4
with:
fetch-depth: 0
path: catalogs
token: ${{ secrets.GH_ACTION_PAT }}
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
python-version: "3.10"
- name: Install dependencies
run: |
uv venv --seed ~/catalogs-venv
source ~/catalogs-venv/bin/activate
cd sky
uv pip install ".[fluidstack]"
- name: Run fetch_fluidstack
id: fetch_catalogs
run: |
source ~/catalogs-venv/bin/activate
versions=$(cat catalogs/.metadata.yml | yq -r '.version_commit | keys[]')
for version in $versions; do
commit_hash=$(cat catalogs/.metadata.yml | yq -r ".version_commit.$version")
cd sky
if [ "$commit_hash" == "latest" ]; then
commit_hash=$(git rev-parse origin/master)
fi
git checkout $commit_hash
uv pip install ".[fluidstack]"
cd -
mkdir -p catalogs/catalogs/$version
cd catalogs/catalogs/$version
mkdir -p ~/.fluidstack
echo "$FLUIDSTACK_API_KEY" > ~/.fluidstack/api_key
python -m sky.clouds.service_catalog.data_fetchers.fetch_fluidstack
cd -
done
env:
FLUIDSTACK_API_KEY: ${{ secrets.FLUIDSTACK_API_KEY }}
- name: Commit catalog
run: |
versions=$(cat catalogs/.metadata.yml | yq -r '.version_commit | keys[]' | tr '\n' ', ')
cd catalogs
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add .
git commit -m"[Bot] Update FluidStack catalog $versions (scheduled at $(date))" || { echo "No changes to commit" && exit 0; }
git fetch origin
git rebase origin/master
git push