I’m trying to run my E2E tests via an API call at staging deploy using this blog tutorial: Advanced pipeline orchestration with the circleback pattern | CircleCI
My E2E pipeline relies on the cypress orb, full code below:
version: 2.1
parameters:
triggering-pipeline-id:
type: string
default: ""
orbs:
discord: antonioned/discord@0.1.0
cypress: cypress-io/cypress@3
executor: cypress/default
commands:
approve-job-in-triggering-pipeline:
steps:
- run:
name: Ping CircleCI API and approve the pending job
command: |
echo << pipeline.parameters.triggering-pipeline-id >>
if ! [ -z "<< pipeline.parameters.triggering-pipeline-id >>" ]
then
workflow_id=$(curl --request GET \
--url https://circleci.com/api/v2/pipeline/<< pipeline.parameters.triggering-pipeline-id >>/workflow \
--header "Circle-Token: $CIRCLECI_API_KEY" \
--header "content-type: application/json" \
| jq -r '.items[0].id')
echo $workflow_id
waiting_job_id=$(curl --request GET \
--url https://circleci.com/api/v2/workflow/$workflow_id/job \
--header "Circle-Token: $CIRCLECI_API_KEY" \
--header "content-type: application/json" \
| jq -r '.items[] | select(.name == "wait-for-triggered-pipeline").id')
echo $waiting_job_id
curl --request POST \
--url https://circleci.com/api/v2/workflow/$workflow_id/approve/$waiting_job_id \
--header "Circle-Token: $CIRCLECI_API_KEY" \
--header "content-type: application/json"
fi
when: always
workflows:
e2e-tests:
jobs:
- cypress/run:
parameters: { "triggering-pipeline-id": << pipeline.parameters.triggering-pipeline-id >> }
name: "Firefox"
cypress-command: npm run test:firefox
install-browsers: true
cypress-cache-key: custom-cypress-cache-v1-{{ arch }}-{{ checksum "package.json" }}
cypress-cache-path: ~/.cache/custom-dir/Cypress
working-directory: /home/circleci/project
post-steps:
- approve-job-in-triggering-pipeline
context:
- webapp-e2e
However, when I attempt to run this pipeline (through API or otherwise), I get:
Error calling workflow: 'e2e-tests'
Error calling job: 'cypress/run'
Error calling command: 'approve-job-in-triggering-pipeline'
Unknown variable(s): triggering-pipeline-id
Running this without passing the parameters down explicitly results in the same error, which makes sense since as documented here: api-preview-docs/pipeline-parameters.md at master · CircleCI-Public/api-preview-docs · GitHub
Pipeline parameters are not available in orbs, including orbs declared locally in your config.yml file
How can I pass my pipeline parameters correctly into the orb?
Thanks!