-
I was happy to know that the global environment is now alive and can be within the job or the workflow (https://github.blog/changelog/2019-10-01-github-actions-new-workflow-syntax-features/#env-at-the-workflow-and-job-level) but for some reason, the env at the job level can’t access any information about the services, for example, something like the following
Will not work, neither
The error I get back: Your workflow file was invalid: The pipeline is not valid. .github/workflows/ci.yml (Line: 26, Col: 16): Unrecognized named-value: ‘job’. Located at position 1 within expression: job.services.mysql.ports[‘3306’] Any idea how to fix that, other than moving the env to the task that need to connect to the database? or it is by design? |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments
-
That is currently by design. The job level ENV is built before the services are setup on the runner so those values are not known. Your only option is to pass the variable to the step where it is needed. |
Beta Was this translation helpful? Give feedback.
-
hey @chrispat is there any plan to change this behavior? |
Beta Was this translation helpful? Give feedback.
-
Not at the moment. We will continue to evaluate based on feedback. |
Beta Was this translation helpful? Give feedback.
-
Thank you very much 👍 |
Beta Was this translation helpful? Give feedback.
-
@Chrispati’ve also run into this issue and would love to be able to do what @linuxjuggler suggests. I have multiple steps that require the database port value. |
Beta Was this translation helpful? Give feedback.
That is currently by design. The job level ENV is built before the services are setup on the runner so those values are not known. Your only option is to pass the variable to the step where it is needed.