Skip to content

Commit

Permalink
Pin Python version in GitHub Actions for osquery version updater, use…
Browse files Browse the repository at this point in the history
… Python HTTP client directly to avoid needing to figure out how to pin requests lib (#24861)

For #24274. Skipping changes file since this is an internal tool.

# Checklist for submitter
- [x] Manual QA for all new/changed functionality
  • Loading branch information
iansltx authored Dec 18, 2024
1 parent 61038bf commit 11c316e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
12 changes: 9 additions & 3 deletions .github/scripts/update_osquery_versions.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
import os
import requests
import re
import json
import http.client

# Use GITHUB_WORKSPACE to get the root of your repository
repo_root = os.environ.get('GITHUB_WORKSPACE', '')
FILE_PATH = os.path.join(repo_root, 'frontend', 'utilities', 'constants.tsx')


def fetch_osquery_versions():
response = requests.get('https://api.github.com/repos/osquery/osquery/releases')
releases = response.json()
conn = http.client.HTTPSConnection('api.github.com')
conn.request('GET', '/repos/osquery/osquery/releases', headers={"User-Agent": "Fleet/osquery-checker"})
resp = conn.getresponse()
content = resp.read()
conn.close()
releases = json.loads(content.decode('utf-8'))

return [release['tag_name'] for release in releases if not release['prerelease']]

def update_min_osquery_version_options(new_versions):
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/update-osquery-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1
with:
python-version: "3.x"
- name: Install dependencies
run: pip install requests
python-version: "3.13.1"
- name: Update Osquery versions in UI
run: python .github/scripts/update_osquery_versions.py
- name: PR changes
Expand Down

0 comments on commit 11c316e

Please sign in to comment.