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

workspace-root does not support anything which is not . #32

Closed
ozooxo opened this issue May 13, 2019 · 2 comments
Closed

workspace-root does not support anything which is not . #32

ozooxo opened this issue May 13, 2019 · 2 comments

Comments

@ozooxo
Copy link

ozooxo commented May 13, 2019

Orb version

3.1.0

What happened

jobs:
  java-build:
    executor: java-with-postgres-executor

    steps:
      - checkout
      ...
      - persist_to_workspace:
          root: /tmp/java-build
          paths:
            - docker/web/*.war

workflows:
  version: 2
  build-test-and-deploy:
    jobs:
      ...
      - aws-ecr/build_and_push_image:
          checkout: true
          attach-workspace: true
          workspace-root: /tmp/java-build
          account-url: AWS_ECR_ACCOUNT_URL
          aws-access-key-id: AWS_ACCESS_KEY_ID
          aws-secret-access-key: AWS_SECRET_ACCESS_KEY
          dockerfile: /tmp/java-build/docker/web/Dockerfile
          path: /tmp/java-build/docker/web
          region: AWS_DEFAULT_REGION
          repo: "ecs-circleci-qa-repository"
          tag: "${CIRCLE_SHA1}"

I got

unable to prepare context: unable to evaluate symlinks in Dockerfile path: lstat /tmp/java-build/docker/web/Dockerfile: no such file or directory
Exited with code 1

https://circleci.com/gh/gitenter/gitenter/388

but change to . the job succeed.

      - aws-ecr/build_and_push_image:
          checkout: true
          attach-workspace: true
          workspace-root: .
          account-url: AWS_ECR_ACCOUNT_URL
          aws-access-key-id: AWS_ACCESS_KEY_ID
          aws-secret-access-key: AWS_SECRET_ACCESS_KEY
          dockerfile: ./docker/web/Dockerfile
          path: ./docker/web
          region: AWS_DEFAULT_REGION
          repo: "ecs-circleci-qa-repository"
          tag: "${CIRCLE_SHA1}"

https://circleci.com/gh/gitenter/gitenter/393

Expected behavior

If it is equivalent to

    working_directory: /tmp/java-build
    steps:
      - checkout
      - attach_workspace:
          at: /tmp/java-build

workspace-root should support arbitrary path rather than just ..

@ozooxo
Copy link
Author

ozooxo commented May 14, 2019

Looks like in your orb definition, you have nowhere to specify working_directory (so it use the default value . and workspace-root has to be ., otherwise it will complain it cannot find the file).

However, I also realized for some images (e.g. circleci/openjdk:11.0-jdk) you cannot setup working_directory to be .. Otherwise it will fail the checkout step with the error

Directory (.) you are trying to checkout to is not empty and not git repository

https://circleci.com/gh/gitenter/gitenter/398

@iynere
Copy link
Contributor

iynere commented May 22, 2019

i think you may be misunderstanding how persist_to_workspace works @ozooxo

https://circleci.com/docs/2.0/configuration-reference/#persist_to_workspace

the root & path parameters tell our system what files you want to save to your workspace. thus, those paths will need to exist.

the error you saw originally is not because of anything in the orb code—it's because you have some kind of path issue & the dockerfile you're trying to build w/ the ecr orb is not at the path where you're telling it to look for it. have you tried rerunning your job with ssh so you can determine where the dockerfile is?

also, i would recommend against setting working_directory to anything in /tmp

@iynere iynere closed this as completed May 22, 2019
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