diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index 8232d13..1a02362 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -81,3 +81,13 @@ jobs: workspace: ${{ github.workspace }} dockerfile: deploy/production/Dockerfile.opensearch destination: akyldash-opensearch:ci + - name: Prepare a synthetic artifact compatibility marker + run: | + mkdir -p artifact-smoke + printf 'Gitea artifact upload smoke test; no release data.\n' > artifact-smoke/marker.txt + - name: Verify Gitea runtime artifact upload + uses: https://gitea.com/actions/gitea-upload-artifact@055b8b3f04a4a7ed853f2c6ab04256f83e4874dc + with: + name: artifact-smoke-${{ github.run_id }}-${{ github.run_attempt }} + path: artifact-smoke/marker.txt + retention-days: 1 diff --git a/.gitea/workflows/release-images.yaml b/.gitea/workflows/release-images.yaml index 28d04ad..442a8d8 100644 --- a/.gitea/workflows/release-images.yaml +++ b/.gitea/workflows/release-images.yaml @@ -49,10 +49,15 @@ jobs: python3 infra/deploy/validate_release.py release/release-manifest.json \ --policy infra/deploy/release-policy.json sha256sum release/release-manifest.json > release/release-manifest.json.sha256 - - name: Print verified release descriptor for the owner + - name: Upload verified release descriptor + uses: https://gitea.com/actions/gitea-upload-artifact@055b8b3f04a4a7ed853f2c6ab04256f83e4874dc + with: + name: release-descriptor-${{ github.run_id }}-${{ github.run_attempt }} + path: | + release/release-manifest.json + release/release-manifest.json.sha256 + retention-days: 90 + - name: Confirm uploaded release descriptor run: | sha256sum -c release/release-manifest.json.sha256 - echo 'Release descriptor (copy from this authenticated run log):' - cat release/release-manifest.json - echo 'Descriptor SHA-256:' - cat release/release-manifest.json.sha256 + echo 'Release descriptor and checksum are available as this run artifact.' diff --git a/backend/README.md b/backend/README.md index 6533960..d7e7e88 100644 --- a/backend/README.md +++ b/backend/README.md @@ -190,6 +190,11 @@ Wildcard removal, пустой индекс и alias с несколькими t старый target успел измениться после проверки, OpenSearch отклонит атомарную операцию удаления точного старого alias. `--resume` повторно проверяет весь ожидаемый inventory, а не только количество документов текущего запуска. +Если ответ на alias request потерян после успешного переключения или процесс +остановился до записи завершённого checkpoint, повторный запуск проверит +фактическую цель alias. Уже опубликованный candidate оставляется на месте, и +checkpoint завершается; старый target позволяет безопасно повторить cutover, +а любой другой target останавливает операцию. После каждого принятого Bulk-пакета загрузчик атомарно сохраняет checkpoint и печатает код безопасного возобновления. При временных HTTP 429/5xx, timeout и diff --git a/backend/search/minjust_opensearch.py b/backend/search/minjust_opensearch.py index b977ab8..0e67b8d 100644 --- a/backend/search/minjust_opensearch.py +++ b/backend/search/minjust_opensearch.py @@ -462,22 +462,44 @@ def switch_alias(base: str, index: str, alias: str, expected_old_index: str) -> if not expected_old_index or expected_old_index == index: raise ValueError("--expected-old-index must name the exact previous index") actual_old_index = alias_target(base, alias) + if actual_old_index == index: + return if actual_old_index != expected_old_index: raise ValueError( f"alias {alias} currently targets {actual_old_index}, expected {expected_old_index}; refusing cutover" ) - result = request_json( - f"{base.rstrip('/')}/_aliases", - "POST", - json.dumps({ - "actions": [ - {"remove": {"index": expected_old_index, "alias": alias, "must_exist": True}}, - {"add": {"index": index, "alias": alias}}, - ] - }).encode(), - "application/json", - ) - if result.get("acknowledged") is not True: + try: + result = request_json( + f"{base.rstrip('/')}/_aliases", + "POST", + json.dumps({ + "actions": [ + {"remove": {"index": expected_old_index, "alias": alias, "must_exist": True}}, + {"add": {"index": index, "alias": alias}}, + ] + }).encode(), + "application/json", + ) + except Exception as error: + try: + current = alias_target(base, alias) + except Exception: + raise RuntimeError(f"alias switch outcome is unknown; inspect {alias} before resuming") from error + if current == index: + return + if current != expected_old_index: + raise ValueError( + f"alias {alias} now targets unexpected index {current}; refusing to retry publication" + ) from error + raise RuntimeError(f"alias switch failed; {alias} still targets {expected_old_index}") from error + if not isinstance(result, dict) or result.get("acknowledged") is not True: + current = alias_target(base, alias) + if current == index: + return + if current != expected_old_index: + raise ValueError( + f"alias {alias} now targets unexpected index {current}; refusing to retry publication" + ) raise RuntimeError(f"OpenSearch did not acknowledge alias switch: {alias}") diff --git a/backend/search/review.html b/backend/search/review.html index 4caffca..d38c2c4 100644 --- a/backend/search/review.html +++ b/backend/search/review.html @@ -657,7 +657,7 @@

Документ

Выберите документ в выдаче, чтобы открыть текст.

Содержание
- +

Черновик появится после поиска.

Вход в Акылдаш

Введите учетные данные, выданные администратором.

Создайте новый пароль

Для продолжения замените временный пароль. Используйте не менее 12 символов.

@@ -675,7 +675,7 @@

Документ

Источники документов

Поиск выполняется по документам, подготовленным из правовых источников Кыргызской Республики. Для каждого результата доступная редакция и ссылка на официальный источник показываются в панели документа.

Официальный источник: Централизованный банк данных правовой информации Министерства юстиции Кыргызской Республики.

Короткое знакомство

- +