Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

env limitation #23

Closed
igor-ivanov opened this issue Mar 19, 2021 · 5 comments
Closed

env limitation #23

igor-ivanov opened this issue Mar 19, 2021 · 5 comments

Comments

@igor-ivanov
Copy link

It seems that env is processed after matrix
As a result following yaml does not work as expected

matrix:
  axes:
    flags:
      - default
      - extra
    arch:
      - x86_64

env:
   TARGET: ${flags}

steps:
...

so workaround is required as:

matrix:
  axes:
    flags:
      - default
      - extra
    arch:
      - x86_64

steps:
  -name: N1
    run: export TARGET=${flags}
...
@mike-dubman
Copy link
Collaborator

  • matrix is dynamically generated
  • env is statically set once

current matrix dimension is passed to step as env variables and can be referred as $flags inside step
why need to refer matrix var from env section?

@igor-ivanov
Copy link
Author

why need to refer matrix var from env section?
Just to avoid doing identical operations as

steps:
  -name: N1
    run: export TARGET=${flags}
  -name: N2
    run: export TARGET=${flags}
...
  -name: NN
    run: export TARGET=${flags}

Every step get a list of environment variables from env. Probably it is more flexible to get environment variables with different values.

@mike-dubman
Copy link
Collaborator

but both env and matrix var available inside step shell
from shell step you can refer $flags and also vars from env
cross reference matrix and env in yaml file seems obscure because they resolved at runtime
WDYT

@igor-ivanov
Copy link
Author

igor-ivanov commented Mar 23, 2021

but both env and matrix var available inside step shell

it is true

from shell step you can refer $flags and also vars from env

it is true

cross reference matrix and env in yaml file seems obscure because they resolved at runtime
WDYT

currently I must do #23 (comment) instead

env:
   TARGET: ${flags}

steps:
  -name: N1
  -name: N2
...
  -name: NN

I can live with current solution if my proposal meets initial arch design

@mike-dubman
Copy link
Collaborator

IMO approach in #23 (comment) is clean and nice
dereferencing matrix var in env makes it complicated
let me know if you disagree or close

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants