fix(controller): handle empty string pagination token (backport #1046) #128
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CRDs | |
| on: | |
| push: | |
| branches: | |
| - develop | |
| - 'release/**' | |
| pull_request: | |
| workflow_dispatch: {} | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| env: | |
| CARGO_TERM_COLOR: always | |
| CARGO_INCREMENTAL: 0 | |
| CI: 1 | |
| CTY_VERSION: 1.1.3 | |
| jobs: | |
| diskpool-crds: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: 'recursive' | |
| - uses: cachix/[email protected] | |
| - name: Pre-populate nix-shell | |
| run: | | |
| export NIX_PATH=nixpkgs=$(jq '.nixpkgs.url' nix/sources.json -r) | |
| echo "NIX_PATH=$NIX_PATH" >> $GITHUB_ENV | |
| nix-shell --run "echo" shell.nix | |
| - name: Handle Rust dependencies caching | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Install cty | |
| run: | | |
| OS=$(uname -s | tr '[:upper:]' '[:lower:]') | |
| ARCH=amd64 | |
| echo "Downloading cty v${CTY_VERSION} for ${OS}_${ARCH}" | |
| curl -fsSL https://github.com/Skarlso/crd-to-sample-yaml/releases/download/v${CTY_VERSION}/cty_${OS}_${ARCH}.tar.gz | tar -xz -C /usr/local/bin cty | |
| echo "/usr/local/bin" >> $GITHUB_PATH | |
| /usr/local/bin/cty version | |
| - name: Generate DiskPool CRD | |
| run: nix-shell --run "cargo run --bin operator-diskpool -- --generate-crd --output-dir k8s/crd_test/crds" | |
| - name: Verify DiskPool CRD | |
| run: | | |
| if [ ! -f k8s/crd_test/crds/diskpools.crd.yaml ]; then | |
| echo "DiskPool CRD was not generated correctly" | |
| exit 1 | |
| fi | |
| echo "DiskPool CRD was generated successfully" | |
| cat k8s/crd_test/crds/diskpools.crd.yaml | |
| - name: Test CRDs for backwards compatibility | |
| id: crd-test | |
| run: | | |
| # Run cty to test CRDs | |
| /usr/local/bin/cty test k8s/crd_test || { | |
| echo "Validation failed: Breaking changes detected." | |
| exit 1 | |
| } | |
| echo "Validation successful: No breaking changes detected." | |
| - name: Check changed files before commenting | |
| id: changes | |
| uses: dorny/paths-filter@v3 | |
| with: | |
| filters: | | |
| crd: | |
| - 'k8s/**' | |
| - name: Add PR comment to update snapshot if required | |
| if: ${{ success() && github.event_name == 'pull_request' && steps.changes.outputs.crd == 'true' }} | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| const prNumber = context.payload.pull_request.number; | |
| const body = ` | |
| **CRD snapshot files may be out-of-date** | |
| Please update the CRD snapshots by running: | |
| \`\`\`bash | |
| cty test k8s/crd_test --update | |
| \`\`\` | |
| and add updated snapshot to the PR patch. | |
| `; | |
| await github.rest.issues.createComment({ | |
| ...context.repo, | |
| issue_number: prNumber, | |
| body | |
| }) |