Why workflow level env variables are not passed down to the jobs? #122218
-
Select Topic AreaQuestion BodyHi, I am have a bit of problem here, according to my understanding we should be having access to the env variables defined at a workflow level in that workflow's job but here I am after my pipelines where failing for no reason I realized that my docker compose container had not access to some env variables: https://github.com/kasir-barati/you-say/blob/main/.github/workflows/backend-e2e-tests.workflow.yml#L26 And I thought I do not need to repeat myself here in this step: https://github.com/kasir-barati/you-say/blob/main/.github/workflows/backend-e2e-tests.workflow.yml#L73 But it seems I was wrong and if I wanna pass down a workflow layer env to a step I need to do it explicitly. Or at least it seems like it. examplename: Backend e2e tests
# ...
env:
# ...
OAUTH_CONFIGURATION_CLIENT_SECRET: "client_secret_${{ github.run_id }}_${{ github.run_attempt }}"
jobs:
build-and-test-backend-e2e:
runs-on: ubuntu-22.04
timeout-minutes: 45
if: ${{
github.event.workflow_run.conclusion == 'success' ||
github.event_name == 'workflow_dispatch' && inputs.run_backend_e2e_tests == true }}
steps:
# ...
- if: ${{ steps.changed-paths.outputs.is-backend == 'true' }}
name: Starting backend service
run: docker compose up -d
env:
FUSIONAUTH_TENANT_ID: ${{ steps.terraform.outputs.fusionauth_tenant_id }}
FUSIONAUTH_APPLICATION_ID: ${{ steps.terraform.outputs.fusionauth_application_id }}
FUSIONAUTH_ADMIN_GROUP_ID: ${{ steps.terraform.outputs.fusionauth_admin_group_id }}
DATABASE_URL: "mongodb://${{ env.MONGO_INITDB_ROOT_USERNAME }}:${{ env.MONGO_INITDB_ROOT_PASSWORD }}@localhost:27017"
APP_HOST: localhost
FUSIONAUTH_OAUTH_SCOPES: offline_access openid
# should I have done something like OAUTH_CONFIGURATION_CLIENT_SECRET: ${{ env.OAUTH_CONFIGURATION_CLIENT_SECRET }} here?
# ... Any help would be much appreciated 🙏. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
BTW I just change the codebase a little, but the main point is still |
Beta Was this translation helpful? Give feedback.
I guess I had found my oversight. I was not passing the env variables to the docker container in my
docker-compose.yml
file. 🥲.