Loading
Remove deprecated previousStageJobsOrNeeds property from GraphQL query
Issue: Frontend: Update pipeline GraphQL query to use ... (#537273 - closed) • Sahil Sharma • 18.5
What does this MR do and why?
This MR removes the deprecated previousStageJobsOrNeeds GraphQL field from the frontend pipeline details query and replaces it with the previousStageJobs field.
The previousStageJobsOrNeeds field was deprecated in GitLab 16.4 and is scheduled for removal in GitLab 19.0. This change ensures the frontend continues to work after the backend field removal.
References
How to set up and validate locally
Option 1: Test with existing pipelines
- Navigate to any project pipeline: http://gdk.test:3000/gitlab-org/gitlab-shell/-/pipelines
- Verify pipeline graph renders correctly:
- Check that job dependencies are displayed properly
- Ensure no console errors or GraphQL errors
Option 2: Create test pipelines
Use the sample YAML configurations below to create pipelines that test different dependency scenarios:
Sample Pipeline YAML Configurations
1. Simple Stage-Based Pipeline
# .gitlab-ci.yml - Stage-based pipeline
stages:
- build
- test
- deploy
# Build stage
build_app:
stage: build
script:
- echo "Building application..."
- sleep 2
build_docker:
stage: build
script:
- echo "Building Docker image..."
- sleep 3
# Test stage (depends on build stage completion)
unit_tests:
stage: test
script:
- echo "Running unit tests..."
- sleep 2
integration_tests:
stage: test
script:
- echo "Running integration tests..."
- sleep 3
lint_code:
stage: test
script:
- echo "Linting code..."
- sleep 1
# Deploy stage (depends on test stage completion)
deploy_staging:
stage: deploy
script:
- echo "Deploying to staging..."
- sleep 2
deploy_production:
stage: deploy
script:
- echo "Deploying to production..."
- sleep 2
when: manual
2. Jobs with explicit needs
# .gitlab-ci.yml - Pipeline with explicit needs
stages:
- prepare
- build
- test
- security
- deploy
install_dependencies:
stage: prepare
script:
- echo "Installing dependencies..."
- sleep 2
generate_version:
stage: prepare
script:
- echo "Generating version..."
- sleep 1
# Build jobs with specific dependencies
build_frontend:
stage: build
needs:
- install_dependencies
- generate_version
script:
- echo "Building frontend..."
- sleep 3
build_backend:
stage: build
needs:
- install_dependencies
- generate_version
script:
- echo "Building backend..."
- sleep 4
build_docs:
stage: build
needs:
- install_dependencies
script:
- echo "Building documentation..."
- sleep 2
# Test jobs with specific needs
test_frontend:
stage: test
needs:
- build_frontend
script:
- echo "Testing frontend..."
- sleep 2
test_backend:
stage: test
needs:
- build_backend
script:
- echo "Testing backend..."
- sleep 3
test_e2e:
stage: test
needs:
- build_frontend
- build_backend
script:
- echo "Running E2E tests..."
- sleep 5
security_scan_frontend:
stage: security
needs:
- build_frontend
script:
- echo "Scanning frontend for vulnerabilities..."
- sleep 2
security_scan_backend:
stage: security
needs:
- build_backend
script:
- echo "Scanning backend for vulnerabilities..."
- sleep 3
# Deploy jobs with complex dependencies
deploy_docs:
stage: deploy
needs:
- build_docs
script:
- echo "Deploying documentation..."
- sleep 1
deploy_staging:
stage: deploy
needs:
- test_frontend
- test_backend
- test_e2e
- security_scan_frontend
- security_scan_backend
script:
- echo "Deploying to staging..."
- sleep 3
deploy_production:
stage: deploy
needs:
- deploy_staging
script:
- echo "Deploying to production..."
- sleep 2
when: manual
3. Mixed Pipeline (Stage-based + explicit needs)
# .gitlab-ci.yml - Mixed pipeline (stages + explicit needs)
stages:
- prepare
- build
- test
- security
- package
- deploy
cache_dependencies:
stage: prepare
script:
- echo "Caching dependencies..."
- sleep 2
setup_environment:
stage: prepare
script:
- echo "Setting up environment..."
- sleep 1
validate_config:
stage: prepare
script:
- echo "Validating configuration..."
- sleep 1
compile_java:
stage: build
script:
- echo "Compiling Java code..."
- sleep 3
compile_frontend:
stage: build
script:
- echo "Compiling frontend..."
- sleep 2
# Mixed: Some tests use stages, others use explicit needs
unit_tests:
stage: test
script:
- echo "Running unit tests..."
- sleep 2
integration_tests:
stage: test
script:
- echo "Running integration tests..."
- sleep 4
frontend_tests:
stage: test
needs:
- compile_frontend
script:
- echo "Running frontend tests..."
- sleep 2
api_tests:
stage: test
needs:
- compile_java
- compile_frontend
script:
- echo "Running API tests..."
- sleep 3
# Mixed dependencies
dependency_scan:
stage: security
script:
- echo "Scanning dependencies..."
- sleep 2
code_quality:
stage: security
needs:
- compile_java
script:
- echo "Running code quality checks..."
- sleep 3
container_scan:
stage: security
needs:
- unit_tests
- integration_tests
script:
- echo "Scanning container..."
- sleep 2
# Package stage (stage-based)
build_jar:
stage: package
script:
- echo "Building JAR..."
- sleep 2
build_docker:
stage: package
script:
- echo "Building Docker image..."
- sleep 3
# Deploy with mixed dependencies
deploy_staging:
stage: deploy
needs:
- build_docker
- dependency_scan
- code_quality
script:
- echo "Deploying to staging..."
- sleep 2
deploy_docs:
stage: deploy
script:
- echo "Deploying documentation..."
- sleep 1
deploy_production:
stage: deploy
needs:
- deploy_staging
- container_scan
script:
- echo "Deploying to production..."
- sleep 2
when: manual
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Edited by Sahil Sharma