Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
circleci: Rewrite integration to support the new webhook format.
Hari Prashant Bhimaraju5346de91647f
diff --git a/static/images/integrations/circleci/001.png b/static/images/integrations/circleci/001.pngindex c3b8089ca2e..1e6add79084 100644Binary files a/static/images/integrations/circleci/001.png and b/static/images/integrations/circleci/001.png differdiff --git a/static/images/integrations/circleci/002.png b/static/images/integrations/circleci/002.pngindex a5e19aa969a..c35072a56a7 100644Binary files a/static/images/integrations/circleci/002.png and b/static/images/integrations/circleci/002.png differdiff --git a/zerver/webhooks/circleci/doc.md b/zerver/webhooks/circleci/doc.mdindex 3e2b6f5b3e1..2edeada1ea0 100644--- a/zerver/webhooks/circleci/doc.md+++ b/zerver/webhooks/circleci/doc.md@@ -1,19 +1,18 @@-Zulip supports integration with CircleCI and can notify you of-your build statuses.+Zulip supports integration with CircleCI and can notify you of your+job and workflow statuses. This integration currently supports using+CircleCI with GitHub, BitBucket and GitLab.1. {!create-stream.md!}1. {!create-bot-construct-url.md!}-1. Add the following to the bottom of your `circle.yml` file:+1. Go to your project on CircleCI and click on **Project+ Settings**. Select **Webhooks** from the list on the left.+ Click on **Add Webhook** in the menu that opens.- ```- notify:- webhooks:- - url: <URL constructed above>- ```-- Set **url** to the URL constructed above. Push this change to your repository.+1. In the form that opens, give your webhook a name and set the+ **Receiver URL** field to the URL constructed above. Choose the+ desired events and click on **Add Webhook**.{!congrats.md!}diff --git a/zerver/webhooks/circleci/fixtures/bitbucket_job_completed.json b/zerver/webhooks/circleci/fixtures/bitbucket_job_completed.jsonnew file mode 100644index 00000000000..bd3f95609c7--- /dev/null+++ b/zerver/webhooks/circleci/fixtures/bitbucket_job_completed.json@@ -0,0 +1,62 @@+{+ "happened_at": "2022-11-07T15:42:15.023009Z",+ "pipeline": {+ "id": "c0c9b267-b287-4c3f-ba40-bcbcc61bcf4c",+ "number": 4,+ "created_at": "2022-11-07T15:41:35.870Z",+ "trigger": {+ "type": "webhook"+ },+ "vcs": {+ "provider_name": "bitbucket",+ "origin_repository_url": "https://bitbucket.org/hariprashant1/circleci-webhook-testing",+ "target_repository_url": "https://bitbucket.org/hariprashant1/circleci-webhook-testing",+ "revision": "8ab595d2de95767993472837df2cb7884519a92b",+ "commit": {+ "subject": "app.py edited online with Bitbucket",+ "body": "",+ "author": {+ "name": "Hari Prashant Bhimaraju",+ "email": "[email protected]"+ },+ "authored_at": "2022-11-07T15:39:51Z",+ "committer": {+ "name": null,+ "email": null+ },+ "committed_at": null+ },+ "branch": "master"+ }+ },+ "webhook": {+ "id": "cb3565f3-a064-457c-ae20-45c21892721d",+ "name": "Webhook Site - Testing"+ },+ "type": "job-completed",+ "organization": {+ "id": "c6f6a77e-03f9-4d15-ba42-7ccb1b765dd8",+ "name": "hariprashant1"+ },+ "workflow": {+ "id": "fd29ef0c-3e39-4c8f-b1d5-d8be1bab8165",+ "name": "sample",+ "created_at": "2022-11-07T15:41:36.135Z",+ "stopped_at": "2022-11-07T15:42:14.944Z",+ "url": "https://app.circleci.com/pipelines/bitbucket/hariprashant1/circleci-webhook-testing/4/workflows/fd29ef0c-3e39-4c8f-b1d5-d8be1bab8165"+ },+ "project": {+ "id": "171594bb-8f19-4010-a3f6-5ae0007e109a",+ "name": "circleci-webhook-testing",+ "slug": "bitbucket/hariprashant1/circleci-webhook-testing"+ },+ "id": "381567cf-8247-3b82-b0ff-352a901ecbdb",+ "job": {+ "id": "0978b96a-7044-4ee0-ad60-0a4aa1668dda",+ "name": "build-and-test",+ "started_at": "2022-11-07T15:41:38.124Z",+ "stopped_at": "2022-11-07T15:42:14.944Z",+ "status": "success",+ "number": 4+ }+}diff --git a/zerver/webhooks/circleci/fixtures/bitbucket_manual_workflow_completed.json b/zerver/webhooks/circleci/fixtures/bitbucket_manual_workflow_completed.jsonnew file mode 100644index 00000000000..595ee7fe4d9--- /dev/null+++ b/zerver/webhooks/circleci/fixtures/bitbucket_manual_workflow_completed.json@@ -0,0 +1,55 @@+{+ "type": "workflow-completed",+ "id": "2039ae23-831c-3e12-a905-e3a1dc24e2d6",+ "happened_at": "2022-11-07T11:45:47.000864Z",+ "webhook": {+ "id": "cb3565f3-a064-457c-ae20-45c21892721d",+ "name": "Webhook Site - Testing"+ },+ "workflow": {+ "id": "baa45986-84db-47a0-bc6c-89e9fe751bc9",+ "name": "sample",+ "created_at": "2022-11-07T11:45:36.683Z",+ "stopped_at": "2022-11-07T11:45:46.906Z",+ "url": "https://app.circleci.com/pipelines/bitbucket/hariprashant1/circleci-webhook-testing/2/workflows/baa45986-84db-47a0-bc6c-89e9fe751bc9",+ "status": "success"+ },+ "pipeline": {+ "id": "20d131f5-8cc3-472e-ac7f-346c7f6f2a49",+ "number": 2,+ "created_at": "2022-11-07T11:45:36.570Z",+ "trigger": {+ "type": "api"+ },+ "vcs": {+ "provider_name": "bitbucket",+ "origin_repository_url": "https://bitbucket.org/hariprashant1/circleci-webhook-testing",+ "target_repository_url": "https://bitbucket.org/hariprashant1/circleci-webhook-testing",+ "revision": "cab5eacb4ccee2710529894425341fa20a48fe6a",+ "commit": {+ "subject": null,+ "body": null,+ "author": {+ "name": null,+ "email": null+ },+ "authored_at": null,+ "committer": {+ "name": null,+ "email": null+ },+ "committed_at": null+ },+ "branch": "master"+ }+ },+ "project": {+ "id": "171594bb-8f19-4010-a3f6-5ae0007e109a",+ "name": "circleci-webhook-testing",+ "slug": "bitbucket/hariprashant1/circleci-webhook-testing"+ },+ "organization": {+ "id": "c6f6a77e-03f9-4d15-ba42-7ccb1b765dd8",+ "name": "hariprashant1"+ }+}diff --git a/zerver/webhooks/circleci/fixtures/bitbucket_private_repo_pull_request_failure.json b/zerver/webhooks/circleci/fixtures/bitbucket_private_repo_pull_request_failure.jsondeleted file mode 100755index 4660f679b19..00000000000--- a/zerver/webhooks/circleci/fixtures/bitbucket_private_repo_pull_request_failure.json+++ /dev/null@@ -1,363 +0,0 @@-{- "payload": {- "compare": null,- "previous_successful_build": {- "build_num": 2,- "status": "success",- "build_time_millis": 33841- },- "build_parameters": {- "CIRCLE_JOB": "build"- },- "oss": false,- "all_commit_details_truncated": false,- "committer_date": "",- "steps": [- {- "name": "Spin Up Environment",- "actions": [- {- "truncated": false,- "index": 0,- "parallel": true,- "failed": null,- "infrastructure_fail": null,- "name": "Spin Up Environment",- "bash_command": null,- "status": "success",- "timedout": null,- "continue": null,- "end_time": "2020-06-12T10:25:35.777Z",- "type": "test",- "allocation_id": "5ee358114751e46626b7e95e-0-build/7E6855FF",- "output_url": "https://circle-production-action-output.s3.amazonaws.com/redacted",- "start_time": "2020-06-12T10:25:31.268Z",- "background": false,- "exit_code": null,- "insignificant": false,- "canceled": null,- "step": 0,- "run_time_millis": 4509,- "has_output": true- }- ]- },- {- "name": "Preparing Environment Variables",- "actions": [- {- "truncated": false,- "index": 0,- "parallel": true,- "failed": null,- "infrastructure_fail": null,- "name": "Preparing Environment Variables",- "bash_command": null,- "status": "success",- "timedout": null,- "continue": null,- "end_time": "2020-06-12T10:25:36.310Z",- "type": "test",- "allocation_id": "5ee358114751e46626b7e95e-0-build/7E6855FF",- "output_url": "https://circle-production-action-output.s3.amazonaws.com/redacted",- "start_time": "2020-06-12T10:25:36.286Z",- "background": false,- "exit_code": null,- "insignificant": false,- "canceled": null,- "step": 99,- "run_time_millis": 24,- "has_output": true- }- ]- },- {- "name": "Checkout code",- "actions": [- {- "truncated": false,- "index": 0,- "parallel": true,- "failed": null,- "infrastructure_fail": null,- "name": "Checkout code",- "bash_command": "#!/bin/sh\nset -e\n\n# Workaround old docker images with incorrect $HOME\n# check https://github.com/docker/docker/issues/2968 for details\nif [ \"${HOME}\" = \"/\" ]\nthen\n export HOME=$(getent passwd $(id -un) | cut -d: -f6)\nfi\n\necho Using SSH Config Dir $SSH_CONFIG_DIR\n\nmkdir -p $SSH_CONFIG_DIR\n\necho 'github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==\nbitbucket.org ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAubiN81eDcafrgMeLzaFPsw2kNvEcqTKl/VqLat/MaB33pZy0y3rJZtnqwR2qOOvbwKZYKiEO1O6VqNEBxKvJJelCq0dTXWT5pbO2gDXC6h6QDXCaHo6pOHGPUy+YBaGQRGuSusMEASYiWunYN0vCAI8QaXnWMXNMdFP3jHAJH0eDsoiGnLPBlBp4TNm6rYI74nMzgz3B9IikW4WVK+dc8KZJZWYjAuORU3jc1c/NPskD2ASinf8v3xnfXeukU0sJ5N6m5E8VLjObPEO+mN2t/FZTMZLiFqPWc/ALSqnMnnhwrNi2rbfg/rd/IpL8Le3pSBne8+seeFVBoGqzHM9yXw==\n' >> $SSH_CONFIG_DIR/known_hosts\n\n(umask 077; touch $SSH_CONFIG_DIR/id_rsa)\nchmod 0600 $SSH_CONFIG_DIR/id_rsa\n(cat <<EOF > $SSH_CONFIG_DIR/id_rsa\n$CHECKOUT_KEY\nEOF\n)\n\nexport GIT_SSH_COMMAND='ssh -i $SSH_CONFIG_DIR/id_rsa -o UserKnownHostsFile=$SSH_CONFIG_DIR/known_hosts'\n\n# use git+ssh instead of https\ngit config --global url.\"ssh://[email protected]\".insteadOf \"https://bitbucket.org\" || true\ngit config --global gc.auto 0 || true\n\nif [ -e /home/circleci/project/.git ]\nthen\n cd /home/circleci/project\n git remote set-url origin \"$CIRCLE_REPOSITORY_URL\" || true\nelse\n mkdir -p /home/circleci/project\n cd /home/circleci/project\n git clone \"$CIRCLE_REPOSITORY_URL\" .\nfi\n\nif [ -n \"$CIRCLE_TAG\" ]\nthen\n git fetch --force origin \"refs/tags/${CIRCLE_TAG}\"\nelse\n git fetch --force origin \"unstable:remotes/origin/unstable\"\nfi\n\n\nif [ -n \"$CIRCLE_TAG\" ]\nthen\n git reset --hard \"$CIRCLE_SHA1\"\n git checkout -q \"$CIRCLE_TAG\"\nelif [ -n \"$CIRCLE_BRANCH\" ]\nthen\n git reset --hard \"$CIRCLE_SHA1\"\n git checkout -q -B \"$CIRCLE_BRANCH\"\nfi\n\ngit reset --hard \"$CIRCLE_SHA1\"",- "status": "success",- "timedout": null,- "continue": null,- "end_time": "2020-06-12T10:25:37.330Z",- "type": "test",- "allocation_id": "5ee358114751e46626b7e95e-0-build/7E6855FF",- "output_url": "https://circle-production-action-output.s3.amazonaws.com/redacted",- "start_time": "2020-06-12T10:25:36.319Z",- "background": false,- "exit_code": null,- "insignificant": false,- "canceled": null,- "step": 101,- "run_time_millis": 1011,- "has_output": true- }- ]- },- {- "name": "sudo pip install requests",- "actions": [- {- "truncated": false,- "index": 0,- "parallel": true,- "failed": null,- "infrastructure_fail": null,- "name": "sudo pip install requests",- "bash_command": "#!/bin/bash -eo pipefail\nsudo pip install requests",- "status": "success",- "timedout": null,- "continue": null,- "end_time": "2020-06-12T10:25:38.811Z",- "type": "test",- "allocation_id": "5ee358114751e46626b7e95e-0-build/7E6855FF",- "start_time": "2020-06-12T10:25:37.339Z",- "background": false,- "exit_code": 0,- "insignificant": false,- "canceled": null,- "step": 102,- "run_time_millis": 1472,- "has_output": true- }- ]- },- {- "name": "python run.py",- "actions": [- {- "truncated": false,- "index": 0,- "parallel": true,- "failed": true,- "infrastructure_fail": null,- "name": "python run.py",- "bash_command": "#!/bin/bash -eo pipefail\npython run.py",- "status": "failed",- "timedout": null,- "continue": null,- "end_time": "2020-06-12T10:25:39.013Z",- "type": "test",- "allocation_id": "5ee358114751e46626b7e95e-0-build/7E6855FF",- "start_time": "2020-06-12T10:25:38.819Z",- "background": false,- "exit_code": 1,- "insignificant": false,- "canceled": null,- "step": 103,- "run_time_millis": 194,- "has_output": true- }- ]- },- {- "name": "Uploading test results",- "actions": [- {- "truncated": false,- "index": 0,- "parallel": true,- "failed": null,- "infrastructure_fail": null,- "name": "Uploading test results",- "bash_command": null,- "status": "success",- "timedout": null,- "continue": null,- "end_time": "2020-06-12T10:25:39.035Z",- "type": "test",- "allocation_id": "5ee358114751e46626b7e95e-0-build/7E6855FF",- "start_time": "2020-06-12T10:25:39.020Z",- "background": false,- "exit_code": null,- "insignificant": false,- "canceled": null,- "step": 104,- "run_time_millis": 15,- "has_output": true- }- ]- },- {- "name": "Uploading artifacts",- "actions": [- {- "truncated": false,- "index": 0,- "parallel": true,- "failed": null,- "infrastructure_fail": null,- "name": "Uploading artifacts",- "bash_command": null,- "status": "success",- "timedout": null,- "continue": null,- "end_time": "2020-06-12T10:25:39.059Z",- "type": "test",- "allocation_id": "5ee358114751e46626b7e95e-0-build/7E6855FF",- "start_time": "2020-06-12T10:25:39.044Z",- "background": false,- "exit_code": null,- "insignificant": false,- "canceled": null,- "step": 105,- "run_time_millis": 15,- "has_output": true- }- ]- }- ],- "body": "",- "usage_queued_at": "2020-06-12T10:25:21.563Z",- "context_ids": [],- "fail_reason": null,- "retry_of": null,- "reponame": "circleci-test",- "ssh_users": [],- "build_url": "https://circleci.com/bb/Hypro999/circleci-test/5",- "parallel": 1,- "failed": true,- "branch": "unstable",- "username": "Hypro999",- "author_date": "2020-06-12T10:25:03.000Z",- "why": "bitbucket",- "user": {- "is_user": true,- "login": "Hypro999",- "avatar_url": "https://secure.gravatar.com/avatar/c4b80edf0959d0f22ece999a27a997e9?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FHA-5.png",- "name": "Hemanth V. Alluri",- "vcs_type": "bitbucket",- "id": "{073cdd10-0fee-4b71-9904-50cf5f3ecd33}"- },- "vcs_revision": "eaa88f9eac0fad86c46a8fe35462fe2c904d84b1",- "workflows": {- "job_name": "build",- "job_id": "69fcea62-1c56-439e-bdfe-f74017b45cde",- "workflow_id": "540db7d1-8ad3-4dd0-9bdc-2e1904066bf0",- "workspace_id": "540db7d1-8ad3-4dd0-9bdc-2e1904066bf0",- "upstream_job_ids": [],- "upstream_concurrency_map": {},- "workflow_name": "workflow"- },- "owners": [- "Hypro999"- ],- "vcs_tag": null,- "pull_requests": [- {- "head_sha": null,- "url": "https://bitbucket.org/Hypro999/circleci-test/pull-requests/1"- }- ],- "build_num": 5,- "infrastructure_fail": false,- "committer_email": null,- "has_artifacts": true,- "previous": {- "build_num": 4,- "status": "failed",- "build_time_millis": 15936- },- "status": "failed",- "committer_name": null,- "retries": null,- "subject": "Add a breaking change.",- "vcs_type": "bitbucket",- "timedout": false,- "dont_build": null,- "lifecycle": "finished",- "no_dependency_cache": false,- "stop_time": "2020-06-12T10:25:39.109Z",- "ssh_disabled": true,- "build_time_millis": 7876,- "picard": {- "build_agent": {- "image": "circleci/picard@sha256:847ae88f32aaf7cfc04321b3eb25a7519630a949cf35df0d0b77ea1d7e886bd3",- "properties": {- "executor": "docker",- "nomad_ami": "ami-07194a5d4dd689502",- "availability_zone": "us-east-1c",- "instance_id": "i-0621811b3dc51c575",- "instance_ip": "172.16.91.76",- "build_agent": "1.0.34234-27aa9735"- }- },- "resource_class": {- "cpu": 2,- "ram": 4096,- "class": "medium",- "name": "Docker Medium"- },- "executor": "docker"- },- "circle_yml": {- "string": "version: 2\njobs:\n build:\n working_directory: null\n docker:\n - image: circleci/python:3.6.4\n steps:\n - checkout\n - run: sudo pip install requests\n - run: python run.py\n - store_test_results:\n path: test-results\n - store_artifacts:\n path: test-results\n destination: tr1\n environment:\n - CIRCLE_COMPARE_URL: https://bitbucket.org/Hypro999/circleci-test/branches/compare/eaa88f9eac0fad86c46a8fe35462fe2c904d84b1..7002beaea5a42561645b93be0aefdefc72a517c1\nnotify:\n webhooks:\n - url: https://webhook.site/378703d4-2758-42c8-a279-74df95cd78f0\nworkflows:\n version: 2\n workflow:\n jobs:\n - build\n"- },- "messages": [],- "is_first_green_build": false,- "job_name": null,- "start_time": "2020-06-12T10:25:31.233Z",- "canceler": null,- "all_commit_details": [- {- "committer_date": "",- "body": "",- "branch": "unstable",- "author_date": "2020-06-12T09:15:58.000Z",- "committer_email": null,- "commit": "6b5361c1661581d975e84b68904ae9bfba75d5e5",- "committer_login": null,- "committer_name": null,- "subject": "Initial commit",- "commit_url": "https://bitbucket.org/Hypro999/circleci-test/commits/6b5361c1661581d975e84b68904ae9bfba75d5e5",- "author_login": null,- "author_name": "Hemanth V. Alluri",- "author_email": "[email protected]"- },- {- "committer_date": "",- "body": "",- "branch": "unstable",- "author_date": "2020-06-12T10:07:12.000Z",- "committer_email": null,- "commit": "b04b124883f6d12046383acc376bfa327f369c81",- "committer_login": null,- "committer_name": null,- "subject": "Add a first draft for CircleCI configuration.",- "commit_url": "https://bitbucket.org/Hypro999/circleci-test/commits/b04b124883f6d12046383acc376bfa327f369c81",- "author_login": null,- "author_name": "Hemanth V. Alluri",- "author_email": "[email protected]"- },- {- "committer_date": "",- "body": "",- "branch": "unstable",- "author_date": "2020-06-12T10:25:03.000Z",- "committer_email": null,- "commit": "eaa88f9eac0fad86c46a8fe35462fe2c904d84b1",- "committer_login": null,- "committer_name": null,- "subject": "Add a breaking change.",- "commit_url": "https://bitbucket.org/Hypro999/circleci-test/commits/eaa88f9eac0fad86c46a8fe35462fe2c904d84b1",- "author_login": null,- "author_name": "Hemanth V. Alluri",- "author_email": "[email protected]"- }- ],- "platform": "2.0",- "outcome": "failed",- "vcs_url": "https://bitbucket.org/Hypro999/circleci-test",- "author_name": "Hemanth V. Alluri",- "node": null,- "queued_at": "2020-06-12T10:25:21.595Z",- "canceled": false,- "author_email": "[email protected]"- }-}diff --git a/zerver/webhooks/circleci/fixtures/bitbucket_workflow_completed.json b/zerver/webhooks/circleci/fixtures/bitbucket_workflow_completed.jsonnew file mode 100644index 00000000000..9441555cbe6--- /dev/null+++ b/zerver/webhooks/circleci/fixtures/bitbucket_workflow_completed.json@@ -0,0 +1,55 @@+{+ "type": "workflow-completed",+ "id": "5cec7374-2683-3717-a1d8-d7e2a47198ac",+ "happened_at": "2022-11-07T15:42:15.076628Z",+ "webhook": {+ "id": "cb3565f3-a064-457c-ae20-45c21892721d",+ "name": "Webhook Site - Testing"+ },+ "workflow": {+ "id": "fd29ef0c-3e39-4c8f-b1d5-d8be1bab8165",+ "name": "sample",+ "created_at": "2022-11-07T15:41:36.135Z",+ "stopped_at": "2022-11-07T15:42:14.944Z",+ "url": "https://app.circleci.com/pipelines/bitbucket/hariprashant1/circleci-webhook-testing/4/workflows/fd29ef0c-3e39-4c8f-b1d5-d8be1bab8165",+ "status": "success"+ },+ "pipeline": {+ "id": "c0c9b267-b287-4c3f-ba40-bcbcc61bcf4c",+ "number": 4,+ "created_at": "2022-11-07T15:41:35.870Z",+ "trigger": {+ "type": "webhook"+ },+ "vcs": {+ "provider_name": "bitbucket",+ "origin_repository_url": "https://bitbucket.org/hariprashant1/circleci-webhook-testing",+ "target_repository_url": "https://bitbucket.org/hariprashant1/circleci-webhook-testing",+ "revision": "8ab595d2de95767993472837df2cb7884519a92b",+ "commit": {+ "subject": "app.py edited online with Bitbucket",+ "body": "",+ "author": {+ "name": "Hari Prashant Bhimaraju",+ "email": "[email protected]"+ },+ "authored_at": "2022-11-07T15:39:51Z",+ "committer": {+ "name": null,+ "email": null+ },+ "committed_at": null+ },+ "branch": "master"+ }+ },+ "project": {+ "id": "171594bb-8f19-4010-a3f6-5ae0007e109a",+ "name": "circleci-webhook-testing",+ "slug": "bitbucket/hariprashant1/circleci-webhook-testing"+ },+ "organization": {+ "id": "c6f6a77e-03f9-4d15-ba42-7ccb1b765dd8",+ "name": "hariprashant1"+ }+}diff --git a/zerver/webhooks/circleci/fixtures/github_bionic_backend_frontend_failure.json b/zerver/webhooks/circleci/fixtures/github_bionic_backend_frontend_failure.jsondeleted file mode 100755index 62ad9443241..00000000000--- a/zerver/webhooks/circleci/fixtures/github_bionic_backend_frontend_failure.json+++ /dev/null@@ -1,656 +0,0 @@-{- "payload": {- "compare": null,- "previous_successful_build": {- "build_num": 1422,- "status": "success",- "build_time_millis": 40755- },- "build_parameters": {- "CIRCLE_JOB": "bionic-backend-frontend"- },- "oss": true,- "all_commit_details_truncated": false,- "committer_date": "2020-06-12T13:33:46.000Z",- "steps": [- {- "name": "Spin Up Environment",- "actions": [- {- "truncated": false,- "index": 0,- "parallel": true,- "failed": null,- "infrastructure_fail": null,- "name": "Spin Up Environment",- "bash_command": null,- "status": "success",- "timedout": null,- "continue": null,- "end_time": "2020-06-12T13:38:14.862Z",- "type": "test",- "allocation_id": "5ee3844efd7aa57cd91af13a-0-build/5478EF76",- "output_url": "https://circle-production-action-output.s3.amazonaws.com/redacted",- "start_time": "2020-06-12T13:37:48.940Z",- "background": false,- "exit_code": null,- "insignificant": false,- "canceled": null,- "step": 0,- "run_time_millis": 25922,- "has_output": true- }- ]- },- {- "name": "Preparing Environment Variables",- "actions": [- {- "truncated": false,- "index": 0,- "parallel": true,- "failed": null,- "infrastructure_fail": null,- "name": "Preparing Environment Variables",- "bash_command": null,- "status": "success",- "timedout": null,- "continue": null,- "end_time": "2020-06-12T13:38:15.163Z",- "type": "test",- "allocation_id": "5ee3844efd7aa57cd91af13a-0-build/5478EF76",- "output_url": "https://circle-production-action-output.s3.amazonaws.com/redacted",- "start_time": "2020-06-12T13:38:15.143Z",- "background": false,- "exit_code": null,- "insignificant": false,- "canceled": null,- "step": 99,- "run_time_millis": 20,- "has_output": true- }- ]- },- {- "name": "Checkout code",- "actions": [- {- "truncated": false,- "index": 0,- "parallel": true,- "failed": null,- "infrastructure_fail": null,- "name": "Checkout code",- "bash_command": "#!/bin/sh\nset -e\n\n# Workaround old docker images with incorrect $HOME\n# check https://github.com/docker/docker/issues/2968 for details\nif [ \"${HOME}\" = \"/\" ]\nthen\n export HOME=$(getent passwd $(id -un) | cut -d: -f6)\nfi\n\necho Using SSH Config Dir $SSH_CONFIG_DIR\n\nmkdir -p $SSH_CONFIG_DIR\n\necho 'github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==\nbitbucket.org ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAubiN81eDcafrgMeLzaFPsw2kNvEcqTKl/VqLat/MaB33pZy0y3rJZtnqwR2qOOvbwKZYKiEO1O6VqNEBxKvJJelCq0dTXWT5pbO2gDXC6h6QDXCaHo6pOHGPUy+YBaGQRGuSusMEASYiWunYN0vCAI8QaXnWMXNMdFP3jHAJH0eDsoiGnLPBlBp4TNm6rYI74nMzgz3B9IikW4WVK+dc8KZJZWYjAuORU3jc1c/NPskD2ASinf8v3xnfXeukU0sJ5N6m5E8VLjObPEO+mN2t/FZTMZLiFqPWc/ALSqnMnnhwrNi2rbfg/rd/IpL8Le3pSBne8+seeFVBoGqzHM9yXw==\n' >> $SSH_CONFIG_DIR/known_hosts\n\n(umask 077; touch $SSH_CONFIG_DIR/id_rsa)\nchmod 0600 $SSH_CONFIG_DIR/id_rsa\n(cat <<EOF > $SSH_CONFIG_DIR/id_rsa\n$CHECKOUT_KEY\nEOF\n)\n\nexport GIT_SSH_COMMAND='ssh -i $SSH_CONFIG_DIR/id_rsa -o UserKnownHostsFile=$SSH_CONFIG_DIR/known_hosts'\n\n# use git+ssh instead of https\ngit config --global url.\"ssh://[email protected]\".insteadOf \"https://github.com\" || true\ngit config --global gc.auto 0 || true\n\nif [ -e /home/circleci/zulip/.git ]\nthen\n cd /home/circleci/zulip\n git remote set-url origin \"$CIRCLE_REPOSITORY_URL\" || true\nelse\n mkdir -p /home/circleci/zulip\n cd /home/circleci/zulip\n git clone \"$CIRCLE_REPOSITORY_URL\" .\nfi\n\nif [ -n \"$CIRCLE_TAG\" ]\nthen\n git fetch --force origin \"refs/tags/${CIRCLE_TAG}\"\nelse\n git fetch --force origin \"circleci:remotes/origin/circleci\"\nfi\n\n\nif [ -n \"$CIRCLE_TAG\" ]\nthen\n git reset --hard \"$CIRCLE_SHA1\"\n git checkout -q \"$CIRCLE_TAG\"\nelif [ -n \"$CIRCLE_BRANCH\" ]\nthen\n git reset --hard \"$CIRCLE_SHA1\"\n git checkout -q -B \"$CIRCLE_BRANCH\"\nfi\n\ngit reset --hard \"$CIRCLE_SHA1\"",- "status": "success",- "timedout": null,- "continue": null,- "end_time": "2020-06-12T13:38:28.848Z",- "type": "test",- "allocation_id": "5ee3844efd7aa57cd91af13a-0-build/5478EF76",- "output_url": "https://circle-production-action-output.s3.amazonaws.com/redacted",- "start_time": "2020-06-12T13:38:15.176Z",- "background": false,- "exit_code": null,- "insignificant": false,- "canceled": null,- "step": 101,- "run_time_millis": 13672,- "has_output": true- }- ]- },- {- "name": "create cache directories",- "actions": [- {- "truncated": false,- "index": 0,- "parallel": true,- "failed": null,- "infrastructure_fail": null,- "name": "create cache directories",- "bash_command": "#!/bin/bash -eo pipefail\ndirs=(/srv/zulip-{npm,venv,emoji}-cache)\nsudo mkdir -p \"${dirs[@]}\"\nsudo chown -R circleci \"${dirs[@]}\"\n",- "status": "success",- "timedout": null,- "continue": null,- "end_time": "2020-06-12T13:38:28.889Z",- "type": "test",- "allocation_id": "5ee3844efd7aa57cd91af13a-0-build/5478EF76",- "start_time": "2020-06-12T13:38:28.854Z",- "background": false,- "exit_code": 0,- "insignificant": false,- "canceled": null,- "step": 102,- "run_time_millis": 35,- "has_output": false- }- ]- },- {- "name": "do Bionic hack",- "actions": [- {- "truncated": false,- "index": 0,- "parallel": true,- "failed": null,- "infrastructure_fail": null,- "name": "do Bionic hack",- "bash_command": "#!/bin/bash -eo pipefail\n# Temporary hack till `sudo service redis-server start` gets fixes in Bionic. See\n# https://chat.zulip.org/#narrow/stream/3-backend/topic/Ubuntu.20bionic.20CircleCI\nsudo sed -i '/^bind/s/bind.*/bind 0.0.0.0/' /etc/redis/redis.conf\n",- "status": "success",- "timedout": null,- "continue": null,- "end_time": "2020-06-12T13:38:28.914Z",- "type": "test",- "allocation_id": "5ee3844efd7aa57cd91af13a-0-build/5478EF76",- "start_time": "2020-06-12T13:38:28.895Z",- "background": false,- "exit_code": 0,- "insignificant": false,- "canceled": null,- "step": 103,- "run_time_millis": 19,- "has_output": false- }- ]- },- {- "name": "Restoring Cache",- "actions": [- {- "truncated": false,- "index": 0,- "parallel": true,- "failed": null,- "infrastructure_fail": null,- "name": "Restoring Cache",- "bash_command": null,- "status": "success",- "timedout": null,- "continue": null,- "end_time": "2020-06-12T13:39:01.223Z",- "type": "test",- "allocation_id": "5ee3844efd7aa57cd91af13a-0-build/5478EF76",- "output_url": "https://circle-production-action-output.s3.amazonaws.com/redacted",- "start_time": "2020-06-12T13:38:28.920Z",- "background": false,- "exit_code": null,- "insignificant": false,- "canceled": null,- "step": 104,- "run_time_millis": 32303,- "has_output": true- }- ]- },- {- "name": "Restoring Cache",- "actions": [- {- "truncated": false,- "index": 0,- "parallel": true,- "failed": null,- "infrastructure_fail": null,- "name": "Restoring Cache",- "bash_command": null,- "status": "success",- "timedout": null,- "continue": null,- "end_time": "2020-06-12T13:39:14.156Z",- "type": "test",- "allocation_id": "5ee3844efd7aa57cd91af13a-0-build/5478EF76",- "output_url": "https://circle-production-action-output.s3.amazonaws.com/redacted",- "start_time": "2020-06-12T13:39:01.229Z",- "background": false,- "exit_code": null,- "insignificant": false,- "canceled": null,- "step": 105,- "run_time_millis": 12927,- "has_output": true- }- ]- },- {- "name": "Restoring Cache",- "actions": [- {- "truncated": false,- "index": 0,- "parallel": true,- "failed": null,- "infrastructure_fail": null,- "name": "Restoring Cache",- "bash_command": null,- "status": "success",- "timedout": null,- "continue": null,- "end_time": "2020-06-12T13:39:16.894Z",- "type": "test",- "allocation_id": "5ee3844efd7aa57cd91af13a-0-build/5478EF76",- "output_url": "https://circle-production-action-output.s3.amazonaws.com/redacted",- "start_time": "2020-06-12T13:39:14.162Z",- "background": false,- "exit_code": null,- "insignificant": false,- "canceled": null,- "step": 106,- "run_time_millis": 2732,- "has_output": true- }- ]- },- {- "name": "install dependencies",- "actions": [- {- "truncated": false,- "index": 0,- "parallel": true,- "failed": null,- "infrastructure_fail": null,- "name": "install dependencies",- "bash_command": "#!/bin/bash -eo pipefail\nsudo apt-get update\n# Install moreutils so we can use `ts` and `mispipe` in the following.\nsudo apt-get install -y moreutils\n\n# CircleCI sets the following in Git config at clone time:\n# url.ssh://[email protected] https://github.com\n# This breaks the Git clones in the NVM `install.sh` we run\n# in `install-node`.\n# TODO: figure out why that breaks, and whether we want it.\n# (Is it an optimization?)\nrm -f /home/circleci/.gitconfig\n\n# This is the main setup job for the test suite\nmispipe \"tools/ci/setup-backend\" ts\n\n# Cleaning caches is mostly unnecessary in Circle, because\n# most builds don't get to write to the cache.\n# mispipe \"scripts/lib/clean_unused_caches.py --verbose --threshold 0\" ts\n",- "status": "success",- "timedout": null,- "continue": null,- "end_time": "2020-06-12T13:41:22.387Z",- "type": "test",- "allocation_id": "5ee3844efd7aa57cd91af13a-0-build/5478EF76",- "output_url": "https://circle-production-action-output.s3.amazonaws.com/redacted",- "start_time": "2020-06-12T13:39:16.900Z",- "background": false,- "exit_code": 0,- "insignificant": false,- "canceled": null,- "step": 107,- "run_time_millis": 125487,- "has_output": true- }- ]- },- {- "name": "Saving Cache",- "actions": [- {- "truncated": false,- "index": 0,- "parallel": true,- "failed": null,- "infrastructure_fail": null,- "name": "Saving Cache",- "bash_command": null,- "status": "success",- "timedout": null,- "continue": null,- "end_time": "2020-06-12T13:41:22.431Z",- "type": "test",- "allocation_id": "5ee3844efd7aa57cd91af13a-0-build/5478EF76",- "output_url": "https://circle-production-action-output.s3.amazonaws.com/redacted",- "start_time": "2020-06-12T13:41:22.393Z",- "background": false,- "exit_code": null,- "insignificant": false,- "canceled": null,- "step": 108,- "run_time_millis": 38,- "has_output": true- }- ]- },- {- "name": "Saving Cache",- "actions": [- {- "truncated": false,- "index": 0,- "parallel": true,- "failed": null,- "infrastructure_fail": null,- "name": "Saving Cache",- "bash_command": null,- "status": "success",- "timedout": null,- "continue": null,- "end_time": "2020-06-12T13:41:22.470Z",- "type": "test",- "allocation_id": "5ee3844efd7aa57cd91af13a-0-build/5478EF76",- "output_url": "https://circle-production-action-output.s3.amazonaws.com/redacted",- "start_time": "2020-06-12T13:41:22.438Z",- "background": false,- "exit_code": null,- "insignificant": false,- "canceled": null,- "step": 109,- "run_time_millis": 32,- "has_output": true- }- ]- },- {- "name": "Saving Cache",- "actions": [- {- "truncated": false,- "index": 0,- "parallel": true,- "failed": null,- "infrastructure_fail": null,- "name": "Saving Cache",- "bash_command": null,- "status": "success",- "timedout": null,- "continue": null,- "end_time": "2020-06-12T13:41:22.494Z",- "type": "test",- "allocation_id": "5ee3844efd7aa57cd91af13a-0-build/5478EF76",- "output_url": "https://circle-production-action-output.s3.amazonaws.com/redacted",- "start_time": "2020-06-12T13:41:22.478Z",- "background": false,- "exit_code": null,- "insignificant": false,- "canceled": null,- "step": 110,- "run_time_millis": 16,- "has_output": true- }- ]- },- {- "name": "run backend tests",- "actions": [- {- "truncated": false,- "index": 0,- "parallel": true,- "failed": true,- "infrastructure_fail": null,- "name": "run backend tests",- "bash_command": "#!/bin/bash -eo pipefail\n. /srv/zulip-py3-venv/bin/activate\nmispipe ./tools/ci/backend ts\n",- "status": "failed",- "timedout": null,- "continue": null,- "end_time": "2020-06-12T13:42:55.898Z",- "type": "test",- "allocation_id": "5ee3844efd7aa57cd91af13a-0-build/5478EF76",- "start_time": "2020-06-12T13:41:22.501Z",- "background": false,- "exit_code": 1,- "insignificant": false,- "canceled": null,- "step": 111,- "run_time_millis": 93397,- "has_output": true- }- ]- },- {- "name": "Uploading artifacts",- "actions": [- {- "truncated": false,- "index": 0,- "parallel": true,- "failed": null,- "infrastructure_fail": null,- "name": "Uploading artifacts",- "bash_command": null,- "status": "success",- "timedout": null,- "continue": null,- "end_time": "2020-06-12T13:42:55.918Z",- "type": "test",- "allocation_id": "5ee3844efd7aa57cd91af13a-0-build/5478EF76",- "start_time": "2020-06-12T13:42:55.903Z",- "background": false,- "exit_code": null,- "insignificant": false,- "canceled": null,- "step": 112,- "run_time_millis": 15,- "has_output": true- }- ]- },- {- "name": "Uploading artifacts",- "actions": [- {- "truncated": false,- "index": 0,- "parallel": true,- "failed": null,- "infrastructure_fail": null,- "name": "Uploading artifacts",- "bash_command": null,- "status": "success",- "timedout": null,- "continue": null,- "end_time": "2020-06-12T13:42:55.940Z",- "type": "test",- "allocation_id": "5ee3844efd7aa57cd91af13a-0-build/5478EF76",- "start_time": "2020-06-12T13:42:55.925Z",- "background": false,- "exit_code": null,- "insignificant": false,- "canceled": null,- "step": 113,- "run_time_millis": 15,- "has_output": true- }- ]- },- {- "name": "Uploading artifacts",- "actions": [- {- "truncated": false,- "index": 0,- "parallel": true,- "failed": null,- "infrastructure_fail": null,- "name": "Uploading artifacts",- "bash_command": null,- "status": "success",- "timedout": null,- "continue": null,- "end_time": "2020-06-12T13:42:56.031Z",- "type": "test",- "allocation_id": "5ee3844efd7aa57cd91af13a-0-build/5478EF76",- "start_time": "2020-06-12T13:42:55.945Z",- "background": false,- "exit_code": null,- "insignificant": false,- "canceled": null,- "step": 114,- "run_time_millis": 86,- "has_output": true- }- ]- },- {- "name": "Uploading test results",- "actions": [- {- "truncated": false,- "index": 0,- "parallel": true,- "failed": null,- "infrastructure_fail": null,- "name": "Uploading test results",- "bash_command": null,- "status": "success",- "timedout": null,- "continue": null,- "end_time": "2020-06-12T13:42:56.051Z",- "type": "test",- "allocation_id": "5ee3844efd7aa57cd91af13a-0-build/5478EF76",- "start_time": "2020-06-12T13:42:56.036Z",- "background": false,- "exit_code": null,- "insignificant": false,- "canceled": null,- "step": 115,- "run_time_millis": 15,- "has_output": true- }- ]- },- {- "name": "On fail",- "actions": [- {- "truncated": false,- "index": 0,- "parallel": true,- "failed": null,- "infrastructure_fail": null,- "name": "On fail",- "bash_command": "#!/bin/bash -eo pipefail\nif [[ \"$CIRCLE_REPOSITORY_URL\" == \"[email protected]:zulip/zulip.git\" ]]; then\n curl -H \"Content-Type: application/json\" \\\n -X POST -i 'https://chat.zulip.org/api/v1/external/circleci?api_key='\"$ZULIP_BOT_KEY\"'&stream=automated%20testing&topic=master%20failing' \\\n -d '{\"payload\": { \"branch\": \"'\"$CIRCLE_BRANCH\"'\", \"reponame\": \"'\"$CIRCLE_PROJECT_REPONAME\"'\", \"status\": \"failed\", \"build_url\": \"'\"$CIRCLE_BUILD_URL\"'\", \"username\": \"'\"$CIRCLE_USERNAME\"'\"}}'\nfi\n",- "status": "success",- "timedout": null,- "continue": null,- "end_time": "2020-06-12T13:42:56.071Z",- "type": "test",- "allocation_id": "5ee3844efd7aa57cd91af13a-0-build/5478EF76",- "start_time": "2020-06-12T13:42:56.058Z",- "background": false,- "exit_code": 0,- "insignificant": false,- "canceled": null,- "step": 116,- "run_time_millis": 13,- "has_output": false- }- ]- }- ],- "body": "",- "usage_queued_at": "2020-06-12T13:34:07.005Z",- "context_ids": [],- "fail_reason": null,- "retry_of": null,- "reponame": "zulip",- "ssh_users": [],- "build_url": "https://circleci.com/gh/Hypro999/zulip/1429",- "parallel": 1,- "failed": true,- "branch": "circleci",- "username": "Hypro999",- "author_date": "2020-06-12T13:33:46.000Z",- "why": "github",- "user": {- "is_user": true,- "login": "Hypro999",- "avatar_url": "https://avatars3.githubusercontent.com/u/29123352?v=4",- "name": "Hemanth V. Alluri",- "vcs_type": "github",- "id": 29123352- },- "vcs_revision": "5326f9ea4084a01cc2bf1a461b9ad819b4ffdd14",- "workflows": {- "job_name": "bionic-backend-frontend",- "job_id": "67650e47-d240-4db6-b2ed-304ca6dfde26",- "workflow_id": "a2522997-5337-41a7-b9fe-07fc03724b12",- "workspace_id": "a2522997-5337-41a7-b9fe-07fc03724b12",- "upstream_job_ids": [],- "upstream_concurrency_map": {},- "workflow_name": "Ubuntu 18.04 Bionic (Python 3.6, backend+frontend)"- },- "owners": [- "Hypro999"- ],- "vcs_tag": null,- "pull_requests": [],- "build_num": 1429,- "infrastructure_fail": false,- "committer_email": "[email protected]",- "has_artifacts": true,- "previous": {- "build_num": 1428,- "status": "success",- "build_time_millis": 29397- },- "status": "failed",- "committer_name": "Hemanth V. Alluri",- "retries": null,- "subject": "circleci: Add temp untested progress to get fixtures for failure.",- "vcs_type": "github",- "timedout": false,- "dont_build": null,- "lifecycle": "finished",- "no_dependency_cache": false,- "stop_time": "2020-06-12T13:42:56.123Z",- "ssh_disabled": true,- "build_time_millis": 307240,- "picard": {- "build_agent": {- "image": "circleci/picard@sha256:847ae88f32aaf7cfc04321b3eb25a7519630a949cf35df0d0b77ea1d7e886bd3",- "properties": {- "instance_ip": "172.16.89.195",- "build_agent": "1.0.34234-27aa9735",- "executor": "docker",- "nomad_ami": "ami-07194a5d4dd689502",- "availability_zone": "us-east-1c",- "instance_id": "i-0fddc2be4c7ebe0b7"- }- },- "resource_class": {- "cpu": 2,- "ram": 4096,- "class": "medium",- "name": "Docker Medium"- },- "executor": "docker"- },- "circle_yml": {},- "messages": [],- "is_first_green_build": false,- "job_name": null,- "start_time": "2020-06-12T13:37:48.883Z",- "canceler": null,- "all_commit_details": [- {- "committer_date": "2020-06-12T13:33:35.000Z",- "body": "",- "branch": "circleci",- "author_date": "2020-06-12T13:33:35.000Z",- "committer_email": "[email protected]",- "commit": "73900eeb69adbf0b83dc487e8eda90661b524eff",- "committer_login": "Hypro999",- "committer_name": "Hemanth V. Alluri",- "subject": "Modify CircleCI config for live-ish testing.",- "commit_url": "https://github.com/Hypro999/zulip/commit/73900eeb69adbf0b83dc487e8eda90661b524eff",- "author_login": "Hypro999",- "author_name": "Hemanth V. Alluri",- "author_email": "[email protected]"- },- {- "committer_date": "2020-06-12T13:33:46.000Z",- "body": "",- "branch": "circleci",- "author_date": "2020-06-12T13:33:46.000Z",- "committer_email": "[email protected]",- "commit": "5326f9ea4084a01cc2bf1a461b9ad819b4ffdd14",- "committer_login": "Hypro999",- "committer_name": "Hemanth V. Alluri",- "subject": "circleci: Add temp untested progress to get fixtures for failure.",- "commit_url": "https://github.com/Hypro999/zulip/commit/5326f9ea4084a01cc2bf1a461b9ad819b4ffdd14",- "author_login": "Hypro999",- "author_name": "Hemanth V. Alluri",- "author_email": "[email protected]"- }- ],- "platform": "2.0",- "outcome": "failed",- "vcs_url": "https://github.com/Hypro999/zulip",- "author_name": "Hemanth V. Alluri",- "node": null,- "queued_at": "2020-06-12T13:37:44.274Z",- "canceled": false,- "author_email": "[email protected]"- }-}diff --git a/zerver/webhooks/circleci/fixtures/github_bionic_production_build_success_multiple_parties.json b/zerver/webhooks/circleci/fixtures/github_bionic_production_build_success_multiple_parties.jsondeleted file mode 100755index d1e812615c4..00000000000--- a/zerver/webhooks/circleci/fixtures/github_bionic_production_build_success_multiple_parties.json+++ /dev/null@@ -1,516 +0,0 @@-{- "payload": {- "compare": null,- "previous_successful_build": {- "build_num": 1422,- "status": "success",- "build_time_millis": 40755- },- "build_parameters": {- "CIRCLE_JOB": "bionic-production-build"- },- "oss": true,- "all_commit_details_truncated": false,- "committer_date": "2020-06-12T13:33:46.000Z",- "steps": [- {- "name": "Spin Up Environment",- "actions": [- {- "truncated": false,- "index": 0,- "parallel": true,- "failed": null,- "infrastructure_fail": null,- "name": "Spin Up Environment",- "bash_command": null,- "status": "success",- "timedout": null,- "continue": null,- "end_time": "2020-06-12T13:43:15.728Z",- "type": "test",- "allocation_id": "5ee3844fa5252234d1078954-0-build/2370AFED",- "output_url": "https://circle-production-action-output.s3.amazonaws.com/redacted",- "start_time": "2020-06-12T13:42:58.439Z",- "background": false,- "exit_code": null,- "insignificant": false,- "canceled": null,- "step": 0,- "run_time_millis": 17289,- "has_output": true- }- ]- },- {- "name": "Preparing Environment Variables",- "actions": [- {- "truncated": false,- "index": 0,- "parallel": true,- "failed": null,- "infrastructure_fail": null,- "name": "Preparing Environment Variables",- "bash_command": null,- "status": "success",- "timedout": null,- "continue": null,- "end_time": "2020-06-12T13:43:16.016Z",- "type": "test",- "allocation_id": "5ee3844fa5252234d1078954-0-build/2370AFED",- "output_url": "https://circle-production-action-output.s3.amazonaws.com/redacted",- "start_time": "2020-06-12T13:43:15.999Z",- "background": false,- "exit_code": null,- "insignificant": false,- "canceled": null,- "step": 99,- "run_time_millis": 17,- "has_output": true- }- ]- },- {- "name": "Checkout code",- "actions": [- {- "truncated": false,- "index": 0,- "parallel": true,- "failed": null,- "infrastructure_fail": null,- "name": "Checkout code",- "bash_command": "#!/bin/sh\nset -e\n\n# Workaround old docker images with incorrect $HOME\n# check https://github.com/docker/docker/issues/2968 for details\nif [ \"${HOME}\" = \"/\" ]\nthen\n export HOME=$(getent passwd $(id -un) | cut -d: -f6)\nfi\n\necho Using SSH Config Dir $SSH_CONFIG_DIR\n\nmkdir -p $SSH_CONFIG_DIR\n\necho 'github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==\nbitbucket.org ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAubiN81eDcafrgMeLzaFPsw2kNvEcqTKl/VqLat/MaB33pZy0y3rJZtnqwR2qOOvbwKZYKiEO1O6VqNEBxKvJJelCq0dTXWT5pbO2gDXC6h6QDXCaHo6pOHGPUy+YBaGQRGuSusMEASYiWunYN0vCAI8QaXnWMXNMdFP3jHAJH0eDsoiGnLPBlBp4TNm6rYI74nMzgz3B9IikW4WVK+dc8KZJZWYjAuORU3jc1c/NPskD2ASinf8v3xnfXeukU0sJ5N6m5E8VLjObPEO+mN2t/FZTMZLiFqPWc/ALSqnMnnhwrNi2rbfg/rd/IpL8Le3pSBne8+seeFVBoGqzHM9yXw==\n' >> $SSH_CONFIG_DIR/known_hosts\n\n(umask 077; touch $SSH_CONFIG_DIR/id_rsa)\nchmod 0600 $SSH_CONFIG_DIR/id_rsa\n(cat <<EOF > $SSH_CONFIG_DIR/id_rsa\n$CHECKOUT_KEY\nEOF\n)\n\nexport GIT_SSH_COMMAND='ssh -i $SSH_CONFIG_DIR/id_rsa -o UserKnownHostsFile=$SSH_CONFIG_DIR/known_hosts'\n\n# use git+ssh instead of https\ngit config --global url.\"ssh://[email protected]\".insteadOf \"https://github.com\" || true\ngit config --global gc.auto 0 || true\n\nif [ -e /home/circleci/zulip/.git ]\nthen\n cd /home/circleci/zulip\n git remote set-url origin \"$CIRCLE_REPOSITORY_URL\" || true\nelse\n mkdir -p /home/circleci/zulip\n cd /home/circleci/zulip\n git clone \"$CIRCLE_REPOSITORY_URL\" .\nfi\n\nif [ -n \"$CIRCLE_TAG\" ]\nthen\n git fetch --force origin \"refs/tags/${CIRCLE_TAG}\"\nelse\n git fetch --force origin \"circleci:remotes/origin/circleci\"\nfi\n\n\nif [ -n \"$CIRCLE_TAG\" ]\nthen\n git reset --hard \"$CIRCLE_SHA1\"\n git checkout -q \"$CIRCLE_TAG\"\nelif [ -n \"$CIRCLE_BRANCH\" ]\nthen\n git reset --hard \"$CIRCLE_SHA1\"\n git checkout -q -B \"$CIRCLE_BRANCH\"\nfi\n\ngit reset --hard \"$CIRCLE_SHA1\"",- "status": "success",- "timedout": null,- "continue": null,- "end_time": "2020-06-12T13:43:29.100Z",- "type": "test",- "allocation_id": "5ee3844fa5252234d1078954-0-build/2370AFED",- "output_url": "https://circle-production-action-output.s3.amazonaws.com/redacted",- "start_time": "2020-06-12T13:43:16.027Z",- "background": false,- "exit_code": null,- "insignificant": false,- "canceled": null,- "step": 101,- "run_time_millis": 13073,- "has_output": true- }- ]- },- {- "name": "create cache directories",- "actions": [- {- "truncated": false,- "index": 0,- "parallel": true,- "failed": null,- "infrastructure_fail": null,- "name": "create cache directories",- "bash_command": "#!/bin/bash -eo pipefail\ndirs=(/srv/zulip-{npm,venv,emoji}-cache)\nsudo mkdir -p \"${dirs[@]}\"\nsudo chown -R circleci \"${dirs[@]}\"\n",- "status": "success",- "timedout": null,- "continue": null,- "end_time": "2020-06-12T13:43:29.131Z",- "type": "test",- "allocation_id": "5ee3844fa5252234d1078954-0-build/2370AFED",- "start_time": "2020-06-12T13:43:29.109Z",- "background": false,- "exit_code": 0,- "insignificant": false,- "canceled": null,- "step": 102,- "run_time_millis": 22,- "has_output": false- }- ]- },- {- "name": "do Bionic hack",- "actions": [- {- "truncated": false,- "index": 0,- "parallel": true,- "failed": null,- "infrastructure_fail": null,- "name": "do Bionic hack",- "bash_command": "#!/bin/bash -eo pipefail\n# Temporary hack till `sudo service redis-server start` gets fixes in Bionic. See\n# https://chat.zulip.org/#narrow/stream/3-backend/topic/Ubuntu.20bionic.20CircleCI\nsudo sed -i '/^bind/s/bind.*/bind 0.0.0.0/' /etc/redis/redis.conf\n",- "status": "success",- "timedout": null,- "continue": null,- "end_time": "2020-06-12T13:43:29.152Z",- "type": "test",- "allocation_id": "5ee3844fa5252234d1078954-0-build/2370AFED",- "start_time": "2020-06-12T13:43:29.139Z",- "background": false,- "exit_code": 0,- "insignificant": false,- "canceled": null,- "step": 103,- "run_time_millis": 13,- "has_output": false- }- ]- },- {- "name": "Restoring Cache",- "actions": [- {- "truncated": false,- "index": 0,- "parallel": true,- "failed": null,- "infrastructure_fail": null,- "name": "Restoring Cache",- "bash_command": null,- "status": "success",- "timedout": null,- "continue": null,- "end_time": "2020-06-12T13:43:55.446Z",- "type": "test",- "allocation_id": "5ee3844fa5252234d1078954-0-build/2370AFED",- "output_url": "https://circle-production-action-output.s3.amazonaws.com/redacted",- "start_time": "2020-06-12T13:43:29.161Z",- "background": false,- "exit_code": null,- "insignificant": false,- "canceled": null,- "step": 104,- "run_time_millis": 26285,- "has_output": true- }- ]- },- {- "name": "Restoring Cache",- "actions": [- {- "truncated": false,- "index": 0,- "parallel": true,- "failed": null,- "infrastructure_fail": null,- "name": "Restoring Cache",- "bash_command": null,- "status": "success",- "timedout": null,- "continue": null,- "end_time": "2020-06-12T13:44:16.256Z",- "type": "test",- "allocation_id": "5ee3844fa5252234d1078954-0-build/2370AFED",- "output_url": "https://circle-production-action-output.s3.amazonaws.com/redacted",- "start_time": "2020-06-12T13:43:55.450Z",- "background": false,- "exit_code": null,- "insignificant": false,- "canceled": null,- "step": 105,- "run_time_millis": 20806,- "has_output": true- }- ]- },- {- "name": "Restoring Cache",- "actions": [- {- "truncated": false,- "index": 0,- "parallel": true,- "failed": null,- "infrastructure_fail": null,- "name": "Restoring Cache",- "bash_command": null,- "status": "success",- "timedout": null,- "continue": null,- "end_time": "2020-06-12T13:44:17.502Z",- "type": "test",- "allocation_id": "5ee3844fa5252234d1078954-0-build/2370AFED",- "output_url": "https://circle-production-action-output.s3.amazonaws.com/redacted",- "start_time": "2020-06-12T13:44:16.261Z",- "background": false,- "exit_code": null,- "insignificant": false,- "canceled": null,- "step": 106,- "run_time_millis": 1241,- "has_output": true- }- ]- },- {- "name": "build production",- "actions": [- {- "truncated": false,- "index": 0,- "parallel": true,- "failed": null,- "infrastructure_fail": null,- "name": "build production",- "bash_command": "#!/bin/bash -eo pipefail\nsudo apt-get update\n# Install moreutils so we can use `ts` and `mispipe` in the following.\nsudo apt-get install -y moreutils\n\nmispipe ./tools/ci/production-build ts\n",- "status": "success",- "timedout": null,- "continue": null,- "end_time": "2020-06-12T13:46:02.606Z",- "type": "test",- "allocation_id": "5ee3844fa5252234d1078954-0-build/2370AFED",- "output_url": "https://circle-production-action-output.s3.amazonaws.com/redacted",- "start_time": "2020-06-12T13:44:17.507Z",- "background": false,- "exit_code": 0,- "insignificant": false,- "canceled": null,- "step": 107,- "run_time_millis": 105099,- "has_output": true- }- ]- },- {- "name": "Saving Cache",- "actions": [- {- "truncated": false,- "index": 0,- "parallel": true,- "failed": null,- "infrastructure_fail": null,- "name": "Saving Cache",- "bash_command": null,- "status": "success",- "timedout": null,- "continue": null,- "end_time": "2020-06-12T13:46:02.648Z",- "type": "test",- "allocation_id": "5ee3844fa5252234d1078954-0-build/2370AFED",- "output_url": "https://circle-production-action-output.s3.amazonaws.com/redacted",- "start_time": "2020-06-12T13:46:02.611Z",- "background": false,- "exit_code": null,- "insignificant": false,- "canceled": null,- "step": 108,- "run_time_millis": 37,- "has_output": true- }- ]- },- {- "name": "Saving Cache",- "actions": [- {- "truncated": false,- "index": 0,- "parallel": true,- "failed": null,- "infrastructure_fail": null,- "name": "Saving Cache",- "bash_command": null,- "status": "success",- "timedout": null,- "continue": null,- "end_time": "2020-06-12T13:46:02.700Z",- "type": "test",- "allocation_id": "5ee3844fa5252234d1078954-0-build/2370AFED",- "output_url": "https://circle-production-action-output.s3.amazonaws.com/redacted",- "start_time": "2020-06-12T13:46:02.654Z",- "background": false,- "exit_code": null,- "insignificant": false,- "canceled": null,- "step": 109,- "run_time_millis": 46,- "has_output": true- }- ]- },- {- "name": "Saving Cache",- "actions": [- {- "truncated": false,- "index": 0,- "parallel": true,- "failed": null,- "infrastructure_fail": null,- "name": "Saving Cache",- "bash_command": null,- "status": "success",- "timedout": null,- "continue": null,- "end_time": "2020-06-12T13:46:02.728Z",- "type": "test",- "allocation_id": "5ee3844fa5252234d1078954-0-build/2370AFED",- "output_url": "https://circle-production-action-output.s3.amazonaws.com/redacted",- "start_time": "2020-06-12T13:46:02.706Z",- "background": false,- "exit_code": null,- "insignificant": false,- "canceled": null,- "step": 110,- "run_time_millis": 22,- "has_output": true- }- ]- },- {- "name": "Persisting to Workspace",- "actions": [- {- "truncated": false,- "index": 0,- "parallel": true,- "failed": null,- "infrastructure_fail": null,- "name": "Persisting to Workspace",- "bash_command": null,- "status": "success",- "timedout": null,- "continue": null,- "end_time": "2020-06-12T13:46:06.549Z",- "type": "test",- "allocation_id": "5ee3844fa5252234d1078954-0-build/2370AFED",- "start_time": "2020-06-12T13:46:02.733Z",- "background": false,- "exit_code": null,- "insignificant": false,- "canceled": null,- "step": 111,- "run_time_millis": 3816,- "has_output": true- }- ]- }- ],- "body": "",- "usage_queued_at": "2020-06-12T13:34:07.373Z",- "context_ids": [],- "fail_reason": null,- "retry_of": null,- "reponame": "zulip",- "ssh_users": [],- "build_url": "https://circleci.com/gh/Hypro999/zulip/1431",- "parallel": 1,- "failed": false,- "branch": "circleci",- "username": "Hypro999",- "author_date": "2020-06-12T13:33:46.000Z",- "why": "github",- "user": {- "is_user": true,- "login": "Hypro999",- "avatar_url": "https://avatars3.githubusercontent.com/u/29123352?v=4",- "name": "Hemanth V. Alluri",- "vcs_type": "github",- "id": 29123352- },- "vcs_revision": "5326f9ea4084a01cc2bf1a461b9ad819b4ffdd14",- "workflows": {- "job_name": "bionic-production-build",- "job_id": "6a97df3e-51eb-4113-bd80-27f8f4f57ee0",- "workflow_id": "056072ea-9615-44fc-b574-7b4c06aa2c8e",- "workspace_id": "056072ea-9615-44fc-b574-7b4c06aa2c8e",- "upstream_job_ids": [],- "upstream_concurrency_map": {},- "workflow_name": "Production"- },- "owners": [- "Hypro999"- ],- "vcs_tag": null,- "pull_requests": [],- "build_num": 1431,- "infrastructure_fail": false,- "committer_email": "[email protected]",- "has_artifacts": true,- "previous": {- "build_num": 1430,- "status": "running",- "build_time_millis": 215274- },- "status": "success",- "committer_name": "Hemanth V. Alluri",- "retries": null,- "subject": "circleci: Add temp untested progress to get fixtures for failure.",- "vcs_type": "github",- "timedout": false,- "dont_build": null,- "lifecycle": "finished",- "no_dependency_cache": false,- "stop_time": "2020-06-12T13:46:06.600Z",- "ssh_disabled": true,- "build_time_millis": 188217,- "picard": {- "build_agent": {- "image": "circleci/picard@sha256:847ae88f32aaf7cfc04321b3eb25a7519630a949cf35df0d0b77ea1d7e886bd3",- "properties": {- "build_agent": "1.0.34234-27aa9735",- "executor": "docker",- "nomad_ami": "ami-07194a5d4dd689502",- "availability_zone": "us-east-1c",- "instance_id": "i-0cbbcd49e6d003611",- "instance_ip": "172.16.88.17"- }- },- "resource_class": {- "cpu": 2,- "ram": 4096,- "class": "medium",- "name": "Docker Medium"- },- "executor": "docker"- },- "circle_yml": {},- "messages": [],- "is_first_green_build": false,- "job_name": null,- "start_time": "2020-06-12T13:42:58.383Z",- "canceler": null,- "all_commit_details": [- {- "committer_date": "2020-06-12T13:33:35.000Z",- "body": "",- "branch": "circleci",- "author_date": "2020-06-12T13:33:35.000Z",- "committer_email": "[email protected]",- "commit": "73900eeb69adbf0b83dc487e8eda90661b524eff",- "committer_login": null,- "committer_name": "Sadaharu",- "subject": "Modify CircleCI config for live-ish testing.",- "commit_url": "https://github.com/Hypro999/zulip/commit/73900eeb69adbf0b83dc487e8eda90661b524eff",- "author_login": "Hypro999",- "author_name": "Hemanth V. Alluri",- "author_email": "[email protected]"- },- {- "committer_date": "2020-06-12T13:33:46.000Z",- "body": "",- "branch": "circleci",- "author_date": "2020-06-12T13:33:46.000Z",- "committer_email": "[email protected]",- "commit": "5326f9ea4084a01cc2bf1a461b9ad819b4ffdd14",- "committer_login": "Hypro999",- "committer_name": "Hemanth V. Alluri",- "subject": "circleci: Add temp untested progress to get fixtures for failure.",- "commit_url": "https://github.com/ShiroYasha999/zulip/commit/5326f9ea4084a01cc2bf1a461b9ad819b4ffdd14",- "author_login": "ShiroYasha999",- "author_name": "Gintoki Sakata",- "author_email": "[email protected]"- }- ],- "platform": "2.0",- "outcome": "success",- "vcs_url": "https://github.com/Hypro999/zulip",- "author_name": "Hemanth V. Alluri",- "node": null,- "queued_at": "2020-06-12T13:42:56.155Z",- "canceled": false,- "author_email": "[email protected]"- }-}diff --git a/zerver/webhooks/circleci/fixtures/github_bionic_production_install_cancelled.json b/zerver/webhooks/circleci/fixtures/github_bionic_production_install_cancelled.jsondeleted file mode 100755index 262c5f97287..00000000000--- a/zerver/webhooks/circleci/fixtures/github_bionic_production_install_cancelled.json+++ /dev/null@@ -1,397 +0,0 @@-{- "payload": {- "compare": null,- "previous_successful_build": {- "build_num": 1415,- "status": "success",- "build_time_millis": 153514- },- "build_parameters": {- "CIRCLE_JOB": "bionic-production-install"- },- "oss": true,- "all_commit_details_truncated": false,- "committer_date": "2020-06-12T13:21:07.000Z",- "steps": [- {- "name": "Spin Up Environment",- "actions": [- {- "truncated": false,- "index": 0,- "parallel": true,- "failed": null,- "infrastructure_fail": null,- "name": "Spin Up Environment",- "bash_command": null,- "status": "success",- "timedout": null,- "continue": null,- "end_time": "2020-06-12T13:26:47.260Z",- "type": "test",- "allocation_id": "5ee3822d4751e46626b827a3-0-build/9D59D73",- "output_url": "https://circle-production-action-output.s3.amazonaws.com/redacted",- "start_time": "2020-06-12T13:26:25.632Z",- "background": false,- "exit_code": null,- "insignificant": false,- "canceled": null,- "step": 0,- "run_time_millis": 21628,- "has_output": true- }- ]- },- {- "name": "Preparing Environment Variables",- "actions": [- {- "truncated": false,- "index": 0,- "parallel": true,- "failed": null,- "infrastructure_fail": null,- "name": "Preparing Environment Variables",- "bash_command": null,- "status": "success",- "timedout": null,- "continue": null,- "end_time": "2020-06-12T13:26:47.634Z",- "type": "test",- "allocation_id": "5ee3822d4751e46626b827a3-0-build/9D59D73",- "output_url": "https://circle-production-action-output.s3.amazonaws.com/redacted",- "start_time": "2020-06-12T13:26:47.612Z",- "background": false,- "exit_code": null,- "insignificant": false,- "canceled": null,- "step": 99,- "run_time_millis": 22,- "has_output": true- }- ]- },- {- "name": "Attaching Workspace",- "actions": [- {- "truncated": false,- "index": 0,- "parallel": true,- "failed": null,- "infrastructure_fail": null,- "name": "Attaching Workspace",- "bash_command": null,- "status": "success",- "timedout": null,- "continue": null,- "end_time": "2020-06-12T13:26:48.772Z",- "type": "test",- "allocation_id": "5ee3822d4751e46626b827a3-0-build/9D59D73",- "output_url": "https://circle-production-action-output.s3.amazonaws.com/redacted",- "start_time": "2020-06-12T13:26:47.642Z",- "background": false,- "exit_code": null,- "insignificant": false,- "canceled": null,- "step": 101,- "run_time_millis": 1130,- "has_output": true- }- ]- },- {- "name": "create cache directories",- "actions": [- {- "truncated": false,- "index": 0,- "parallel": true,- "failed": null,- "infrastructure_fail": null,- "name": "create cache directories",- "bash_command": "#!/bin/bash -eo pipefail\ndirs=(/srv/zulip-{npm,venv,emoji}-cache)\nsudo mkdir -p \"${dirs[@]}\"\nsudo chown -R circleci \"${dirs[@]}\"\n",- "status": "success",- "timedout": null,- "continue": null,- "end_time": "2020-06-12T13:26:48.809Z",- "type": "test",- "allocation_id": "5ee3822d4751e46626b827a3-0-build/9D59D73",- "start_time": "2020-06-12T13:26:48.777Z",- "background": false,- "exit_code": 0,- "insignificant": false,- "canceled": null,- "step": 102,- "run_time_millis": 32,- "has_output": false- }- ]- },- {- "name": "do Bionic hack",- "actions": [- {- "truncated": false,- "index": 0,- "parallel": true,- "failed": null,- "infrastructure_fail": null,- "name": "do Bionic hack",- "bash_command": "#!/bin/bash -eo pipefail\n# Temporary hack till `sudo service redis-server start` gets fixes in Bionic. See\n# https://chat.zulip.org/#narrow/stream/3-backend/topic/Ubuntu.20bionic.20CircleCI\nsudo sed -i '/^bind/s/bind.*/bind 0.0.0.0/' /etc/redis/redis.conf\n",- "status": "success",- "timedout": null,- "continue": null,- "end_time": "2020-06-12T13:26:48.833Z",- "type": "test",- "allocation_id": "5ee3822d4751e46626b827a3-0-build/9D59D73",- "start_time": "2020-06-12T13:26:48.816Z",- "background": false,- "exit_code": 0,- "insignificant": false,- "canceled": null,- "step": 103,- "run_time_millis": 17,- "has_output": false- }- ]- },- {- "name": "production extract tarball",- "actions": [- {- "truncated": false,- "index": 0,- "parallel": true,- "failed": null,- "infrastructure_fail": null,- "name": "production extract tarball",- "bash_command": "#!/bin/bash -eo pipefail\nsudo apt-get update\n# Install moreutils so we can use `ts` and `mispipe` in the following.\nsudo apt-get install -y moreutils\n\nmispipe /tmp/production-extract-tarball ts\n",- "status": "success",- "timedout": null,- "continue": null,- "end_time": "2020-06-12T13:26:55.803Z",- "type": "test",- "allocation_id": "5ee3822d4751e46626b827a3-0-build/9D59D73",- "output_url": "https://circle-production-action-output.s3.amazonaws.com/redacted",- "start_time": "2020-06-12T13:26:48.841Z",- "background": false,- "exit_code": 0,- "insignificant": false,- "canceled": null,- "step": 104,- "run_time_millis": 6962,- "has_output": true- }- ]- },- {- "name": "Restoring Cache",- "actions": [- {- "truncated": false,- "index": 0,- "parallel": true,- "failed": null,- "infrastructure_fail": null,- "name": "Restoring Cache",- "bash_command": null,- "status": "success",- "timedout": null,- "continue": null,- "end_time": "2020-06-12T13:26:55.950Z",- "type": "test",- "allocation_id": "5ee3822d4751e46626b827a3-0-build/9D59D73",- "output_url": "https://circle-production-action-output.s3.amazonaws.com/redacted",- "start_time": "2020-06-12T13:26:55.809Z",- "background": false,- "exit_code": null,- "insignificant": false,- "canceled": null,- "step": 105,- "run_time_millis": 141,- "has_output": true- }- ]- },- {- "name": "install production",- "actions": [- {- "truncated": false,- "index": 0,- "parallel": true,- "failed": null,- "infrastructure_fail": null,- "name": "install production",- "bash_command": "#!/bin/bash -eo pipefail\nsudo service rabbitmq-server restart\nsudo mispipe /tmp/production-install ts\n",- "status": "running",- "timedout": null,- "continue": null,- "end_time": null,- "type": "test",- "allocation_id": "5ee3822d4751e46626b827a3-0-build/9D59D73",- "start_time": "2020-06-12T13:26:55.955Z",- "background": false,- "exit_code": null,- "insignificant": false,- "canceled": null,- "step": 106,- "run_time_millis": null,- "has_output": true- }- ]- },- {- "name": "Error executing build steps",- "actions": [- {- "truncated": false,- "index": 0,- "parallel": true,- "failed": null,- "infrastructure_fail": null,- "name": "Error executing build steps",- "bash_command": null,- "status": "canceled",- "timedout": null,- "continue": null,- "end_time": "2020-06-12T13:26:56.384Z",- "type": "test",- "allocation_id": "5ee3822d4751e46626b827a3-0-build/9D59D73",- "start_time": "2020-06-12T13:26:56.374Z",- "background": false,- "exit_code": null,- "insignificant": false,- "canceled": true,- "step": 1023,- "run_time_millis": 10,- "has_output": true- }- ]- }- ],- "body": "",- "usage_queued_at": "2020-06-12T13:25:02.040Z",- "context_ids": [],- "fail_reason": null,- "retry_of": null,- "reponame": "zulip",- "ssh_users": [],- "build_url": "https://circleci.com/gh/Hypro999/zulip/1420",- "parallel": 1,- "failed": false,- "branch": "circleci",- "username": "Hypro999",- "author_date": "2020-06-12T13:21:07.000Z",- "why": "github",- "user": {- "is_user": true,- "login": "Hypro999",- "avatar_url": "https://avatars3.githubusercontent.com/u/29123352?v=4",- "name": "Hemanth V. Alluri",- "vcs_type": "github",- "id": 29123352- },- "vcs_revision": "b0d6197fb4cacaf917adca77f77354882ee80621",- "workflows": {- "job_name": "bionic-production-install",- "job_id": "9cecf80d-fe76-422f-a8c0-5e1fd69bbf0f",- "workflow_id": "ab148cd0-5f8a-4b91-a8b5-26da1cbfdf5d",- "workspace_id": "ab148cd0-5f8a-4b91-a8b5-26da1cbfdf5d",- "upstream_job_ids": [- "56ee3397-bfca-4921-b520-d5d4e1201245"- ],- "upstream_concurrency_map": {},- "workflow_name": "Production"- },- "owners": [- "Hypro999"- ],- "vcs_tag": null,- "pull_requests": [],- "build_num": 1420,- "infrastructure_fail": false,- "committer_email": "[email protected]",- "has_artifacts": true,- "previous": {- "build_num": 1415,- "status": "success",- "build_time_millis": 153514- },- "status": "canceled",- "committer_name": "Hemanth V. Alluri",- "retries": null,- "subject": "circleci: Add temp untested progress to fixtures for failure.",- "vcs_type": "github",- "timedout": false,- "dont_build": null,- "lifecycle": "finished",- "no_dependency_cache": false,- "stop_time": "2020-06-12T13:26:56.390Z",- "ssh_disabled": true,- "build_time_millis": 30807,- "picard": {- "build_agent": {- "image": "circleci/picard@sha256:847ae88f32aaf7cfc04321b3eb25a7519630a949cf35df0d0b77ea1d7e886bd3",- "properties": {- "nomad_ami": "ami-07194a5d4dd689502",- "availability_zone": "us-east-1c",- "instance_id": "i-063da79367c8689f2",- "instance_ip": "172.16.91.151",- "build_agent": "1.0.34234-27aa9735",- "executor": "docker"- }- },- "resource_class": {- "cpu": 2,- "ram": 4096,- "class": "medium",- "name": "Docker Medium"- },- "executor": "docker"- },- "circle_yml": {},- "messages": [],- "is_first_green_build": false,- "job_name": null,- "start_time": "2020-06-12T13:26:25.583Z",- "canceler": {- "avatar_url": "https://avatars3.githubusercontent.com/u/29123352?v=4",- "external_id": 29123352,- "id": 29123352,- "name": "Hemanth V. Alluri",- "user?": true,- "domain": "github.com",- "type": "github",- "authorized?": true,- "provider_id": "bcc68be8-ef10-4dd6-9b76-34f19e0db930",- "login": "Hypro999"- },- "all_commit_details": [- {- "committer_date": "2020-06-12T13:21:07.000Z",- "body": "",- "branch": "circleci",- "author_date": "2020-06-12T13:21:07.000Z",- "committer_email": "[email protected]",- "commit": "b0d6197fb4cacaf917adca77f77354882ee80621",- "committer_login": "Hypro999",- "committer_name": "Hemanth V. Alluri",- "subject": "circleci: Add temp untested progress to fixtures for failure.",- "commit_url": "https://github.com/Hypro999/zulip/commit/b0d6197fb4cacaf917adca77f77354882ee80621",- "author_login": "Hypro999",- "author_name": "Hemanth V. Alluri",- "author_email": "[email protected]"- }- ],- "platform": "2.0",- "outcome": "canceled",- "vcs_url": "https://github.com/Hypro999/zulip",- "author_name": "Hemanth V. Alluri",- "node": null,- "queued_at": "2020-06-12T13:26:22.775Z",- "canceled": true,- "author_email": "[email protected]"- }-}diff --git a/zerver/webhooks/circleci/fixtures/github_job_completed.json b/zerver/webhooks/circleci/fixtures/github_job_completed.jsonnew file mode 100644index 00000000000..219330cb0b1--- /dev/null+++ b/zerver/webhooks/circleci/fixtures/github_job_completed.json@@ -0,0 +1,62 @@+{+ "happened_at": "2022-09-20T12:54:38.685719Z",+ "pipeline": {+ "id": "877c620f-900a-455b-ad51-1a772b5a3eab",+ "number": 4,+ "created_at": "2022-09-20T12:48:46.741Z",+ "trigger": {+ "type": "webhook"+ },+ "vcs": {+ "provider_name": "github",+ "origin_repository_url": "https://github.com/zulip-testing/circleci-webhook-test",+ "target_repository_url": "https://github.com/zulip-testing/circleci-webhook-test",+ "revision": "a5e30a908224e46626a796d058289475f6d387b5",+ "commit": {+ "subject": ".circleci: Update Webhook URL.",+ "body": "",+ "author": {+ "name": "Hari Prashant Bhimaraju",+ "email": "[email protected]"+ },+ "authored_at": "2022-09-20T12:48:34Z",+ "committer": {+ "name": "Hari Prashant Bhimaraju",+ "email": "[email protected]"+ },+ "committed_at": "2022-09-20T12:48:34Z"+ },+ "branch": "main"+ }+ },+ "webhook": {+ "id": "20d1ec27-1d95-43df-9f92-cadcff3eb6a1",+ "name": "Webhook Site"+ },+ "type": "job-completed",+ "organization": {+ "id": "b4567a7d-7c4e-446b-82b7-a1e798c1afcf",+ "name": "zulip-testing"+ },+ "workflow": {+ "id": "7381218b-d04c-4aa3-b8b8-8c00a9319d1f",+ "name": "sample",+ "created_at": "2022-09-20T12:54:26.737Z",+ "stopped_at": "2022-09-20T12:54:38.599Z",+ "url": "https://app.circleci.com/pipelines/github/zulip-testing/circleci-webhook-test/4/workflows/7381218b-d04c-4aa3-b8b8-8c00a9319d1f"+ },+ "project": {+ "id": "c4fa043c-d2ba-4d97-a6ca-2745b3518114",+ "name": "circleci-webhook-test",+ "slug": "github/zulip-testing/circleci-webhook-test"+ },+ "id": "e7346c18-44cb-331d-9d45-698a38edb2e0",+ "job": {+ "id": "bc772f25-9fd4-49f3-a3b8-d5a0cb5a2ab6",+ "name": "build-and-test",+ "started_at": "2022-09-20T12:54:28.900Z",+ "stopped_at": "2022-09-20T12:54:38.599Z",+ "status": "success",+ "number": 6+ }+ }diff --git a/zerver/webhooks/circleci/fixtures/github_tag_workflow_completed.json b/zerver/webhooks/circleci/fixtures/github_tag_workflow_completed.jsonnew file mode 100644index 00000000000..ed8e208ca88--- /dev/null+++ b/zerver/webhooks/circleci/fixtures/github_tag_workflow_completed.json@@ -0,0 +1,55 @@+{+ "type": "workflow-completed",+ "id": "f2fa57fa-fc6f-3ecc-a84f-5d983f150a9f",+ "happened_at": "2022-11-08T11:13:21.949388Z",+ "webhook": {+ "id": "20d1ec27-1d95-43df-9f92-cadcff3eb6a1",+ "name": "Webhook Site"+ },+ "workflow": {+ "id": "045c6271-78e2-4802-8a62-f4fa6d25d0c9",+ "name": "sample",+ "created_at": "2022-11-08T11:13:02.522Z",+ "stopped_at": "2022-11-08T11:13:21.855Z",+ "url": "https://app.circleci.com/pipelines/github/prah23/circleci-webhook-test/20/workflows/045c6271-78e2-4802-8a62-f4fa6d25d0c9",+ "status": "success"+ },+ "pipeline": {+ "id": "0659423a-fc7f-4b86-9986-33e321b30b25",+ "number": 20,+ "created_at": "2022-11-08T11:13:02.383Z",+ "trigger": {+ "type": "webhook"+ },+ "vcs": {+ "provider_name": "github",+ "origin_repository_url": "https://github.com/prah23/circleci-webhook-test",+ "target_repository_url": "https://github.com/prah23/circleci-webhook-test",+ "revision": "0e6e66c14e61fbcd95db716b0f30d67dbcce7814",+ "commit": {+ "subject": null,+ "body": null,+ "author": {+ "name": null,+ "email": null+ },+ "authored_at": null,+ "committer": {+ "name": null,+ "email": null+ },+ "committed_at": null+ },+ "branch": null+ }+ },+ "project": {+ "id": "c4fa043c-d2ba-4d97-a6ca-2745b3518114",+ "name": "circleci-webhook-test",+ "slug": "github/prah23/circleci-webhook-test"+ },+ "organization": {+ "id": "b4567a7d-7c4e-446b-82b7-a1e798c1afcf",+ "name": "prah23"+ }+}diff --git a/zerver/webhooks/circleci/fixtures/github_workflow_completed.json b/zerver/webhooks/circleci/fixtures/github_workflow_completed.jsonnew file mode 100644index 00000000000..8436e26d2cc--- /dev/null+++ b/zerver/webhooks/circleci/fixtures/github_workflow_completed.json@@ -0,0 +1,55 @@+{+ "type": "workflow-completed",+ "id": "630a6132-5bf1-3600-b26d-a020d41358f9",+ "happened_at": "2022-09-20T12:54:38.733348Z",+ "webhook": {+ "id": "20d1ec27-1d95-43df-9f92-cadcff3eb6a1",+ "name": "Webhook Site"+ },+ "workflow": {+ "id": "7381218b-d04c-4aa3-b8b8-8c00a9319d1f",+ "name": "sample",+ "created_at": "2022-09-20T12:54:26.737Z",+ "stopped_at": "2022-09-20T12:54:38.599Z",+ "url": "https://app.circleci.com/pipelines/github/zulip-testing/circleci-webhook-test/4/workflows/7381218b-d04c-4aa3-b8b8-8c00a9319d1f",+ "status": "success"+ },+ "pipeline": {+ "id": "877c620f-900a-455b-ad51-1a772b5a3eab",+ "number": 4,+ "created_at": "2022-09-20T12:48:46.741Z",+ "trigger": {+ "type": "webhook"+ },+ "vcs": {+ "provider_name": "github",+ "origin_repository_url": "https://github.com/zulip-testing/circleci-webhook-test",+ "target_repository_url": "https://github.com/zulip-testing/circleci-webhook-test",+ "revision": "a5e30a908224e46626a796d058289475f6d387b5",+ "commit": {+ "subject": ".circleci: Update Webhook URL.",+ "body": "",+ "author": {+ "name": "Hari Prashant Bhimaraju",+ "email": "[email protected]"+ },+ "authored_at": "2022-09-20T12:48:34Z",+ "committer": {+ "name": "Hari Prashant Bhimaraju",+ "email": "[email protected]"+ },+ "committed_at": "2022-09-20T12:48:34Z"+ },+ "branch": "main"+ }+ },+ "project": {+ "id": "c4fa043c-d2ba-4d97-a6ca-2745b3518114",+ "name": "circleci-webhook-test",+ "slug": "github/zulip-testing/circleci-webhook-test"+ },+ "organization": {+ "id": "b4567a7d-7c4e-446b-82b7-a1e798c1afcf",+ "name": "zulip-testing"+ }+ }diff --git a/zerver/webhooks/circleci/fixtures/gitlab_job_completed.json b/zerver/webhooks/circleci/fixtures/gitlab_job_completed.jsonnew file mode 100644index 00000000000..3d9c1322a52--- /dev/null+++ b/zerver/webhooks/circleci/fixtures/gitlab_job_completed.json@@ -0,0 +1,83 @@+{+ "happened_at": "2022-09-30T21:03:15.074581Z",+ "pipeline": {+ "id": "18448206-98fd-4ed2-abef-896da41340c0",+ "number": 3,+ "created_at": "2022-09-30T21:03:00.809Z",+ "trigger": {+ "type": "gitlab"+ },+ "trigger_parameters": {+ "gitlab": {+ "web_url": "https://gitlab.com/zulip-testing/circleci-webhook-test",+ "x_gitlab_event_id": "",+ "commit_author_name": "Hari Prashant Bhimaraju",+ "user_id": "12677834",+ "user_name": "Hari Prashant Bhimaraju",+ "user_username": "hariprashant1",+ "branch": "main",+ "commit_title": "app: Enhance message within hello().",+ "tag": "",+ "commit_message": "app: Enhance message within hello().",+ "total_commits_count": "1",+ "repo_url": "[email protected]:zulip-testing/circleci-webhook-test.git",+ "user_avatar": "https://secure.gravatar.com/avatar/8527d1b08a499c8e274790c6b4575d24?s=80&d=identicon",+ "type": "push",+ "project_id": "39861975",+ "ref": "refs/heads/main",+ "repo_name": "circleci-webhook-test",+ "commit_author_email": "[email protected]",+ "checkout_sha": "c31f86994c54672f97b5bd5e544315b7bd40e4c1",+ "commit_timestamp": "2022-09-30T21:02:59+00:00",+ "default_branch": "",+ "commit_sha": "c31f86994c54672f97b5bd5e544315b7bd40e4c1",+ "is_fork_merge_request": false+ },+ "circleci": {+ "config_source_id": "f31f5e00-2d0c-412f-b246-57a0a2317671",+ "event_time": "2022-09-30T21:03:00.278Z",+ "actor_id": "1836b5d5-24a6-43f9-9618-21a2d876bbd2",+ "trigger_id": "7eba7e4c-62e4-48ab-9ab3-252f15ea167d",+ "event_type": "push",+ "trigger_type": "gitlab"+ },+ "git": {+ "tag": "",+ "checkout_sha": "c31f86994c54672f97b5bd5e544315b7bd40e4c1",+ "ref": "refs/heads/main",+ "branch": "main",+ "checkout_url": "[email protected]:zulip-testing/circleci-webhook-test.git"+ }+ }+ },+ "webhook": {+ "id": "e6bf8ebb-fc5e-490b-9460-46c464d4f9db",+ "name": "Webhook (Site)"+ },+ "type": "job-completed",+ "organization": {+ "id": "39f0325f-b957-4b73-bdf5-05eb3d76699f",+ "name": "zulip-testing"+ },+ "workflow": {+ "id": "b23ceb64-127a-4075-a27c-d204a7a0a3b3",+ "name": "sample",+ "created_at": "2022-09-30T21:03:00.929Z",+ "stopped_at": "2022-09-30T21:03:15.017Z",+ "url": "https://app.circleci.com/pipelines/circleci/89xcrx7UvWQfzcUPAEmu5Q/63AY3yf3XeUQojmQcGZTtB/3/workflows/b23ceb64-127a-4075-a27c-d204a7a0a3b3"+ },+ "project": {+ "id": "28cb0ea5-e88c-43e0-a052-ed0294f0b6d0",+ "name": "circleci-webhook-test",+ "slug": "circleci/89xcrx7UvWQfzcUPAEmu5Q/63AY3yf3XeUQojmQcGZTtB"+ },+ "id": "b17b2fea-ca08-3f0c-b0a1-e60547af1305",+ "job": {+ "id": "fa6d0b0f-473d-40ea-b1ed-da1e89298f47",+ "name": "build-and-test",+ "started_at": "2022-09-30T21:03:03.359Z",+ "stopped_at": "2022-09-30T21:03:15.017Z",+ "status": "success",+ "number": 2+ }+}diff --git a/zerver/webhooks/circleci/fixtures/gitlab_workflow_completed.json b/zerver/webhooks/circleci/fixtures/gitlab_workflow_completed.jsonnew file mode 100644index 00000000000..14026c9a880--- /dev/null+++ b/zerver/webhooks/circleci/fixtures/gitlab_workflow_completed.json@@ -0,0 +1,76 @@+{+ "type": "workflow-completed",+ "id": "02ca6868-629c-3f34-b574-6f2d506357f8",+ "happened_at": "2022-09-30T21:03:15.110144Z",+ "webhook": {+ "id": "e6bf8ebb-fc5e-490b-9460-46c464d4f9db",+ "name": "Webhook (Site)"+ },+ "workflow": {+ "id": "b23ceb64-127a-4075-a27c-d204a7a0a3b3",+ "name": "sample",+ "created_at": "2022-09-30T21:03:00.929Z",+ "stopped_at": "2022-09-30T21:03:15.017Z",+ "url": "https://app.circleci.com/pipelines/circleci/89xcrx7UvWQfzcUPAEmu5Q/63AY3yf3XeUQojmQcGZTtB/3/workflows/b23ceb64-127a-4075-a27c-d204a7a0a3b3",+ "status": "success"+ },+ "pipeline": {+ "id": "18448206-98fd-4ed2-abef-896da41340c0",+ "number": 3,+ "created_at": "2022-09-30T21:03:00.809Z",+ "trigger": {+ "type": "gitlab"+ },+ "trigger_parameters": {+ "gitlab": {+ "web_url": "https://gitlab.com/zulip-testing/circleci-webhook-test",+ "x_gitlab_event_id": "",+ "commit_author_name": "Hari Prashant Bhimaraju",+ "user_id": "12677834",+ "user_name": "Hari Prashant Bhimaraju",+ "user_username": "hariprashant1",+ "branch": "main",+ "commit_title": "app: Enhance message within hello().",+ "tag": "",+ "commit_message": "app: Enhance message within hello().",+ "total_commits_count": "1",+ "repo_url": "[email protected]:zulip-testing/circleci-webhook-test.git",+ "user_avatar": "https://secure.gravatar.com/avatar/8527d1b08a499c8e274790c6b4575d24?s=80&d=identicon",+ "type": "push",+ "project_id": "39861975",+ "ref": "refs/heads/main",+ "repo_name": "circleci-webhook-test",+ "commit_author_email": "[email protected]",+ "checkout_sha": "c31f86994c54672f97b5bd5e544315b7bd40e4c1",+ "commit_timestamp": "2022-09-30T21:02:59+00:00",+ "default_branch": "",+ "commit_sha": "c31f86994c54672f97b5bd5e544315b7bd40e4c1",+ "is_fork_merge_request": false+ },+ "circleci": {+ "config_source_id": "f31f5e00-2d0c-412f-b246-57a0a2317671",+ "event_time": "2022-09-30T21:03:00.278Z",+ "actor_id": "1836b5d5-24a6-43f9-9618-21a2d876bbd2",+ "trigger_id": "7eba7e4c-62e4-48ab-9ab3-252f15ea167d",+ "event_type": "push",+ "trigger_type": "gitlab"+ },+ "git": {+ "tag": "",+ "checkout_sha": "c31f86994c54672f97b5bd5e544315b7bd40e4c1",+ "ref": "refs/heads/main",+ "branch": "main",+ "checkout_url": "[email protected]:zulip-testing/circleci-webhook-test.git"+ }+ }+ },+ "project": {+ "id": "28cb0ea5-e88c-43e0-a052-ed0294f0b6d0",+ "name": "circleci-webhook-test",+ "slug": "circleci/89xcrx7UvWQfzcUPAEmu5Q/63AY3yf3XeUQojmQcGZTtB"+ },+ "organization": {+ "id": "39f0325f-b957-4b73-bdf5-05eb3d76699f",+ "name": "zulip-testing"+ }+}diff --git a/zerver/webhooks/circleci/fixtures/super_minimal_payload.json b/zerver/webhooks/circleci/fixtures/super_minimal_payload.jsondeleted file mode 100644index b64b6c63882..00000000000--- a/zerver/webhooks/circleci/fixtures/super_minimal_payload.json+++ /dev/null@@ -1,9 +0,0 @@-{- "payload": {- "branch": "master",- "reponame": "zulip",- "status": "failed",- "build_url": "https:\/\/circleci.com\/gh\/zulip\/zulip\/48056",- "username": "timabbott"- }-}diff --git a/zerver/webhooks/circleci/tests.py b/zerver/webhooks/circleci/tests.pyindex 6cf8212dcd6..f424367cee4 100644--- a/zerver/webhooks/circleci/tests.py+++ b/zerver/webhooks/circleci/tests.py@@ -6,60 +6,74 @@ class CircleCiHookTests(WebhookTestCase):URL_TEMPLATE = "/api/v1/external/circleci?stream={stream}&api_key={api_key}"WEBHOOK_DIR_NAME = "circleci"- def test_private_repo_with_pull_request_off_bitbucket(self) -> None:- expected_topic = "circleci-test"+ def test_bitbucket_job_completed(self) -> None:+ expected_topic = "circleci-webhook-testing"expected_message = """-Build [#5](https://circleci.com/bb/Hypro999/circleci-test/5) of `build`/`workflow` on branch `unstable` has failed.-- **Commits (3):** [6b5361c1661](https://bitbucket.org/Hypro999/circleci-test/commits/6b5361c1661581d975e84b68904ae9bfba75d5e5) ... [eaa88f9eac0](https://bitbucket.org/Hypro999/circleci-test/commits/eaa88f9eac0fad86c46a8fe35462fe2c904d84b1)-- **Pull request:** https://bitbucket.org/Hypro999/circleci-test/pull-requests/1-- **Author:** Hemanth V. Alluri+Job `build-and-test` within Pipeline #4 has succeeded.++Triggered on [`8ab595d2de9: app.py edited online with Bitbucket`](https://bitbucket.org/hariprashant1/circleci-webhook-testing/commits/8ab595d2de95767993472837df2cb7884519a92b) on branch `master` by Hari Prashant Bhimaraju.+""".strip()+ self.check_webhook("bitbucket_job_completed", expected_topic, expected_message)++ def test_bitbucket_manual_workflow_completed(self) -> None:+ expected_topic = "circleci-webhook-testing"+ expected_message = """+Workflow [`sample`](https://app.circleci.com/pipelines/bitbucket/hariprashant1/circleci-webhook-testing/2/workflows/baa45986-84db-47a0-bc6c-89e9fe751bc9) within Pipeline #2 has succeeded.++Triggered on `master`'s HEAD on [cab5eacb4cc](https://bitbucket.org/hariprashant1/circleci-webhook-testing/commits/cab5eacb4ccee2710529894425341fa20a48fe6a).+""".strip()+ self.check_webhook("bitbucket_manual_workflow_completed", expected_topic, expected_message)++ def test_bitbucket_workflow_completed(self) -> None:+ expected_topic = "circleci-webhook-testing"+ expected_message = """+Workflow [`sample`](https://app.circleci.com/pipelines/bitbucket/hariprashant1/circleci-webhook-testing/4/workflows/fd29ef0c-3e39-4c8f-b1d5-d8be1bab8165) within Pipeline #4 has succeeded.++Triggered on [`8ab595d2de9: app.py edited online with Bitbucket`](https://bitbucket.org/hariprashant1/circleci-webhook-testing/commits/8ab595d2de95767993472837df2cb7884519a92b) on branch `master` by Hari Prashant Bhimaraju.""".strip()- self.check_webhook(- "bitbucket_private_repo_pull_request_failure", expected_topic, expected_message- )+ self.check_webhook("bitbucket_workflow_completed", expected_topic, expected_message)- def test_for_failed_build_off_github(self) -> None:- expected_topic = "zulip"+ def test_github_job_completed(self) -> None:+ expected_topic = "circleci-webhook-test"expected_message = """-Build [#1429](https://circleci.com/gh/Hypro999/zulip/1429) of `bionic-backend-frontend`/`Ubuntu 18.04 Bionic (Python 3.6, backend+frontend)` on branch `circleci` has failed.-- **Commits (2):** [73900eeb69a ... 5326f9ea408](https://github.com/Hypro999/zulip/compare/73900eeb69adbf0b83dc487e8eda90661b524eff...5326f9ea4084a01cc2bf1a461b9ad819b4ffdd14)+Job `build-and-test` within Pipeline #4 has succeeded.-- **Author:** Hemanth V. Alluri (Hypro999)-- **Committer:** Hemanth V. Alluri (Hypro999)+Triggered on [`a5e30a90822: .circleci: Update Webhook URL.`](https://github.com/zulip-testing/circleci-webhook-test/commit/a5e30a908224e46626a796d058289475f6d387b5) on branch `main` by Hari Prashant Bhimaraju.""".strip()- self.check_webhook(- "github_bionic_backend_frontend_failure", expected_topic, expected_message- )+ self.check_webhook("github_job_completed", expected_topic, expected_message)- def test_for_success_build_off_github_with_multiple_parties(self) -> None:- expected_topic = "zulip"+ def test_github_tag_workflow_completed(self) -> None:+ expected_topic = "circleci-webhook-test"expected_message = """-Build [#1431](https://circleci.com/gh/Hypro999/zulip/1431) of `bionic-production-build`/`Production` on branch `circleci` has succeeded.-- **Commits (2):** [73900eeb69a ... 5326f9ea408](https://github.com/Hypro999/zulip/compare/73900eeb69adbf0b83dc487e8eda90661b524eff...5326f9ea4084a01cc2bf1a461b9ad819b4ffdd14)+Workflow [`sample`](https://app.circleci.com/pipelines/github/prah23/circleci-webhook-test/20/workflows/045c6271-78e2-4802-8a62-f4fa6d25d0c9) within Pipeline #20 has succeeded.-- **Authors:** Gintoki Sakata (ShiroYasha999), Hemanth V. Alluri (Hypro999)-- **Committers:** Hemanth V. Alluri (Hypro999), Sadaharu+Triggered on the latest tag on [0e6e66c14e6](https://github.com/prah23/circleci-webhook-test/commit/0e6e66c14e61fbcd95db716b0f30d67dbcce7814).""".strip()- self.check_webhook(- "github_bionic_production_build_success_multiple_parties",- expected_topic,- expected_message,- )-- def test_for_cancelled_build_off_github(self) -> None:- expected_topic = "zulip"+ self.check_webhook("github_tag_workflow_completed", expected_topic, expected_message)++ def test_github_workflow_completed(self) -> None:+ expected_topic = "circleci-webhook-test"+ expected_message = """+Workflow [`sample`](https://app.circleci.com/pipelines/github/zulip-testing/circleci-webhook-test/4/workflows/7381218b-d04c-4aa3-b8b8-8c00a9319d1f) within Pipeline #4 has succeeded.++Triggered on [`a5e30a90822: .circleci: Update Webhook URL.`](https://github.com/zulip-testing/circleci-webhook-test/commit/a5e30a908224e46626a796d058289475f6d387b5) on branch `main` by Hari Prashant Bhimaraju.+""".strip()+ self.check_webhook("github_workflow_completed", expected_topic, expected_message)++ def test_gitlab_job_completed(self) -> None:+ expected_topic = "circleci-webhook-test"+ expected_message = """+Job `build-and-test` within Pipeline #3 has succeeded.++Triggered on [`c31f86994c5: app: Enhance message within hello().`](https://gitlab.com/zulip-testing/circleci-webhook-test/-/commit/c31f86994c54672f97b5bd5e544315b7bd40e4c1) on branch `main` by Hari Prashant Bhimaraju.+""".strip()+ self.check_webhook("gitlab_job_completed", expected_topic, expected_message)++ def test_gitlab_workflow_completed(self) -> None:+ expected_topic = "circleci-webhook-test"expected_message = """-Build [#1420](https://circleci.com/gh/Hypro999/zulip/1420) of `bionic-production-install`/`Production` on branch `circleci` was canceled.-- **Commit:** [b0d6197fb4c](https://github.com/Hypro999/zulip/commit/b0d6197fb4cacaf917adca77f77354882ee80621)+Workflow [`sample`](https://app.circleci.com/pipelines/circleci/89xcrx7UvWQfzcUPAEmu5Q/63AY3yf3XeUQojmQcGZTtB/3/workflows/b23ceb64-127a-4075-a27c-d204a7a0a3b3) within Pipeline #3 has succeeded.-- **Author:** Hemanth V. Alluri (Hypro999)-- **Committer:** Hemanth V. Alluri (Hypro999)+Triggered on [`c31f86994c5: app: Enhance message within hello().`](https://gitlab.com/zulip-testing/circleci-webhook-test/-/commit/c31f86994c54672f97b5bd5e544315b7bd40e4c1) on branch `main` by Hari Prashant Bhimaraju.""".strip()- self.check_webhook(- "github_bionic_production_install_cancelled", expected_topic, expected_message- )-- def test_super_minimal_payload(self) -> None:- expected_topic = "zulip"- expected_message = "[Build](https://circleci.com/gh/zulip/zulip/48056) triggered by timabbott on branch `master` has failed."- self.check_webhook("super_minimal_payload", expected_topic, expected_message)+ self.check_webhook("gitlab_workflow_completed", expected_topic, expected_message)diff --git a/zerver/webhooks/circleci/view.py b/zerver/webhooks/circleci/view.pyindex e82121047bb..093a4f4f131 100644--- a/zerver/webhooks/circleci/view.py+++ b/zerver/webhooks/circleci/view.py@@ -1,9 +1,19 @@from django.http import HttpRequest, HttpResponse+from django.utils.translation import gettext as _from zerver.decorator import webhook_view+from zerver.lib.exceptions import JsonableErrorfrom zerver.lib.request import REQ, has_request_variablesfrom zerver.lib.response import json_success-from zerver.lib.validator import WildValue, check_int, check_none_or, check_string, to_wild_value+from zerver.lib.validator import (+ WildValue,+ check_int,+ check_none_or,+ check_string,+ check_string_in,+ check_url,+ to_wild_value,+)from zerver.lib.webhooks.common import check_send_webhook_messagefrom zerver.lib.webhooks.git import get_short_shafrom zerver.models import UserProfile@@ -12,9 +22,39 @@ outcome_to_formatted_status_map = {"success": "has succeeded","failed": "has failed","canceled": "was canceled",+ "unauthorized": "was unauthorized",+ "error": "had an error",}-ALL_EVENT_TYPES = list(outcome_to_formatted_status_map.keys())+GITHUB_COMMIT_LINK = "{target_repository_url}/commit/{commit_sha}"++BITBUCKET_COMMIT_LINK = "{target_repository_url}/commits/{commit_sha}"++GITLAB_COMMIT_LINK = "{web_url}/-/commit/{commit_sha}"++FULL_COMMIT_INFO_TEMPLATE = """+Triggered on [`{commit_details}`]({commit_link}) on branch `{branch_name}` by {author_name}.+"""++MANUAL_TRIGGER_INFO_TEMPLATE = """+Triggered on `{branch_name}`'s HEAD on [{commit_sha}]({commit_link}).+"""++TAG_TRIGGER_INFO_TEMPLATE = """+Triggered on the latest tag on [{commit_sha}]({commit_link}).+"""++WORKFLOW_BODY_TEMPLATE = """+Workflow [`{workflow_name}`]({workflow_url}) within Pipeline #{pipeline_number} {formatted_status}.+{commit_details}+"""++JOB_BODY_TEMPLATE = """+Job `{job_name}` within Pipeline #{pipeline_number} {formatted_status}.+{commit_details}+"""++ALL_EVENT_TYPES = ["job-completed", "workflow-completed"]@webhook_view("CircleCI", all_event_types=ALL_EVENT_TYPES)@@ -24,133 +64,123 @@ def api_circleci_webhook(user_profile: UserProfile,payload: WildValue = REQ(argument_type="body", converter=to_wild_value),) -> HttpResponse:- payload = payload["payload"]subject = get_subject(payload)body = get_body(payload)+ pipeline = payload["pipeline"]++ # We currently don't support projects using VCS providers other than GitHub,+ # BitBucket and GitLab.+ if "trigger_parameters" in pipeline and pipeline["trigger"]["type"] != "gitlab":+ raise JsonableError(+ _("Projects using this version control system provider aren't supported")+ ) # nocoverage+check_send_webhook_message(request,user_profile,subject,body,- payload["status"].tame(check_string)- if "build_num" not in payload- else payload["outcome"].tame(check_string),+ payload["type"].tame(check_string),)return json_success(request)def get_subject(payload: WildValue) -> str:- return payload["reponame"].tame(check_string)---def get_commit_range_info(payload: WildValue) -> str:- commits = payload["all_commit_details"]- num_commits = len(commits)-- if num_commits == 1:- commit_id = get_short_sha(commits[0]["commit"].tame(check_string))- commit_url = commits[0]["commit_url"].tame(check_string)- return f"- **Commit:** [{commit_id}]({commit_url})"-- vcs_provider = payload["user"]["vcs_type"].tame(check_string) # Same as payload["why"]?- first_commit_id = commits[0]["commit"].tame(check_string)- shortened_first_commit_id = get_short_sha(first_commit_id)- last_commit_id = commits[-1]["commit"].tame(check_string)- shortened_last_commit_id = get_short_sha(last_commit_id)- if vcs_provider == "github":- # Then use GitHub's commit range feature to form the appropriate url.- vcs_url = payload["vcs_url"].tame(check_string)- commit_range_url = f"{vcs_url}/compare/{first_commit_id}...{last_commit_id}"- return f"- **Commits ({num_commits}):** [{shortened_first_commit_id} ... {shortened_last_commit_id}]({commit_range_url})"- else:- # Bitbucket doesn't have a good commit range URL feature like GitHub does.- # So let's just show the two separately.- # https://community.atlassian.com/t5/Bitbucket-questions/BitBucket-4-14-diff-between-any-two-commits/qaq-p/632974- first_commit_url = commits[0]["commit_url"].tame(check_string)- last_commit_url = commits[-1]["commit_url"].tame(check_string)- return f"- **Commits ({num_commits}):** [{shortened_first_commit_id}]({first_commit_url}) ... [{shortened_last_commit_id}]({last_commit_url})"---def get_authors_and_committer_info(payload: WildValue) -> str:- body = ""-- author_names = set()- committer_names = set()- for commit in payload["all_commit_details"]:- author_name = commit["author_name"].tame(check_string)- author_username = commit["author_login"].tame(check_none_or(check_string))- if author_username is not None:- author_names.add(f"{author_name} ({author_username})")- else:- author_names.add(author_name)-- if commit["committer_email"].tame(check_none_or(check_string)) is not None:- committer_name = commit["committer_name"].tame(check_string)- committer_username = commit["committer_login"].tame(check_none_or(check_string))- if committer_username is not None:- committer_names.add(f"{committer_name} ({committer_username})")- else:- committer_names.add(committer_name)-- author_names_list = list(author_names)- author_names_list.sort()- committer_names_list = list(committer_names)- committer_names_list.sort()- authors = ", ".join(author_names_list)- committers = ", ".join(committer_names_list)-- # Add the authors' information to the body.- if len(author_names_list) > 1:- body += f"- **Authors:** {authors}"- else:- body += f"- **Author:** {authors}"-- # Add information about the committers if it was provided.- if len(committer_names) > 0:- if len(committer_names) > 1:- body += f"\n- **Committers:** {committers}"- else:- body += f"\n- **Committer:** {committers}"+ return payload["project"]["name"].tame(check_string)- return body+def get_commit_details(payload: WildValue) -> str:+ if "vcs" in payload["pipeline"]: # GitHub and BitBucket associated pipelines.+ revision = payload["pipeline"]["vcs"]["revision"].tame(check_string)+ commit_id = get_short_sha(revision)-def super_minimal_body(payload: WildValue) -> str:- branch_name = payload["branch"].tame(check_string)- status = payload["status"].tame(check_string)- formatted_status = outcome_to_formatted_status_map.get(status, status)- build_url = payload["build_url"].tame(check_string)- username = payload["username"].tame(check_string)- return f"[Build]({build_url}) triggered by {username} on branch `{branch_name}` {formatted_status}."+ if payload["pipeline"]["vcs"]["provider_name"] == "github":+ commit_link = GITHUB_COMMIT_LINK.format(+ target_repository_url=payload["pipeline"]["vcs"]["target_repository_url"].tame(+ check_url+ ),+ commit_sha=revision,+ )+ else:+ commit_link = BITBUCKET_COMMIT_LINK.format(+ target_repository_url=payload["pipeline"]["vcs"]["target_repository_url"].tame(+ check_url+ ),+ commit_sha=revision,+ )++ branch = payload["pipeline"]["vcs"]["branch"].tame(check_none_or(check_string))+ commit_subject = payload["pipeline"]["vcs"]["commit"]["subject"].tame(+ check_none_or(check_string)+ )+ if not commit_subject:+ # Manually triggered pipelines (possible only for GitHub and BitBucket projects currently).+ if not branch:+ return TAG_TRIGGER_INFO_TEMPLATE.format(+ commit_sha=commit_id, commit_link=commit_link+ )+ return MANUAL_TRIGGER_INFO_TEMPLATE.format(+ branch_name=branch, commit_sha=commit_id, commit_link=commit_link+ )++ commit_details = f"{commit_id}: {commit_subject}"+ author_name = payload["pipeline"]["vcs"]["commit"]["author"]["name"].tame(check_string)++ else: # Other providers (GitLab).+ commit_title = payload["pipeline"]["trigger_parameters"]["gitlab"]["commit_title"].tame(+ check_string+ )+ checkout_sha = payload["pipeline"]["trigger_parameters"]["gitlab"]["checkout_sha"].tame(+ check_string+ )+ commit_id = get_short_sha(checkout_sha)+ commit_details = f"{commit_id}: {commit_title}"++ author_name = payload["pipeline"]["trigger_parameters"]["gitlab"][+ "commit_author_name"+ ].tame(check_string)++ commit_link = GITLAB_COMMIT_LINK.format(+ web_url=payload["pipeline"]["trigger_parameters"]["gitlab"]["web_url"].tame(check_url),+ commit_sha=checkout_sha,+ )++ branch = payload["pipeline"]["trigger_parameters"]["gitlab"]["branch"].tame(check_string)++ return FULL_COMMIT_INFO_TEMPLATE.format(+ commit_details=commit_details,+ commit_link=commit_link,+ author_name=author_name,+ branch_name=branch,+ )def get_body(payload: WildValue) -> str:- if "build_num" not in payload:- return super_minimal_body(payload)-- build_num = payload["build_num"].tame(check_int)- build_url = payload["build_url"].tame(check_string)-- outcome = payload["outcome"].tame(check_string)- formatted_status = outcome_to_formatted_status_map.get(outcome, outcome)-- branch_name = payload["branch"].tame(check_string)- workflow_name = payload["workflows"]["workflow_name"].tame(check_string)- job_name = payload["workflows"]["job_name"].tame(check_string)-- commit_range_info = get_commit_range_info(payload)- pull_request_info = ""- if len(payload["pull_requests"]) > 0:- pull_request_url = payload["pull_requests"][0]["url"].tame(check_string)- pull_request_info = f"- **Pull request:** {pull_request_url}"- authors_and_committers_info = get_authors_and_committer_info(payload)-- body = f"""-Build [#{build_num}]({build_url}) of `{job_name}`/`{workflow_name}` on branch `{branch_name}` {formatted_status}.-{commit_range_info}-{pull_request_info}-{authors_and_committers_info}-""".strip()-- return body+ pipeline_number = payload["pipeline"]["number"].tame(check_int)+ commit_details = get_commit_details(payload)+ payload_type = payload["type"].tame(check_string_in(["job-completed", "workflow-completed"]))++ if payload_type == "job-completed":+ job_name = payload["job"]["name"].tame(check_string)+ status = payload["job"]["status"].tame(check_string)+ formatted_status = outcome_to_formatted_status_map.get(status)+ return JOB_BODY_TEMPLATE.format(+ job_name=job_name,+ pipeline_number=pipeline_number,+ formatted_status=formatted_status,+ commit_details=commit_details,+ )++ else:+ workflow_name = payload["workflow"]["name"].tame(check_string)+ workflow_url = payload["workflow"]["url"].tame(check_url)+ status = payload["workflow"]["status"].tame(check_string)+ formatted_status = outcome_to_formatted_status_map.get(status)+ return WORKFLOW_BODY_TEMPLATE.format(+ workflow_name=workflow_name,+ workflow_url=workflow_url,+ pipeline_number=pipeline_number,+ formatted_status=formatted_status,+ commit_details=commit_details,+ )