Compare-ydb-configs-in-branches #83
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Compare-ydb-configs-in-branches | |
| on: | |
| schedule: | |
| - cron: "0 * * * *" # Every hour | |
| workflow_dispatch: | |
| inputs: | |
| commit_sha: | |
| type: string | |
| default: "" | |
| branches: | |
| type: string | |
| default: "" | |
| description: | | |
| List of branches for compare separated by space. | |
| If not set, result will be uploaded to global store for the default list of branches. | |
| required: false | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| main: | |
| name: Compare configs | |
| runs-on: [ self-hosted, auto-provisioned, build-preset-analytic-node] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| ref: ${{ inputs.commit_sha }} | |
| fetch-depth: 1 | |
| - name: Setup ydb access | |
| uses: ./.github/actions/setup_ci_ydb_service_account_key_file_credentials | |
| with: | |
| ci_ydb_service_account_key_file_credentials: ${{ secrets.CI_YDB_SERVICE_ACCOUNT_KEY_FILE_CREDENTIALS }} | |
| ydb_qa_config: ${{ vars.YDB_QA_CONFIG }} | |
| - name: Build | |
| uses: ./.github/actions/build_and_test_ya | |
| with: | |
| build_preset: "release" | |
| build_target: "ydb/tests/library/compatibility/configs/dump ydb/tests/library/compatibility/configs/comparator" | |
| increment: false | |
| run_tests: false | |
| put_build_results_to_cache: false | |
| add_vcs_info: true | |
| secs: ${{ format('{{"AWS_KEY_ID":"{0}","AWS_KEY_VALUE":"{1}","REMOTE_CACHE_USERNAME":"{2}","REMOTE_CACHE_PASSWORD":"{3}","YDBOT_TELEGRAM_BOT_TOKEN":"{4}"}}', | |
| secrets.AWS_KEY_ID, secrets.AWS_KEY_VALUE, secrets.REMOTE_CACHE_USERNAME, secrets.REMOTE_CACHE_PASSWORD, secrets.YDBOT_TELEGRAM_BOT_TOKEN ) }} | |
| vars: ${{ format('{{"AWS_BUCKET":"{0}","AWS_ENDPOINT":"{1}","REMOTE_CACHE_URL":"{2}","GH_ALERTS_TG_LOGINS":"{3}","GH_ALERTS_TG_CHAT":"{4}"}}', | |
| vars.AWS_BUCKET, vars.AWS_ENDPOINT, vars.REMOTE_CACHE_URL_YA, vars.GH_ALERTS_TG_LOGINS, vars.GH_ALERTS_TG_CHAT ) }} | |
| - name: Setup s3cmd | |
| uses: ./.github/actions/s3cmd | |
| with: | |
| s3_bucket: "ydb-builds" | |
| s3_endpoint: ${{ vars.AWS_ENDPOINT }} | |
| s3_key_id: ${{ secrets.AWS_KEY_ID }} | |
| s3_key_secret: ${{ secrets.AWS_KEY_VALUE }} | |
| build_preset: "release" | |
| - name: Comapare and publish result | |
| shell: bash | |
| run: | | |
| set -xe | |
| cd ./ydb/tests/library/compatibility/configs | |
| if [[ -z "${{inputs.branches}}" ]]; then | |
| BRANCH_LIST="stable-26-1-1 stable-26-1 stable-26-2-1 stable-26-2 prestable-26-3 current" | |
| else | |
| BRANCH_LIST="${{inputs.branches}}" | |
| fi | |
| BRANCH_LIST_NO_PRESTABLE=() | |
| for BRANCH in $BRANCH_LIST; do | |
| if [[ $BRANCH == 'current' ]]; then | |
| if [[ -e dump/config-meta.json ]]; then | |
| ln -s -f dump/config-meta.json current | |
| else | |
| echo "Error: dump/config-meta.json not found for 'current' branch" >&2 | |
| exit 1 | |
| fi | |
| else | |
| s3cmd get s3://ydb-builds/$BRANCH/release/config-meta.json $BRANCH | |
| fi | |
| if [[ $BRANCH != prestable* ]]; then | |
| BRANCH_LIST_NO_PRESTABLE+=($BRANCH) | |
| fi | |
| done | |
| ./comparator/comparator $BRANCH_LIST > config_diff_with_prestable.html | |
| s3cmd sync --follow-symlinks --acl-public --no-progress --stats --check-md5 "config_diff_with_prestable.html" "$S3_BUCKET_PATH/" | |
| ./comparator/comparator ${BRANCH_LIST_NO_PRESTABLE[@]} > config_diff.html | |
| s3cmd sync --follow-symlinks --acl-public --no-progress --stats --check-md5 "config_diff.html" "$S3_BUCKET_PATH/" | |
| if [[ -z "${{inputs.branches}}" ]]; then | |
| s3cmd sync --follow-symlinks --acl-public --no-progress --stats --check-md5 "config_diff_with_prestable.html" "s3://ydb-builds/main/config_diff_with_prestable.html" -d | |
| echo "Report (including prestables) with comparison placed to [global](${{ vars.AWS_ENDPOINT }}/ydb-builds/main/config_diff_with_prestable.html) and [per run]($S3_URL_PREFIX/config_diff_with_prestable.html) storages.">> $GITHUB_STEP_SUMMARY | |
| s3cmd sync --follow-symlinks --acl-public --no-progress --stats --check-md5 "config_diff.html" "s3://ydb-builds/main/config_diff.html" -d | |
| echo "Report with comparison placed to [global](${{ vars.AWS_ENDPOINT }}/ydb-builds/main/config_diff.html) and [per run]($S3_URL_PREFIX/config_diff.html) storages.">> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "Report (including prestables) with comparison placed to [per run]($S3_URL_PREFIX/config_diff_with_prestable.html) storage.">> $GITHUB_STEP_SUMMARY | |
| echo "Report with comparison placed to [per run]($S3_URL_PREFIX/config_diff.html) storage.">> $GITHUB_STEP_SUMMARY | |
| fi | |