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.
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.
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
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.
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.