{"action":"created","comment":{"url":"https://api.github.com/repos/openshift/vagrant-openshift/pulls/comments/32311604","id":32311604,"diff_hunk":"@@ -37,50 +37,44 @@ def fix_insecure_registry_cmd(registry_url)\n           }\n         end\n \n-        def build_image(image_name, git_ref, repo_url, registry)\n+        def push_image(image_name, git_ref, registry)\n           %{\n set -e\n+pushd /data/src/github/openshift/#{image_name}\n+git checkout #{git_ref}\n+git_ref=$(git rev-parse --short HEAD)\n+echo \"Pushing image #{image_name}:$git_ref...\"\n+docker tag -f #{image_name}-centos7 #{registry}#{image_name}-centos7:$git_ref\n+docker tag -f #{image_name}-centos7 #{registry}#{image_name}-centos7:latest\n+docker tag -f #{image_name}-centos7 docker.io/#{image_name}-centos7:latest\n+docker tag -f #{image_name}-rhel7 #{registry}#{image_name}-rhel7:$git_ref\n+docker tag -f #{image_name}-rhel7 #{registry}#{image_name}-rhel7:latest\n+# FIXME: Paralelize this\n+docker push -f #{registry}#{image_name}-centos7:$git_ref\n+docker push -f #{registry}#{image_name}-centos7:latest\n+docker push -f docker.io/#{image_name}-centos7:latest\n+docker push -f #{registry}#{image_name}-rhel7:$git_ref\n+docker push -f #{registry}#{image_name}-rhel7:latest\n+popd\n+          }\n+        end\n \n-# so we can call sti\n-PATH=/data/src/github.com/openshift/source-to-image/_output/go/bin:/data/src/github.com/openshift/source-to-image/_output/local/go/bin:$PATH\n-\n+        def build_image(image_name, git_ref, repo_url, registry)\n+          %{\n dest_dir=\"/data/src/github/openshift/#{image_name}\"\n rm -rf ${dest_dir}; mkdir -p ${dest_dir}\n-if git clone #{repo_url} ${dest_dir}; then\n-  cd ${dest_dir}\n-  git checkout #{git_ref}\n-  git_ref=$(git rev-parse --short HEAD)\n-  echo \"Building and testing #{image_name}:$git_ref\"\n-  if ! make test TARGET=centos7; then\n-    echo \"ERROR: #{image_name}-centos7 failed testing.\"\n-    exit 1\n-  fi\n-  if make build TARGET=centos7; then\n-    docker tag -f #{image_name}-centos7 #{registry}#{image_name}-centos7:$git_ref\n-    docker tag -f #{image_name}-centos7 #{registry}#{image_name}-centos7:latest\n-    docker tag -f #{image_name}-centos7 docker.io/#{image_name}-centos7:latest\n-    docker push -f #{registry}#{image_name}-centos7:$git_ref\n-    docker push -f #{registry}#{image_name}-centos7:latest\n-    docker push -f docker.io/#{image_name}-centos7:latest\n-  else\n-    echo \"ERROR: Failed to build #{image_name}-centos7\"\n-    exit 1\n-  fi\n-\n-  if ! make test TARGET=rhel7; then\n-    echo \"ERROR: #{image_name}-rhel7 failed testing.\"\n-    exit 1\n-  fi\n-  if make build TARGET=rhel7; then\n-    docker tag -f #{image_name}-rhel7 #{registry}#{image_name}-rhel7:$git_ref\n-    docker tag -f #{image_name}-rhel7 #{registry}#{image_name}-rhel7:latest\n-    docker push -f #{registry}#{image_name}-rhel7:$git_ref\n-    docker push -f #{registry}#{image_name}-rhel7:latest\n-  else\n-    echo \"ERROR: Failed to build #{image_name}-rhel7\"\n-    exit 1\n-  fi\n-fi\n+set -e\n+pushd ${dest_dir}\n+git init && git remote add -t master origin #{repo_url}\n+git fetch && git checkout #{git_ref}\n+git_ref=$(git rev-parse --short HEAD)\n+echo \"Building and testing #{image_name}-centos7:$git_ref ...\"\n+make test TARGET=centos7\n+make build TARGET=centos7\n+echo \"Building and testing #{image_name}-rhel7:$git_ref ...\"\n+make test TARGET=rhel7\n+make build TARGET=rhel7\n+popd","path":"lib/vagrant-openshift/action/push_openshift_images.rb","position":80,"original_position":80,"commit_id":"5b423a5a946d0281e07f5c301674b51adbb4aa97","original_commit_id":"5b423a5a946d0281e07f5c301674b51adbb4aa97","user":{"login":"bparees","id":4974046,"avatar_url":"https://avatars.githubusercontent.com/u/4974046?v=3","gravatar_id":"","url":"https://api.github.com/users/bparees","html_url":"https://github.com/bparees","followers_url":"https://api.github.com/users/bparees/followers","following_url":"https://api.github.com/users/bparees/following{/other_user}","gists_url":"https://api.github.com/users/bparees/gists{/gist_id}","starred_url":"https://api.github.com/users/bparees/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bparees/subscriptions","organizations_url":"https://api.github.com/users/bparees/orgs","repos_url":"https://api.github.com/users/bparees/repos","events_url":"https://api.github.com/users/bparees/events{/privacy}","received_events_url":"https://api.github.com/users/bparees/received_events","type":"User","site_admin":false},"body":"sure, but if no error occurs you've left it in set -e mode for the next block.\r\n\r\nI think each block should be setting up -e/+e as it desires, otherwise you've got unexpected behavior when the next block runs, right?\r\n","created_at":"2015-06-12T12:35:19Z","updated_at":"2015-06-12T12:35:19Z","html_url":"https://github.com/openshift/vagrant-openshift/pull/269#discussion_r32311604","pull_request_url":"https://api.github.com/repos/openshift/vagrant-openshift/pulls/269","_links":{"self":{"href":"https://api.github.com/repos/openshift/vagrant-openshift/pulls/comments/32311604"},"html":{"href":"https://github.com/openshift/vagrant-openshift/pull/269#discussion_r32311604"},"pull_request":{"href":"https://api.github.com/repos/openshift/vagrant-openshift/pulls/269"}}},"pull_request":{"url":"https://api.github.com/repos/openshift/vagrant-openshift/pulls/269","id":37551215,"html_url":"https://github.com/openshift/vagrant-openshift/pull/269","diff_url":"https://github.com/openshift/vagrant-openshift/pull/269.diff","patch_url":"https://github.com/openshift/vagrant-openshift/pull/269.patch","issue_url":"https://api.github.com/repos/openshift/vagrant-openshift/issues/269","number":269,"state":"open","locked":false,"title":"Improvements to the push_images job","user":{"login":"mfojtik","id":44136,"avatar_url":"https://avatars.githubusercontent.com/u/44136?v=3","gravatar_id":"","url":"https://api.github.com/users/mfojtik","html_url":"https://github.com/mfojtik","followers_url":"https://api.github.com/users/mfojtik/followers","following_url":"https://api.github.com/users/mfojtik/following{/other_user}","gists_url":"https://api.github.com/users/mfojtik/gists{/gist_id}","starred_url":"https://api.github.com/users/mfojtik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mfojtik/subscriptions","organizations_url":"https://api.github.com/users/mfojtik/orgs","repos_url":"https://api.github.com/users/mfojtik/repos","events_url":"https://api.github.com/users/mfojtik/events{/privacy}","received_events_url":"https://api.github.com/users/mfojtik/received_events","type":"User","site_admin":false},"body":"- Fix prepending of PATH\r\n- Push images only after all images builds && test\r\n- Simplify the bash scripts","created_at":"2015-06-12T10:47:17Z","updated_at":"2015-06-12T12:35:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"02d4b82edf53a87c3151291d8da192bd6ff3dff3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/openshift/vagrant-openshift/pulls/269/commits","review_comments_url":"https://api.github.com/repos/openshift/vagrant-openshift/pulls/269/comments","review_comment_url":"https://api.github.com/repos/openshift/vagrant-openshift/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openshift/vagrant-openshift/issues/269/comments","statuses_url":"https://api.github.com/repos/openshift/vagrant-openshift/statuses/5b423a5a946d0281e07f5c301674b51adbb4aa97","head":{"label":"mfojtik:improve-push-images","ref":"improve-push-images","sha":"5b423a5a946d0281e07f5c301674b51adbb4aa97","user":{"login":"mfojtik","id":44136,"avatar_url":"https://avatars.githubusercontent.com/u/44136?v=3","gravatar_id":"","url":"https://api.github.com/users/mfojtik","html_url":"https://github.com/mfojtik","followers_url":"https://api.github.com/users/mfojtik/followers","following_url":"https://api.github.com/users/mfojtik/following{/other_user}","gists_url":"https://api.github.com/users/mfojtik/gists{/gist_id}","starred_url":"https://api.github.com/users/mfojtik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mfojtik/subscriptions","organizations_url":"https://api.github.com/users/mfojtik/orgs","repos_url":"https://api.github.com/users/mfojtik/repos","events_url":"https://api.github.com/users/mfojtik/events{/privacy}","received_events_url":"https://api.github.com/users/mfojtik/received_events","type":"User","site_admin":false},"repo":{"id":19775873,"name":"vagrant-openshift","full_name":"mfojtik/vagrant-openshift","owner":{"login":"mfojtik","id":44136,"avatar_url":"https://avatars.githubusercontent.com/u/44136?v=3","gravatar_id":"","url":"https://api.github.com/users/mfojtik","html_url":"https://github.com/mfojtik","followers_url":"https://api.github.com/users/mfojtik/followers","following_url":"https://api.github.com/users/mfojtik/following{/other_user}","gists_url":"https://api.github.com/users/mfojtik/gists{/gist_id}","starred_url":"https://api.github.com/users/mfojtik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mfojtik/subscriptions","organizations_url":"https://api.github.com/users/mfojtik/orgs","repos_url":"https://api.github.com/users/mfojtik/repos","events_url":"https://api.github.com/users/mfojtik/events{/privacy}","received_events_url":"https://api.github.com/users/mfojtik/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mfojtik/vagrant-openshift","description":"vagrant-openshift","fork":true,"url":"https://api.github.com/repos/mfojtik/vagrant-openshift","forks_url":"https://api.github.com/repos/mfojtik/vagrant-openshift/forks","keys_url":"https://api.github.com/repos/mfojtik/vagrant-openshift/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mfojtik/vagrant-openshift/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mfojtik/vagrant-openshift/teams","hooks_url":"https://api.github.com/repos/mfojtik/vagrant-openshift/hooks","issue_events_url":"https://api.github.com/repos/mfojtik/vagrant-openshift/issues/events{/number}","events_url":"https://api.github.com/repos/mfojtik/vagrant-openshift/events","assignees_url":"https://api.github.com/repos/mfojtik/vagrant-openshift/assignees{/user}","branches_url":"https://api.github.com/repos/mfojtik/vagrant-openshift/branches{/branch}","tags_url":"https://api.github.com/repos/mfojtik/vagrant-openshift/tags","blobs_url":"https://api.github.com/repos/mfojtik/vagrant-openshift/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mfojtik/vagrant-openshift/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mfojtik/vagrant-openshift/git/refs{/sha}","trees_url":"https://api.github.com/repos/mfojtik/vagrant-openshift/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mfojtik/vagrant-openshift/statuses/{sha}","languages_url":"https://api.github.com/repos/mfojtik/vagrant-openshift/languages","stargazers_url":"https://api.github.com/repos/mfojtik/vagrant-openshift/stargazers","contributors_url":"https://api.github.com/repos/mfojtik/vagrant-openshift/contributors","subscribers_url":"https://api.github.com/repos/mfojtik/vagrant-openshift/subscribers","subscription_url":"https://api.github.com/repos/mfojtik/vagrant-openshift/subscription","commits_url":"https://api.github.com/repos/mfojtik/vagrant-openshift/commits{/sha}","git_commits_url":"https://api.github.com/repos/mfojtik/vagrant-openshift/git/commits{/sha}","comments_url":"https://api.github.com/repos/mfojtik/vagrant-openshift/comments{/number}","issue_comment_url":"https://api.github.com/repos/mfojtik/vagrant-openshift/issues/comments{/number}","contents_url":"https://api.github.com/repos/mfojtik/vagrant-openshift/contents/{+path}","compare_url":"https://api.github.com/repos/mfojtik/vagrant-openshift/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mfojtik/vagrant-openshift/merges","archive_url":"https://api.github.com/repos/mfojtik/vagrant-openshift/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mfojtik/vagrant-openshift/downloads","issues_url":"https://api.github.com/repos/mfojtik/vagrant-openshift/issues{/number}","pulls_url":"https://api.github.com/repos/mfojtik/vagrant-openshift/pulls{/number}","milestones_url":"https://api.github.com/repos/mfojtik/vagrant-openshift/milestones{/number}","notifications_url":"https://api.github.com/repos/mfojtik/vagrant-openshift/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mfojtik/vagrant-openshift/labels{/name}","releases_url":"https://api.github.com/repos/mfojtik/vagrant-openshift/releases{/id}","created_at":"2014-05-14T10:46:02Z","updated_at":"2015-05-07T09:04:58Z","pushed_at":"2015-06-12T11:00:54Z","git_url":"git://github.com/mfojtik/vagrant-openshift.git","ssh_url":"git@github.com:mfojtik/vagrant-openshift.git","clone_url":"https://github.com/mfojtik/vagrant-openshift.git","svn_url":"https://github.com/mfojtik/vagrant-openshift","homepage":null,"size":1296,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"openshift:master","ref":"master","sha":"d3eebed9bb9562d8f70506f7245399b2674dfa9d","user":{"login":"openshift","id":792337,"avatar_url":"https://avatars.githubusercontent.com/u/792337?v=3","gravatar_id":"","url":"https://api.github.com/users/openshift","html_url":"https://github.com/openshift","followers_url":"https://api.github.com/users/openshift/followers","following_url":"https://api.github.com/users/openshift/following{/other_user}","gists_url":"https://api.github.com/users/openshift/gists{/gist_id}","starred_url":"https://api.github.com/users/openshift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openshift/subscriptions","organizations_url":"https://api.github.com/users/openshift/orgs","repos_url":"https://api.github.com/users/openshift/repos","events_url":"https://api.github.com/users/openshift/events{/privacy}","received_events_url":"https://api.github.com/users/openshift/received_events","type":"Organization","site_admin":false},"repo":{"id":12317077,"name":"vagrant-openshift","full_name":"openshift/vagrant-openshift","owner":{"login":"openshift","id":792337,"avatar_url":"https://avatars.githubusercontent.com/u/792337?v=3","gravatar_id":"","url":"https://api.github.com/users/openshift","html_url":"https://github.com/openshift","followers_url":"https://api.github.com/users/openshift/followers","following_url":"https://api.github.com/users/openshift/following{/other_user}","gists_url":"https://api.github.com/users/openshift/gists{/gist_id}","starred_url":"https://api.github.com/users/openshift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openshift/subscriptions","organizations_url":"https://api.github.com/users/openshift/orgs","repos_url":"https://api.github.com/users/openshift/repos","events_url":"https://api.github.com/users/openshift/events{/privacy}","received_events_url":"https://api.github.com/users/openshift/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openshift/vagrant-openshift","description":"vagrant-openshift","fork":false,"url":"https://api.github.com/repos/openshift/vagrant-openshift","forks_url":"https://api.github.com/repos/openshift/vagrant-openshift/forks","keys_url":"https://api.github.com/repos/openshift/vagrant-openshift/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openshift/vagrant-openshift/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openshift/vagrant-openshift/teams","hooks_url":"https://api.github.com/repos/openshift/vagrant-openshift/hooks","issue_events_url":"https://api.github.com/repos/openshift/vagrant-openshift/issues/events{/number}","events_url":"https://api.github.com/repos/openshift/vagrant-openshift/events","assignees_url":"https://api.github.com/repos/openshift/vagrant-openshift/assignees{/user}","branches_url":"https://api.github.com/repos/openshift/vagrant-openshift/branches{/branch}","tags_url":"https://api.github.com/repos/openshift/vagrant-openshift/tags","blobs_url":"https://api.github.com/repos/openshift/vagrant-openshift/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openshift/vagrant-openshift/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openshift/vagrant-openshift/git/refs{/sha}","trees_url":"https://api.github.com/repos/openshift/vagrant-openshift/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openshift/vagrant-openshift/statuses/{sha}","languages_url":"https://api.github.com/repos/openshift/vagrant-openshift/languages","stargazers_url":"https://api.github.com/repos/openshift/vagrant-openshift/stargazers","contributors_url":"https://api.github.com/repos/openshift/vagrant-openshift/contributors","subscribers_url":"https://api.github.com/repos/openshift/vagrant-openshift/subscribers","subscription_url":"https://api.github.com/repos/openshift/vagrant-openshift/subscription","commits_url":"https://api.github.com/repos/openshift/vagrant-openshift/commits{/sha}","git_commits_url":"https://api.github.com/repos/openshift/vagrant-openshift/git/commits{/sha}","comments_url":"https://api.github.com/repos/openshift/vagrant-openshift/comments{/number}","issue_comment_url":"https://api.github.com/repos/openshift/vagrant-openshift/issues/comments{/number}","contents_url":"https://api.github.com/repos/openshift/vagrant-openshift/contents/{+path}","compare_url":"https://api.github.com/repos/openshift/vagrant-openshift/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openshift/vagrant-openshift/merges","archive_url":"https://api.github.com/repos/openshift/vagrant-openshift/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openshift/vagrant-openshift/downloads","issues_url":"https://api.github.com/repos/openshift/vagrant-openshift/issues{/number}","pulls_url":"https://api.github.com/repos/openshift/vagrant-openshift/pulls{/number}","milestones_url":"https://api.github.com/repos/openshift/vagrant-openshift/milestones{/number}","notifications_url":"https://api.github.com/repos/openshift/vagrant-openshift/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openshift/vagrant-openshift/labels{/name}","releases_url":"https://api.github.com/repos/openshift/vagrant-openshift/releases{/id}","created_at":"2013-08-23T07:19:59Z","updated_at":"2015-05-29T13:44:42Z","pushed_at":"2015-06-12T11:00:54Z","git_url":"git://github.com/openshift/vagrant-openshift.git","ssh_url":"git@github.com:openshift/vagrant-openshift.git","clone_url":"https://github.com/openshift/vagrant-openshift.git","svn_url":"https://github.com/openshift/vagrant-openshift","homepage":null,"size":2425,"stargazers_count":41,"watchers_count":41,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":71,"mirror_url":null,"open_issues_count":7,"forks":71,"open_issues":7,"watchers":41,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openshift/vagrant-openshift/pulls/269"},"html":{"href":"https://github.com/openshift/vagrant-openshift/pull/269"},"issue":{"href":"https://api.github.com/repos/openshift/vagrant-openshift/issues/269"},"comments":{"href":"https://api.github.com/repos/openshift/vagrant-openshift/issues/269/comments"},"review_comments":{"href":"https://api.github.com/repos/openshift/vagrant-openshift/pulls/269/comments"},"review_comment":{"href":"https://api.github.com/repos/openshift/vagrant-openshift/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openshift/vagrant-openshift/pulls/269/commits"},"statuses":{"href":"https://api.github.com/repos/openshift/vagrant-openshift/statuses/5b423a5a946d0281e07f5c301674b51adbb4aa97"}}}}