Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 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/add-waiting-response-on-fail.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Add waiting-response on failures

on:
workflow_run:
workflows: ['Check for new usages of deprecated functionality', 'GoLang Linting', 'Website Linting', 'Generation Check', 'Validate Examples', 'Unit Tests', 'Terraform Schema Linting', '32 Bit Build', 'Provider Tests', 'Vendor Dependencies Check']
workflows: ['Check for new usages of deprecated functionality', 'GoLang Linting', 'Website Linting', 'Generation Check', 'Validate Examples', 'Unit Tests', 'Terraform Schema Linting', 'Provider Tests', 'Vendor Dependencies Check']
types: [completed]

permissions:
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/breaking-change-detection.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,12 @@ jobs:
with:
go-version-file: ./.go-version
- run: bash ./scripts/run-breaking-change-detection.sh
- name: Guidance on failure
if: failure()
run: |
echo "::error::Breaking Schema Changes detected."
echo ""
echo "Your changes contain breaking schema changes (e.g. removing or renaming"
echo "a property, changing a property type, or making an optional property required)."
echo "Breaking changes must be gated behind the appropriate feature flag (e.g. features.FivePointOh())."
echo "Please review the breaking changes guide: contributing/topics/guide-breaking-changes.md"
19 changes: 19 additions & 0 deletions .github/workflows/close-failing-ci-prs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: 'Close PRs With Failing CI'
on:
workflow_dispatch:
schedule:
- cron: '0 6 * * MON,WED,FRI'

permissions:
issues: write
pull-requests: write
checks: read
statuses: read

jobs:
close-failing-ci-prs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Process PRs with failing CI
run: ./scripts/close-failing-ci-prs.sh -o "${{ github.repository_owner }}" -r "${{ github.event.repository.name }}" -t "${{ secrets.GITHUB_TOKEN }}" -l
32 changes: 27 additions & 5 deletions .github/workflows/comment-failure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,31 @@ jobs:
with:
result-encoding: string
script: |
const workflowName = '${{ github.workflow }}';

const guidance = {
'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.',
'Website Linting': 'Run `make website-lint` and `make document-validate` locally to check your documentation files under `website/` for formatting or validation issues.',
'Generation Check': 'Run `make generate` locally to regenerate any auto-generated code, then commit the resulting changes.',
'GoLang Linting': 'Run the Go linter locally with `golangci-lint run -v ./internal/...` and fix any reported issues.',
'Terraform Schema Linting': 'Run `make tflint` locally and fix any Terraform schema issues in your resource or data source definitions.',
'Unit Tests': 'Run `make test` locally to reproduce and fix the failing unit tests.',
'ShellCheck Scripts': 'Run `make shellcheck` locally to check shell scripts for issues and fix any warnings or errors.',
'Validate Examples': 'Run `make validate-examples` locally to check that your example Terraform configurations under `examples/` are valid.',

};

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 }}).`;

if (guidance[workflowName]) {
body += `\n\n<b>How to fix:</b> ${guidance[workflowName]}`;
}

body += `\n\nFor more information, please refer to our [Contributing Guide](https://github.com/${{ github.repository }}/blob/main/contributing/README.md).`;

github.rest.issues.createComment({
issue_number: ${{ github.event.number }},
owner: context.repo.owner,
repo: context.repo.repo,
body: '<b>Build failure</b> \n\n This pull request contains a build failure which needs addressed [here](${{ env.gha_url}}) .'
})
issue_number: ${{ github.event.number }},
owner: context.repo.owner,
repo: context.repo.repo,
body: body
})
8 changes: 8 additions & 0 deletions .github/workflows/depscheck.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ jobs:
go-version-file: ./.go-version
- run: bash scripts/gogetcookie.sh
- run: make depscheck
- name: Guidance on failure
if: failure()
run: |
echo "::error::Vendor Dependencies Check failed."
echo ""
echo "Do not modify files in the vendor/ directory directly."
echo "Instead, update dependencies in go.mod and run 'go mod tidy && go mod vendor' to sync the vendor directory."
echo "Then run 'make depscheck' locally to verify before pushing."
save-artifacts-on-fail:
needs: depscheck
if: ${{ failure() }}
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/gencheck.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ jobs:
go-version-file: ./.go-version
- run: bash scripts/gogetcookie.sh
- run: make gencheck
- name: Guidance on failure
if: failure()
run: |
echo "::error::Generation Check failed."
echo ""
echo "Run 'make generate' locally to regenerate auto-generated code, then commit the changes."
echo "This check ensures that generated files are up to date with their source definitions."
save-artifacts-on-fail:
needs: gencheck
if: ${{ failure() }}
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/golint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ jobs:
with:
version: 'v2.4.0'
args: -v ./internal/...
- name: Guidance on failure
if: failure()
run: |
echo "::error::GoLang Linting failed."
echo ""
echo "Run the Go linter locally: golangci-lint run -v ./internal/..."
echo "Fix any reported issues before pushing. Common issues include:"
echo " - Unused variables or imports"
echo " - Error return values not checked"
echo " - Formatting issues (run 'gofmt -w .')"
save-artifacts-on-fail:
needs: golint
if: ${{ failure() }}
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/gradually-deprecated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ jobs:
with:
go-version-file: ./.go-version
- run: bash ./scripts/run-gradually-deprecated.sh
- name: Guidance on failure
if: failure()
run: |
echo "::error::New usage of deprecated functionality detected."
echo ""
echo "Your changes introduce new usages of deprecated functions or patterns."
echo "Please use the recommended replacement instead. Check the output above"
echo "for details on which deprecated items were referenced."
save-artifacts-on-fail:
needs: test
if: ${{ failure() }}
Expand Down
53 changes: 53 additions & 0 deletions .github/workflows/label-ci-status.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: 'Label CI Status on PRs'
on:
check_suite:
types: [completed]

permissions:
pull-requests: write

jobs:
label-ci-status:
runs-on: ubuntu-latest
# Only run for PRs, not pushes to branches
if: github.event.check_suite.pull_requests[0] != null
steps:
- name: Add or remove ci-failed label
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
const pullRequests = context.payload.check_suite.pull_requests;
const conclusion = context.payload.check_suite.conclusion;
const label = 'ci-failed';

for (const pr of pullRequests) {
const prNumber = pr.number;

// Get current labels
const { data: currentLabels } = await github.rest.issues.listLabelsOnIssue({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
});
const hasLabel = currentLabels.some(l => l.name === label);

if (conclusion === 'failure' && !hasLabel) {
console.log(`PR #${prNumber}: CI failed → adding '${label}' label`);
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
labels: [label],
});
} else if (conclusion === 'success' && hasLabel) {
console.log(`PR #${prNumber}: CI passed → removing '${label}' label`);
await github.rest.issues.removeLabel({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
name: label,
});
} else {
console.log(`PR #${prNumber}: conclusion=${conclusion}, hasLabel=${hasLabel} → no action`);
}
}
8 changes: 8 additions & 0 deletions .github/workflows/preview-api-version-linter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ jobs:
with:
go-version-file: ./.go-version
- run: go run internal/tools/preview-api-version-linter/main.go
- name: Guidance on failure
if: failure()
run: |
echo "::error::Preview API Version Linter failed."
echo ""
echo "Your changes reference Azure ARM API versions that are in preview."
echo "Preview API versions should not be used unless explicitly required and approved."
echo "Please update the API version references to use GA (stable) versions."
comment-on-fail:
needs: preview-api-version-linter
if: ${{ failure() }}
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/shellcheck.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ jobs:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Run ShellCheck
run: make shellcheck
- name: Guidance on failure
if: failure()
run: |
echo "::error::ShellCheck failed."
echo ""
echo "Run 'make shellcheck' locally to check shell scripts for issues."
echo "ShellCheck identifies common shell scripting pitfalls and bugs."
echo "See https://www.shellcheck.net/wiki/ for explanations of each warning code."
save-artifacts-on-fail:
needs: shellcheck
if: ${{ failure() }}
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/static-analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,11 @@ jobs:
with:
go-version-file: ./.go-version
- run: bash ./scripts/run-static-analysis.sh
- name: Guidance on failure
if: failure()
run: |
echo "::error::Static Analysis failed."
echo ""
echo "Run 'bash ./scripts/run-static-analysis.sh' locally to reproduce."
echo "This check looks for common code patterns that may indicate bugs or"
echo "deviations from project conventions."
9 changes: 9 additions & 0 deletions .github/workflows/tflint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ jobs:
- run: bash scripts/gogetcookie.sh
- run: make tools
- run: make tflint
- name: Guidance on failure
if: failure()
run: |
echo "::error::Terraform Schema Linting failed."
echo ""
echo "Run 'make tflint' locally to reproduce and fix the errors."
echo "This check validates Terraform schema definitions in your resource and data source code."
echo "Common issues include: missing descriptions, incorrect type definitions,"
echo "or schema validation rules that don't match the API."
save-artifacts-on-fail:
needs: tflint
if: ${{ failure() }}
Expand Down
37 changes: 0 additions & 37 deletions .github/workflows/thirty-two-bit.yaml

This file was deleted.

9 changes: 9 additions & 0 deletions .github/workflows/unit-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ jobs:
- run: make test
env:
GITHUB_ACTIONS_STAGE: "UNIT_TESTS"
- name: Guidance on failure
if: failure()
run: |
echo "::error::Unit Tests failed."
echo ""
echo "Run 'make test' locally to reproduce and fix the failing tests."
echo "If you have added a new resource or data source, ensure you have added"
echo "the corresponding unit tests. Check the test output above for details"
echo "on which tests failed and why."
save-artifacts-on-fail:
needs: test
if: ${{ failure() }}
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/validate-examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ jobs:
- run: bash scripts/gogetcookie.sh
- run: make tools
- run: make validate-examples
- name: Guidance on failure
if: failure()
run: |
echo "::error::Example Validation failed."
echo ""
echo "Run 'make validate-examples' locally to check that your example"
echo "Terraform configurations under examples/ are valid."
echo "Ensure all examples use valid HCL syntax and reference existing resources."
save-artifacts-on-fail:
needs: website-lint
if: ${{ failure() }}
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/website-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ jobs:
- run: make tools
- run: make website-lint
- run: make document-validate
- name: Guidance on failure
if: failure()
run: |
echo "::error::Website Linting failed."
echo ""
echo "Run 'make website-lint' and 'make document-validate' locally."
echo "Check your documentation files under website/ for formatting or validation issues."
echo "Common issues include: missing required frontmatter fields, incorrect markdown formatting,"
echo "or mismatched resource documentation with the schema definition."
save-artifacts-on-fail:
needs: website-lint
if: ${{ failure() }}
Expand Down
16 changes: 10 additions & 6 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,24 +57,25 @@ lint:
shellcheck:
@command -v shellcheck >/dev/null || (echo "shellcheck not installed. Install via: brew install shellcheck (macOS) or apt install shellcheck (Linux)" && exit 1)
@echo "==> Checking shell scripts with shellcheck..."
@shellcheck scripts/*.sh
@shellcheck scripts/*.sh || \
(echo; echo "ShellCheck found issues in shell scripts."; echo "Review the errors above and fix them. See https://www.shellcheck.net/ for detailed explanations of each rule."; exit 1)

depscheck:
@echo "==> Checking dependencies.."
@./scripts/track2-check.sh
@echo "==> Checking source code with go mod tidy..."
@go mod tidy
@git diff --exit-code -- go.mod go.sum || \
(echo; echo "Unexpected difference in go.mod/go.sum files. Run 'go mod tidy' command or revert any go.mod/go.sum changes and commit."; exit 1)
(echo; echo "Unexpected difference in go.mod/go.sum files. Run 'go mod tidy' command or revert any go.mod/go.sum changes and commit."; echo "Do not modify files in the vendor/ directory directly."; exit 1)
@echo "==> Checking source code with go mod vendor..."
@go mod vendor
@git diff --compact-summary --exit-code -- vendor || \
(echo; echo "Unexpected difference in vendor/ directory. Run 'go mod vendor' command or revert any go.mod/go.sum/vendor changes and commit."; exit 1)
(echo; echo "Unexpected difference in vendor/ directory. Run 'go mod vendor' command or revert any go.mod/go.sum/vendor changes and commit."; echo "Do not modify files in the vendor/ directory directly."; exit 1)

gencheck: generate
@echo "==> Comparing generated code to committed code..."
@git diff --compact-summary --exit-code -- ./ || \
(echo; echo "Unexpected difference in generated code. Run 'make generate' to update the generated code and commit."; exit 1)
(echo; echo "Unexpected difference in generated code. Run 'make generate' to update the generated code and commit."; echo "If you added or modified a resource, ensure 'go generate' directives are up to date."; exit 1)

tflint:
./scripts/run-tflint.sh
Expand Down Expand Up @@ -118,13 +119,16 @@ website-lint:
@echo "==> Checking documentation for .html.markdown extension present"
@if ! find website/docs -type f -not -name "*.html.markdown" -print -exec false {} +; then \
echo "ERROR: file extension should be .html.markdown"; \
echo "All documentation files must use the .html.markdown extension."; \
exit 1; \
fi
@echo "==> Checking documentation spelling..."
@misspell -error -source=text -i hdinsight,exportfs website/
@misspell -error -source=text -i hdinsight,exportfs website/ || \
(echo; echo "Spelling errors found in documentation. Install misspell: go install github.com/client9/misspell/cmd/misspell@latest"; exit 1)
@echo "==> Checking documentation for errors..."
@tfproviderdocs check -provider-name=azurerm -require-resource-subcategory \
-allowed-resource-subcategories-file website/allowed-subcategories
-allowed-resource-subcategories-file website/allowed-subcategories || \
(echo; echo "Documentation validation failed. Check that your docs follow the provider documentation format."; echo "See: contributing/topics/guide-new-resource.md for documentation requirements."; exit 1)
@sh -c "'$(CURDIR)/scripts/terrafmt-website.sh'"

website:
Expand Down
Loading
Loading