Replies: 2 comments 3 replies
-
|
Hey there! I can see what's happening here. The issue is that your The problem is in how you're defining your matrix strategy. You're trying to use Here's what you need to change: Notice the key difference: Then in your job steps, you'd reference the matrix values like:
This will create one job execution for each object in your instances array, and each job will have access to that specific instance's Hope this helps! |
Beta Was this translation helpful? Give feedback.
-
|
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Why are you starting this discussion?
Question
What GitHub Actions topic or product is this about?
Workflow Configuration
Discussion Details
Hello, I have a question regarding passing a list of objects to matrix strategy.
outputs:
instances: ${{ steps.pick.outputs.instances }}
script_path: ${{ steps.pick.outputs.script_path }}
name: Resolve instances + script path (jq, no status filter)
id: pick
shell: bash
run: |
set -euo pipefail
case "${{ inputs.action }}" in
pull) SCRIPT_PATH="https://github.com/var/lib/cloud/app/pull_image.sh" ;;
deploy) SCRIPT_PATH="https://github.com/var/lib/cloud/app/deploy_docker.sh" ;;
*) echo "Nieznana action"; exit 1 ;;
esac
echo "script_path=${SCRIPT_PATH}" >> "$GITHUB_OUTPUT"
exec:
needs: resolve
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 1
matrix: ${{ fromJSON(needs.resolve.outputs.instances) }}
env:
PROJECT_ID: ${{ secrets.PROJECT_ID }}
SCRIPT_PATH: ${{ needs.resolve.outputs.script_path }}
Here I am passing to strategy list of VMs on which I want to execute a script.
Debug step is showing a correct json:
steps.pick.outputs.instances (raw below):
[
]
and first part of the pipeline ends up with success. But the second part throws an error:
Error when evaluating 'strategy' for job 'exec'. .github/workflows/pull_run_docker_image.yml (Line: 120, Col: 15): Error from function 'fromJSON': empty input, .github/workflows/pull_run_docker_image.yml (Line: 120, Col: 15): Unexpected value ''
Thank you in advance for your help!
Beta Was this translation helpful? Give feedback.
All reactions