fix: disable unnecessary fetch_materials option for pipeline-complete branches#89
Merged
mchen-sentry merged 2 commits intomainfrom Mar 5, 2026
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Orphaned golden files with no matching fixture
- Removed the two orphaned
rollback-final-stage-overridegolden files so only fixture-backed goldens remain.
- Removed the two orphaned
Or push these changes by commenting:
@cursor push 0e07865eab
Preview (0e07865eab)
diff --git a/test/testdata/goldens/pipedream/rollback-final-stage-override.jsonnet_output-files.golden b/test/testdata/goldens/pipedream/rollback-final-stage-override.jsonnet_output-files.golden
deleted file mode 100644
--- a/test/testdata/goldens/pipedream/rollback-final-stage-override.jsonnet_output-files.golden
+++ /dev/null
@@ -1,484 +1,0 @@
-{
- "deploy-example-customer-1.yaml": {
- "format_version": 10,
- "pipelines": {
- "deploy-example-customer-1": {
- "display_order": 5,
- "group": "example",
- "materials": {
- "deploy-example-us-pipeline-complete": {
- "pipeline": "deploy-example-us",
- "stage": "pipeline-complete"
- },
- "example_repo": {
- "branch": "master",
- "destination": "example",
- "git": "git@github.com:getsentry/example.git"
- }
- },
- "stages": [
- {
- "deploy": {
- "jobs": {
- "deploy": {
- "elastic_profile_id": "example",
- "tasks": [
- {
- "script": "./deploy.sh --region=customer-1"
- }
- ]
- }
- }
- }
- },
- {
- "pipeline-complete": {
- "fetch_materials": false,
- "jobs": {
- "pipeline-complete": {
- "tasks": [
- {
- "exec": {
- "command": true
- }
- }
- ]
- }
- }
- }
- }
- ]
- }
- }
- },
- "deploy-example-customer-2.yaml": {
- "format_version": 10,
- "pipelines": {
- "deploy-example-customer-2": {
- "display_order": 6,
- "group": "example",
- "materials": {
- "deploy-example-customer-1-pipeline-complete": {
- "pipeline": "deploy-example-customer-1",
- "stage": "pipeline-complete"
- },
- "example_repo": {
- "branch": "master",
- "destination": "example",
- "git": "git@github.com:getsentry/example.git"
- }
- },
- "stages": [
- {
- "deploy": {
- "jobs": {
- "deploy": {
- "elastic_profile_id": "example",
- "tasks": [
- {
- "script": "./deploy.sh --region=customer-2"
- }
- ]
- }
- }
- }
- },
- {
- "pipeline-complete": {
- "fetch_materials": false,
- "jobs": {
- "pipeline-complete": {
- "tasks": [
- {
- "exec": {
- "command": true
- }
- }
- ]
- }
- }
- }
- }
- ]
- }
- }
- },
- "deploy-example-customer-4.yaml": {
- "format_version": 10,
- "pipelines": {
- "deploy-example-customer-4": {
- "display_order": 7,
- "group": "example",
- "materials": {
- "deploy-example-customer-2-pipeline-complete": {
- "pipeline": "deploy-example-customer-2",
- "stage": "pipeline-complete"
- },
- "example_repo": {
- "branch": "master",
- "destination": "example",
- "git": "git@github.com:getsentry/example.git"
- }
- },
- "stages": [
- {
- "deploy": {
- "jobs": {
- "deploy": {
- "elastic_profile_id": "example",
- "tasks": [
- {
- "script": "./deploy.sh --region=customer-4"
- }
- ]
- }
- }
- }
- },
- {
- "pipeline-complete": {
- "fetch_materials": false,
- "jobs": {
- "pipeline-complete": {
- "tasks": [
- {
- "exec": {
- "command": true
- }
- }
- ]
- }
- }
- }
- }
- ]
- }
- }
- },
- "deploy-example-customer-7.yaml": {
- "format_version": 10,
- "pipelines": {
- "deploy-example-customer-7": {
- "display_order": 8,
- "group": "example",
- "materials": {
- "deploy-example-customer-4-pipeline-complete": {
- "pipeline": "deploy-example-customer-4",
- "stage": "pipeline-complete"
- },
- "example_repo": {
- "branch": "master",
- "destination": "example",
- "git": "git@github.com:getsentry/example.git"
- }
- },
- "stages": [
- {
- "deploy": {
- "jobs": {
- "deploy": {
- "elastic_profile_id": "example",
- "tasks": [
- {
- "script": "./deploy.sh --region=customer-7"
- }
- ]
- }
- }
- }
- },
- {
- "pipeline-complete": {
- "fetch_materials": false,
- "jobs": {
- "pipeline-complete": {
- "tasks": [
- {
- "exec": {
- "command": true
- }
- }
- ]
- }
- }
- }
- }
- ]
- }
- }
- },
- "deploy-example-de.yaml": {
- "format_version": 10,
- "pipelines": {
- "deploy-example-de": {
- "display_order": 3,
- "group": "example",
- "materials": {
- "deploy-example-s4s2-pipeline-complete": {
- "pipeline": "deploy-example-s4s2",
- "stage": "pipeline-complete"
- },
- "example_repo": {
- "branch": "master",
- "destination": "example",
- "git": "git@github.com:getsentry/example.git"
- }
- },
- "stages": [
- {
- "deploy": {
- "jobs": {
- "deploy": {
- "elastic_profile_id": "example",
- "tasks": [
- {
- "script": "./deploy.sh --region=de"
- }
- ]
- }
- }
- }
- },
- {
- "pipeline-complete": {
- "fetch_materials": false,
- "jobs": {
- "pipeline-complete": {
- "tasks": [
- {
- "exec": {
- "command": true
- }
- }
- ]
- }
- }
- }
- }
- ]
- }
- }
- },
- "deploy-example-s4s.yaml": {
- "format_version": 10,
- "pipelines": {
- "deploy-example-s4s": {
- "display_order": 9,
- "group": "example",
- "materials": {
- "example_repo": {
- "branch": "master",
- "destination": "example",
- "git": "git@github.com:getsentry/example.git"
- }
- },
- "stages": [
- {
- "deploy": {
- "jobs": {
- "deploy": {
- "elastic_profile_id": "example",
- "tasks": [
- {
- "script": "./deploy.sh --region=s4s"
- }
- ]
- }
- }
- }
- },
- {
- "pipeline-complete": {
- "fetch_materials": false,
- "jobs": {
- "pipeline-complete": {
- "tasks": [
- {
- "exec": {
- "command": true
- }
- }
- ]
- }
- }
- }
- }
- ]
- }
- }
- },
- "deploy-example-s4s2.yaml": {
- "format_version": 10,
- "pipelines": {
- "deploy-example-s4s2": {
- "display_order": 2,
- "group": "example",
- "materials": {
- "example_repo": {
- "branch": "master",
- "destination": "example",
- "git": "git@github.com:getsentry/example.git"
- }
- },
- "stages": [
- {
- "deploy": {
- "jobs": {
- "deploy": {
- "elastic_profile_id": "example",
- "tasks": [
- {
- "script": "./deploy.sh --region=s4s2"
- }
- ]
- }
- }
- }
- },
- {
- "pipeline-complete": {
- "fetch_materials": false,
- "jobs": {
- "pipeline-complete": {
- "tasks": [
- {
- "exec": {
- "command": true
- }
- }
- ]
- }
- }
- }
- }
- ]
- }
- }
- },
- "deploy-example-us.yaml": {
- "format_version": 10,
- "pipelines": {
- "deploy-example-us": {
- "display_order": 4,
- "group": "example",
- "materials": {
- "deploy-example-de-pipeline-complete": {
- "pipeline": "deploy-example-de",
- "stage": "pipeline-complete"
- },
- "example_repo": {
- "branch": "master",
- "destination": "example",
- "git": "git@github.com:getsentry/example.git"
- }
- },
- "stages": [
- {
- "deploy": {
- "jobs": {
- "deploy": {
- "elastic_profile_id": "example",
- "tasks": [
- {
- "script": "./deploy.sh --region=us"
- }
- ]
- }
- }
- }
- },
- {
- "pipeline-complete": {
- "fetch_materials": false,
- "jobs": {
- "pipeline-complete": {
- "tasks": [
- {
- "exec": {
- "command": true
- }
- }
- ]
- }
- }
- }
- }
- ]
- }
- }
- },
- "rollback-example.yaml": {
- "format_version": 10,
- "pipelines": {
- "rollback-example": {
- "display_order": 1,
- "environment_variables": {
- "ALL_PIPELINE_FLAGS": "--pipeline=deploy-example-s4s2 --pipeline=deploy-example-de --pipeline=deploy-example-us --pipeline=deploy-example-customer-1 --pipeline=deploy-example-customer-2 --pipeline=deploy-example-customer-4 --pipeline=deploy-example-customer-7",
- "GOCD_ACCESS_TOKEN": "{{SECRET:[devinfra][gocd_access_token]}}",
- "REGION_PIPELINE_FLAGS": "--pipeline=deploy-example-s4s2 --pipeline=deploy-example-de --pipeline=deploy-example-us --pipeline=deploy-example-customer-1 --pipeline=deploy-example-customer-2 --pipeline=deploy-example-customer-4 --pipeline=deploy-example-customer-7",
- "ROLLBACK_MATERIAL_NAME": "example_repo",
- "ROLLBACK_STAGE": "deploy",
- "TRIGGERED_BY": ""
- },
- "group": "example",
- "lock_behavior": "unlockWhenFinished",
- "materials": {
- "deploy-example-customer-7-deploy": {
- "pipeline": "deploy-example-customer-7",
- "stage": "deploy"
- }
- },
- "stages": [
- {
- "pause_pipelines": {
- "approval": {
- "type": "manual"
- },
- "jobs": {
- "rollback": {
- "elastic_profile_id": "example",
- "tasks": [
- {
- "script": "##!/bin/bash\n\n## Note: $ALL_PIPELINE_FLAGS has no quoting, for word expansion\n## shellcheck disable=SC2086\nif [[ \"${ALL_PIPELINE_FLAGS:-}\" ]]; then\n set -- $ALL_PIPELINE_FLAGS\nfi\n\n## The user that triggered the rollback\nTRIGGERED_BY=\"${TRIGGERED_BY:-}\"\n\npause_message='This pipeline is being rolled back, please check with team before un-pausing.'\n\n## Include triggered by in the pause message if it is not empty\nif [ -n \"$TRIGGERED_BY\" ]; then\n pause_message=\"$pause_message Triggered by: $TRIGGERED_BY\"\nfi\n\n## Pause all pipelines in the pipedream\ngocd-pause-and-cancel-pipelines \\\n --pause-message=\"$pause_message\" \\\n \"$@\"\n"
- }
- ]
- }
- }
- }
- },
- {
- "start_rollback": {
- "jobs": {
- "rollback": {
- "elastic_profile_id": "example",
- "tasks": [
- {
- "script": "##!/bin/bash\n\n## Note: $REGION_PIPELINE_FLAGS has no quoting, for word expansion\n## shellcheck disable=SC2086\nif [[ \"${REGION_PIPELINE_FLAGS:-}\" ]]; then\n set -- $REGION_PIPELINE_FLAGS\nfi\n\n## The user that triggered the rollback\nTRIGGERED_BY=\"${TRIGGERED_BY:-}\"\n\npause_message='This pipeline was rolled back, please check with team before un-pausing.'\n\n## Include triggered by in the pause message if it is not empty\nif [ -n \"$TRIGGERED_BY\" ]; then\n pause_message=\"$pause_message Triggered by: $TRIGGERED_BY\"\nfi\n\n## Get sha from the given pipeline run to deploy to all pipedream pipelines.\nsha=$(gocd-sha-for-pipeline --material-name=\"${ROLLBACK_MATERIAL_NAME}\")\n\necho \"📑 Rolling back to sha: ${sha}\"\n\ngocd-emergency-deploy \\\n --material-name=\"${ROLLBACK_MATERIAL_NAME}\" \\\n --commit-sha=\"${sha}\" \\\n --deploy-stage=\"${ROLLBACK_STAGE}\" \\\n --pause-message=\"$pause_message\" \\\n \"$@\"\n"
- }
- ]
- }
- }
- }
- },
- {
- "incident_resolved": {
- "approval": {
- "type": "manual"
- },
- "jobs": {
- "rollback": {
- "elastic_profile_id": "example",
- "tasks": [
- {
- "script": "##!/bin/bash\n\n## Note: $ALL_PIPELINE_FLAGS has no quoting, for word expansion\n## shellcheck disable=SC2086\nif [[ \"${ALL_PIPELINE_FLAGS:-}\" ]]; then\n set -- $ALL_PIPELINE_FLAGS\nfi\n\n## Unpause and unlock all pipelines in the pipedream\ngocd-unpause-and-unlock-pipelines \\\n \"$@\"\n"
- }
- ]
- }
- }
- }
- }
- ]
- }
- }
- }
-}
\ No newline at end of file
diff --git a/test/testdata/goldens/pipedream/rollback-final-stage-override.jsonnet_single-file.golden b/test/testdata/goldens/pipedream/rollback-final-stage-override.jsonnet_single-file.golden
deleted file mode 100644
--- a/test/testdata/goldens/pipedream/rollback-final-stage-override.jsonnet_single-file.golden
+++ /dev/null
@@ -1,442 +1,0 @@
-{
- "format_version": 10,
- "pipelines": {
- "deploy-example-customer-1": {
- "display_order": 5,
- "group": "example",
- "materials": {
- "deploy-example-us-pipeline-complete": {
- "pipeline": "deploy-example-us",
- "stage": "pipeline-complete"
- },
- "example_repo": {
- "branch": "master",
- "destination": "example",
- "git": "git@github.com:getsentry/example.git"
- }
- },
- "stages": [
- {
- "deploy": {
- "jobs": {
- "deploy": {
- "elastic_profile_id": "example",
- "tasks": [
- {
- "script": "./deploy.sh --region=customer-1"
- }
- ]
- }
- }
- }
- },
- {
- "pipeline-complete": {
- "fetch_materials": false,
- "jobs": {
- "pipeline-complete": {
- "tasks": [
- {
- "exec": {
- "command": true
- }
- }
- ]
- }
- }
- }
- }
- ]
- },
- "deploy-example-customer-2": {
- "display_order": 6,
- "group": "example",
- "materials": {
- "deploy-example-customer-1-pipeline-complete": {
- "pipeline": "deploy-example-customer-1",
- "stage": "pipeline-complete"
- },
- "example_repo": {
- "branch": "master",
- "destination": "example",
- "git": "git@github.com:getsentry/example.git"
- }
- },
- "stages": [
- {
- "deploy": {
- "jobs": {
- "deploy": {
- "elastic_profile_id": "example",
- "tasks": [
- {
- "script": "./deploy.sh --region=customer-2"
- }
- ]
- }
- }
- }
- },
- {
- "pipeline-complete": {
- "fetch_materials": false,
- "jobs": {
- "pipeline-complete": {
- "tasks": [
- {
- "exec": {
- "command": true
- }
- }
- ]
- }
- }
- }
- }
- ]
- },
- "deploy-example-customer-4": {
- "display_order": 7,
- "group": "example",
- "materials": {
- "deploy-example-customer-2-pipeline-complete": {
- "pipeline": "deploy-example-customer-2",
- "stage": "pipeline-complete"
- },
- "example_repo": {
- "branch": "master",
- "destination": "example",
- "git": "git@github.com:getsentry/example.git"
- }
- },
- "stages": [
- {
- "deploy": {
- "jobs": {
- "deploy": {
- "elastic_profile_id": "example",
- "tasks": [
- {
- "script": "./deploy.sh --region=customer-4"
- }
- ]
- }
- }
- }
- },
- {
- "pipeline-complete": {
- "fetch_materials": false,
- "jobs": {
- "pipeline-complete": {
- "tasks": [
- {
- "exec": {
- "command": true
- }
- }
- ]
- }
- }
- }
- }
- ]
- },
- "deploy-example-customer-7": {
- "display_order": 8,
- "group": "example",
- "materials": {
- "deploy-example-customer-4-pipeline-complete": {
- "pipeline": "deploy-example-customer-4",
- "stage": "pipeline-complete"
- },
- "example_repo": {
- "branch": "master",
- "destination": "example",
- "git": "git@github.com:getsentry/example.git"
- }
- },
- "stages": [
- {
- "deploy": {
- "jobs": {
- "deploy": {
- "elastic_profile_id": "example",
- "tasks": [
- {
- "script": "./deploy.sh --region=customer-7"
- }
- ]
- }
- }
- }
- },
- {
- "pipeline-complete": {
- "fetch_materials": false,
- "jobs": {
- "pipeline-complete": {
- "tasks": [
- {
- "exec": {
- "command": true
- }
- }
- ]
- }
- }
- }
- }
- ]
- },
- "deploy-example-de": {
- "display_order": 3,
- "group": "example",
- "materials": {
- "deploy-example-s4s2-pipeline-complete": {
- "pipeline": "deploy-example-s4s2",
- "stage": "pipeline-complete"
- },
- "example_repo": {
- "branch": "master",
- "destination": "example",
- "git": "git@github.com:getsentry/example.git"
- }
- },
- "stages": [
- {
- "deploy": {
- "jobs": {
- "deploy": {
- "elastic_profile_id": "example",
- "tasks": [
- {
- "script": "./deploy.sh --region=de"
- }
- ]
- }
- }
- }
- },
- {
- "pipeline-complete": {
- "fetch_materials": false,
- "jobs": {
- "pipeline-complete": {
- "tasks": [
- {
- "exec": {
- "command": true
- }
- }
- ]
- }
- }
- }
- }
- ]
- },
- "deploy-example-s4s": {
- "display_order": 9,
- "group": "example",
- "materials": {
- "example_repo": {
- "branch": "master",
- "destination": "example",
- "git": "git@github.com:getsentry/example.git"
- }
- },
- "stages": [
- {
- "deploy": {
- "jobs": {
- "deploy": {
- "elastic_profile_id": "example",
- "tasks": [
- {
- "script": "./deploy.sh --region=s4s"
- }
- ]
- }
- }
- }
- },
- {
- "pipeline-complete": {
- "fetch_materials": false,
- "jobs": {
- "pipeline-complete": {
- "tasks": [
- {
- "exec": {
- "command": true
- }
- }
- ]
- }
- }
- }
- }
- ]
- },
- "deploy-example-s4s2": {
- "display_order": 2,
- "group": "example",
- "materials": {
- "example_repo": {
- "branch": "master",
- "destination": "example",
- "git": "git@github.com:getsentry/example.git"
- }
- },
- "stages": [
- {
- "deploy": {
- "jobs": {
- "deploy": {
- "elastic_profile_id": "example",
- "tasks": [
- {
- "script": "./deploy.sh --region=s4s2"
- }
- ]
- }
- }
... diff truncated: showing 800 of 939 lines
test/testdata/goldens/pipedream/rollback-final-stage-override.jsonnet_output-files.golden
Outdated
Show resolved
Hide resolved
joshuarli
approved these changes
Mar 5, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

fetch_materialsis enabled by default in GoCD and enforces that the agent must first fetch Git materials (git fetchon the repo if existing, otherwise clone), before proceeding.This operation should not be enabled in the
pipeline-completestage as it's unnecessary and introduces additional overhead.Currently, it's blocking pipelines from completing as our static agent used for the
pipeline-completestage is going OOM due to cloning too many large repos.See thread: https://sentry.slack.com/archives/CTJL7358X/p1772738303953669