feat(backend): postgres integration #129
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: API Server Tests - Postgres | |
| on: | |
| push: | |
| branches: | |
| - master | |
| - feature/postgres-integration # temp for trigger CI on my fork | |
| pull_request: | |
| paths: | |
| - "backend/**" | |
| - "manifests/kustomize/third-party/postgresql/**" | |
| - ".github/resources/manifests/standalone/**" | |
| - ".github/workflows/kfp-backend-v2-postgres-tests.yml" | |
| - "!**/*.md" | |
| - "!**/OWNERS" | |
| env: | |
| NAMESPACE: kubeflow | |
| POSTGRES_NAMESPACE: kubeflow | |
| DB_TYPE: postgres | |
| DB_DRIVER: pgx | |
| DB_PORT: "5432" | |
| DB_USER: user | |
| DB_PASSWORD: password | |
| DB_NAME: mlpipeline | |
| jobs: | |
| build: | |
| uses: ./.github/workflows/image-builds-with-cache.yml | |
| postgres-pgx: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| continue-on-error: false | |
| strategy: | |
| matrix: | |
| cache_enabled: [true, false] | |
| fail-fast: false # Ensure all jobs in the matrix run, even if one fails | |
| name: KFP Backend V2 Postgres Tests (Cache ${{ matrix.cache_enabled }}) | |
| steps: | |
| - name: Checkout target code | |
| uses: actions/checkout@v5 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.22" | |
| cache: true | |
| - name: Create KFP cluster | |
| uses: ./.github/actions/create-cluster | |
| with: | |
| k8s_version: "v1.30.2" | |
| - name: Deploy KFP with Postgres | |
| uses: ./.github/actions/deploy | |
| with: | |
| db_type: "pgx" | |
| pipeline_store: "database" | |
| cache_enabled: ${{ matrix.cache_enabled }} | |
| image_path: ${{ needs.build.outputs.IMAGE_PATH }} | |
| image_tag: ${{ needs.build.outputs.IMAGE_TAG }} | |
| image_registry: ${{ needs.build.outputs.IMAGE_REGISTRY }} | |
| forward_port: "true" | |
| - name: Port-forward Postgres | |
| run: kubectl -n "$POSTGRES_NAMESPACE" port-forward svc/postgres-service ${{ env.DB_PORT }}:${{ env.DB_PORT }} & | |
| - name: Port-forward ML Metadata service | |
| run: kubectl -n "$NAMESPACE" port-forward svc/metadata-grpc-service 8080:8080 & | |
| - name: Run v2 api tests | |
| uses: ./.github/actions/test-and-report | |
| with: | |
| pipeline_store: "database" | |
| cache_enabled: ${{ matrix.cache_enabled }} | |
| test_directory: "./backend/test/v2/api" | |
| test_label: "!UpgradePreparation && !UpgradeVerification" | |
| default_namespace: ${{ env.NAMESPACE }} | |
| report_name: "Postgres_Cache${{ matrix.cache_enabled }}" | |
| - name: Run v2 integration tests | |
| run: | | |
| # v2/integration tests use testify/suite framework, not Ginkgo, so we must use 'go test' instead of 'ginkgo' | |
| # Build the go test command with appropriate flags | |
| TEST_CMD="go test -v -timeout 30m ./backend/test/v2/integration/..." | |
| # Arguments for the test binary (passed after -args) | |
| TEST_ARGS="-runIntegrationTests=true -namespace=$NAMESPACE -cacheEnabled=${{ matrix.cache_enabled }} -repoName=${{ github.repository }} -branchName=${{ github.ref_name }}" | |
| if [[ "${{ matrix.cache_enabled }}" == "false" ]]; then | |
| # When cache is disabled, we must skip the cache test itself. | |
| # Use Go test's -skip flag to exclude TestCache | |
| TEST_CMD="$TEST_CMD -skip TestCache" | |
| fi | |
| # Execute the test command with arguments | |
| eval "$TEST_CMD -args $TEST_ARGS" | |
| env: | |
| PULL_NUMBER: ${{ github.event.pull_request.number }} | |
| - name: Collect pod logs | |
| if: always() | |
| run: | | |
| mkdir -p /tmp/tmp.kfp /tmp/tmp.postgres | |
| ./.github/resources/scripts/collect-logs.sh --ns "$NAMESPACE" --output /tmp/tmp.kfp/pod_log.txt | |
| ./.github/resources/scripts/collect-logs.sh --ns "$POSTGRES_NAMESPACE" --output /tmp/tmp.postgres/pod_log.txt | |
| - name: Upload test artifacts | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: api-server-postgres-test-artifacts-cache-${{ matrix.cache_enabled }} | |
| path: /tmp/tmp*/* |