{"action":"created","comment":{"url":"https://api.github.com/repos/edx/edx-gomatic/pulls/comments/72797049","id":72797049,"diff_hunk":"@@ -445,3 +469,106 @@ def generate_run_app_playbook(job, secure_dir, playbook_path, runif=\"passed\", **\n             runif=runif\n         )\n     )\n+\n+\n+def backup_drupal_database(job, site_env):\n+    \"\"\"\n+    Creates a backup of the database in the given environment.\n+\n+    Stage using this task must have the following environment variables:\n+        PRIVATE_ACQUIA_USERNAME\n+        PRIVATE_ACQUIA_PASSWORD\n+\n+    Args:\n+        job (gomatic.job.Job): the gomatic job to which the task will be added\n+        site_env (str): The environment to clear caches from. Choose 'test' for stage and 'prod' for prod\n+\n+    Returns:\n+        The newly created task (gomatic.gocd.tasks.ExecTask)\n+    \"\"\"\n+    return job.add_task(\n+        ExecTask(\n+            [\n+                '/bin/bash',\n+                '-c',\n+                'python scripts/drupal_backup_database.py '\n+                '--env ${site_env} '\n+                '--username $PRIVATE_ACQUIA_USERNAME '\n+                '--password $PRIVATE_ACQUIA_PASSWORD'.format(\n+                    site_env=site_env\n+                )\n+            ],\n+            working_dir='tubular'\n+        )\n+    )\n+\n+\n+def flush_drupal_caches(job, site_env):\n+    \"\"\"\n+    Flushes all drupal caches (including the varnish cache)\n+    Assumes the drupal root is located in edx-mktg/docroot. If changed, change the working dir.\n+\n+    Stage using this task must have the following environment variables:\n+        PRIVATE_ACQUIA_USERNAME\n+        PRIVATE_ACQUIA_PASSWORD\n+\n+    Args:\n+        job (gomatic.job.Job): the gomatic job to which the task will be added\n+        site_env (str): The environment to clear caches from. Choose 'test' for stage and 'prod' for prod\n+\n+    Returns:\n+        The newly created task (gomatic.gocd.tasks.ExecTask)\n+    \"\"\"\n+    return job.add_task(\n+        ExecTask(\n+            [\n+                '/bin/bash',\n+                '-c',\n+                'drush -y @edx.{site_env} cc all && '\n+                'python tubular/scripts/drupal_clear_varnish.py '\n+                '--env ${site_env} '\n+                '--username $PRIVATE_ACQUIA_USERNAME '\n+                '--password $PRIVATE_ACQUIA_PASSWORD'.format(\n+                    site_env=site_env\n+                )\n+            ],\n+            working_dir='edx-mktg/docroot'\n+        )\n+    )\n+\n+\n+def drupal_deploy(job, site_env):\n+    \"\"\"\n+    Deploys the tag to the environment.\n+\n+    Stage using this task must have the following environment variables:\n+        PRIVATE_ACQUIA_USERNAME\n+        PRIVATE_ACQUIA_PASSWORD\n+\n+    Expects there to be:\n+        - a text file containing the tag name in \"target/tag_name.txt\"\n+\n+    Args:\n+        job (gomatic.job.Job): the gomatic job to which the task will be added\n+        site_env (str): The environment to clear caches from. Choose 'test' for stage and 'prod' for prod\n+\n+    Returns:\n+        The newly created task (gomatic.gocd.tasks.ExecTask)\n+    \"\"\"\n+    return job.add_task(\n+        ExecTask(\n+            [\n+                '/bin/bash',\n+                '-c',\n+                'TAG_NAME=`cat ../target/tag_name.txt` && '","path":"edxpipelines/patterns/tasks.py","position":126,"original_position":126,"commit_id":"c616eb591628bf30efed86dd955e7fac0e65a29d","original_commit_id":"c616eb591628bf30efed86dd955e7fac0e65a29d","user":{"login":"Dillon-Dumesnil","id":12799718,"avatar_url":"https://avatars.githubusercontent.com/u/12799718?v=3","gravatar_id":"","url":"https://api.github.com/users/Dillon-Dumesnil","html_url":"https://github.com/Dillon-Dumesnil","followers_url":"https://api.github.com/users/Dillon-Dumesnil/followers","following_url":"https://api.github.com/users/Dillon-Dumesnil/following{/other_user}","gists_url":"https://api.github.com/users/Dillon-Dumesnil/gists{/gist_id}","starred_url":"https://api.github.com/users/Dillon-Dumesnil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Dillon-Dumesnil/subscriptions","organizations_url":"https://api.github.com/users/Dillon-Dumesnil/orgs","repos_url":"https://api.github.com/users/Dillon-Dumesnil/repos","events_url":"https://api.github.com/users/Dillon-Dumesnil/events{/privacy}","received_events_url":"https://api.github.com/users/Dillon-Dumesnil/received_events","type":"User","site_admin":false},"body":"Do I not need spaces at the end of every line? Looking at the patterns generate_run_migrations made me think I did. When do you need spaces vs. when don't you?","created_at":"2016-07-29T14:08:43Z","updated_at":"2016-07-29T14:08:43Z","html_url":"https://github.com/edx/edx-gomatic/pull/15#discussion_r72797049","pull_request_url":"https://api.github.com/repos/edx/edx-gomatic/pulls/15","_links":{"self":{"href":"https://api.github.com/repos/edx/edx-gomatic/pulls/comments/72797049"},"html":{"href":"https://github.com/edx/edx-gomatic/pull/15#discussion_r72797049"},"pull_request":{"href":"https://api.github.com/repos/edx/edx-gomatic/pulls/15"}}},"pull_request":{"url":"https://api.github.com/repos/edx/edx-gomatic/pulls/15","id":78690372,"html_url":"https://github.com/edx/edx-gomatic/pull/15","diff_url":"https://github.com/edx/edx-gomatic/pull/15.diff","patch_url":"https://github.com/edx/edx-gomatic/pull/15.patch","issue_url":"https://api.github.com/repos/edx/edx-gomatic/issues/15","number":15,"state":"open","locked":false,"title":"Ddumesnil/drupal","user":{"login":"Dillon-Dumesnil","id":12799718,"avatar_url":"https://avatars.githubusercontent.com/u/12799718?v=3","gravatar_id":"","url":"https://api.github.com/users/Dillon-Dumesnil","html_url":"https://github.com/Dillon-Dumesnil","followers_url":"https://api.github.com/users/Dillon-Dumesnil/followers","following_url":"https://api.github.com/users/Dillon-Dumesnil/following{/other_user}","gists_url":"https://api.github.com/users/Dillon-Dumesnil/gists{/gist_id}","starred_url":"https://api.github.com/users/Dillon-Dumesnil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Dillon-Dumesnil/subscriptions","organizations_url":"https://api.github.com/users/Dillon-Dumesnil/orgs","repos_url":"https://api.github.com/users/Dillon-Dumesnil/repos","events_url":"https://api.github.com/users/Dillon-Dumesnil/events{/privacy}","received_events_url":"https://api.github.com/users/Dillon-Dumesnil/received_events","type":"User","site_admin":false},"body":"@edx/pipeline-team Please review. Also, thoughts on making the deploy task into a pattern or just writing the clear caches script into the clear caches jobs directly in the deploy_marketing_site file? I use both the same number of times, but once as a pattern and once inline.\r\n@edx/ecommerce FYI. Clinton, please review.\r\nhttps://openedx.atlassian.net/browse/ECOM-4918\r\nhttps://openedx.atlassian.net/browse/ECOM-4921\r\nhttps://openedx.atlassian.net/browse/ECOM-4924","created_at":"2016-07-25T14:25:29Z","updated_at":"2016-07-29T14:08:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e1e2b0855f50cc9a428b1f96bf85daa808d85513","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/edx/edx-gomatic/pulls/15/commits","review_comments_url":"https://api.github.com/repos/edx/edx-gomatic/pulls/15/comments","review_comment_url":"https://api.github.com/repos/edx/edx-gomatic/pulls/comments{/number}","comments_url":"https://api.github.com/repos/edx/edx-gomatic/issues/15/comments","statuses_url":"https://api.github.com/repos/edx/edx-gomatic/statuses/c616eb591628bf30efed86dd955e7fac0e65a29d","head":{"label":"edx:ddumesnil/drupal","ref":"ddumesnil/drupal","sha":"c616eb591628bf30efed86dd955e7fac0e65a29d","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"repo":{"id":61151389,"name":"edx-gomatic","full_name":"edx/edx-gomatic","owner":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/edx/edx-gomatic","description":"Collection of gomatic scripts used at edx","fork":false,"url":"https://api.github.com/repos/edx/edx-gomatic","forks_url":"https://api.github.com/repos/edx/edx-gomatic/forks","keys_url":"https://api.github.com/repos/edx/edx-gomatic/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/edx-gomatic/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/edx-gomatic/teams","hooks_url":"https://api.github.com/repos/edx/edx-gomatic/hooks","issue_events_url":"https://api.github.com/repos/edx/edx-gomatic/issues/events{/number}","events_url":"https://api.github.com/repos/edx/edx-gomatic/events","assignees_url":"https://api.github.com/repos/edx/edx-gomatic/assignees{/user}","branches_url":"https://api.github.com/repos/edx/edx-gomatic/branches{/branch}","tags_url":"https://api.github.com/repos/edx/edx-gomatic/tags","blobs_url":"https://api.github.com/repos/edx/edx-gomatic/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/edx-gomatic/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/edx-gomatic/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/edx-gomatic/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/edx-gomatic/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/edx-gomatic/languages","stargazers_url":"https://api.github.com/repos/edx/edx-gomatic/stargazers","contributors_url":"https://api.github.com/repos/edx/edx-gomatic/contributors","subscribers_url":"https://api.github.com/repos/edx/edx-gomatic/subscribers","subscription_url":"https://api.github.com/repos/edx/edx-gomatic/subscription","commits_url":"https://api.github.com/repos/edx/edx-gomatic/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/edx-gomatic/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/edx-gomatic/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/edx-gomatic/issues/comments{/number}","contents_url":"https://api.github.com/repos/edx/edx-gomatic/contents/{+path}","compare_url":"https://api.github.com/repos/edx/edx-gomatic/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/edx-gomatic/merges","archive_url":"https://api.github.com/repos/edx/edx-gomatic/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/edx-gomatic/downloads","issues_url":"https://api.github.com/repos/edx/edx-gomatic/issues{/number}","pulls_url":"https://api.github.com/repos/edx/edx-gomatic/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/edx-gomatic/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/edx-gomatic/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/edx-gomatic/labels{/name}","releases_url":"https://api.github.com/repos/edx/edx-gomatic/releases{/id}","deployments_url":"https://api.github.com/repos/edx/edx-gomatic/deployments","created_at":"2016-06-14T19:50:32Z","updated_at":"2016-06-22T20:30:37Z","pushed_at":"2016-07-28T21:39:29Z","git_url":"git://github.com/edx/edx-gomatic.git","ssh_url":"git@github.com:edx/edx-gomatic.git","clone_url":"https://github.com/edx/edx-gomatic.git","svn_url":"https://github.com/edx/edx-gomatic","homepage":null,"size":98,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"edx:master","ref":"master","sha":"2081a9dfaef66ccce39fa008dcca14e42afa68aa","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"repo":{"id":61151389,"name":"edx-gomatic","full_name":"edx/edx-gomatic","owner":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/edx/edx-gomatic","description":"Collection of gomatic scripts used at edx","fork":false,"url":"https://api.github.com/repos/edx/edx-gomatic","forks_url":"https://api.github.com/repos/edx/edx-gomatic/forks","keys_url":"https://api.github.com/repos/edx/edx-gomatic/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/edx-gomatic/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/edx-gomatic/teams","hooks_url":"https://api.github.com/repos/edx/edx-gomatic/hooks","issue_events_url":"https://api.github.com/repos/edx/edx-gomatic/issues/events{/number}","events_url":"https://api.github.com/repos/edx/edx-gomatic/events","assignees_url":"https://api.github.com/repos/edx/edx-gomatic/assignees{/user}","branches_url":"https://api.github.com/repos/edx/edx-gomatic/branches{/branch}","tags_url":"https://api.github.com/repos/edx/edx-gomatic/tags","blobs_url":"https://api.github.com/repos/edx/edx-gomatic/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/edx-gomatic/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/edx-gomatic/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/edx-gomatic/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/edx-gomatic/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/edx-gomatic/languages","stargazers_url":"https://api.github.com/repos/edx/edx-gomatic/stargazers","contributors_url":"https://api.github.com/repos/edx/edx-gomatic/contributors","subscribers_url":"https://api.github.com/repos/edx/edx-gomatic/subscribers","subscription_url":"https://api.github.com/repos/edx/edx-gomatic/subscription","commits_url":"https://api.github.com/repos/edx/edx-gomatic/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/edx-gomatic/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/edx-gomatic/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/edx-gomatic/issues/comments{/number}","contents_url":"https://api.github.com/repos/edx/edx-gomatic/contents/{+path}","compare_url":"https://api.github.com/repos/edx/edx-gomatic/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/edx-gomatic/merges","archive_url":"https://api.github.com/repos/edx/edx-gomatic/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/edx-gomatic/downloads","issues_url":"https://api.github.com/repos/edx/edx-gomatic/issues{/number}","pulls_url":"https://api.github.com/repos/edx/edx-gomatic/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/edx-gomatic/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/edx-gomatic/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/edx-gomatic/labels{/name}","releases_url":"https://api.github.com/repos/edx/edx-gomatic/releases{/id}","deployments_url":"https://api.github.com/repos/edx/edx-gomatic/deployments","created_at":"2016-06-14T19:50:32Z","updated_at":"2016-06-22T20:30:37Z","pushed_at":"2016-07-28T21:39:29Z","git_url":"git://github.com/edx/edx-gomatic.git","ssh_url":"git@github.com:edx/edx-gomatic.git","clone_url":"https://github.com/edx/edx-gomatic.git","svn_url":"https://github.com/edx/edx-gomatic","homepage":null,"size":98,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/edx/edx-gomatic/pulls/15"},"html":{"href":"https://github.com/edx/edx-gomatic/pull/15"},"issue":{"href":"https://api.github.com/repos/edx/edx-gomatic/issues/15"},"comments":{"href":"https://api.github.com/repos/edx/edx-gomatic/issues/15/comments"},"review_comments":{"href":"https://api.github.com/repos/edx/edx-gomatic/pulls/15/comments"},"review_comment":{"href":"https://api.github.com/repos/edx/edx-gomatic/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/edx/edx-gomatic/pulls/15/commits"},"statuses":{"href":"https://api.github.com/repos/edx/edx-gomatic/statuses/c616eb591628bf30efed86dd955e7fac0e65a29d"}}}}
{"actor":{"display_login":"Dillon-Dumesnil"}}