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

nx:run-commands executor ignore envFile option #23581

Closed
2 of 4 tasks
izaneuski opened this issue May 20, 2024 · 3 comments · Fixed by #26459
Closed
2 of 4 tasks

nx:run-commands executor ignore envFile option #23581

izaneuski opened this issue May 20, 2024 · 3 comments · Fixed by #26459
Assignees
Labels

Comments

@izaneuski
Copy link

izaneuski commented May 20, 2024

Current Behavior

We have monorepo with couple of apps/libs.
When executing npx nx affected --target=publish --base=master it's running publish target for each affected applicaton.

    "publish": {
      "executor": "nx:run-commands",
      "options": {
        "parallel": false,
        "envFile": ".gitlab/apps/app1.env",
        "commands": ["./.gitlab/scripts/job-publish.sh"]
      }
    "publish": {
      "executor": "nx:run-commands",
      "options": {
        "parallel": false,
        "envFile": ".gitlab/apps/app2.env",
        "commands": ["./.gitlab/scripts/job-publish.sh"]
      }

Each app use own envFile in config, despite that all affected runs nx run app:publish use same envFile(first nx affected in list)

Expected Behavior

Each app gets own variables from envFile

GitHub Repo

No response

Steps to Reproduce

  1. create 2 apps (app1, app2)
  2. create envfile per app with content
    .tmp/apps/app1.env:
app_name="app1"

.tmp/apps/app2.env:

app_name="app2"
  1. for each app add target
    app1:
    "publish-test": {
      "executor": "nx:run-commands",
      "options": {
        "parallel": false,
        "envFile": ".tmp/apps/app1.env",
        "commands": [
          "echo $app_name"
        ]
      }
    },

app2:

    "publish-test": {
      "executor": "nx:run-commands",
      "options": {
        "parallel": false,
        "envFile": ".tmp/apps/app2.env",
        "commands": [
          "echo $app_name"
        ]
      }
    },
  1. run npx nx affected --target=publish-test --base=master --verbose

Nx Report

NX   Report complete - copy this into the issue template

Node   : 20.12.2
OS     : darwin-x64
npm    : 10.5.0

nx                 : 19.0.4
@nx/js             : 19.0.4
@nx/jest           : 19.0.4
@nx/linter         : 19.0.4
@nx/eslint         : 19.0.4
@nx/workspace      : 19.0.4
@nx/devkit         : 19.0.4
@nx/eslint-plugin  : 19.0.4
@nx/plugin         : 19.0.4
@nx/react          : 19.0.4
@nrwl/tao          : 19.0.4
@nx/web            : 19.0.4
@nx/webpack        : 19.0.4
typescript         : 5.4.5

Failure Logs

No response

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

@FrozenPandaz FrozenPandaz added the scope: core core nx functionality label May 21, 2024
@xiongemi
Copy link
Collaborator

i tried the steps to reproduce, i could not replicate with nx 19.2.3. do you have repo link?

@izaneuski
Copy link
Author

Hey @xiongemi ,
Issue is still reproducable with nx 19.2.3.
Please, try to clone https://github.com/izaneuski/nx-test
switch to test/nx branch
and run npx nx affected --target=publish-test --base=main --verbose

FrozenPandaz pushed a commit that referenced this issue Jun 26, 2024
This pr is meant to replace #22585 and
#20524

Env variables using other variables were not unloaded from the
environment and further customizations were impossible in more specific
env files.

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #23581

Co-authored-by: Mateo Tibaquira <[email protected]>
(cherry picked from commit 88fd03b)
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants