Skip to content

issue-196: block checksums should be calculated after we copy the data from the client's buffer to our buffer, otherwise our client may modify the data between the checksum calculation stage and the writeblob stage #1436

issue-196: block checksums should be calculated after we copy the data from the client's buffer to our buffer, otherwise our client may modify the data between the checksum calculation stage and the writeblob stage

issue-196: block checksums should be calculated after we copy the data from the client's buffer to our buffer, otherwise our client may modify the data between the checksum calculation stage and the writeblob stage #1436

Workflow file for this run

name: PR-check
on:
pull_request_target:
branches:
- 'main'
paths-ignore:
- 'ydb/docs/**'
- '.github/**'
- 'example/**'
- 'doc/**'
- '**.md'
types:
- 'opened'
- 'synchronize'
- 'reopened'
- 'labeled'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
check-running-allowed:
runs-on: ubuntu-latest
outputs:
result: ${{ steps.check-ownership-membership.outputs.result }}
steps:
- name: Check if running tests is allowed
id: check-ownership-membership
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
script: |
// How to interpret membership status code:
// https://docs.github.com/en/rest/orgs/members?apiVersion=2022-11-28#check-organization-membership-for-a-user
const userLogin = context.payload.pull_request.user.login;
const isOrgMember = async function () {
try {
const response = await github.rest.orgs.checkMembershipForUser({
org: context.payload.organization.login,
username: userLogin,
});
return response.status == 204;
} catch (error) {
if (error.status && error.status == 404) {
return false;
}
throw error;
}
}
if (context.payload.repository.owner.login == userLogin) {
console.log('User is repo owner')
return true;
}
if (await isOrgMember()) {
console.log('User is member')
return true;
}
const labels = context.payload.pull_request.labels;
const okToTestLabel = labels.find(
label => label.name == 'ok-to-test'
);
return okToTestLabel !== undefined;
- name: comment-if-waiting-on-ok
if: steps.check-ownership-membership.outputs.result == 'false' &&
github.event.action == 'opened'
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Hi! Thank you for contributing!\nThe tests on this PR will run after a maintainer adds an `ok-to-test` label to this PR manually. Thank you for your patience!'
});
- name: cleanup-test-label
uses: actions/github-script@v7
with:
script: |
const { owner, repo } = context.repo;
const prNumber = context.payload.pull_request.number;
const labelToRemove = 'ok-to-test';
try {
const result = await github.rest.issues.removeLabel({
owner,
repo,
issue_number: prNumber,
name: labelToRemove
});
} catch(e) {
// ignore the 404 error that arises
// when the label did not exist for the
// organization member
console.log(e);
}
create-build-and-test-target-var:
needs:
- check-running-allowed
if: needs.check-running-allowed.outputs.result == 'true'
outputs:
build_target: ${{ steps.set-build-and-test-targets.outputs.build_target }}
test_target: ${{ steps.set-build-and-test-targets.outputs.test_target }}
runs-on: ubuntu-latest
steps:
- name: Set build and test targets
id: set-build-and-test-targets
shell: bash
run: |
# Initialize variables
build_target_components=""
test_target_components=""
true_count=0
false_count=0
# Function to add components
add_components() {
if [ "$1" = "true" ]; then
build_target_components="${build_target_components}$2,"
test_target_components="${test_target_components}$3,"
true_count=$((true_count + 1))
else
false_count=$((false_count + 1))
fi
}
# Add components based on conditions
add_components "$contains_blockstore" "cloud/blockstore/apps/" "cloud/blockstore/"
add_components "$contains_filestore" "cloud/filestore/apps/" "cloud/filestore/"
add_components "$contains_disk_manager" "cloud/disk_manager/" "cloud/disk_manager/"
add_components "$contains_tasks" "cloud/tasks/" "cloud/tasks/"
# Remove trailing commas
build_target_components=${build_target_components%,}
test_target_components=${test_target_components%,}
# Determine build_target and test_target based on conditions
if [ "$true_count" -eq 4 ] || [ "$false_count" -eq 4 ]; then
build_target="cloud/blockstore/apps/,cloud/filestore/apps/,cloud/disk_manager/,cloud/tasks/"
test_target="cloud/blockstore/,cloud/filestore/,cloud/disk_manager/,cloud/tasks/"
else
build_target=$build_target_components
test_target=$test_target_components
fi
# Output to GitHub environment file
echo "build_target=\"$build_target\"" >> $GITHUB_OUTPUT
echo "test_target=\"$test_target\"" >> $GITHUB_OUTPUT
env:
contains_blockstore: ${{ contains(github.event.pull_request.labels.*.name, 'blockstore') && 'true' || 'false' }}
contains_filestore: ${{ contains(github.event.pull_request.labels.*.name, 'filestore') && 'true' || 'false' }}
contains_disk_manager: ${{ contains(github.event.pull_request.labels.*.name, 'disk_manager') && 'true' || 'false' }}
contains_tasks: ${{ contains(github.event.pull_request.labels.*.name, 'tasks') && 'true' || 'false' }}
build_and_test:
needs:
- check-running-allowed
- create-build-and-test-target-var
if: needs.check-running-allowed.outputs.result == 'true'
name: Build and test
uses: ./.github/workflows/build_and_test_on_demand.yaml
with:
build_target: ${{ needs.create-build-and-test-target-var.outputs.build_target }}
test_target: ${{ needs.create-build-and-test-target-var.outputs.test_target }}
build_preset: "relwithdebinfo"
test_size: ${{ contains(github.event.pull_request.labels.*.name, 'large-tests') && 'small,medium,large' || 'small,medium' }}
test_type: "unittest,clang_tidy,gtest,py3test,py2test,pytest,flake8,black,py2_flake8,go_test,gofmt"
run_tests: true
cache_update_build: false
cache_update_tests: false
sleep_after_tests: ${{ contains(github.event.pull_request.labels.*.name, 'sleep') && '7200' || '1' }}
secrets: inherit