remen
February 17, 2018, 7:43am
1
My project configures its artifact name using the name of the project root directory. Is it possible to configure CircleCI 2.0 to checkout the git repository to a directory with the same name (i.e., the default behaviour of git clone)?
(also asked on StackOverflow: https://stackoverflow.com/questions/48823009/can-i-keep-the-git-repository-name-in-a-circleci-workspace )
halfer
February 17, 2018, 11:33am
2
As far as I understand it, you can omit the checkout
step and just replace it with your own run: git clone ...
command, and from there you can do anything you like.
1 Like
Answered on Stack Overflow and reposting here:
Yes.
You can do so either by telling the checkout command the name of the direction: https://circleci.com/docs/2.0/configuration-reference/#checkout
Or by setting a custom working_directory: https://circleci.com/docs/2.0/configuration-reference/#job_name
Respectfully,
Ricardo N Feliciano
Developer Evangelist, CircleCI
1 Like
remen
February 19, 2018, 2:07pm
4
Thanks! But that means that I have to store the name of my repository in .circleci/config.yml, right? That would defeat the purpose for me.
What’s wrong with doing that?
Regardless, you can store the name as a string in a private environment variable, then use it with git clone
to clone the repo.
1 Like
remen
February 23, 2018, 6:39am
6
There’s nothing inherently wrong with it, but I have a use-case where I would like to avoid it.
Manually using git clone sounds like a good work-around. Thanks!
1 Like
remen
February 28, 2018, 10:09am
7
FYI - I solved my use-case by setting the artifact name to $CIRCLE_PROJECT_REPONAME within the build itself.