Concourse Pipelines与Pivotal Tracker集成:状态触发流水线可行性问询
Absolutely! You can totally trigger Concourse Pipelines when story states in Pivotal Tracker shift to finished, delivered, or accepted. Let’s break down how to set this up properly:
First, you’ll need to configure Pivotal to send a notification whenever a story’s state changes. Here’s how:
- Go to your Pivotal Tracker project, click Settings > Webhooks.
- Click Add Webhook and enter the endpoint URL where Concourse (or an intermediary service) will listen for events.
- Under Event Types, select the option for story state changes (Pivotal labels this as "Story updated" specifically for state transitions).
- Optional but recommended: Add an
X-Tracker-Tokenheader with a secret value to authenticate requests later.
You have two solid options to trigger your pipeline from the webhook:
Option 1: Use Concourse’s webhook Resource
Concourse has a built-in webhook resource type that’s perfect for this use case. Here’s a sample pipeline snippet:
resources: - name: pivotal-state-trigger type: webhook source: url: /hooks/pivotal-story-change token: ((pivotal_webhook_secret)) # Store this in Concourse's secret manager jobs: - name: run-on-pivotal-state-change plan: - get: pivotal-state-trigger trigger: true - task: validate-state config: platform: linux image_resource: type: docker-image source: {repository: alpine/jq} inputs: - name: pivotal-state-trigger run: path: sh args: - -c | # Parse the webhook payload to check the new state STATE=$(jq '.story.current_state' pivotal-state-trigger/payload) if [[ $STATE =~ "\"finished\"" || $STATE =~ "\"delivered\"" || $STATE =~ "\"accepted\"" ]]; then echo "Triggering pipeline for valid state change: $STATE" # Add your pipeline steps here (e.g., deploy, test, etc.) else echo "Ignoring non-target state change: $STATE" exit 0 fi
This setup will trigger the job whenever the webhook receives a request, and the task filters out any state changes that aren’t your target ones.
Option 2: Use an Intermediary Service + Concourse API
If you need more flexibility (like complex filtering or additional logic), you can use a small custom service (Node.js, Python, etc.) to:
- Receive the Pivotal webhook request.
- Validate the payload and check if the state is one of your target values.
- Call the Concourse API to trigger your pipeline job.
To trigger a job via the API, send a POST request to:
/api/v1/teams/<YOUR_TEAM>/pipelines/<YOUR_PIPELINE>/jobs/<YOUR_JOB>/builds
Include authentication headers (either a Bearer token or basic auth) to authorize the request.
Don’t skip these steps to keep your setup safe:
- Always use HTTPS for webhook endpoints to encrypt data in transit.
- Validate the
X-Tracker-Token(if you set it) in your webhook receiver to ensure requests are actually from Pivotal. - Store all secrets (webhook tokens, Concourse API credentials) in a secure secret manager—never hardcode them in your pipeline.
With this setup, your Concourse pipelines will automatically kick off whenever your team moves stories to those key states in Pivotal Tracker, tying your project management workflow directly to your CI/CD process.
内容的提问来源于stack exchange,提问作者CodeFreak




