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

update #78

Merged
merged 1 commit into from
Jan 16, 2025
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/2-bb-masking-column.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ jobs:
with:
script: |
const changedFiles = process.env.CHANGED_FILES || '';
let commentBody = `### Masking Policy Update Summary\n\n`;
let commentBody = `### Update Column Masking and Exception Summary\n\n`;

// Add status of merge
commentBody += `✅ **PR Status:** Merged\n\n`;
Expand Down
51 changes: 23 additions & 28 deletions .github/workflows/3-bb-masking-classification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,34 +88,29 @@ jobs:
id: apply-global-masking-rule
if: ${{ steps.changed-files.outputs.any_changed == 'true' && contains(steps.changed-files.outputs.all_changed_files, 'global-masking-rule-classification.json') }}
run: |
# Process all global-masking-rule-classification.json files
echo "${{ steps.changed-files.outputs.all_changed_files }}" | tr ' ' '\n' | grep "global-masking-rule-classification.json" | while read -r CHANGED_FILE; do
echo "Processing: $CHANGED_FILE"

response=$(curl -s -w "\n%{http_code}" --request PATCH "${{ steps.bytebase-login.outputs.api_url }}/policies/masking_rule?allow_missing=true&update_mask=payload" \
--header "Authorization: Bearer ${{ steps.bytebase-login.outputs.token }}" \
--header "Content-Type: application/json" \
--data @"$CHANGED_FILE")

# Extract status code and response body
status_code=$(echo "$response" | tail -n1)
body=$(echo "$response" | sed '$d')

echo "Status code: $status_code"
echo "Response body: $body"

# Append to outputs (with unique identifiers)
if [[ $status_code -ge 200 && $status_code -lt 300 ]]; then
echo "${body}" >> $GITHUB_OUTPUT
else
echo "Failed with status code: $status_code"
echo "Response body: ${body}"
if [[ $status_code -eq 403 ]]; then
echo "Access denied. Please check your permissions and API token."
fi
exit 1
fi
done
CHANGED_FILE="masking/global-masking-rule-classification.json"
echo "Processing: $CHANGED_FILE"

response=$(curl -s -w "\n%{http_code}" --request PATCH "${{ steps.bytebase-login.outputs.api_url }}/policies/masking_rule?allow_missing=true&update_mask=payload" \
--header "Authorization: Bearer ${{ steps.bytebase-login.outputs.token }}" \
--data @"$CHANGED_FILE")

# Extract status code and response body
status_code=$(echo "$response" | tail -n1)
body=$(echo "$response" | sed '$d')

echo "status_code=${status_code}" >> $GITHUB_OUTPUT
echo "response_body<<EOF" >> $GITHUB_OUTPUT
echo "${body}" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT

echo "status_code=${status_code}"
echo "response_body=${body}"

if [[ $status_code -lt 200 || $status_code -ge 300 ]]; then
echo "Failed with status code: $status_code"
exit 1
fi

- name: Apply column masking policy
id: apply-column-masking
Expand Down
2 changes: 1 addition & 1 deletion masking/global-masking-rule-classification.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{
"id": "76356d81-6231-4128-9be7-2c549fc505f5",
"condition": {
"expression": "classification_level in [\"2\", \"3\"]",
"expression": "classification_level in [\"2\"]",
"title": "",
"description": ""
},
Expand Down
Loading