Skip to content

Commit 23ecaea

Browse files
Merge pull request #721 from MikroElektronika/update/indexing_approach_update
Added option to skip waiting for database update
2 parents afe1325 + 5a922f9 commit 23ecaea

2 files changed

Lines changed: 74 additions & 45 deletions

File tree

.github/workflows/index.yaml

Lines changed: 73 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
release_version:
77
type: string
88
description: Which release version to index (type mikroSDK-2.14.2 for example)
9-
default: "mikroSDK-2.14.2"
9+
default: "mikroSDK-2.17.13"
1010
select_index:
1111
type: choice
1212
description: Index as test or live
@@ -21,6 +21,10 @@ on:
2121
type: boolean
2222
description: Update asset indexes for chosen tag without changing their dates? (Will update only hash values based on metadata.json)
2323
default: false
24+
skip_database_update:
25+
type: boolean
26+
description: Skip triggering database update in core_packages?
27+
default: false
2428
notify_sdk:
2529
type: boolean
2630
description: Notify SDK
@@ -29,51 +33,17 @@ on:
2933
- cron: "51 6 8 1 *" # 08.01.2026 for RA6M4 SDK release
3034

3135
jobs:
32-
index:
36+
update_core_database:
3337
runs-on: ubuntu-latest
3438
steps:
35-
- name: Authorize Mikroe Actions App
36-
uses: actions/create-github-app-token@v2
37-
id: app-token
38-
with:
39-
app-id: ${{ vars.MIKROE_ACTIONS }}
40-
private-key: ${{ secrets.MIKROE_ACTIONS_KEY_AUTHORIZE }}
41-
42-
- name: Checkout code
43-
uses: actions/checkout@v6
44-
with:
45-
token: ${{ steps.app-token.outputs.token }}
46-
47-
- name: Set up Python
48-
uses: actions/setup-python@v6
49-
with:
50-
python-version: '3.x'
51-
52-
- name: Cache Python packages
53-
uses: actions/cache@v5
54-
with:
55-
path: ~/.cache/pip
56-
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
57-
restore-keys: |
58-
${{ runner.os }}-pip-
59-
60-
- name: Install Dependencies
39+
- name: Skip Core database update
40+
if: ${{ github.event.inputs.skip_database_update == 'true' }}
6141
run: |
62-
python -m pip install --upgrade pip
63-
pip install aiohttp
64-
pip install aiofiles
65-
pip install requests
66-
pip install py7zr
67-
pip install beautifulsoup4
68-
pip install "chardet==6.0.0"
69-
pip install alive-progress
70-
pip install elasticsearch==7.13.4
71-
sudo apt-get install p7zip-full
42+
echo "Skipping Core database update."
7243
7344
- name: Trigger database update in Core repo
74-
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.keep_dates == 'false' }}
45+
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.keep_dates == 'false' && github.event.inputs.skip_database_update == 'false' }}
7546
run: |
76-
# Set the required variables
7747
repo_owner="MikroElektronika"
7848
repo_name="core_packages"
7949
event_type="trigger-workflow-update-database-from-sdk"
@@ -94,7 +64,7 @@ jobs:
9464
-d "{\"event_type\": \"$event_type\", \"client_payload\": {\"version\": \"$version\", \"index\": \"$index\", \"unit\": false, \"integration\": true}}"
9565
9666
- name: Wait for Core repo updateDbFromSdk.yaml to finish
97-
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.keep_dates == 'false' }}
67+
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.keep_dates == 'false' && github.event.inputs.skip_database_update == 'false' }}
9868
env:
9969
GH_TOKEN: ${{ secrets.MIKROE_ACTIONS_KEY }}
10070
run: |
@@ -158,6 +128,49 @@ jobs:
158128
sleep 15
159129
done
160130
131+
index:
132+
runs-on: ubuntu-latest
133+
needs: update_core_database
134+
135+
steps:
136+
- name: Authorize Mikroe Actions App
137+
uses: actions/create-github-app-token@v2
138+
id: app-token
139+
with:
140+
app-id: ${{ vars.MIKROE_ACTIONS }}
141+
private-key: ${{ secrets.MIKROE_ACTIONS_KEY_AUTHORIZE }}
142+
143+
- name: Checkout code
144+
uses: actions/checkout@v6
145+
with:
146+
token: ${{ steps.app-token.outputs.token }}
147+
148+
- name: Set up Python
149+
uses: actions/setup-python@v6
150+
with:
151+
python-version: '3.x'
152+
153+
- name: Cache Python packages
154+
uses: actions/cache@v5
155+
with:
156+
path: ~/.cache/pip
157+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
158+
restore-keys: |
159+
${{ runner.os }}-pip-
160+
161+
- name: Install Dependencies
162+
run: |
163+
python -m pip install --upgrade pip
164+
pip install aiohttp
165+
pip install aiofiles
166+
pip install requests
167+
pip install py7zr
168+
pip install beautifulsoup4
169+
pip install "chardet==6.0.0"
170+
pip install alive-progress
171+
pip install elasticsearch==7.13.4
172+
sudo apt-get install p7zip-full
173+
161174
- name: Run Index Script - Scheduled
162175
if: ${{ github.event_name == 'schedule' }}
163176
env:
@@ -179,13 +192,28 @@ jobs:
179192
run: |
180193
if [[ ${{ github.event.inputs.select_index }} == "Live" ]]; then
181194
echo "Indexing to Live."
182-
python -u scripts/index.py ${{ github.repository }} ${{ steps.app-token.outputs.token }} ${{ github.event.inputs.release_version }} ${{ secrets.ES_INDEX_LIVE }} ${{ github.event.inputs.set_as_latest }} "--keep_previous_dates" ${{ github.event.inputs.keep_dates }}
195+
python -u scripts/index.py \
196+
${{ github.repository }} \
197+
${{ steps.app-token.outputs.token }} \
198+
${{ github.event.inputs.release_version }} \
199+
${{ secrets.ES_INDEX_LIVE }} \
200+
${{ github.event.inputs.set_as_latest }} \
201+
"--keep_previous_dates" \
202+
${{ github.event.inputs.keep_dates }}
183203
else
184204
echo "Indexing to Test."
185205
if [[ ${{ github.event.inputs.set_as_latest }} ]]; then
186206
echo "Promote to latest requested, but ignored. Only available for LIVE updates."
187207
fi
188-
python -u scripts/index.py ${{ github.repository }} ${{ steps.app-token.outputs.token }} ${{ github.event.inputs.release_version }} ${{ secrets.ES_INDEX_TEST }} "False" "--keep_previous_dates" ${{ github.event.inputs.keep_dates }}
208+
209+
python -u scripts/index.py \
210+
${{ github.repository }} \
211+
${{ steps.app-token.outputs.token }} \
212+
${{ github.event.inputs.release_version }} \
213+
${{ secrets.ES_INDEX_TEST }} \
214+
"False" \
215+
"--keep_previous_dates" \
216+
${{ github.event.inputs.keep_dates }}
189217
fi
190218
191219
- name: Build SDK Message with Python
@@ -200,5 +228,5 @@ jobs:
200228
run: |
201229
MESSAGE=$(cat message.txt)
202230
curl -X POST -H 'Content-Type: application/json' \
203-
--data "{\"text\": \"$MESSAGE\"}" \
204-
$MATTERMOST_WEBHOOK_URL
231+
--data "{\"text\": \"$MESSAGE\"}" \
232+
$MATTERMOST_WEBHOOK_URL

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ settings.json
1616
# do not track them
1717
flatten_me.h
1818
eth_driver.h
19+
.venv

0 commit comments

Comments
 (0)