Clone aws codecommit repo using chef

Hello,

How can i clone aws codecommit repo with chef recipe?

I tried installing AWS CLI and added credentials with codecommit access, then use chef’s git resource to clone the repo. but it fails with could not read Username for ‘https://git-codecommit.us-east-1.amazonaws.com’ .

git "/home/ubuntu/lead_intake" do
  repository node[:app_name][:git_repository]
  action :sync
end

When tried to clone from the command line it works.

helps would be appreciated

You may wanna check which user is chef-client running with and if that user has aws configuration added into .gitconfig file or not. Also check what credential manager is being used? Share some logs, that helps at times.

Please don’t cross-post on here and SO until at least some time has passed, most of us that watch also watch the other.

Posted on both places to get a quick response as its urgent my friend.

Chef client is running under root user. and the aws credentials and .gitconfig are stored under /root/.aws/ and /root/.gitconfig respectively.

Error reported

       Mixlib::ShellOut::ShellCommandFailed
       ------------------------------------
       Expected process to exit with [0], but received '128'
       ---- Begin output of "bash"  "/tmp/chef-script20171227-27351-v4c747" ----
       STDOUT:
       STDERR: Cloning into 'lead-engine-intake'...
       fatal: could not read Username for 'https://git-codecommit.us-east-1.amazonaws.com': No such device or address
       ---- End output of "bash"  "/tmp/chef-script20171227-27351-v4c747" ----
       Ran "bash"  "/tmp/chef-script20171227-27351-v4c747" returned 128

I tried to run the git clone with chef’s bash resource as well. same error.

Detailed chef recipe

cookbook_file '/root/.gitconfig' do
  source 'gitconfig'
  owner 'root'
  group 'root'
  mode '0755'
  action :create
end


cloudcli_aws_credentials '/root/.aws/credentials' do
  owner 'root'
  group 'root'
  mode 0600
  credential_params(
    aws_access_key_id: 'xxxxxxxxxxx',
    aws_secret_access_key: 'xxxxxxxx',
    region: 'us-east-1'
  )
end

git config file

[filter "lfs"]
        required = true
        clean = git-lfs clean -- %f
        smudge = git-lfs smudge -- %f
        process = git-lfs filter-process

[credential]
        helper = !aws codecommit credential-helper $@
        UseHttpPath = true

If it is urgent, you can purchase a support contract from Chef Software Inc. See https://www.chef.io/ccss/ for details. Or I’m sure many other places will sell you a commercial support incident.

Brother. Ultimate goal to come here is to get my problem solved. So please help. It will be appreciated.

Then pick one place and ask there. Though you can probably now consider yourself persona non grata by virtue of being rude to support volunteers. Maybe someone else will help you.

Did I sound rude? I’m sorry if you get offended by my words. i didt mean to be rude, its my bad English , sorry :frowning: