Support the secret
context in a reusable workflow input
#17554
Replies: 7 comments 2 replies
-
|
Beta Was this translation helpful? Give feedback.
-
I worked around this problem for a similar docker build reusable workflow. I used a job to define outputs and tested conditionals on those, but I totally agree that env and secrets should be supported in conditionals. You can see my solution which is working in a similar reusable workflow here: https://github.com/HariSekhon/GitHub-Actions/blob/master/.github/workflows/docker_build.yaml |
Beta Was this translation helpful? Give feedback.
-
That's what should be right. We compilation process requires variables that aren't exactly consistent, and are too cumbersome for a CI/CD platform if they can't be easily passed by the caller. Many of our projects are using reusable workflows, but they are only used to regulate the workflow of each repository execution, not quite at 100% reusable, It's actually true that it's not exactly a reusable workflow. Although GitHub Action is already much more convenient and simple than Jenkins and GitLab CI, I still wish it could be better ❤️ |
Beta Was this translation helpful? Give feedback.
-
I would say that composite actions and and reusable workflows are two features that need to have the same functionality. The biggest two are pass workflow env vars to the with block and being able leverage a secrets block when calling from the parent workflow. |
Beta Was this translation helpful? Give feedback.
-
I would add being able to call its own secrets from the called workflow within the called workflow. At the moment it seems we can pass all secrets from caller to called ( I found a very clear description of the problem here. So the product team took the wrong decision in my humble opinion. If the idea is to avoid confusion, then the Organization secrets should be emptied too within the called workflow? (unless it's already the case, I haven't tested it) |
Beta Was this translation helpful? Give feedback.
-
Encountered the same limitation and truly baffled why its not possible. Reusable workflows seem so rigid and painful at times. I think I understand they want to limit what secrets the reusable workflow has access to, but this use case isnt uncommon. I have a reusable workflow that runs terraform with arguments. There's an I've tried various approaches including:
# main workflow
on:
workflow_dispatch:
jobs:
call-workflow:
uses: bortington/github-common/.github/workflows/test-reusable-workflow.yml@main
with:
username: Bert
secrets:
SECRET_TF_OPTIONS_PLAN: -var "beep=${{secrets.NOT_A_SECRET}}" This works, but my secret is leaked and is not masked at all: |
Beta Was this translation helpful? Give feedback.
-
I'm actually shocked I've got to raise a feature request for something as basic as this for reusable workflows. As it stands for our organisation reusable workflows are almost entirely useless.
One of the main use cases for reusable workflows is to provide a centralised definition of a generic workflow, for example a something that invovles a docker build. As a result, a need for dynamism around inputs is critical to even entertain using a reusable workflow e.g. an output from a job, a environment variable. Without the ability to do this the reusable workflow must be extremely rigid.
Take this extremely stripped down basic example, in this scenario I am letting people define the build arguments as an input:
If I consume this reusable workflow like below I can't do anything around setting the values in the key-value pairs for the docker_build_arguments input like below:
I am honestly at a loss as how anyone is using reusable workflows with such a limitation. I hope I am missing something as Jenkins can do better than this and it's a decade old.
I'm aware you can pass in secrets via the dedicated key or just implicitly inherit all accessible secrets which allows some aspect to be worked around but then actually using that said results in:
If you can't use them directly like I've shown as an example at least let me process in an initial job and then pass them in as outputs or environment variables
Reusable workflows as it stands only work for a predefined extremely rigid flow which, whilst is a use case and my org certainly has pipelines that fit within that limited scope, makes the reusable feature offering of incredibly limited value and hard to justify opting for GitHub Actions as a CI/CD platform.
Beta Was this translation helpful? Give feedback.
All reactions