Are steps without any matrix variable executed as a single run? #2318
-
Right now do I have a workflow file with a Matrix setup which does the following:
The issue I see right now with this is, that the first action is executed within each matrix run, meaning I would in this case do 3 individual calls to the API, which is just wasteful. I would like to only obtain the ID once, preferably in a step before the one creating the files, to then reuse in the later steps, but I'm not sure if woodpecker works the way I expect it to... If I would define a step that doesn't use any matrix variables defined, would woodpecker assume it's a single step or would it create individual ones for each matrix variable? Help is greatly apreciated as I'm not too experienced yet with woodpecker. My current setup: when:
event: tag
matrix:
include:
- PLATFORM: Bukkit
DIRECTORY: bukkit
- PLATFORM: BungeeCord
DIRECTORY: bungeecord
- PLATFORM: Velocity
DIRECTORY: velocity
steps:
createFiles:
image: eclipse-temurin
secrets:
- cb_token
commands:
# Build the jar files
- mvn --projects :core,:${DIRECTORY} clean install
# Obtain release ID
- |-
export RELEASE_ID=`curl --locatiion "https://codeberg.org/api/v1/repos/Andre601/AdvancedServerList/releases?limit=10" \
--header 'Authorization: token $CB_TOKEN' \
--header 'Accept: application/json' -s -S \
--fail-with-body | jq -r ".[] | select (.tag_name==\"$CI_COMMIT_TAG\").id"`
# Upload release assets to Codeberg release
- |-
curl --location "https://codeberg.org/api/v1/repos/Andre601/AdvancedServerList/releases/$RELEASE_ID/assets" \
--header "Authorization: token $CB_TOKEN" \
--header "Content-Type: multipart/form-data" -s -S \
--form "attachment=@${DIRECTORY}/target/AdvancedServerList-${PLATFORM}-${CI_COMMIT_TAG##v}.jar;type=application/octet-stream" \
--fail-with-body |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
@Andre601 sorry for the late answer. No, this doesn't work. The issue is: We don't know if you use the matrix env var. You can build a custom binary that uses it and we definitely won't analyze binaries to check whether they use an env var :) Also, there's a another issue: Matrixes generate multiple workflows and workflows don't share anything with other workflows. I see that there's room for improvement here, feel free to open a feature request. |
Beta Was this translation helpful? Give feedback.
@Andre601 sorry for the late answer.
No, this doesn't work. The issue is: We don't know if you use the matrix env var. You can build a custom binary that uses it and we definitely won't analyze binaries to check whether they use an env var :)
Also, there's a another issue: Matrixes generate multiple workflows and workflows don't share anything with other workflows.
I see that there's room for improvement here, feel free to open a feature request.