{"action":"created","comment":{"url":"https://api.github.com/repos/dharmit/ccp-openshift/pulls/comments/212308906","pull_request_review_id":148910589,"id":212308906,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxMjMwODkwNg==","diff_hunk":"@@ -0,0 +1,43 @@\n+\"\"\"\n+This file contains operational Openshift clients\n+\"\"\"\n+\n+from ccp.lib.clients.base import CmdClient\n+import ccp.lib.utils\n+\n+\n+class OpenshiftCmdClient(CmdClient):\n+    \"\"\"\n+    Basic openshift client\n+    \"\"\"\n+\n+    def __init__(self):\n+        self.core_oc_cmd = \"oc\"\n+        self.oc_params = \"{globalflags} {operation} {what}{which}\"\n+\n+    def get_jenkins_service_account_token(self):\n+        \"\"\"\n+        Queries and gets the jenkins token. This assumes you have access to oc\n+        command line.\n+        :return: The token, if it was able to get it.\n+        \"\"\"\n+        token = None\n+        token_cmd = \"\"\"\n+        {core_oc_cmd} sa/jenkins --template='{template1}' | xargs -n 1 \n+        {core_oc_cmd} get secret --template='{template2}' | head -n 1 | \n+        base64 -d -\n+        \"\"\".format(\n+            core_oc_cmd=self.core_oc_cmd,\n+            template1=\"{{range .secrets}}{{ .name }} {{end}}\",\n+            template2=\"{{ if .data.token }}{{ .data.token }}{{end}}'\"\n+        )\n+        out, ex = ccp.lib.utils.run_cmd(token_cmd, shell=True, use_pipes=True)\n+        if ex:\n+            raise Exception(\"Failed to get token due to {}\".format(ex))\n+        else:\n+            data, err = out\n+            if data:\n+                token = data\n+            else:\n+                raise Exception(\"Failed to get token due to {}\".format(err))\n+        return token","path":"ccp/lib/clients/openshift/client.py","position":43,"original_position":43,"commit_id":"38f8941f6b36196b094881d539fb05d788e2cd6a","original_commit_id":"38f8941f6b36196b094881d539fb05d788e2cd6a","user":{"login":"mohammedzee1000","id":8547729,"node_id":"MDQ6VXNlcjg1NDc3Mjk=","avatar_url":"https://avatars3.githubusercontent.com/u/8547729?v=4","gravatar_id":"","url":"https://api.github.com/users/mohammedzee1000","html_url":"https://github.com/mohammedzee1000","followers_url":"https://api.github.com/users/mohammedzee1000/followers","following_url":"https://api.github.com/users/mohammedzee1000/following{/other_user}","gists_url":"https://api.github.com/users/mohammedzee1000/gists{/gist_id}","starred_url":"https://api.github.com/users/mohammedzee1000/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mohammedzee1000/subscriptions","organizations_url":"https://api.github.com/users/mohammedzee1000/orgs","repos_url":"https://api.github.com/users/mohammedzee1000/repos","events_url":"https://api.github.com/users/mohammedzee1000/events{/privacy}","received_events_url":"https://api.github.com/users/mohammedzee1000/received_events","type":"User","site_admin":false},"body":"Removed","created_at":"2018-08-23T13:30:07Z","updated_at":"2018-08-23T13:30:07Z","html_url":"https://github.com/dharmit/ccp-openshift/pull/38#discussion_r212308906","pull_request_url":"https://api.github.com/repos/dharmit/ccp-openshift/pulls/38","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/dharmit/ccp-openshift/pulls/comments/212308906"},"html":{"href":"https://github.com/dharmit/ccp-openshift/pull/38#discussion_r212308906"},"pull_request":{"href":"https://api.github.com/repos/dharmit/ccp-openshift/pulls/38"}},"in_reply_to_id":212218858},"pull_request":{"url":"https://api.github.com/repos/dharmit/ccp-openshift/pulls/38","id":209462061,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA5NDYyMDYx","html_url":"https://github.com/dharmit/ccp-openshift/pull/38","diff_url":"https://github.com/dharmit/ccp-openshift/pull/38.diff","patch_url":"https://github.com/dharmit/ccp-openshift/pull/38.patch","issue_url":"https://api.github.com/repos/dharmit/ccp-openshift/issues/38","number":38,"state":"open","locked":false,"title":"Creating library and clients for querying jenkins.","user":{"login":"mohammedzee1000","id":8547729,"node_id":"MDQ6VXNlcjg1NDc3Mjk=","avatar_url":"https://avatars3.githubusercontent.com/u/8547729?v=4","gravatar_id":"","url":"https://api.github.com/users/mohammedzee1000","html_url":"https://github.com/mohammedzee1000","followers_url":"https://api.github.com/users/mohammedzee1000/followers","following_url":"https://api.github.com/users/mohammedzee1000/following{/other_user}","gists_url":"https://api.github.com/users/mohammedzee1000/gists{/gist_id}","starred_url":"https://api.github.com/users/mohammedzee1000/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mohammedzee1000/subscriptions","organizations_url":"https://api.github.com/users/mohammedzee1000/orgs","repos_url":"https://api.github.com/users/mohammedzee1000/repos","events_url":"https://api.github.com/users/mohammedzee1000/events{/privacy}","received_events_url":"https://api.github.com/users/mohammedzee1000/received_events","type":"User","site_admin":false},"body":"- Create utils for commonly used functions.\r\n- Create base Client structure.\r\n- Create base ApiClient Structure.\r\n- Create basic OpenshiftClient Structure.\r\n- Create basic Jenkins API Client structure.\r\n\r\nSigned-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>","created_at":"2018-08-20T09:31:32Z","updated_at":"2018-08-23T13:30:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"894d025cb039d20b68d8d7816af3174e86b39ad4","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/dharmit/ccp-openshift/pulls/38/commits","review_comments_url":"https://api.github.com/repos/dharmit/ccp-openshift/pulls/38/comments","review_comment_url":"https://api.github.com/repos/dharmit/ccp-openshift/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dharmit/ccp-openshift/issues/38/comments","statuses_url":"https://api.github.com/repos/dharmit/ccp-openshift/statuses/38f8941f6b36196b094881d539fb05d788e2cd6a","head":{"label":"mohammedzee1000:get_logs_pipeline","ref":"get_logs_pipeline","sha":"38f8941f6b36196b094881d539fb05d788e2cd6a","user":{"login":"mohammedzee1000","id":8547729,"node_id":"MDQ6VXNlcjg1NDc3Mjk=","avatar_url":"https://avatars3.githubusercontent.com/u/8547729?v=4","gravatar_id":"","url":"https://api.github.com/users/mohammedzee1000","html_url":"https://github.com/mohammedzee1000","followers_url":"https://api.github.com/users/mohammedzee1000/followers","following_url":"https://api.github.com/users/mohammedzee1000/following{/other_user}","gists_url":"https://api.github.com/users/mohammedzee1000/gists{/gist_id}","starred_url":"https://api.github.com/users/mohammedzee1000/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mohammedzee1000/subscriptions","organizations_url":"https://api.github.com/users/mohammedzee1000/orgs","repos_url":"https://api.github.com/users/mohammedzee1000/repos","events_url":"https://api.github.com/users/mohammedzee1000/events{/privacy}","received_events_url":"https://api.github.com/users/mohammedzee1000/received_events","type":"User","site_admin":false},"repo":{"id":134232927,"node_id":"MDEwOlJlcG9zaXRvcnkxMzQyMzI5Mjc=","name":"ccp-openshift","full_name":"mohammedzee1000/ccp-openshift","owner":{"login":"mohammedzee1000","id":8547729,"node_id":"MDQ6VXNlcjg1NDc3Mjk=","avatar_url":"https://avatars3.githubusercontent.com/u/8547729?v=4","gravatar_id":"","url":"https://api.github.com/users/mohammedzee1000","html_url":"https://github.com/mohammedzee1000","followers_url":"https://api.github.com/users/mohammedzee1000/followers","following_url":"https://api.github.com/users/mohammedzee1000/following{/other_user}","gists_url":"https://api.github.com/users/mohammedzee1000/gists{/gist_id}","starred_url":"https://api.github.com/users/mohammedzee1000/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mohammedzee1000/subscriptions","organizations_url":"https://api.github.com/users/mohammedzee1000/orgs","repos_url":"https://api.github.com/users/mohammedzee1000/repos","events_url":"https://api.github.com/users/mohammedzee1000/events{/privacy}","received_events_url":"https://api.github.com/users/mohammedzee1000/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mohammedzee1000/ccp-openshift","description":"MVP for OpenShift-ification of CentOS Container Pipeline service","fork":true,"url":"https://api.github.com/repos/mohammedzee1000/ccp-openshift","forks_url":"https://api.github.com/repos/mohammedzee1000/ccp-openshift/forks","keys_url":"https://api.github.com/repos/mohammedzee1000/ccp-openshift/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mohammedzee1000/ccp-openshift/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mohammedzee1000/ccp-openshift/teams","hooks_url":"https://api.github.com/repos/mohammedzee1000/ccp-openshift/hooks","issue_events_url":"https://api.github.com/repos/mohammedzee1000/ccp-openshift/issues/events{/number}","events_url":"https://api.github.com/repos/mohammedzee1000/ccp-openshift/events","assignees_url":"https://api.github.com/repos/mohammedzee1000/ccp-openshift/assignees{/user}","branches_url":"https://api.github.com/repos/mohammedzee1000/ccp-openshift/branches{/branch}","tags_url":"https://api.github.com/repos/mohammedzee1000/ccp-openshift/tags","blobs_url":"https://api.github.com/repos/mohammedzee1000/ccp-openshift/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mohammedzee1000/ccp-openshift/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mohammedzee1000/ccp-openshift/git/refs{/sha}","trees_url":"https://api.github.com/repos/mohammedzee1000/ccp-openshift/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mohammedzee1000/ccp-openshift/statuses/{sha}","languages_url":"https://api.github.com/repos/mohammedzee1000/ccp-openshift/languages","stargazers_url":"https://api.github.com/repos/mohammedzee1000/ccp-openshift/stargazers","contributors_url":"https://api.github.com/repos/mohammedzee1000/ccp-openshift/contributors","subscribers_url":"https://api.github.com/repos/mohammedzee1000/ccp-openshift/subscribers","subscription_url":"https://api.github.com/repos/mohammedzee1000/ccp-openshift/subscription","commits_url":"https://api.github.com/repos/mohammedzee1000/ccp-openshift/commits{/sha}","git_commits_url":"https://api.github.com/repos/mohammedzee1000/ccp-openshift/git/commits{/sha}","comments_url":"https://api.github.com/repos/mohammedzee1000/ccp-openshift/comments{/number}","issue_comment_url":"https://api.github.com/repos/mohammedzee1000/ccp-openshift/issues/comments{/number}","contents_url":"https://api.github.com/repos/mohammedzee1000/ccp-openshift/contents/{+path}","compare_url":"https://api.github.com/repos/mohammedzee1000/ccp-openshift/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mohammedzee1000/ccp-openshift/merges","archive_url":"https://api.github.com/repos/mohammedzee1000/ccp-openshift/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mohammedzee1000/ccp-openshift/downloads","issues_url":"https://api.github.com/repos/mohammedzee1000/ccp-openshift/issues{/number}","pulls_url":"https://api.github.com/repos/mohammedzee1000/ccp-openshift/pulls{/number}","milestones_url":"https://api.github.com/repos/mohammedzee1000/ccp-openshift/milestones{/number}","notifications_url":"https://api.github.com/repos/mohammedzee1000/ccp-openshift/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mohammedzee1000/ccp-openshift/labels{/name}","releases_url":"https://api.github.com/repos/mohammedzee1000/ccp-openshift/releases{/id}","deployments_url":"https://api.github.com/repos/mohammedzee1000/ccp-openshift/deployments","created_at":"2018-05-21T07:17:32Z","updated_at":"2018-08-08T07:48:36Z","pushed_at":"2018-08-23T09:53:19Z","git_url":"git://github.com/mohammedzee1000/ccp-openshift.git","ssh_url":"git@github.com:mohammedzee1000/ccp-openshift.git","clone_url":"https://github.com/mohammedzee1000/ccp-openshift.git","svn_url":"https://github.com/mohammedzee1000/ccp-openshift","homepage":null,"size":196,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dharmit:master","ref":"master","sha":"4fcb267ee9ce6a26c7610f5f187cac00b46e9817","user":{"login":"dharmit","id":713521,"node_id":"MDQ6VXNlcjcxMzUyMQ==","avatar_url":"https://avatars2.githubusercontent.com/u/713521?v=4","gravatar_id":"","url":"https://api.github.com/users/dharmit","html_url":"https://github.com/dharmit","followers_url":"https://api.github.com/users/dharmit/followers","following_url":"https://api.github.com/users/dharmit/following{/other_user}","gists_url":"https://api.github.com/users/dharmit/gists{/gist_id}","starred_url":"https://api.github.com/users/dharmit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dharmit/subscriptions","organizations_url":"https://api.github.com/users/dharmit/orgs","repos_url":"https://api.github.com/users/dharmit/repos","events_url":"https://api.github.com/users/dharmit/events{/privacy}","received_events_url":"https://api.github.com/users/dharmit/received_events","type":"User","site_admin":false},"repo":{"id":123950705,"node_id":"MDEwOlJlcG9zaXRvcnkxMjM5NTA3MDU=","name":"ccp-openshift","full_name":"dharmit/ccp-openshift","owner":{"login":"dharmit","id":713521,"node_id":"MDQ6VXNlcjcxMzUyMQ==","avatar_url":"https://avatars2.githubusercontent.com/u/713521?v=4","gravatar_id":"","url":"https://api.github.com/users/dharmit","html_url":"https://github.com/dharmit","followers_url":"https://api.github.com/users/dharmit/followers","following_url":"https://api.github.com/users/dharmit/following{/other_user}","gists_url":"https://api.github.com/users/dharmit/gists{/gist_id}","starred_url":"https://api.github.com/users/dharmit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dharmit/subscriptions","organizations_url":"https://api.github.com/users/dharmit/orgs","repos_url":"https://api.github.com/users/dharmit/repos","events_url":"https://api.github.com/users/dharmit/events{/privacy}","received_events_url":"https://api.github.com/users/dharmit/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dharmit/ccp-openshift","description":"CentOS Container Pipeline Service","fork":false,"url":"https://api.github.com/repos/dharmit/ccp-openshift","forks_url":"https://api.github.com/repos/dharmit/ccp-openshift/forks","keys_url":"https://api.github.com/repos/dharmit/ccp-openshift/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dharmit/ccp-openshift/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dharmit/ccp-openshift/teams","hooks_url":"https://api.github.com/repos/dharmit/ccp-openshift/hooks","issue_events_url":"https://api.github.com/repos/dharmit/ccp-openshift/issues/events{/number}","events_url":"https://api.github.com/repos/dharmit/ccp-openshift/events","assignees_url":"https://api.github.com/repos/dharmit/ccp-openshift/assignees{/user}","branches_url":"https://api.github.com/repos/dharmit/ccp-openshift/branches{/branch}","tags_url":"https://api.github.com/repos/dharmit/ccp-openshift/tags","blobs_url":"https://api.github.com/repos/dharmit/ccp-openshift/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dharmit/ccp-openshift/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dharmit/ccp-openshift/git/refs{/sha}","trees_url":"https://api.github.com/repos/dharmit/ccp-openshift/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dharmit/ccp-openshift/statuses/{sha}","languages_url":"https://api.github.com/repos/dharmit/ccp-openshift/languages","stargazers_url":"https://api.github.com/repos/dharmit/ccp-openshift/stargazers","contributors_url":"https://api.github.com/repos/dharmit/ccp-openshift/contributors","subscribers_url":"https://api.github.com/repos/dharmit/ccp-openshift/subscribers","subscription_url":"https://api.github.com/repos/dharmit/ccp-openshift/subscription","commits_url":"https://api.github.com/repos/dharmit/ccp-openshift/commits{/sha}","git_commits_url":"https://api.github.com/repos/dharmit/ccp-openshift/git/commits{/sha}","comments_url":"https://api.github.com/repos/dharmit/ccp-openshift/comments{/number}","issue_comment_url":"https://api.github.com/repos/dharmit/ccp-openshift/issues/comments{/number}","contents_url":"https://api.github.com/repos/dharmit/ccp-openshift/contents/{+path}","compare_url":"https://api.github.com/repos/dharmit/ccp-openshift/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dharmit/ccp-openshift/merges","archive_url":"https://api.github.com/repos/dharmit/ccp-openshift/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dharmit/ccp-openshift/downloads","issues_url":"https://api.github.com/repos/dharmit/ccp-openshift/issues{/number}","pulls_url":"https://api.github.com/repos/dharmit/ccp-openshift/pulls{/number}","milestones_url":"https://api.github.com/repos/dharmit/ccp-openshift/milestones{/number}","notifications_url":"https://api.github.com/repos/dharmit/ccp-openshift/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dharmit/ccp-openshift/labels{/name}","releases_url":"https://api.github.com/repos/dharmit/ccp-openshift/releases{/id}","deployments_url":"https://api.github.com/repos/dharmit/ccp-openshift/deployments","created_at":"2018-03-05T16:58:26Z","updated_at":"2018-08-20T07:11:53Z","pushed_at":"2018-08-23T12:17:22Z","git_url":"git://github.com/dharmit/ccp-openshift.git","ssh_url":"git@github.com:dharmit/ccp-openshift.git","clone_url":"https://github.com/dharmit/ccp-openshift.git","svn_url":"https://github.com/dharmit/ccp-openshift","homepage":"https://wiki.centos.org/ContainerPipeline","size":143,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"archived":false,"open_issues_count":16,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":4,"open_issues":16,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dharmit/ccp-openshift/pulls/38"},"html":{"href":"https://github.com/dharmit/ccp-openshift/pull/38"},"issue":{"href":"https://api.github.com/repos/dharmit/ccp-openshift/issues/38"},"comments":{"href":"https://api.github.com/repos/dharmit/ccp-openshift/issues/38/comments"},"review_comments":{"href":"https://api.github.com/repos/dharmit/ccp-openshift/pulls/38/comments"},"review_comment":{"href":"https://api.github.com/repos/dharmit/ccp-openshift/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dharmit/ccp-openshift/pulls/38/commits"},"statuses":{"href":"https://api.github.com/repos/dharmit/ccp-openshift/statuses/38f8941f6b36196b094881d539fb05d788e2cd6a"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"mohammedzee1000"}}