circleci-orb icon indicating copy to clipboard operation
circleci-orb copied to clipboard

cypress/run always attaches a workspace

Open maalur opened this issue 5 years ago • 2 comments

cypress/run always attaches a workspace

  • using orb version 1.24.0, circleci version 2.1
  • relevant source code: https://github.com/cypress-io/circleci-orb/blob/v1.24.0/src/orb.yml#L518-L526
      - when:
          condition: << parameters.parallel >> << parameters.attach-workspace >>
          # user wants to run in parallel mode
          # thus we assume the dependencies were installed as separate job
          # hmm, can we detect if this job requires cypress/install automatically?
          steps:
            - run: echo "Assuming dependencies were installed using cypress/install job"
            - attach_workspace:
                at: ~/
  • what I think should happen: A workspace should only be attached when parameters.parallel or parameters.attach-workspace are set to true.
  • what happens: The current condition always evaluates to true, even when both parameters.parallel and parameters.attach-workspace are explicitly set to false. This results in a workspace always being attached. This can add a significant amount of time to job execution when loading large workspaces.
  • proposed solution: Based on CircleCI's Logic Statements documentation I believe this should solve the issue:
      - when:
          condition:
            or: [ << parameters.parallel >>, << parameters.attach-workspace >> ]
          # user wants to run in parallel mode
          # thus we assume the dependencies were installed as separate job
          # hmm, can we detect if this job requires cypress/install automatically?
          steps:
            - run: echo "Assuming dependencies were installed using cypress/install job"
            - attach_workspace:
                at: ~/

maalur avatar Jun 17 '20 00:06 maalur

Ohhh did Circle change it, this is a new syntax I believe

Sent from my iPhone

On Jun 16, 2020, at 20:51, Mark Urich [email protected] wrote:

 cypress/run always attaches a workspace

using orb version 1.24.0 relevant source code: https://github.com/cypress-io/circleci-orb/blob/v1.24.0/src/orb.yml#L518-L526 - when: condition: << parameters.parallel >> << parameters.attach-workspace >> # user wants to run in parallel mode # thus we assume the dependencies were installed as separate job # hmm, can we detect if this job requires cypress/install automatically? steps: - run: echo "Assuming dependencies were installed using cypress/install job" - attach_workspace: at: ~/ what I think should happen: A workspace should only be attached when parameters.parallel or parameters.attach-workspace are set to true. what happens: The current condition always evaluates to true, even when both parameters.parallel and parameters.attach-workspace are explicitly set to false. This results in a workspace always being attached. This can add a significant amount of time to job execution when loading large workspaces. proposed solution: Based on CircleCI's Logic Statements documentation I believe this should solve the issue: - when: condition: or: [ << parameters.parallel >>, << parameters.attach-workspace >> ] # user wants to run in parallel mode # thus we assume the dependencies were installed as separate job # hmm, can we detect if this job requires cypress/install automatically? steps: - run: echo "Assuming dependencies were installed using cypress/install job" - attach_workspace: at: ~/ — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

bahmutov avatar Jun 17 '20 00:06 bahmutov

Yea, looks like it was added about a month ago: https://discuss.circleci.com/t/advanced-logic-in-config/36011

maalur avatar Jun 17 '20 01:06 maalur