{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/awx/issues/2088","repository_url":"https://api.github.com/repos/ansible/awx","labels_url":"https://api.github.com/repos/ansible/awx/issues/2088/labels{/name}","comments_url":"https://api.github.com/repos/ansible/awx/issues/2088/comments","events_url":"https://api.github.com/repos/ansible/awx/issues/2088/events","html_url":"https://github.com/ansible/awx/issues/2088","id":343988376,"node_id":"MDU6SXNzdWUzNDM5ODgzNzY=","number":2088,"title":"Sync AWX Project with Git fails with a different \"SCM BRANCH/TAG/COMMIT\" than the default repository branch","user":{"login":"khelkun","id":1519738,"node_id":"MDQ6VXNlcjE1MTk3Mzg=","avatar_url":"https://avatars2.githubusercontent.com/u/1519738?v=4","gravatar_id":"","url":"https://api.github.com/users/khelkun","html_url":"https://github.com/khelkun","followers_url":"https://api.github.com/users/khelkun/followers","following_url":"https://api.github.com/users/khelkun/following{/other_user}","gists_url":"https://api.github.com/users/khelkun/gists{/gist_id}","starred_url":"https://api.github.com/users/khelkun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/khelkun/subscriptions","organizations_url":"https://api.github.com/users/khelkun/orgs","repos_url":"https://api.github.com/users/khelkun/repos","events_url":"https://api.github.com/users/khelkun/events{/privacy}","received_events_url":"https://api.github.com/users/khelkun/received_events","type":"User","site_admin":false},"labels":[{"id":687169246,"node_id":"MDU6TGFiZWw2ODcxNjkyNDY=","url":"https://api.github.com/repos/ansible/awx/labels/component:api","name":"component:api","color":"fbca04","default":false},{"id":861898136,"node_id":"MDU6TGFiZWw4NjE4OTgxMzY=","url":"https://api.github.com/repos/ansible/awx/labels/flag:%F0%9F%8E%B1","name":"flag:🎱","color":"31e0bd","default":false},{"id":686255387,"node_id":"MDU6TGFiZWw2ODYyNTUzODc=","url":"https://api.github.com/repos/ansible/awx/labels/priority:high","name":"priority:high","color":"f7c6c7","default":false},{"id":670226707,"node_id":"MDU6TGFiZWw2NzAyMjY3MDc=","url":"https://api.github.com/repos/ansible/awx/labels/state:needs_devel","name":"state:needs_devel","color":"ededed","default":false},{"id":607283748,"node_id":"MDU6TGFiZWw2MDcyODM3NDg=","url":"https://api.github.com/repos/ansible/awx/labels/type:bug","name":"type:bug","color":"F79F81","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-07-24T11:03:28Z","updated_at":"2018-08-13T19:33:35Z","closed_at":null,"author_association":"NONE","body":"##### ISSUE TYPE\r\n - Bug Report\r\n\r\n##### COMPONENT NAME\r\n - API\r\n - UI\r\n\r\n##### SUMMARY\r\nI use AWX Project synced with a Git repository with SSH source control credential type which uses a private key and a passphrase.\r\nEverything's fine except if I try to sync the AWX Project with a different branch than the default branch of the Git repository e.g: using the \"SCM BRANCH/TAG/COMMIT\" field in the AWX Project configuration. In this use case the project sync job launches the command \"/usr/bin/git ls-remote origin -h refs/heads/mybranch\" after clonging the repository branch. And this command apparently fails to authenticate through SSH with the private key and passphrase.\r\n\r\n##### ENVIRONMENT\r\n* AWX version: 1.0.6.3\r\n* AWX install method: docker on linux\r\n* Ansible version:  2.5.2\r\n* Operating System: Ubuntu 16.04 LTS\r\n* Web Browser: Google Chrome 67.0.3396.99 (Official Build) (64-bit)\r\n\r\n##### STEPS TO REPRODUCE\r\n- We want to sync an AWX project with a specific branch of Git (Gitlab in my case) repository. The authentication method to git is SSH with private key and passphrase.\r\n- Create a credential of type \"Source Control\" with:\r\n  - a username (\"git\") in my case\r\n  - no password\r\n  - a private key and its passphrase\r\n- Create an AWX Project with:\r\n  - \"SCM Type\" set to \"Git\" and sync it with a repository\r\n  - \"SCM Credential\" set to the previously created \"Source Control\" credential\r\n  - \"SCM BRANCH/TAG/COMMIT\" set to a branch different from the default clone branch of the Git repository, lets call it \"mybranch\"\r\n- Save the project click on the button \"Get latest SCM revision\" to get the project from the Git repository\r\n\r\n##### EXPECTED RESULTS\r\nThe project is successfully synced and exists in /var/lib/awx/project directory inside the awx_task_1 Docker container.\r\n\r\n##### ACTUAL RESULTS\r\nThe Project sync job fails with the following error:\r\n```\r\nfatal: [localhost]: FAILED! => \r\n{\r\n   \"changed\":false,\r\n   \"cmd\":\"/usr/bin/git ls-remote origin -h refs/heads/mybranch\",\r\n   \"msg\":\"ssh: connect to host gitlab.mydomain.com port 22: Connection refused\\\\r\\\\nfatal: Could not read from remote repository.\\\\n\\\\nPlease make sure you have the correct access rights\\\\nand the repository exists.\",\r\n   \"rc\":128,\r\n   \"stderr\":\"ssh: connect to host gitlab.mydomain.com port 22: Connection refused\\\\r\\\\nfatal: Could not read from remote repository.\\\\n\\\\nPlease make sure you have the correct access rights\\\\nand the repository exists.\\\\n\",\r\n   \"stderr_lines\":[\r\n      \"ssh: connect to host gitlab.mydomain.com port 22: Connection refused\",\r\n      \"fatal: Could not read from remote repository.\",\r\n      \"\",\r\n      \"Please make sure you have the correct access rights\",\r\n      \"and the repository exists.\"\r\n   ],\r\n   \"stdout\":\"\",\r\n   \"stdout_lines\":[\r\n\r\n   ]\r\n}\r\n```\r\nHowever:\r\n- The project actually exists inside `/var/lib/awx/project/_X__myproject`\r\n- a `git status` inside `/var/lib/awx/project/_X__myproject` reports that:\r\n```\r\nOn branch mybranch\r\nYour branch is up to date with 'origin/mybranch'.\r\n\r\nnothing to commit, working tree clean\r\n```\r\n\r\nSo as stated in my brief summary, the clone was done successfully but the command \"/usr/bin/git ls-remote origin -h refs/heads/mybranch\" apparently fails to authenticate through SSH with the private key and passphrase.\r\n\r\n##### ADDITIONAL INFORMATION\r\nThis is a minor issue ihmo because if I leave the \"SCM BRANCH/TAG/COMMIT\" field empty in the Project configuration then everything goes fine. So as a workaround, I simply changed the default branch of my repository from \"master\" to \"mybranch\".\r\nHowever @matburt on IRC told me I could file the issue here.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/ansible/awx/issues/comments/412637020","html_url":"https://github.com/ansible/awx/issues/2088#issuecomment-412637020","issue_url":"https://api.github.com/repos/ansible/awx/issues/2088","id":412637020,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMjYzNzAyMA==","user":{"login":"YunfanZhang42","id":39713606,"node_id":"MDQ6VXNlcjM5NzEzNjA2","avatar_url":"https://avatars2.githubusercontent.com/u/39713606?v=4","gravatar_id":"","url":"https://api.github.com/users/YunfanZhang42","html_url":"https://github.com/YunfanZhang42","followers_url":"https://api.github.com/users/YunfanZhang42/followers","following_url":"https://api.github.com/users/YunfanZhang42/following{/other_user}","gists_url":"https://api.github.com/users/YunfanZhang42/gists{/gist_id}","starred_url":"https://api.github.com/users/YunfanZhang42/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/YunfanZhang42/subscriptions","organizations_url":"https://api.github.com/users/YunfanZhang42/orgs","repos_url":"https://api.github.com/users/YunfanZhang42/repos","events_url":"https://api.github.com/users/YunfanZhang42/events{/privacy}","received_events_url":"https://api.github.com/users/YunfanZhang42/received_events","type":"User","site_admin":false},"created_at":"2018-08-13T19:33:35Z","updated_at":"2018-08-13T19:33:35Z","author_association":"CONTRIBUTOR","body":"Hi @khelkun, we just released awx 1.0.7 today and we were unable to reproduce this bug on this version. Can you try to use awx 1.0.7 and see if this problem persists? Thanks! "}}
{"actor":{"display_login":"YunfanZhang42"}}