Skip to content

Commit b992f7c

Browse files
Merge pull request #124 from uptick/dev-1077/update-deployment-status
DEV-1077 fix: remove status updater and replace with a post deploy hook
2 parents f465d9a + e72c2ad commit b992f7c

File tree

6 files changed

+5
-144
lines changed

6 files changed

+5
-144
lines changed

gitops_server/main.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
from gitops_server import settings
1515
from gitops_server.app import app
16-
from gitops_server.workers import DeploymentStatusWorker, DeployQueueWorker
16+
from gitops_server.workers import DeployQueueWorker
1717

1818
manually_instrument_logging()
1919
manually_instrument_fastapi()
@@ -64,9 +64,6 @@ async def startup_event():
6464
deploy_queue_worker = DeployQueueWorker.get_worker()
6565
deploy_queue_worker.task = asyncio.ensure_future(deploy_queue_worker.run(), loop=loop)
6666

67-
deployment_status_worker = DeploymentStatusWorker.get_worker()
68-
deployment_status_worker.task = asyncio.ensure_future(deployment_status_worker.run(), loop=loop)
69-
7067

7168
def get_digest(data: bytes) -> str:
7269
"""Calculate the digest of a webhook body.

gitops_server/workers/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
from .deployer import DeployQueueWorker # NOQA
2-
from .status_updater import DeploymentStatusWorker # NOQA

gitops_server/workers/deployer/hooks.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,13 @@ async def update_issue_from_deployment_url(app: App, deployment_url: str, **kwar
5050

5151
async def handle_successful_deploy(app: App, result, deployer, **kwargs) -> UpdateAppResult:
5252
github_deployment_url = str(app.values.get("github/deployment_url", ""))
53+
# I know this shouldn't be uptick specific but for now it is.
54+
environment_url = app.values.get("github/environment_url", "") or f"https://{app.name}.onuptick.com"
5355
await github.update_deployment(
5456
github_deployment_url,
55-
status=github.STATUSES.in_progress,
57+
status=github.STATUSES.success,
5658
description="Helm installed app into cluster. Waiting for pods to deploy.",
59+
environment_url=environment_url,
5760
)
5861
return result
5962

gitops_server/workers/status_updater/__init__.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

gitops_server/workers/status_updater/worker.py

Lines changed: 0 additions & 126 deletions
This file was deleted.

tests/test_gitops_server.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,3 @@ def test_webhook_returns_200_if_hmac_is_correct():
3131

3232
assert response.status_code == 200
3333
get_worker_mock.assert_called()
34-
35-
36-
@patch("gitops_server.main.settings.GITHUB_WEBHOOK_KEY", "test_key")
37-
def test_webhook_returns_400_if_hmac_is_invalid():
38-
sha_encoding = "INVALID HMAC ENCODING"
39-
headers["X-Hub-Signature"] = f"sha1={sha_encoding}"
40-
41-
with patch.object(gitops_server.workers.DeploymentStatusWorker, "get_worker", AsyncMock):
42-
response = client.post("/webhook", headers=headers, json=payload)
43-
44-
assert response.status_code == 400

0 commit comments

Comments
 (0)