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

Error when using path option in parent of working_directory #33

Open
pkyeck opened this issue May 30, 2022 · 2 comments
Open

Error when using path option in parent of working_directory #33

pkyeck opened this issue May 30, 2022 · 2 comments

Comments

@pkyeck
Copy link

pkyeck commented May 30, 2022

First I tried to replace the "normal" checkout step with the following

working_directory: ~/project/api

steps:
  - unless:
          condition:
            or:
              - equal: [ true, << pipeline.parameters.ci-changed >> ]
              - equal: [ true, << pipeline.parameters.api-changed >> ]
              - equal: [ true, << pipeline.parameters.common-changed >> ]
          steps:
            - run: 
                name: skip job b/c no changes occured
                command: circleci-agent step halt
  - checkout:
      path: ~/project
  - restore_cache:
      keys:
        - v1-dependencies-api-{{ checksum "yarn.lock" }}
        - v1-dependencies-api-
working_directory: ~/project/api

steps:
  - unless:
          condition:
            or:
              - equal: [ true, << pipeline.parameters.ci-changed >> ]
              - equal: [ true, << pipeline.parameters.api-changed >> ]
              - equal: [ true, << pipeline.parameters.common-changed >> ]
          steps:
            - run: 
                name: skip job b/c no changes occured
                command: circleci-agent step halt
  - git-shallow-clone/checkout:
      path: ~/project
  - restore_cache:
      keys:
        - v1-dependencies-api-{{ checksum "yarn.lock" }}
        - v1-dependencies-api-

But it seems the orb cannot handle the ~/project path correctly and checks out the repo into the wrong folder.
My next step (restore_cache) failed with:

error computing cache key: template: cacheKey:1:23: executing "cacheKey" at <checksum "yarn.lock">: error calling checksum: open /home/circleci/project/api/yarn.lock: no such file or directory

So I changed the path to an absolute path like this:

working_directory: ~/project/api

steps:
  - unless:
          condition:
            or:
              - equal: [ true, << pipeline.parameters.ci-changed >> ]
              - equal: [ true, << pipeline.parameters.api-changed >> ]
              - equal: [ true, << pipeline.parameters.common-changed >> ]
          steps:
            - run: 
                name: skip job b/c no changes occured
                command: circleci-agent step halt
  - git-shallow-clone/checkout:
      path: /home/circleci/project

Now I get the error message: fatal: destination path '/home/circleci/project' already exists and is not an empty directory.

Logging into the machine via ssh and checking the folder show that the ~/project/api was already created (by CircleCI!?).
How does the "normal" checkout command handle this case?

Can we somehow improve the git-shallow-clone/checkout command to handle:

  1. path with ~/... in it
  2. the "path already exists" error

Maybe you have a quick idea or I can try and take a look at how to tackle this.

@steinbrueckri
Copy link

Any news about that?

@guitarrapc
Copy link
Owner

Is this issue related to #51 with Source caching feature? If so can you try v2.7.0 which include Source cahcing support.

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

3 participants