Page MenuHomePhabricator

Unable to configure Arcanist as per the quick start tutorial
Closed, ResolvedPublic

Description

Hi,

I'm trying to introduce Phabricator in my organization. I pointed them to the arcanist quick start tutorial
https://secure.phabricator.com/book/phabricator/article/arcanist_quick_start/
I've had returns from devs that they can't install Arcanist certificate with an .arcconfig

I've checked that it doesn't work on debian and the value in the .arcconfig is never used
I've told them to put

{
  "config": {
    "default": "http://this.is.our.phabricator-url.com/"
  }
}

in a ~/.arcrc which works as a charm

Maybe the doc should be updated as it is the first encounters with Arcanist which is a fantastic tool

Related Objects

Event Timeline

I can't reproduce this. Here's what I did.

I removed my .arcrc:

epriestley@orbital ~/dev/scratch/poems $ cat ~/.arcrc
cat: /Users/epriestley/.arcrc: No such file or directory

I changed the current working directory to a project directory with a .arcconfig file, configured per the "Configure Your Project" instructions in the quick start document:

epriestley@orbital ~/dev/scratch/poems $ cat .arcconfig
{
  "phabricator.uri": "https://secure.phabricator.com/"
}

I ran arc install-certificate:

epriestley@orbital ~/dev/scratch/poems $ arc install-certificate
 CONNECT  Connecting to "https://secure.phabricator.com/api/"...
LOGIN TO PHABRICATOR
Open this page in your browser and login to Phabricator if necessary:

https://secure.phabricator.com/conduit/login/

Then paste the API Token on that page below.
...

Things worked correctly.

Do you have any idea what I can do differently to reproduce the issue you encountered?

I tried to reproduce your steps :

I removed my .arcrc:

10:06 grooveek@anlin ~/Projects/test-phabricator% cat ~/.arcrc    
cat: /home/grooveek/.arcrc: No such file or directory
zsh: exit 1     cat ~/.arcrc

I changed the current working directory to a project directory with a .arcconfig file, configured per the "Configure Your Project" instructions in the quick start document:

10:09 grooveek@anlin ~/Projects/test-phabricator% cat .arcconfig 
{
  "phabricator.uri" : "http://secure.phabricator.dev/"
 }

I ran arc install-certificate:

10:10 grooveek@anlin ~/Projects/test-phabricator% arc install-certificate
Usage Exception: Specify an explicit URI or run this command from within a project which is configured with a .arcconfig.
zsh: exit 1     arc install-certificate

It failed ...

So, I tried a strace of the arcanist.php install-certificate and grepped for the search of .arcconfig :

10:28 grooveek@anlin ~/Projects/test-phabricator% grep -e arcrc -e arcconfig arctrace 
access("/home/grooveek/.arcrc", F_OK) = -1 ENOENT (No such file or directory)
lstat("/home/grooveek/.arcrc", 0x7fff13876e50) = -1 ENOENT (No such file or directory)
access("/etc/arcconfig", F_OK)          = -1 ENOENT (No such file or directory)
lstat("/etc/arcconfig", 0x7fff13876fc0) = -1 ENOENT (No such file or directory)

Not sure if we should see a lstat of the project .arcconfig though

We're all on a debian Jessie. PHP cli's version below

ii  php5-cli     5.6.22+dfsg-0+deb8u1      amd64        command-line interpreter for the php5 scripting language

Can you try arc install-certificate --trace, and show me the output?

This comment was removed by grooveek.

Working Copy: Path "/home/fl.blondeau/NetBeansProjects/namescan-phabricator" is not in any working copy.

Which kind of working copy are you expecting this to be -- Git, Subversion, or Mercurial?

I should have checked if there exists a verbose output first :-D
Anyway, here is the output :

14:21 grooveek@anlin ~/Projects/test-phabricator%  arc install-certificate --trace                                                           
 ARGV  '/home/grooveek/Projects/arcanist/bin/../scripts/arcanist.php' 'install-certificate' '--trace'
 LOAD  Loaded "phutil" from "/home/grooveek/Projects/libphutil/src".
 LOAD  Loaded "arcanist" from "/home/grooveek/Projects/arcanist/src".
Config: Did not find user configuration at "/home/grooveek/.arcrc".
Config: Did not find system configuration at "/etc/arcconfig".
Working Copy: No candidate locations for .arcconfig from this working directory.
Working Copy: Path "/home/grooveek/Projects/test-phabricator" is not in any working copy.
Usage Exception: Specify an explicit URI or run this command from within a project which is configured with a .arcconfig.

[2016-06-21 12:23:19] EXCEPTION: (ArcanistUsageException) Specify an explicit URI or run this command from within a project which is configured with a .arcconfig. at [<arcanist>/src/workflow/ArcanistInstallCertificateWorkflow.php:190]
arcanist(head=master, ref.master=2234c8cacc21), phutil(head=master, ref.master=5eaf0a9f5a35)
  #0 ArcanistInstallCertificateWorkflow::determineConduitURI() called at [<arcanist>/src/workflow/ArcanistInstallCertificateWorkflow.php:53]
  #1 ArcanistInstallCertificateWorkflow::run() called at [<arcanist>/scripts/arcanist.php:392]
zsh: exit 255   arc install-certificate --trace

Working Copy: No candidate locations for .arcconfig from this working directory. is annoying

14:27 grooveek@anlin ~/Projects/test-phabricator% ls -al
total 12
drwxr-xr-x  2 grooveek users 4096 juin  21 14:27 .
drwx------ 36 grooveek users 4096 juin  17 16:05 ..
-rw-r--r--  1 grooveek users   58 juin  21 10:09 .arcconfig

That also doesn't look like a working copy.

A working copy is created with a version control command like git clone, hg clone, or svn checkout. It normally has a .git/, .hg/ or .svn/ directory in it. That just looks like a random directory you made with a command like mkdir.

You need to run arc inside a working copy, not just a bare directory. Most arc commands operate on repository state or history, and do not make sense if there's no repository information available.

OK, I think I get it

I reproduced what my colleagues was doing, but haven't check if it was a phabricator way to do the things

This directory was an empty one, which was created to get a fresh install of a repo.
So, arcanist install-certificate won't work if a repo has not been init-ed

OK, I understand now what is the point

Running in a configured hg or git project takes the default repo URL and removes the burden of specifying an URL

When a user goes directly to the Arcanist Quick Start in the first few minutes of reading the docs, it's not so clear

Maybe a word or two in the doc would avoid some people to figure out how to do the things
In fact, I think it's the word project that we were understand broadly whereas it meant repository

Thanks for helping

epriestley claimed this task.

We haven't seen any other users run into difficulty with this, but we'll keep an eye on it and consider updating the documentation if we see further confusion.

Fwiw, if someone else lands here (which I just did by Googling the same error message), the problem for me was the same as for the original poster -- having not first initialized a repo locally one way or another. My intuition (which is probably wrong) is that there is an interesting order of operations problem here.

If I'm creating a hosted instance of Phabricator, then I setup the Diffusion repository in the Phabricator web UI first before I have anything local.
Then, I want to checkout the repo from the hosted instance in my development environment.
However, I can't do that because I haven't yet setup my user account locally with the hosted instance (i.e. haven't installed my arc certificate).
To do that, I need a working copy, which I don't have because I haven't installed the certificate...
So, you need a repo to setup a certificate, but you can't get the repo because you don't have a certificate.
Is there a different set of steps that prevents this?

Btw, I solved the problem for myself by just initializing an empty repo locally, adding the .arcconfig, and then running arc install-certificate.

You should be able to can arc install-certificate --conduit-uri=https://whatever to install a certificate for an arbitrary install with no other configuration.

I generally follow this order of operations when, e.g., launching a Phacility test instance to reproduce something or run a scenario like rLOCATIONS:

  • Create the repository in Diffusion.
  • Add SSH keys to my user account.
  • Clone the empty repository with git clone.
  • Add .gitignore, .arcconfig, .arclint, .arcunit, etc., and anything else which makes sense.
  • Commit them, creating an initial commit.

You shouldn't need to to setup arc before you can run git clone, only before you run arc diff or other arc commands. So I'm not sure what issue you hit here, specifically:

However, I can't do that [checkout the repo] because I haven't yet setup my user account locally with the hosted instance (i.e. haven't installed my arc certificate).

My expectation is that you checkout the repo by running git clone, and arc does not need to be configured for this. You only need to add your SSH key to Settings.

Ah, yes -- this is where I got off track. In my head I had conflated being able to clone the repo with having the arc certificate installed. These steps are unrelated, I understand clearly now. As long as the SSH key is added in Phabricator and the Repo is activated in Diffusion, cloning it is no problem. In this case, I thought it was the lack of arc certificate blocking me, when in was actually just that I forgot to activate the repo. Whoops. Thanks for clarifying.

It is somewhat confusing to have both an SSH key access level that allows repo cloning and an arc certificate level of access that enables different features.

In the future (T550) we plan to allow arc commands to use an SSH key. I'm not sure if that will reduce or increase confusion.

We could theoretically use arc credentials to clone, but then you'd have to arc clone instead of git clone, and I think we'd get nothing else from doing that right now. I suspect this would be more confusing than helpful on the balance today.