How to use output of one step in input of other steps? #4246
-
Hi, I am wondering how we can use output of one step as the input of subsequent steps? I came across env_vars but that does not seem to work for plugins it seems. I wanna have the following workflow: when:
event: push
branch: feature/rails-image-woodpecker
steps:
- name: check-and-duplicate-cache
image: alpine
environment:
REGISTRY_USERNAME:
from_secret: REGISTRY_USERNAME
REGISTRY_PASSWORD:
from_secret: REGISTRY_PASSWORD
commands:
- |
CACHE_IMAGE_TAG=myregistry.example.com/myproject/rails:cache-${CI_COMMIT_BRANCH//\//_}
if ! curl -s -f -lL -u $REGISTRY_USERNAME:$REGISTRY_PASSWORD "https://myregistry.example.com/v2/myproject/rails/manifests/$CACHE_IMAGE_TAG"; then
echo "Cache image not found, attempting to pull cache-main"
CACHE_IMAGE_TAG=myregistry.example.com/myproject/rails:cache-main
fi
echo "CACHE_IMAGE_TAG=$CACHE_IMAGE_TAG >> env_vars"
- name: build-rails-image
image: woodpeckerci/plugin-docker-buildx
settings:
repo: myregistry.example.com/myproject/rails
tag: ${CI_COMMIT_BRANCH//\//_}
dockerfile: apps/rails/Dockerfile
auto_tag: true
logins:
- registry: myregistry.example.com
username:
from_secret: REGISTRY_USERNAME
password:
from_secret: REGISTRY_PASSWORD
cache_from:
- $CACHE_IMAGE_TAG
cache_to:
- type=registry,ref=$CACHE_IMAGE_TAG,mode=max,image-manifest=true,oci-mediatypes=true But this does not seem to be possible because I would need to source the env_vars file using a command which is not allowed for plugins. To me, it seems to be a very basic requirement for a CI/CD pipeline - am I missing something? Github actions has https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/passing-information-between-jobs and I am looking for something like this in woodpecker. Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Nope, #2266. Fork and patch the plugin, whether it would be env file or some json/yaml. |
Beta Was this translation helpful? Give feedback.
-
Can we close this as duplicate? |
Beta Was this translation helpful? Give feedback.
Nope, #2266.
Fork and patch the plugin, whether it would be env file or some json/yaml.