Application cookbook -- using Mercurial SCM provider


#1

Hi –

I’m using the Application / Application_python cookbook to install Django.
The app source code lives in a Mercurial repo (which happens to be
private).
I need a little help here on how to do this. This is what I’ve got, but
it’s not working.

Does anyone have an example of how to do this?

How do I correctly reference the Mercurial provider?
I have verified that hg clone works with that url.
Does the ssh private key have to omit a passphrase?
I think the file referenced by deploy_key has to be uploaded somehow as
part of the cookbook.

application “bart” do
path "/srv/bart"
owner "nobody"
group "nogroup"
scm_provider "Chef::Provider::Mercurial"
repository "ssh://hg@bitbucket.org/bart/server/bart"
revision "master"
deploy_key "/home/liam/.ssh/bti"
migrate true
packages [“libpq-dev”, “git-core”, “mercurial”]

Thanks!
Liam


Liam Kirsher
PGP: http://liam.numenet.com/pgp/


#2

It would help if you included the error you’re getting.

Guessing from the questions you asked, I’d say that the SSH key should be passphrase-less since Chef will run unsupervised.

Cassiano Leal

On Jun 4, 2013, at 16:50, Liam Kirsher liamk@numenet.com wrote:

Hi –

I’m using the Application / Application_python cookbook to install Django.
The app source code lives in a Mercurial repo (which happens to be
private).
I need a little help here on how to do this. This is what I’ve got, but
it’s not working.

Does anyone have an example of how to do this?

How do I correctly reference the Mercurial provider?
I have verified that hg clone works with that url.
Does the ssh private key have to omit a passphrase?
I think the file referenced by deploy_key has to be uploaded somehow as
part of the cookbook.

application “bart” do
path "/srv/bart"
owner "nobody"
group "nogroup"
scm_provider "Chef::Provider::Mercurial"
repository "ssh://hg@bitbucket.org/bart/server/bart"
revision "master"
deploy_key "/home/liam/.ssh/bti"
migrate true
packages [“libpq-dev”, “git-core”, “mercurial”]

Thanks!
Liam


Liam Kirsher
PGP: http://liam.numenet.com/pgp/


#3

The error is:

No provider found to match ‘Chef::Provider::Mercurial’

On 06/04/2013 12:54 PM, Cassiano Leal wrote:

It would help if you included the error you’re getting.

Guessing from the questions you asked, I’d say that the SSH key should be passphrase-less since Chef will run unsupervised.

Cassiano Leal

On Jun 4, 2013, at 16:50, Liam Kirsher liamk@numenet.com wrote:

Hi –

I’m using the Application / Application_python cookbook to install Django.
The app source code lives in a Mercurial repo (which happens to be
private).
I need a little help here on how to do this. This is what I’ve got, but
it’s not working.

Does anyone have an example of how to do this?

How do I correctly reference the Mercurial provider?
I have verified that hg clone works with that url.
Does the ssh private key have to omit a passphrase?
I think the file referenced by deploy_key has to be uploaded somehow as
part of the cookbook.

application “bart” do
path "/srv/bart"
owner "nobody"
group "nogroup"
scm_provider "Chef::Provider::Mercurial"
repository "ssh://hg@bitbucket.org/bart/server/bart"
revision "master"
deploy_key "/home/liam/.ssh/bti"
migrate true
packages [“libpq-dev”, “git-core”, “mercurial”]
Thanks!
Liam


Liam Kirsher
PGP: http://liam.numenet.com/pgp/


Liam Kirsher
PGP: http://liam.numenet.com/pgp/


#4

There’s no mercurial provider. I notice you’re using BitBucket, I
understand they support Git as well. I’m not sure if the two are
compatible in terms of talking to a single repository.

You’ll need to enhance Chef to be aware of Mercurial repositories (by
adding a Mercurial source code management provider), e.g. git [0],
subversion [1].

This could probably be added to the mercurial cookbook, which is
woefully lacking, the reason of which should be obvious (Git :P). [2]

Cheers,

AJ

[0] https://github.com/opscode/chef/blob/master/lib/chef/provider/git.rb
[1] https://github.com/opscode/chef/blob/master/lib/chef/provider/subversion.rb
[2] http://ckbk.it/mercurial |
https://github.com/cookbooks/mercurial/blob/master/recipes/default.rb

On 5 June 2013 08:43, Liam Kirsher liamk@numenet.com wrote:

The error is:

No provider found to match ‘Chef::Provider::Mercurial’

On 06/04/2013 12:54 PM, Cassiano Leal wrote:

It would help if you included the error you’re getting.

Guessing from the questions you asked, I’d say that the SSH key should be passphrase-less since Chef will run unsupervised.

Cassiano Leal

On Jun 4, 2013, at 16:50, Liam Kirsher liamk@numenet.com wrote:

Hi –

I’m using the Application / Application_python cookbook to install Django.
The app source code lives in a Mercurial repo (which happens to be
private).
I need a little help here on how to do this. This is what I’ve got, but
it’s not working.

Does anyone have an example of how to do this?

How do I correctly reference the Mercurial provider?
I have verified that hg clone works with that url.
Does the ssh private key have to omit a passphrase?
I think the file referenced by deploy_key has to be uploaded somehow as
part of the cookbook.

application “bart” do
path "/srv/bart"
owner "nobody"
group "nogroup"
scm_provider "Chef::Provider::Mercurial"
repository "ssh://hg@bitbucket.org/bart/server/bart"
revision "master"
deploy_key "/home/liam/.ssh/bti"
migrate true
packages [“libpq-dev”, “git-core”, “mercurial”]
Thanks!
Liam


Liam Kirsher
PGP: http://liam.numenet.com/pgp/


Liam Kirsher
PGP: http://liam.numenet.com/pgp/


#5

On 06/04/2013 01:47 PM, AJ Christensen wrote:

There’s no mercurial provider.
I saw this, which made me think there was a Mercurial provider –
https://github.com/opscode-cookbooks/mercurial/pull/5
I guess it wasn’t merged?
I notice you’re using BitBucket, I
understand they support Git as well. I’m not sure if the two are
compatible in terms of talking to a single repository.
I haven’t been able to find a way to use git to access mercurial without
jumping through lots of hoops.

You’ll need to enhance Chef to be aware of Mercurial repositories (by
adding a Mercurial source code management provider), e.g. git [0],
subversion [1].

This could probably be added to the mercurial cookbook, which is
woefully lacking, the reason of which should be obvious (Git :P). [2]
I’m trying to avoid forcing a switch from mercurial to git. People are
religious about that kind of stuff.
If git’s really required, then okay, but I’d like to see if Chef can use
mercurial without /too/ much trouble.
On the other hand, I don’t want to get sidetracked with making Chef use
mercurial when it would be possible to convert from mercurial to git.

Cheers,

AJ

[0] https://github.com/opscode/chef/blob/master/lib/chef/provider/git.rb
[1] https://github.com/opscode/chef/blob/master/lib/chef/provider/subversion.rb
[2] http://ckbk.it/mercurial |
https://github.com/cookbooks/mercurial/blob/master/recipes/default.rb

On 5 June 2013 08:43, Liam Kirsher liamk@numenet.com wrote:

The error is:

No provider found to match ‘Chef::Provider::Mercurial’

On 06/04/2013 12:54 PM, Cassiano Leal wrote:

It would help if you included the error you’re getting.

Guessing from the questions you asked, I’d say that the SSH key should be passphrase-less since Chef will run unsupervised.

Cassiano Leal

On Jun 4, 2013, at 16:50, Liam Kirsher liamk@numenet.com wrote:

Hi –

I’m using the Application / Application_python cookbook to install Django.
The app source code lives in a Mercurial repo (which happens to be
private).
I need a little help here on how to do this. This is what I’ve got, but
it’s not working.

Does anyone have an example of how to do this?

How do I correctly reference the Mercurial provider?
I have verified that hg clone works with that url.
Does the ssh private key have to omit a passphrase?
I think the file referenced by deploy_key has to be uploaded somehow as
part of the cookbook.

application “bart” do
path "/srv/bart"
owner "nobody"
group "nogroup"
scm_provider "Chef::Provider::Mercurial"
repository "ssh://hg@bitbucket.org/bart/server/bart"
revision "master"
deploy_key "/home/liam/.ssh/bti"
migrate true
packages [“libpq-dev”, “git-core”, “mercurial”]
Thanks!
Liam


Liam Kirsher
PGP: http://liam.numenet.com/pgp/


Liam Kirsher
PGP: http://liam.numenet.com/pgp/


Liam Kirsher
PGP: http://liam.numenet.com/pgp/


#6

On Jun 4, 2013, at 12:50 PM, Liam Kirsher wrote:

Hi –

I’m using the Application / Application_python cookbook to install Django.
The app source code lives in a Mercurial repo (which happens to be
private).
I need a little help here on how to do this. This is what I’ve got, but
it’s not working.

Does anyone have an example of how to do this?

How do I correctly reference the Mercurial provider?
I have verified that hg clone works with that url.
Does the ssh private key have to omit a passphrase?
I think the file referenced by deploy_key has to be uploaded somehow as
part of the cookbook.

application “bart” do
path "/srv/bart"
owner "nobody"
group "nogroup"
scm_provider "Chef::Provider::Mercurial"
repository "ssh://hg@bitbucket.org/bart/server/bart"
revision "master"
deploy_key "/home/liam/.ssh/bti"
migrate true
packages [“libpq-dev”, “git-core”, “mercurial”]

This is not currently possible :frowning: You can look at the pypy-home cookbook in github.com/python/psf-chef for my best effort (using a forked version of the hg cookbook, take note) but it is still super flaky.

–Noah


#7

Le 4 juin 2013 à 23:23, Liam Kirsher liamk@numenet.com a écrit :

I’m trying to avoid forcing a switch from mercurial to git. People are religious about that kind of stuff.
If git’s really required, then okay, but I’d like to see if Chef can use mercurial without too much trouble.
On the other hand, I don’t want to get sidetracked with making Chef use mercurial when it would be possible to convert from mercurial to git.

Or maybe you could keep using mercurial, and automatically mirror to a git repository, and point Chef to it.


Ronan Amicel


#8

On Tue, Jun 4, 2013 at 1:47 PM, AJ Christensen aj@junglist.gen.nz wrote:

There’s no mercurial provider. I notice you’re using BitBucket, I
understand they support Git as well. I’m not sure if the two are
compatible in terms of talking to a single repository.

BitBucket repos can be either git or hg, but not both. You have to choose
when
you set up the repo.

  • Booker C. Bense

#9

On Tue, Jun 4, 2013 at 2:41 PM, Ronan Amicel ronan.amicel@gmail.com wrote:

Or maybe you could keep using mercurial, and automatically mirror to a git
repository, and point Chef to it.


Ronan Amicel

If you just need to clone a branch, this might be useful.

  • Booker C. Bense