Skip to content
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

chore: fail the workflow after unsuccessful requests #169

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
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
9 changes: 8 additions & 1 deletion .github/workflows/update_deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.12
- run: ./sc4s_sync.sh
- uses: crazy-max/ghaction-import-gpg@v6
with:
Expand Down Expand Up @@ -45,7 +47,12 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- run: ./splunk_sync.sh
with:
python-version: 3.12
- run: |
pip install -r requirements.txt
splunk_version=$(python splunk_matrix_update.py)
echo $splunk_version
- uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.SA_GPG_PRIVATE_KEY }}
Expand Down
4 changes: 4 additions & 0 deletions splunk_matrix_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
def get_token():
splunk_token_url = "https://auth.docker.io/token?service=registry.docker.io&scope=repository:splunk/splunk:pull"
response = requests.get(splunk_token_url)
response.raise_for_status()
response_json = json.loads(response.text)
token = response_json["token"]
return token
Expand All @@ -19,6 +20,7 @@ def get_images_list(token):
headers = {"Authorization": f"Bearer {token}"}
splunk_image_list_url = "https://registry.hub.docker.com/v2/splunk/splunk/tags/list"
response = requests.get(splunk_image_list_url, headers=headers)
response.raise_for_status()
response_json = json.loads(response.text)
return response_json["tags"]

Expand Down Expand Up @@ -57,6 +59,7 @@ def get_image_digest(token, image):
f"https://registry.hub.docker.com/v2/splunk/splunk/manifests/{image}"
)
response = requests.get(image_digest_url, headers=headers)
response.raise_for_status()
if response.headers["Docker-Content-Digest"]:
return response.headers["Docker-Content-Digest"]
else:
Expand All @@ -71,6 +74,7 @@ def get_image_digest(token, image):
)
)
response = requests.get(image_digest_url, headers=headers)
response.raise_for_status()
return response.headers["Docker-Content-Digest"]


Expand Down
7 changes: 0 additions & 7 deletions splunk_sync.sh

This file was deleted.

Loading