Skip to content

Commit 15089c2

Browse files
committed
Merge branch 'main' into fix/asr-replicated-vm-disk-update-in-place
2 parents ee56cf6 + dbf907a commit 15089c2

2,216 files changed

Lines changed: 46106 additions & 93274 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/labeler-issue-triage.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,11 +249,14 @@ service/network-function:
249249
- '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_(network_function_azure_traffic_collector\W+|network_function_collector_policy\W+|new_relic_monitor\W+|new_relic_tag_rule\W+)((.|\n)*)###'
250250

251251
service/nginx:
252-
- '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_(nginx_|oracle_)((.|\n)*)###'
252+
- '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_nginx_((.|\n)*)###'
253253

254254
service/notifications:
255255
- '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_notification_hub((.|\n)*)###'
256256

257+
service/oracle:
258+
- '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_oracle_((.|\n)*)###'
259+
257260
service/orbital:
258261
- '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_orbital_((.|\n)*)###'
259262

.github/labeler-pull-request-triage.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,11 @@ service/notifications:
424424
- any-glob-to-any-file:
425425
- internal/services/notificationhub/**/*
426426

427+
service/oracle:
428+
- changed-files:
429+
- any-glob-to-any-file:
430+
- internal/services/oracle/**/*
431+
427432
service/orbital:
428433
- changed-files:
429434
- any-glob-to-any-file:

.github/workflows/comment-ci-failure-outdated.yaml

Lines changed: 94 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,22 @@ jobs:
1111
comment-ci-failure-outdated:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- name: Minimize outdated failure comments
14+
- name: Strike through fixed failure and clean up
1515
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
1616
with:
1717
result-encoding: string
18+
retries: 3
1819
script: |
1920
const workflowName = '${{ github.workflow }}';
21+
const sha = '${{ github.event.pull_request.head.sha }}';
22+
const shortSha = sha.substring(0, 7);
2023
const prNumber = ${{ github.event.number }};
21-
const marker = `<b>Build failure: ${workflowName}</b>`;
2224
23-
console.log(`==> Checking PR #${prNumber} for outdated "${workflowName}" failure comments...`);
24-
console.log(` Marker: ${marker}`);
25+
console.log(`=== Comment Cleanup: "${workflowName}" ===`);
26+
console.log(`PR #${prNumber}, commit ${shortSha} (${sha})`);
2527
26-
// Use GraphQL to fetch comments with isMinimized status, paginating through all
28+
// Fetch all comments using GraphQL for minimize capability
29+
console.log(`Fetching PR comments via GraphQL...`);
2730
const query = `
2831
query($owner: String!, $repo: String!, $number: Int!, $cursor: String) {
2932
repository(owner: $owner, name: $repo) {
@@ -46,15 +49,15 @@ jobs:
4649
}
4750
`;
4851
52+
// Collect all non-minimized failure comments
4953
let cursor = null;
5054
let hasNextPage = true;
51-
let totalComments = 0;
52-
let botComments = 0;
53-
let matchingComments = 0;
54-
let minimizedCount = 0;
55-
let alreadyHiddenCount = 0;
55+
const failureComments = [];
56+
let totalFetched = 0;
57+
let pageCount = 0;
5658
5759
while (hasNextPage) {
60+
pageCount++;
5861
const result = await github.graphql(query, {
5962
owner: context.repo.owner,
6063
repo: context.repo.repo,
@@ -65,43 +68,104 @@ jobs:
6568
const { nodes, pageInfo } = result.repository.pullRequest.comments;
6669
hasNextPage = pageInfo.hasNextPage;
6770
cursor = pageInfo.endCursor;
68-
totalComments += nodes.length;
71+
totalFetched += nodes.length;
6972
7073
for (const comment of nodes) {
71-
// Only target comments left by the github-actions bot.
7274
// GraphQL returns author.login as 'github-actions' while the REST API
7375
// returns it as 'github-actions[bot]'. Using startsWith to handle both.
7476
if (!comment.author.login.startsWith('github-actions')) continue;
75-
botComments++;
77+
if (!comment.body) continue;
78+
if (comment.isMinimized) continue;
7679
77-
if (!comment.body || !comment.body.includes(marker)) continue;
78-
matchingComments++;
80+
if (comment.body.includes('CI Build Failures for')) {
81+
failureComments.push(comment);
82+
}
83+
}
84+
}
85+
86+
console.log(`Fetched ${totalFetched} comments across ${pageCount} page(s)`);
87+
console.log(`Found ${failureComments.length} active (non-minimized) failure comment(s)`);
88+
89+
// Process ALL non-minimized failure comments for this workflow
90+
let struckCount = 0;
91+
for (const comment of failureComments) {
92+
const hasActiveLine = comment.body.split('\n').some(line =>
93+
line.trim().startsWith('- ❌') &&
94+
line.includes(`<b>${workflowName}</b>`) &&
95+
!line.includes('<del>')
96+
);
97+
if (!hasActiveLine) continue;
7998
80-
// Skip comments that are already minimized
81-
if (comment.isMinimized) {
82-
alreadyHiddenCount++;
83-
const url = `https://github.com/${context.repo.owner}/${context.repo.repo}/pull/${prNumber}#issuecomment-${comment.databaseId}`;
84-
console.log(` Already hidden: ${url}`);
85-
continue;
99+
console.log(`\n--- Processing comment (id: ${comment.databaseId}) ---`);
100+
101+
// Strike through the line for this workflow
102+
const lines = comment.body.split('\n');
103+
const updatedLines = lines.map(line => {
104+
if (line.trim().startsWith('- ❌') &&
105+
line.includes(`<b>${workflowName}</b>`) &&
106+
!line.includes('<del>')) {
107+
console.log(`Striking through: ${line.trim().substring(0, 60)}...`);
108+
return `- <del>${line.trim().substring(2)}</del>`;
86109
}
110+
return line;
111+
});
112+
113+
// Count remaining active failures in this comment
114+
const activeFailures = updatedLines.filter(l =>
115+
l.trim().startsWith('- ❌') && !l.includes('<del>')
116+
).length;
117+
const totalFailures = updatedLines.filter(l =>
118+
l.trim().startsWith('- ❌') || l.trim().startsWith('- <del>')
119+
).length;
87120
121+
console.log(`Failure count: ${activeFailures} active / ${totalFailures} total`);
122+
123+
// Update counter line
124+
let body;
125+
if (activeFailures === 0) {
126+
console.log(`All failures resolved in this comment — updating counter to "All jobs have been fixed!"`);
127+
body = updatedLines.join('\n').replace(
128+
/^(?:\d+(?:\/\d+)?\s+job.*:|All jobs have been fixed.*$)/m,
129+
`All jobs have been fixed! ✅`
130+
);
131+
} else {
132+
const counterText = `${activeFailures}/${totalFailures} jobs still failing:`;
133+
console.log(`Updating counter to "${counterText}"`);
134+
body = updatedLines.join('\n').replace(
135+
/^(?:\d+(?:\/\d+)?\s+job.*:|All jobs have been fixed.*$)/m,
136+
counterText
137+
);
138+
}
139+
140+
// Update the comment
141+
await github.rest.issues.updateComment({
142+
comment_id: comment.databaseId,
143+
owner: context.repo.owner,
144+
repo: context.repo.repo,
145+
body: body,
146+
});
147+
struckCount++;
148+
console.log(`✅ Struck through "${workflowName}" in comment (id: ${comment.databaseId})`);
149+
150+
// If all failures in this comment are resolved, minimize it
151+
if (activeFailures === 0) {
152+
console.log(`All failures resolved — minimizing comment (id: ${comment.databaseId})...`);
88153
await github.graphql(`
89154
mutation($id: ID!) {
90155
minimizeComment(input: {
91156
subjectId: $id,
92-
classifier: OUTDATED
157+
classifier: RESOLVED
93158
}) {
94-
minimizedComment {
95-
isMinimized
96-
}
159+
minimizedComment { isMinimized }
97160
}
98161
}
99162
`, { id: comment.id });
100-
101-
minimizedCount++;
102-
const url = `https://github.com/${context.repo.owner}/${context.repo.repo}/pull/${prNumber}#issuecomment-${comment.databaseId}`;
103-
console.log(` Minimized: ${url}`);
163+
console.log(`✅ Minimized resolved comment (id: ${comment.databaseId})`);
104164
}
105165
}
106166
107-
console.log(`==> Done. Scanned ${totalComments} comments: ${botComments} from bot, ${matchingComments} matching "${workflowName}", ${minimizedCount} newly minimized, ${alreadyHiddenCount} already hidden.`);
167+
if (struckCount === 0) {
168+
console.log(`✅ No active failure line found for "${workflowName}" in any comment — nothing to strike through`);
169+
} else {
170+
console.log(`\n✅ Done — struck through "${workflowName}" in ${struckCount} comment(s)`);
171+
}

.github/workflows/comment-ci-failure.yaml

Lines changed: 128 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,21 @@ jobs:
1414
- name: Get run url
1515
run: |
1616
echo "gha_url=https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}" >> $GITHUB_ENV
17-
- name: Send build failure comment
17+
- name: Add failure to unified build comment
1818
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
1919
with:
2020
result-encoding: string
21+
retries: 3
2122
script: |
2223
const workflowName = '${{ github.workflow }}';
24+
const sha = '${{ github.event.pull_request.head.sha }}';
25+
const shortSha = sha.substring(0, 7);
26+
const runUrl = '${{ env.gha_url }}';
27+
const prNumber = ${{ github.event.number }};
28+
29+
console.log(`=== Comment Failure: "${workflowName}" ===`);
30+
console.log(`PR #${prNumber}, commit ${shortSha} (${sha})`);
31+
console.log(`Run URL: ${runUrl}`);
2332
2433
const guidance = {
2534
'Vendor Dependencies Check': 'Do not modify files in the `vendor/` directory directly. Instead, update dependencies in `go.mod` and run `go mod vendor` to sync the vendor directory. Then run `make depscheck` locally to verify.',
@@ -30,20 +39,129 @@ jobs:
3039
'Unit Tests': 'Run `make test` locally to reproduce and fix the failing unit tests.',
3140
'ShellCheck Scripts': 'Run `make shellcheck` locally to check shell scripts for issues and fix any warnings or errors.',
3241
'Validate Examples': 'Run `make validate-examples` locally to check that your example Terraform configurations under `examples/` are valid.',
33-
42+
'Provider Tests': 'Run `make testacc TEST=./internal/provider TESTARGS="-run \'^TestAcc\'"` locally to reproduce and fix the failing provider tests.',
43+
'Check for new usages of deprecated functionality': 'Your changes introduce new usages of deprecated functions or patterns. Please use the recommended replacements instead.',
44+
'Preview ARM API Version Linter': 'Your changes reference Azure ARM API versions that are in preview. Please update the API version references to use GA (stable) versions.',
3445
};
3546
36-
let body = `<b>Build failure: ${workflowName}</b>\n\nThis pull request contains a build failure in the <b>${workflowName}</b> check which needs to be addressed [here](${{ env.gha_url }}).`;
47+
const commitUrl = `https://github.com/${{ github.repository }}/commit/${sha}`;
48+
const marker = `CI Build Failures for <a href="${commitUrl}"><code>${shortSha}</code></a>`;
49+
const guideText = guidance[workflowName] || 'Check the logs for details on the failure.';
50+
const failureLine = `- ❌ <b>${workflowName}</b> — ${guideText} (<a href="${runUrl}">logs</a>)`;
3751
38-
if (guidance[workflowName]) {
39-
body += `\n\n<b>How to fix:</b> ${guidance[workflowName]}`;
52+
if (!guidance[workflowName]) {
53+
console.log(`⚠️ No guidance text found for workflow "${workflowName}", using default`);
4054
}
4155
42-
body += `\n\nFor more information, please refer to our [Contributing Guide](https://github.com/${{ github.repository }}/blob/main/contributing/README.md).`;
56+
const footer = `\n\nFor more information, please refer to our <a href="https://github.com/${{ github.repository }}/blob/main/contributing/README.md">Contributing Guide</a>.`;
4357
44-
github.rest.issues.createComment({
45-
issue_number: ${{ github.event.number }},
58+
// Find existing unified comment for this commit
59+
console.log(`Searching for existing unified comment with marker: "${marker}"`);
60+
const { data: comments } = await github.rest.issues.listComments({
61+
issue_number: prNumber,
4662
owner: context.repo.owner,
4763
repo: context.repo.repo,
48-
body: body
49-
})
64+
per_page: 100,
65+
});
66+
67+
const botComments = comments.filter(c => c.user.login === 'github-actions[bot]');
68+
console.log(`Found ${comments.length} total comments, ${botComments.length} from github-actions[bot]`);
69+
70+
const botComment = botComments.find(c => c.body && c.body.includes('CI Build Failures for') && c.body.includes(`<code>${shortSha}</code>`));
71+
72+
if (botComment) {
73+
console.log(`Found existing unified comment (id: ${botComment.id}) for commit ${shortSha}`);
74+
75+
let body = botComment.body;
76+
77+
const activeLinePattern = `- ❌ <b>${workflowName}</b>`;
78+
const struckLinePattern = `- <del>❌ <b>${workflowName}</b>`;
79+
80+
if (body.includes(struckLinePattern)) {
81+
console.log(`"${workflowName}" was previously struck through (fixed) — removing old line and re-adding as active failure`);
82+
const lines = body.split('\n');
83+
const filtered = lines.filter(line => {
84+
const trimmed = line.trim();
85+
return !(trimmed.startsWith('- <del>') && trimmed.includes(`<b>${workflowName}</b>`));
86+
});
87+
body = filtered.join('\n');
88+
// Fall through to insert the new failure line below
89+
} else if (body.includes(activeLinePattern)) {
90+
console.log(`"${workflowName}" already has an active failure line — updating log URL`);
91+
const lines = body.split('\n');
92+
const updated = lines.map(line => {
93+
if (line.includes(`<b>${workflowName}</b>`) && !line.includes('<del>')) {
94+
return failureLine;
95+
}
96+
return line;
97+
});
98+
body = updated.join('\n');
99+
100+
body = updateCounter(body);
101+
102+
await github.rest.issues.updateComment({
103+
comment_id: botComment.id,
104+
owner: context.repo.owner,
105+
repo: context.repo.repo,
106+
body: body,
107+
});
108+
console.log(`✅ Updated log URL for "${workflowName}" in unified comment`);
109+
return;
110+
} else {
111+
console.log(`"${workflowName}" is a new failure — adding to existing comment`);
112+
}
113+
114+
// Insert the new failure line before the footer
115+
const footerIndex = body.lastIndexOf('\n\nFor more information');
116+
if (footerIndex !== -1) {
117+
body = body.substring(0, footerIndex) + '\n' + failureLine + body.substring(footerIndex);
118+
console.log(`Inserted failure line before footer`);
119+
} else {
120+
body += '\n' + failureLine;
121+
console.log(`⚠️ Footer not found, appended failure line to end`);
122+
}
123+
124+
body = updateCounter(body);
125+
126+
await github.rest.issues.updateComment({
127+
comment_id: botComment.id,
128+
owner: context.repo.owner,
129+
repo: context.repo.repo,
130+
body: body,
131+
});
132+
console.log(`✅ Added "${workflowName}" failure to existing unified comment (id: ${botComment.id})`);
133+
} else {
134+
console.log(`No existing unified comment found for commit ${shortSha} — creating new one`);
135+
136+
const body = `<b>${marker}</b>\n\n` +
137+
`1 job has failed and needs to be addressed:\n\n` +
138+
failureLine +
139+
footer;
140+
141+
const { data: newComment } = await github.rest.issues.createComment({
142+
issue_number: prNumber,
143+
owner: context.repo.owner,
144+
repo: context.repo.repo,
145+
body: body,
146+
});
147+
console.log(`✅ Created unified failure comment (id: ${newComment.id}) for "${workflowName}" at commit ${shortSha}`);
148+
}
149+
150+
function updateCounter(body) {
151+
const lines = body.split('\n');
152+
const activeFailures = lines.filter(l =>
153+
l.trim().startsWith('- ❌') && !l.includes('<del>')
154+
).length;
155+
const totalFailures = lines.filter(l =>
156+
(l.trim().startsWith('- ❌') || (l.trim().startsWith('- <del>')))
157+
).length;
158+
159+
const counterText = activeFailures === totalFailures
160+
? `${activeFailures} job${activeFailures === 1 ? ' has' : 's have'} failed and need${activeFailures === 1 ? 's' : ''} to be addressed:`
161+
: `${activeFailures}/${totalFailures} jobs still failing:`;
162+
163+
console.log(`Counter update: ${activeFailures} active / ${totalFailures} total → "${counterText}"`);
164+
165+
// Replace the counter line
166+
return body.replace(/^(?:\d+(?:\/\d+)?\s+job.*:|All jobs have been fixed.*$)/m, counterText);
167+
}

0 commit comments

Comments
 (0)