{"action":"created","issue":{"url":"https://api.github.com/repos/robdimsdale/concourse-pipeline-resource/issues/1","repository_url":"https://api.github.com/repos/robdimsdale/concourse-pipeline-resource","labels_url":"https://api.github.com/repos/robdimsdale/concourse-pipeline-resource/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/robdimsdale/concourse-pipeline-resource/issues/1/comments","events_url":"https://api.github.com/repos/robdimsdale/concourse-pipeline-resource/issues/1/events","html_url":"https://github.com/robdimsdale/concourse-pipeline-resource/issues/1","id":153898660,"number":1,"title":"Concourse API client assumes a \"target\" url that is authenticated","user":{"login":"ryanmoran","id":155736,"avatar_url":"https://avatars.githubusercontent.com/u/155736?v=3","gravatar_id":"","url":"https://api.github.com/users/ryanmoran","html_url":"https://github.com/ryanmoran","followers_url":"https://api.github.com/users/ryanmoran/followers","following_url":"https://api.github.com/users/ryanmoran/following{/other_user}","gists_url":"https://api.github.com/users/ryanmoran/gists{/gist_id}","starred_url":"https://api.github.com/users/ryanmoran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryanmoran/subscriptions","organizations_url":"https://api.github.com/users/ryanmoran/orgs","repos_url":"https://api.github.com/users/ryanmoran/repos","events_url":"https://api.github.com/users/ryanmoran/events{/privacy}","received_events_url":"https://api.github.com/users/ryanmoran/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-05-10T00:21:31Z","updated_at":"2016-05-30T16:39:34Z","closed_at":"2016-05-30T16:36:53Z","body":"It looks like the target URL that is used in the concourse API client assumes an authenticated URL (meaning basic auth credentials embedded into the URL). What this means is that a user will have to provide resource configuration like the following to make this resource work:\r\n\r\n```yaml\r\nresources:\r\n- name: some-pipeline\r\n  type: concourse-pipeline\r\n  source:\r\n    target: https://username:password@my-concourse.com\r\n    username: username\r\n    password: password\r\n```\r\n\r\nWe found this when we tried to use the resource against a concourse that is protected by basic auth. We were unable to do a `put` to create a new pipeline. We saw output like the following:\r\n\r\n```\r\nLogging to /tmp/concourse-pipeline-resource-out.log789647078\r\n2016/05/10 00:06:57 Unexpected response status code: 401, expected: 200\r\n```\r\n\r\nAnd when we hijacked the put container, we saw this in the logs:\r\n```\r\n/tmp/build/put # more /tmp/concourse-pipeline-resource-out.log027887453\r\nConcourse Pipeline Resource version: 0.2.2\r\nReceived input: {Source:{Target:https://my-concourse.com Username:username Password:***REDACTED-PASSWORD***} Params:{Pipelines:[{Name:pipeline ConfigFile:pipeline/pipeline.yml VarsFiles:[]}] PipelinesFile:}}\r\nPerforming login\r\nStarting fly command: [-t concourse-pipeline-resource-target login -c https://my-concourse.com -u username -p ***REDACTED-PASSWORD***]\r\nWaiting for fly command: [-t concourse-pipeline-resource-target login -c https://my-concourse.com -u username -p ***REDACTED-PASSWORD***]\r\nLogin successful\r\nInput pipelines: [{Name:pipeline ConfigFile:pipeline/pipeline.yml VarsFiles:[]}]\r\nSetting pipelines\r\nStarting fly command: [-t concourse-pipeline-resource-target set-pipeline -n -p pipeline -c /tmp/build/put/pipeline/pipeline.yml]\r\nWaiting for fly command: [-t concourse-pipeline-resource-target set-pipeline -n -p pipeline -c /tmp/build/put/pipeline/pipeline.yml]\r\nSetting pipelines complete\r\nGetting pipelines\r\nExiting with error: Unexpected response status code: 401, expected: 200\r\n```\r\n\r\nWe think the issue is that the URL given to this GET request (https://github.com/robdimsdale/concourse-pipeline-resource/blob/14e4a76d1470c336047d9c912a37f6d406b0416c/concourse/api/pipelines.go#L31) does not include the basic auth credentials if you don't include them with the target like is shown above."},"comment":{"url":"https://api.github.com/repos/robdimsdale/concourse-pipeline-resource/issues/comments/222525760","html_url":"https://github.com/robdimsdale/concourse-pipeline-resource/issues/1#issuecomment-222525760","issue_url":"https://api.github.com/repos/robdimsdale/concourse-pipeline-resource/issues/1","id":222525760,"user":{"login":"robdimsdale","id":7230694,"avatar_url":"https://avatars.githubusercontent.com/u/7230694?v=3","gravatar_id":"","url":"https://api.github.com/users/robdimsdale","html_url":"https://github.com/robdimsdale","followers_url":"https://api.github.com/users/robdimsdale/followers","following_url":"https://api.github.com/users/robdimsdale/following{/other_user}","gists_url":"https://api.github.com/users/robdimsdale/gists{/gist_id}","starred_url":"https://api.github.com/users/robdimsdale/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robdimsdale/subscriptions","organizations_url":"https://api.github.com/users/robdimsdale/orgs","repos_url":"https://api.github.com/users/robdimsdale/repos","events_url":"https://api.github.com/users/robdimsdale/events{/privacy}","received_events_url":"https://api.github.com/users/robdimsdale/received_events","type":"User","site_admin":false},"created_at":"2016-05-30T16:39:34Z","updated_at":"2016-05-30T16:39:34Z","body":"Firstly, sorry for the delay. I didn't realize I wasn't \"watching\" the repo - is that default github behavior when you create a repo? I assumed I was watching.\r\n\r\nAnyway, to your issue, that's odd, as I see this work against my test concourse instance which requires authentication. My concourse is set up to allow both basic auth and github, so I haven't tried it with only basic auth? Other than I can't really see why this doesn't work.\r\n\r\nThe PR at #6 was merged, hopefully that fixes this issue"}}
{"actor":{"display_login":"robdimsdale"}}