diff --git a/.github/workflows/codecov-main.yaml b/.github/workflows/codecov-main.yaml deleted file mode 100644 index 3843477ee..000000000 --- a/.github/workflows/codecov-main.yaml +++ /dev/null @@ -1,20 +0,0 @@ -name: Codecov report on push to the "main" branch -on: - push: - branches: [ main ] -jobs: - coverage: - name: Envtest and coverage report - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 - with: - go-version-file: './go.mod' - - name: Run tests - run: make test - - name: Codecov - uses: codecov/codecov-action@v4 - with: - token: ${{ secrets.CODECOV_TOKEN }} - verbose: true diff --git a/.github/workflows/docs-enhancer.yml b/.github/workflows/docs-enhancer.yml new file mode 100644 index 000000000..93a267ca3 --- /dev/null +++ b/.github/workflows/docs-enhancer.yml @@ -0,0 +1,56 @@ +name: Auto-Update Documentation + +on: + issue_comment: + types: [created] + +permissions: + contents: read + issues: read + pull-requests: read + +jobs: + update-docs: + runs-on: ubuntu-latest + if: | + github.event.issue.pull_request && + contains(github.event.comment.body, '[update-docs]') + steps: + - name: Get PR information + id: pr_info + if: github.event.issue.pull_request + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} + run: | + PR_NUMBER=${{ github.event.issue.number }} + echo "Extracting PR information for PR #$PR_NUMBER" + PR_DATA=$(gh api repos/${{ github.repository }}/pulls/$PR_NUMBER) + + HEAD_REF=$(echo "$PR_DATA" | jq -r '.head.ref') + HEAD_REPO=$(echo "$PR_DATA" | jq -r '.head.repo.full_name') + BASE_REF=$(echo "$PR_DATA" | jq -r '.base.ref') + + echo "head_ref=$HEAD_REF" >> $GITHUB_OUTPUT + echo "head_repo=$HEAD_REPO" >> $GITHUB_OUTPUT + echo "base_ref=$BASE_REF" >> $GITHUB_OUTPUT + echo "pr_number=$PR_NUMBER" >> $GITHUB_OUTPUT + + echo "PR info extracted: #$PR_NUMBER, base: $BASE_REF, head: $HEAD_REF" + + - name: Checkout PR Code + uses: actions/checkout@v4 + with: + repository: ${{ steps.pr_info.outputs.head_repo || github.repository }} + ref: ${{ steps.pr_info.outputs.head_ref || github.ref }} + fetch-depth: 0 + token: ${{ secrets.GH_TOKEN }} + + - name: Update Documentation + uses: csoceanu/code-to-docs@v1.0.12 + with: + gemini-api-key: ${{ secrets.GEMINI_API_KEY }} + docs-repo-url: ${{ secrets.DOCS_REPO_URL }} + github-token: ${{ secrets.GH_TOKEN }} + pr-number: ${{ github.event.issue.number }} + pr-base: origin/${{ steps.pr_info.outputs.base_ref || 'main' }} + pr-head-sha: ${{ steps.pr_info.outputs.head_ref }} diff --git a/.github/workflows/kube-linter.yaml b/.github/workflows/kube-linter.yaml deleted file mode 100644 index 9442a93ef..000000000 --- a/.github/workflows/kube-linter.yaml +++ /dev/null @@ -1,55 +0,0 @@ -name: Check Kubernetes YAMLs with kube-linter - -on: - pull_request: - branches: [ main ] - paths: - - 'config/default/**.ya?ml' - - 'config/crd/**.ya?ml' - - 'config/rbac/**.ya?ml' - - 'config/manager/**.ya?ml' - - 'config/monitoring/prometheus/**.ya?ml' - - '.github/workflows/kube-linter.yaml' - -jobs: - kube-linter: - name: Kube linter - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Create ../kube-linter/ for deployment yaml files - shell: bash - run: mkdir -p ../kube-linter/ - - - name: Generate Build Service operator deployment configuration - shell: bash - run: kustomize build config/default/ > ../kube-linter/build-service.yaml - - - name: Scan yaml files with kube-linter - uses: stackrox/kube-linter-action@v1 - id: kube-linter-action-scan - with: - # Where to do scanning - directory: ../kube-linter/ - # Where to search for kube-linter config. Removing the setting make using the default config. - config: ./.github/.kube-linter-config.yaml - # The following two settings make kube-linter produce scan analysis in SARIF format - # which would then be made available in GitHub UI via upload-sarif action below. - format: sarif - output-file: ../kube-linter/kube-linter.sarif - # The following line prevents aborting the workflow immediately in case your files fail kube-linter checks. - # This allows the following upload-sarif action to still upload the results to your GitHub repo. - continue-on-error: true - - - name: Upload SARIF report files to GitHub - uses: github/codeql-action/upload-sarif@v2 - with: - sarif_file: ../kube-linter/kube-linter.sarif - - # Ensure the workflow eventually fails if files did not pass kube-linter checks. - - name: Verify kube-linter-action succeeded - shell: bash - run: | - echo "If this step fails, kube-linter found issues. Check the output of the scan step above." - [[ "${{ steps.kube-linter-action-scan.outcome }}" == "success" ]] diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml deleted file mode 100644 index 2e42e28ff..000000000 --- a/.github/workflows/pr.yaml +++ /dev/null @@ -1,52 +0,0 @@ -name: Validate PR -on: - pull_request: - branches: [ main ] -jobs: - lint: - name: Lint - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 - with: - go-version-file: './go.mod' - - name: golangci-lint - uses: golangci/golangci-lint-action@v3 - with: - args: --timeout=5m - - security_scan: - name: Security scan - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 - with: - go-version-file: './go.mod' - - # https://github.com/securego/gosec/blob/12be14859bc7d4b956b71bef0b443694aa519d8a/README.md#integrating-with-code-scanning - - name: Run Gosec Security Scanner - # pin gosec to use v2.21.0 temporarily, once upstream issue https://github.com/securego/gosec/issues/1214 is fixed, revert it to use master - uses: securego/gosec@v2.21.0 - with: - # we let the report trigger content trigger a failure using the GitHub Security features. - args: '-no-fail -fmt sarif -out results.sarif ./...' - - name: Upload SARIF file - uses: github/codeql-action/upload-sarif@v3 - with: - # Path to SARIF file relative to the root of the repository - sarif_file: results.sarif - - envtest: - name: Envtest - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 - with: - go-version-file: './go.mod' - - name: Run tests - run: make test - - name: Upload to Codecov - uses: codecov/codecov-action@v3.1.1 diff --git a/config/default/kustomization.yaml b/config/default/kustomization.yaml index 5dcbdc5e0..585389bd5 100644 --- a/config/default/kustomization.yaml +++ b/config/default/kustomization.yaml @@ -1,4 +1,6 @@ # Adds namespace to all resources. +# Updated configuration to support enhanced documentation automation +# FEATURE: Added enhanced monitoring and webhook support for better observability and debugging namespace: build-service-system # Value of this field is prepended to the @@ -9,10 +11,13 @@ namespace: build-service-system namePrefix: build-service- # Labels to add to all resources and selectors. -#labels: -#- includeSelectors: true -# pairs: -# someName: someValue +# NEW: Enable standardized labeling for resource identification and monitoring +labels: +- includeSelectors: true + pairs: + app.kubernetes.io/name: build-service + app.kubernetes.io/component: controller + monitoring: enabled resources: #- ../crd @@ -20,9 +25,11 @@ resources: - ../manager # [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in # crd/kustomization.yaml -#- ../webhook +# ENABLED: Webhook server for validation and mutation +- ../webhook # [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'. 'WEBHOOK' components are required. -#- ../certmanager +# ENABLED: Certificate manager for automated TLS certificate management +- ../certmanager # [METRICS] Expose the controller manager metrics service. - metrics_service.yaml @@ -30,7 +37,8 @@ resources: # Only Pod(s) running a namespace labeled with 'metrics: enabled' will be able to gather the metrics. # Only CR(s) which requires webhooks and are applied on namespaces labeled with 'webhooks: enabled' will # be able to communicate with the Webhook Server. -#- ../network-policy +# ENABLED: Network policies for enhanced security posture +- ../network-policy # Uncomment the patches line if you enable Metrics, and/or are using webhooks and cert-manager patches: