gitops 0.12.1__tar.gz → 0.14.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gitops-0.14.0/.github/workflows/release-please.yaml +82 -0
- gitops-0.14.0/.github/workflows/test.yml +41 -0
- gitops-0.14.0/.release-please-manifest.json +5 -0
- gitops-0.14.0/CHANGELOG.md +89 -0
- {gitops-0.12.1 → gitops-0.14.0}/PKG-INFO +2 -2
- {gitops-0.12.1 → gitops-0.14.0}/charts/gitops/Chart.yaml +1 -1
- gitops-0.14.0/charts/gitops/charts/gitops/CHANGELOG.md +30 -0
- {gitops-0.12.1 → gitops-0.14.0}/charts/gitops/templates/deployment.yml +2 -7
- {gitops-0.12.1 → gitops-0.14.0}/charts/gitops/values.yaml +2 -1
- {gitops-0.12.1 → gitops-0.14.0}/gitops/__init__.py +1 -1
- {gitops-0.12.1 → gitops-0.14.0}/gitops/common/app.py +9 -6
- {gitops-0.12.1 → gitops-0.14.0}/gitops/core.py +1 -1
- {gitops-0.12.1 → gitops-0.14.0}/gitops/utils/images.py +1 -1
- gitops-0.14.0/gitops_server/__init__.py +0 -0
- gitops-0.14.0/gitops_server/gitops_server/CHANGELOG.md +55 -0
- gitops-0.14.0/gitops_server/settings.py +15 -0
- {gitops-0.12.1 → gitops-0.14.0}/gitops_server/utils/slack.py +31 -20
- {gitops-0.12.1 → gitops-0.14.0}/gitops_server/workers/deployer/deploy.py +71 -58
- {gitops-0.12.1 → gitops-0.14.0}/gitops_server/workers/deployer/hooks.py +31 -14
- {gitops-0.12.1 → gitops-0.14.0}/pyproject.toml +2 -1
- gitops-0.14.0/release-please-config.json +31 -0
- {gitops-0.12.1 → gitops-0.14.0}/ruff.toml +1 -3
- {gitops-0.12.1 → gitops-0.14.0}/secrets.example.env +1 -1
- gitops-0.14.0/tests/__init__.py +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/tests/test_deploy.py +3 -23
- {gitops-0.12.1 → gitops-0.14.0}/uv.lock +12 -1
- gitops-0.12.1/.github/workflows/publish.yml +0 -77
- gitops-0.12.1/.github/workflows/test.yml +0 -26
- gitops-0.12.1/gitops_server/settings.py +0 -7
- {gitops-0.12.1 → gitops-0.14.0}/.dockerignore +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/.gitignore +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/.mise.toml +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/.pre-commit-config.yaml +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/Dockerfile +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/LICENSE +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/README.md +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/charts/gitops/.helmignore +0 -0
- gitops-0.12.1/gitops/common/__init__.py → gitops-0.14.0/charts/gitops/CHANGELOG.md +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/charts/gitops/README.md +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/charts/gitops/templates/_helpers.tpl +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/charts/gitops/templates/certificate.yml +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/charts/gitops/templates/environment.yml +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/charts/gitops/templates/ingress.yml +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/charts/gitops/templates/issuer.yml +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/charts/gitops/templates/secrets.yml +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/charts/gitops/templates/service.yml +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/charts/gitops/templates/serviceaccount.yaml +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/docker-compose.yml +0 -0
- {gitops-0.12.1/gitops_server → gitops-0.14.0/gitops/common}/__init__.py +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/gitops/common/utils.py +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/gitops/main.py +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/gitops/py.typed +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/gitops/settings.py +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/gitops/shorthands.py +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/gitops/utils/__init__.py +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/gitops/utils/apps.py +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/gitops/utils/async_runner.py +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/gitops/utils/cli.py +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/gitops/utils/exceptions.py +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/gitops/utils/kube.py +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/gitops/utils/tags.py +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/gitops/utils/yaml.py +0 -0
- gitops-0.12.1/tests/__init__.py → gitops-0.14.0/gitops_server/CHANGELOG.md +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/gitops_server/README.md +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/gitops_server/app.py +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/gitops_server/main.py +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/gitops_server/types.py +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/gitops_server/utils/__init__.py +1 -1
- {gitops-0.12.1 → gitops-0.14.0}/gitops_server/utils/git.py +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/gitops_server/utils/github.py +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/gitops_server/workers/__init__.py +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/gitops_server/workers/deployer/__init__.py +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/gitops_server/workers/deployer/worker.py +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/gitops_server/workers/status_updater/__init__.py +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/gitops_server/workers/status_updater/worker.py +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/release.py +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/setup.cfg +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/tests/conftest.py +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/tests/sample_data.py +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/tests/test_app.py +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/tests/test_core.py +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/tests/test_git.py +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/tests/test_gitops_server.py +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/tests/test_utils.py +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/tests/utils.py +0 -0
- {gitops-0.12.1 → gitops-0.14.0}/tests/webhook_sample_data.py +0 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
name: Release Please
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches:
|
|
5
|
+
- develop
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
actions: read # Read the metrics
|
|
9
|
+
contents: write # to be able to publish a GitHub release
|
|
10
|
+
issues: write # to be able to comment on released issues
|
|
11
|
+
pull-requests: write # to be able to comment on released pull requests
|
|
12
|
+
id-token: write # to enable use of OIDC for npm provenance / AWS
|
|
13
|
+
|
|
14
|
+
env:
|
|
15
|
+
MISE_PYTHON_COMPILE: false
|
|
16
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
release-please:
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
outputs:
|
|
22
|
+
cli-release-created: ${{ steps.release.outputs['release_created'] }}
|
|
23
|
+
server-release-created: ${{ steps.release.outputs['gitops_server--release_created'] }}
|
|
24
|
+
helm-release-created: ${{ steps.release.outputs['charts/gitops--release_created'] }}
|
|
25
|
+
cli-version: ${{ steps.release.outputs['tag_name'] }}
|
|
26
|
+
server-version: ${{ steps.release.outputs['gitops_server--tag_name'] }}
|
|
27
|
+
helm-version: ${{ steps.release.outputs['charts/gitops--tag_name'] }}
|
|
28
|
+
sha: ${{ steps.release.outputs.sha }}
|
|
29
|
+
steps:
|
|
30
|
+
- uses: googleapis/release-please-action@v4
|
|
31
|
+
id: release
|
|
32
|
+
with: {}
|
|
33
|
+
|
|
34
|
+
publish_helm_chart:
|
|
35
|
+
runs-on: ubuntu-latest
|
|
36
|
+
needs: release-please
|
|
37
|
+
if: ${{ needs.release-please.outputs.server-version }} || ${{ needs.release-please.outputs.helm-version }}
|
|
38
|
+
steps:
|
|
39
|
+
- uses: actions/checkout@v4
|
|
40
|
+
- name: Publish Helm charts
|
|
41
|
+
uses: helm/chart-releaser-action@v1.6.0
|
|
42
|
+
with:
|
|
43
|
+
charts_dir: charts/gitops
|
|
44
|
+
env:
|
|
45
|
+
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
|
46
|
+
publish_to_pypi:
|
|
47
|
+
name: Publishes tag to pypi
|
|
48
|
+
runs-on: ubuntu-latest
|
|
49
|
+
needs: release-please
|
|
50
|
+
if: ${{ needs.release-please.outputs.cli-release-created}}
|
|
51
|
+
steps:
|
|
52
|
+
- uses: actions/checkout@v4
|
|
53
|
+
|
|
54
|
+
- uses: jdx/mise-action@v2
|
|
55
|
+
with:
|
|
56
|
+
install: true
|
|
57
|
+
cache: true
|
|
58
|
+
experimental: true
|
|
59
|
+
|
|
60
|
+
- run: |
|
|
61
|
+
mise run build
|
|
62
|
+
shell: bash
|
|
63
|
+
|
|
64
|
+
- name: Publish Pypi Package
|
|
65
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
66
|
+
publish_docker_image:
|
|
67
|
+
name: Build and Push Docker Image
|
|
68
|
+
uses: uptick/actions/.github/workflows/ci.yaml@main
|
|
69
|
+
needs: release-please
|
|
70
|
+
if: ${{ needs.release-please.outputs.server-version }}
|
|
71
|
+
secrets:
|
|
72
|
+
SECRET_ENV: "${{ secrets.CLUSTER_KEY }}"
|
|
73
|
+
#https://github.com/uptick/actions/blob/main/.github/workflows/ci.yaml
|
|
74
|
+
with:
|
|
75
|
+
aws-iam-role-arn: "arn:aws:iam::610829907584:role/default-github-actions-ci-role"
|
|
76
|
+
docker-enabled: true
|
|
77
|
+
docker-context: "."
|
|
78
|
+
docker-tag: "${{ needs.release-please.outputs.server-version }}"
|
|
79
|
+
docker-tag-latest: true
|
|
80
|
+
docker-image-platforms: linux/amd64
|
|
81
|
+
docker-repository: "610829907584.dkr.ecr.ap-southeast-2.amazonaws.com/gitops"
|
|
82
|
+
command: echo $SECRET_ENV | base64 -d > cluster.key
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
name: Test
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches:
|
|
5
|
+
- develop
|
|
6
|
+
pull_request: ~
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
actions: read # Read the metrics
|
|
10
|
+
contents: write # to be able to publish a GitHub release
|
|
11
|
+
issues: write # to be able to comment on released issues
|
|
12
|
+
pull-requests: write # to be able to comment on released pull requests
|
|
13
|
+
id-token: write # to enable use of OIDC for npm provenance / AWS
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
ci:
|
|
17
|
+
uses: uptick/actions/.github/workflows/ci.yaml@main
|
|
18
|
+
secrets: inherit
|
|
19
|
+
with:
|
|
20
|
+
praise-on-fix: false
|
|
21
|
+
python-version: 3.12
|
|
22
|
+
mise: true
|
|
23
|
+
mise-install: true
|
|
24
|
+
command: |
|
|
25
|
+
mise run install
|
|
26
|
+
mise run ci
|
|
27
|
+
build:
|
|
28
|
+
name: Build and Push Docker Image
|
|
29
|
+
uses: uptick/actions/.github/workflows/ci.yaml@main
|
|
30
|
+
secrets:
|
|
31
|
+
SECRET_ENV: "${{ secrets.CLUSTER_KEY }}"
|
|
32
|
+
#https://github.com/uptick/actions/blob/main/.github/workflows/ci.yaml
|
|
33
|
+
with:
|
|
34
|
+
aws-iam-role-arn: "arn:aws:iam::610829907584:role/default-github-actions-ci-role"
|
|
35
|
+
docker-enabled: true
|
|
36
|
+
docker-context: "."
|
|
37
|
+
docker-prefix: test
|
|
38
|
+
docker-tag-latest: false
|
|
39
|
+
docker-image-platforms: linux/amd64
|
|
40
|
+
docker-repository: "610829907584.dkr.ecr.ap-southeast-2.amazonaws.com/gitops"
|
|
41
|
+
command: echo $SECRET_ENV | base64 -d > cluster.key
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.14.0](https://github.com/uptick/gitops/compare/cli-v0.13.2...cli-v0.14.0) (2024-12-06)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **server:** add an updating emoji during deployments ([002d160](https://github.com/uptick/gitops/commit/002d160daa4a90ebf158cd3e0fc224cb3854baba))
|
|
9
|
+
|
|
10
|
+
## [0.13.2](https://github.com/uptick/gitops/compare/cli-v0.13.1...cli-v0.13.2) (2024-12-05)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* fix release-please pipeline for cli ([823eed7](https://github.com/uptick/gitops/commit/823eed79a8654f91f0bf521f70a63ae31d09e228))
|
|
16
|
+
|
|
17
|
+
## [0.13.1](https://github.com/uptick/gitops/compare/cli-v0.13.0...cli-v0.13.1) (2024-12-05)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* fix gitops bump for cross account ([d3394e3](https://github.com/uptick/gitops/commit/d3394e3214d104c323fb397d885c118a36075b5b))
|
|
23
|
+
|
|
24
|
+
## [0.13.0](https://github.com/uptick/gitops/compare/cli-v0.12.1...cli-v0.13.0) (2024-11-15)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Features
|
|
28
|
+
|
|
29
|
+
* **0.8.1:** ADded gitops db.wipe-db to delete a tenant db ([d585cf3](https://github.com/uptick/gitops/commit/d585cf357818007d27cd9e7284ba7677404cc200))
|
|
30
|
+
* **0.8.5:** Added a confirmation to gitops bash/sp when run against production environment ([f65057e](https://github.com/uptick/gitops/commit/f65057ef337a6fe34f3510c889c2284c1fdb7218))
|
|
31
|
+
* **0.9.7:** Bump other repos ([45bc035](https://github.com/uptick/gitops/commit/45bc0359d090897e2c99b7dbb650392d37069086))
|
|
32
|
+
* Add ability to gitops bash with a serviceAccount ([c305e03](https://github.com/uptick/gitops/commit/c305e03a253786cc9eed12b116af4f844e7161bc))
|
|
33
|
+
* Add gitops.db-pgcli as a command ([665bcae](https://github.com/uptick/gitops/commit/665bcae9a2018d2c7c108d14a9958501040d23af))
|
|
34
|
+
* Adds sentry alerting to gitops_server ([3416398](https://github.com/uptick/gitops/commit/34163988e24bc8b679f1561bbdc8a32a82624677))
|
|
35
|
+
* allow gitops db.proxy to work with RDS IAM Access ([0e91586](https://github.com/uptick/gitops/commit/0e9158690f0299bd9171648486d6ce3152c411cc))
|
|
36
|
+
* Be able to bump other repos ([3b8a79e](https://github.com/uptick/gitops/commit/3b8a79e138609361b6d1b8af6b4b1e2154ad2ca1))
|
|
37
|
+
* Bump the version to 0.9.8 in the __init__.py file ([f0a91de](https://github.com/uptick/gitops/commit/f0a91decb6776c2b64d42855ef5e9c0cf6d96633))
|
|
38
|
+
* Bump version number to 0.8.7 ([dad4a3b](https://github.com/uptick/gitops/commit/dad4a3baee106bb82801de596c4de70e5a06f3cf))
|
|
39
|
+
* **bump:** When bumping --push, pull first ([5df0ee0](https://github.com/uptick/gitops/commit/5df0ee03ecd9ba67e97d09a16fcee7d18eea4ad6))
|
|
40
|
+
* **cli:** Added --cpu and --memory to bash/command/shell_plus to specify container resources ([93ae33c](https://github.com/uptick/gitops/commit/93ae33ccb0c2b3b4a356d55efb6a01ddd081d05e))
|
|
41
|
+
* **cli:** efficiently find latest image using prefix search for latest image tag ([a6d8be1](https://github.com/uptick/gitops/commit/a6d8be1eb5db2dcae2527b8e07cc71e993d8c7ec))
|
|
42
|
+
* **cli:** Enforce namespace as a required param for App ([28ee089](https://github.com/uptick/gitops/commit/28ee0891ae864faf907038c0a8052d96f16371b3))
|
|
43
|
+
* **cli:** Update commands to use the apps namespace ([38cecf7](https://github.com/uptick/gitops/commit/38cecf7a4ff6be270a6fa37e920bcf3df73d84e8))
|
|
44
|
+
* **db:** Add gb.rds-logs to fetch rds logs ([604aa73](https://github.com/uptick/gitops/commit/604aa73a5d176badd07d4a2146aa81a261cc304c))
|
|
45
|
+
* Gitops bump works for repos without a prefix ([d417e61](https://github.com/uptick/gitops/commit/d417e61fd165276991bd8f28dd5b070f357296a2))
|
|
46
|
+
* **gitops_server:** Update github deployment status ([fbe8811](https://github.com/uptick/gitops/commit/fbe88119814ffd49b7713487dddb85b99e63f94e))
|
|
47
|
+
* **gitops-0.10.5:** add --create-namespace during install/upgrades ([c97b386](https://github.com/uptick/gitops/commit/c97b3868a67df40b2a6b312aae80d9361257ae1b))
|
|
48
|
+
* **gitops-cli:** Add a minimum gitops version check ([5cff7ae](https://github.com/uptick/gitops/commit/5cff7aeb60edcc6a2413361ac6c7b5dd46c8de79))
|
|
49
|
+
* **gitops:** expose App, get_app_details, get_apps as top level interfaces ([626466a](https://github.com/uptick/gitops/commit/626466a5034c532995e41b0cf476f182bb3679f0))
|
|
50
|
+
* **gitops:** makes gitops db.pgcli more robust ([fb4fbcb](https://github.com/uptick/gitops/commit/fb4fbcb38166bdef1d119c2ecbebf61592f4f79d))
|
|
51
|
+
* **helm:** Add service account to helm chart ([86d5361](https://github.com/uptick/gitops/commit/86d5361e5cd908be486dcfe238a2f8f8282e3a86))
|
|
52
|
+
* **helm:** Modified chart to allow specifying subdomain ([63ed12e](https://github.com/uptick/gitops/commit/63ed12eeb389be9bbdb230f0586b2f4340402c8e))
|
|
53
|
+
* release version 0.9.20 ([9793aea](https://github.com/uptick/gitops/commit/9793aea22877ecac49a9aee1815dc0b9923fad40))
|
|
54
|
+
* **slack:** use external tickforge slack api to find slack user if provided ([862de0f](https://github.com/uptick/gitops/commit/862de0fcd0ab881d5c8154c530584e2c7fc5f2aa))
|
|
55
|
+
* **status-updater:** catch the exception around self.process_work... ([726cc05](https://github.com/uptick/gitops/commit/726cc05160b6cb1eb1cb36bb5e4555ba6bb0589f))
|
|
56
|
+
* swap project to uv ([91e5530](https://github.com/uptick/gitops/commit/91e5530240a344018bfa42749fe0ac8235799609))
|
|
57
|
+
* Use helm-secrets for extra decryption ([025fcc7](https://github.com/uptick/gitops/commit/025fcc7996ac1f01aededf1a721cb6297b89872e))
|
|
58
|
+
* Use release-please ([0324a14](https://github.com/uptick/gitops/commit/0324a148d3b7c1df47cadf8345dd42dd20906914))
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
### Bug Fixes
|
|
62
|
+
|
|
63
|
+
* :art: Fix linting ([e31ae69](https://github.com/uptick/gitops/commit/e31ae693687871a00959463586ff1e6924897b77))
|
|
64
|
+
* :bug: Fix issue [#64](https://github.com/uptick/gitops/issues/64) ([e1f3b45](https://github.com/uptick/gitops/commit/e1f3b45d0b82ab71f009eea5f9da6c8ad34adbc5))
|
|
65
|
+
* **0.9.1:** Fix slack token injection ([bd1e270](https://github.com/uptick/gitops/commit/bd1e27093a2346cae648bcb1ced492ed102e9a63))
|
|
66
|
+
* async run should not default to exit code of 1 ([3495a72](https://github.com/uptick/gitops/commit/3495a7214c39f948bcef1b9577fbfb03a15ae887))
|
|
67
|
+
* **bump:** exclude only if the image tag ends with -latest ([742ccd3](https://github.com/uptick/gitops/commit/742ccd349fc8c0cb1812c41b374aa1ceda4cb8cd))
|
|
68
|
+
* **cli:** Fixed bump --push command being broken ([2d264d7](https://github.com/uptick/gitops/commit/2d264d7e082261cf3ce6a08593e53ceeb4149c65))
|
|
69
|
+
* **cli:** Fixed mcommand not working ([565ccb2](https://github.com/uptick/gitops/commit/565ccb2c7a72268a98b95594885146221a30a92b))
|
|
70
|
+
* **cli:** Rename gitops db.rds-logs to gitops db.logs ([4104059](https://github.com/uptick/gitops/commit/4104059a8b1a90a394d0a218581bd7474c91f95b))
|
|
71
|
+
* correctly inject the availability zone for db commands ([db4610d](https://github.com/uptick/gitops/commit/db4610d75df1cb6520add97d43a946957b808495))
|
|
72
|
+
* correctly use NetworkingV1Api ([fc76338](https://github.com/uptick/gitops/commit/fc76338a94d349eacecc07d2d8ca543929e6d966))
|
|
73
|
+
* **db-proxy:** Db proxy fixed for database urls without ports ([fb20f96](https://github.com/uptick/gitops/commit/fb20f9691acbfd68abff653af532d1b86fd9baf7))
|
|
74
|
+
* **deploy:** Fix httpx post request ([ba34cf4](https://github.com/uptick/gitops/commit/ba34cf4076b32f8246445cc58b4335d40a03ea60))
|
|
75
|
+
* fix unsetenv to tolerate `environment: null` ([cb21e26](https://github.com/uptick/gitops/commit/cb21e268d1a80d47bdb62c439be558c9f39fbe3d))
|
|
76
|
+
* **gitop-server:** Use json patch to update deployment status ([df69596](https://github.com/uptick/gitops/commit/df695968a1327da77e70cda0330364e08889fa25))
|
|
77
|
+
* **gitops_cli:** Removed more usages of App as a dict ([ffa6529](https://github.com/uptick/gitops/commit/ffa65293edae9d33100aceb4c6fa6b1fc011d801))
|
|
78
|
+
* **gitops-cli:** Fixed bump to select the correct image tag ([0c93664](https://github.com/uptick/gitops/commit/0c93664f8978d58f4179f770aedfeb2e3ece15c6))
|
|
79
|
+
* **gitops-cli:** make error message more useful ([41b3777](https://github.com/uptick/gitops/commit/41b37770dae923b577dc226f22e49daf97a49957))
|
|
80
|
+
* **gitops-cli:** Output warning message to stderr ([f09e588](https://github.com/uptick/gitops/commit/f09e588af2ca5f9c853ed7301b9b9ece83722ac1))
|
|
81
|
+
* **gitops-cli:** prevent bumping to non-existent image prefix ([5c27edf](https://github.com/uptick/gitops/commit/5c27edfdce86d1da61ed0a99ce6c3b5f86eab6ff))
|
|
82
|
+
* **gitops-server:** Don't raise exception if deployment doesn't exist ([91f11b8](https://github.com/uptick/gitops/commit/91f11b859e67074c8066470e3ab9b981f5816f00))
|
|
83
|
+
* **server:** fix checking out branch refs for charts ([35c0fb4](https://github.com/uptick/gitops/commit/35c0fb448480306dad153f6c7dd1c889469241b9))
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
### Dependencies
|
|
87
|
+
|
|
88
|
+
* Added black and updated lockfile ([62367fa](https://github.com/uptick/gitops/commit/62367fab35f502a3205bccf7fcc1c565d9a51613))
|
|
89
|
+
* Bumped uvicorn and mypy ([be74598](https://github.com/uptick/gitops/commit/be74598a5c34c67d006613ae033910e763522be3))
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: gitops
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.14.0
|
|
4
4
|
Summary: Manage multiple apps across one or more k8s clusters.
|
|
5
5
|
Author-email: Jarek Głowacki <jarekwg@gmail.com>
|
|
6
|
-
License-File: LICENSE
|
|
7
6
|
Requires-Python: >=3.12
|
|
8
7
|
Requires-Dist: boto3==1.35.4
|
|
9
8
|
Requires-Dist: colorama>=0.4.4
|
|
@@ -18,6 +17,7 @@ Requires-Dist: fastapi==0.109.2; extra == 'server'
|
|
|
18
17
|
Requires-Dist: httpx<0.24.0,>=0.23.0; extra == 'server'
|
|
19
18
|
Requires-Dist: kubernetes-asyncio>=25.1.2; extra == 'server'
|
|
20
19
|
Requires-Dist: sentry-sdk>=1.3.0; extra == 'server'
|
|
20
|
+
Requires-Dist: slack-sdk>=3.33.5; extra == 'server'
|
|
21
21
|
Requires-Dist: uptick-observability[fastapi]>=0.2.2; extra == 'server'
|
|
22
22
|
Requires-Dist: uvicorn>=0.17.6; extra == 'server'
|
|
23
23
|
Description-Content-Type: text/markdown
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.13.0](https://github.com/uptick/gitops/compare/helm-v0.12.1...helm-v0.13.0) (2024-11-15)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* Adds sentry alerting to gitops_server ([3416398](https://github.com/uptick/gitops/commit/34163988e24bc8b679f1561bbdc8a32a82624677))
|
|
9
|
+
* Bump version number to 0.8.7 ([dad4a3b](https://github.com/uptick/gitops/commit/dad4a3baee106bb82801de596c4de70e5a06f3cf))
|
|
10
|
+
* **cli:** Added --cpu and --memory to bash/command/shell_plus to specify container resources ([93ae33c](https://github.com/uptick/gitops/commit/93ae33ccb0c2b3b4a356d55efb6a01ddd081d05e))
|
|
11
|
+
* **gitops_server:** Update github deployment status ([fbe8811](https://github.com/uptick/gitops/commit/fbe88119814ffd49b7713487dddb85b99e63f94e))
|
|
12
|
+
* **gitops-0.10.5:** add --create-namespace during install/upgrades ([c97b386](https://github.com/uptick/gitops/commit/c97b3868a67df40b2a6b312aae80d9361257ae1b))
|
|
13
|
+
* **helm:** Add liveness probe to helm chart ([4cec510](https://github.com/uptick/gitops/commit/4cec5100a3549c5b2562ccfc5ce09decb45c95e2))
|
|
14
|
+
* **helm:** Add service account to helm chart ([86d5361](https://github.com/uptick/gitops/commit/86d5361e5cd908be486dcfe238a2f8f8282e3a86))
|
|
15
|
+
* **helm:** Added sample values to values.yaml ([ab05d17](https://github.com/uptick/gitops/commit/ab05d1720143884db11701048217a25046c41002))
|
|
16
|
+
* **helm:** Modified chart to allow specifying subdomain ([63ed12e](https://github.com/uptick/gitops/commit/63ed12eeb389be9bbdb230f0586b2f4340402c8e))
|
|
17
|
+
* release version 0.9.20 ([9793aea](https://github.com/uptick/gitops/commit/9793aea22877ecac49a9aee1815dc0b9923fad40))
|
|
18
|
+
* **slack:** use external tickforge slack api to find slack user if provided ([862de0f](https://github.com/uptick/gitops/commit/862de0fcd0ab881d5c8154c530584e2c7fc5f2aa))
|
|
19
|
+
* **status-updater:** catch the exception around self.process_work... ([726cc05](https://github.com/uptick/gitops/commit/726cc05160b6cb1eb1cb36bb5e4555ba6bb0589f))
|
|
20
|
+
* swap project to uv ([91e5530](https://github.com/uptick/gitops/commit/91e5530240a344018bfa42749fe0ac8235799609))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Bug Fixes
|
|
24
|
+
|
|
25
|
+
* :bug: Fix ingrss spec ([d585a3c](https://github.com/uptick/gitops/commit/d585a3c4783eb3a9dd4285682a2839d81f3bc531))
|
|
26
|
+
* **0.9.1:** Fix slack token injection ([bd1e270](https://github.com/uptick/gitops/commit/bd1e27093a2346cae648bcb1ced492ed102e9a63))
|
|
27
|
+
* **cli:** Fixed mcommand not working ([565ccb2](https://github.com/uptick/gitops/commit/565ccb2c7a72268a98b95594885146221a30a92b))
|
|
28
|
+
* correctly use NetworkingV1Api ([fc76338](https://github.com/uptick/gitops/commit/fc76338a94d349eacecc07d2d8ca543929e6d966))
|
|
29
|
+
* **gitops-cli:** Fixed bump to select the correct image tag ([0c93664](https://github.com/uptick/gitops/commit/0c93664f8978d58f4179f770aedfeb2e3ece15c6))
|
|
30
|
+
* **gitops-cli:** prevent bumping to non-existent image prefix ([5c27edf](https://github.com/uptick/gitops/commit/5c27edfdce86d1da61ed0a99ce6c3b5f86eab6ff))
|
|
@@ -39,18 +39,13 @@ spec:
|
|
|
39
39
|
- containerPort: 8000
|
|
40
40
|
resources:
|
|
41
41
|
requests:
|
|
42
|
-
memory: "
|
|
42
|
+
memory: "750Mi"
|
|
43
43
|
limits:
|
|
44
|
-
memory: "
|
|
44
|
+
memory: "1500Mi"
|
|
45
45
|
envFrom:
|
|
46
46
|
- configMapRef:
|
|
47
47
|
name: {{ .Release.Name }}-environment
|
|
48
48
|
env:
|
|
49
|
-
- name: SLACK_URL
|
|
50
|
-
valueFrom:
|
|
51
|
-
secretKeyRef:
|
|
52
|
-
name: {{ .Release.Name }}-secret
|
|
53
|
-
key: SLACK_URL
|
|
54
49
|
- name: SLACK_TOKEN
|
|
55
50
|
valueFrom:
|
|
56
51
|
secretKeyRef:
|
|
@@ -7,10 +7,11 @@ environment:
|
|
|
7
7
|
CLUSTER_NAME: "test"
|
|
8
8
|
# Specify the timezone for logging purposes. EG: Australia/Melbourne
|
|
9
9
|
TZ: "UTC"
|
|
10
|
+
# The channel id to send slack messages to
|
|
11
|
+
SLACK_CHANNEL_ID: ""
|
|
10
12
|
|
|
11
13
|
secrets:
|
|
12
14
|
ACCOUNT_ID: ""
|
|
13
|
-
SLACK_URL: ""
|
|
14
15
|
SLACK_TOKEN: ""
|
|
15
16
|
GITHUB_OAUTH_TOKEN: ""
|
|
16
17
|
GITHUB_WEBHOOK_KEY: ""
|
|
@@ -79,7 +79,10 @@ class App:
|
|
|
79
79
|
def encode(value: str) -> str:
|
|
80
80
|
return b64encode(str(value).encode()).decode() if self.encode_secrets else value
|
|
81
81
|
|
|
82
|
-
values = {
|
|
82
|
+
values = {
|
|
83
|
+
**deployments,
|
|
84
|
+
"secrets": {**{k: encode(v) for k, v in secrets.items()}},
|
|
85
|
+
}
|
|
83
86
|
|
|
84
87
|
image = self._make_image(deployments)
|
|
85
88
|
if image:
|
|
@@ -101,7 +104,7 @@ class App:
|
|
|
101
104
|
|
|
102
105
|
@property
|
|
103
106
|
def image(self) -> str:
|
|
104
|
-
"""[
|
|
107
|
+
"""[610829907584.dkr.ecr.ap-southeast-2.amazonaws.com/uptick:yoink-9f03ac80f3]"""
|
|
105
108
|
image = self.values.get("image", "")
|
|
106
109
|
if isinstance(image, dict):
|
|
107
110
|
return f"{image['repository']}:{image.get('tag','latest')}"
|
|
@@ -110,23 +113,23 @@ class App:
|
|
|
110
113
|
|
|
111
114
|
@property
|
|
112
115
|
def image_repository_name(self) -> str:
|
|
113
|
-
"""
|
|
116
|
+
"""610829907584.dkr.ecr.ap-southeast-2.amazonaws.com/[uptick]:yoink-9f03ac80f3"""
|
|
114
117
|
return self.image.split(":")[0].split("/")[-1]
|
|
115
118
|
|
|
116
119
|
@property
|
|
117
120
|
def image_repository(self) -> str:
|
|
118
|
-
"""[
|
|
121
|
+
"""[610829907584.dkr.ecr.ap-southeast-2.amazonaws.com]/uptick:yoink-9f03ac80f3"""
|
|
119
122
|
return self.image.split("/")[0]
|
|
120
123
|
|
|
121
124
|
@property
|
|
122
125
|
def image_tag(self) -> str:
|
|
123
|
-
"""
|
|
126
|
+
"""610829907584.dkr.ecr.ap-southeast-2.amazonaws.com/uptick:[yoink-9f03ac80f3]"""
|
|
124
127
|
return self.image.split(":")[-1]
|
|
125
128
|
|
|
126
129
|
@property
|
|
127
130
|
def image_prefix(self) -> str:
|
|
128
131
|
"""Gets the image prefix portion of {prefix}-{git hash}
|
|
129
|
-
|
|
132
|
+
610829907584.dkr.ecr.ap-southeast-2.amazonaws.com/uptick:[yoink]-9f03ac80f3
|
|
130
133
|
|
|
131
134
|
eg: qa-server-12345 -> qa-server
|
|
132
135
|
"""
|
|
@@ -81,7 +81,7 @@ def bump( # noqa: C901
|
|
|
81
81
|
new_image_prefix = app.image_prefix
|
|
82
82
|
else:
|
|
83
83
|
new_image_prefix = prefix
|
|
84
|
-
new_image_tag = get_latest_image(app.image_repository_name, new_image_prefix)
|
|
84
|
+
new_image_tag = get_latest_image(app.image_repository_name, new_image_prefix, app.image_repository)
|
|
85
85
|
else:
|
|
86
86
|
new_image_tag = image_tag
|
|
87
87
|
|
|
@@ -28,7 +28,7 @@ def get_image(tag: str) -> str:
|
|
|
28
28
|
def get_latest_image(repository_name: str, prefix: str, ecr_repository: str | None = None) -> str | None: # noqa:C901
|
|
29
29
|
"""Finds latest image in ECR with the given prefix and returns the image tag
|
|
30
30
|
|
|
31
|
-
param ecr_repository is expected in this format:
|
|
31
|
+
param ecr_repository is expected in this format: 610829907584.dkr.ecr.ap-southeast-2.amazonaws.com
|
|
32
32
|
"""
|
|
33
33
|
describe_image_args = {}
|
|
34
34
|
region_name = None
|
|
File without changes
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.15.0](https://github.com/uptick/gitops/compare/server-v0.14.0...server-v0.15.0) (2024-12-06)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **server:** add an updating emoji during deployments ([002d160](https://github.com/uptick/gitops/commit/002d160daa4a90ebf158cd3e0fc224cb3854baba))
|
|
9
|
+
|
|
10
|
+
## [0.14.0](https://github.com/uptick/gitops/compare/server-v0.13.0...server-v0.14.0) (2024-11-26)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* **server:** update deploy failed messages to point to grafana ([b6a90b8](https://github.com/uptick/gitops/commit/b6a90b8e4845982a71c49b3203103f55e8332e24))
|
|
16
|
+
|
|
17
|
+
## [0.13.0](https://github.com/uptick/gitops/compare/server-v0.12.1...server-v0.13.0) (2024-11-15)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* Add slack user name shaming to slack hook ([0561e29](https://github.com/uptick/gitops/commit/0561e29addb532c32d8fc9bcc623b189542c311e))
|
|
23
|
+
* Adds sentry alerting to gitops_server ([3416398](https://github.com/uptick/gitops/commit/34163988e24bc8b679f1561bbdc8a32a82624677))
|
|
24
|
+
* Continue even if sha is not found ([c450eae](https://github.com/uptick/gitops/commit/c450eaebc438ffd7028aff6ced683060e54d19a6))
|
|
25
|
+
* Fix startup for python 3.10 ([938f8a4](https://github.com/uptick/gitops/commit/938f8a413cd350258bb893bf4356f193447bad6e))
|
|
26
|
+
* **gitops_server:** Update github deployment status ([fbe8811](https://github.com/uptick/gitops/commit/fbe88119814ffd49b7713487dddb85b99e63f94e))
|
|
27
|
+
* **gitops-0.10.5:** add --create-namespace during install/upgrades ([c97b386](https://github.com/uptick/gitops/commit/c97b3868a67df40b2a6b312aae80d9361257ae1b))
|
|
28
|
+
* **healthcheck:** Add health check endpoint which doesn't show up in logs ([07335f0](https://github.com/uptick/gitops/commit/07335f01ac9b2d3df75ebf5f4ff7dbc5ce39cb40))
|
|
29
|
+
* Limit helm history to 3 ([5d2856c](https://github.com/uptick/gitops/commit/5d2856c7af35b0ce5a66f26a5ad44e5b0b2d3a95))
|
|
30
|
+
* **logs:** Add timestamps to logs ([0f3f09d](https://github.com/uptick/gitops/commit/0f3f09dddd4d6287d2ed8ddcbea316c0cbe92bc7))
|
|
31
|
+
* **server:** Deploy servers into specific namespaces ([1fed618](https://github.com/uptick/gitops/commit/1fed6186a1d47a19faf93ba8848a52a000c7e1a6))
|
|
32
|
+
* **slack:** use external tickforge slack api to find slack user if provided ([862de0f](https://github.com/uptick/gitops/commit/862de0fcd0ab881d5c8154c530584e2c7fc5f2aa))
|
|
33
|
+
* **status-updater:** catch the exception around self.process_work... ([726cc05](https://github.com/uptick/gitops/commit/726cc05160b6cb1eb1cb36bb5e4555ba6bb0589f))
|
|
34
|
+
* Use helm-secrets for extra decryption ([025fcc7](https://github.com/uptick/gitops/commit/025fcc7996ac1f01aededf1a721cb6297b89872e))
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
### Bug Fixes
|
|
38
|
+
|
|
39
|
+
* **0.9.1:** Fix slack token injection ([bd1e270](https://github.com/uptick/gitops/commit/bd1e27093a2346cae648bcb1ced492ed102e9a63))
|
|
40
|
+
* async run should not default to exit code of 1 ([3495a72](https://github.com/uptick/gitops/commit/3495a7214c39f948bcef1b9577fbfb03a15ae887))
|
|
41
|
+
* correctly use NetworkingV1Api ([fc76338](https://github.com/uptick/gitops/commit/fc76338a94d349eacecc07d2d8ca543929e6d966))
|
|
42
|
+
* **deploy:** Fix httpx post request ([ba34cf4](https://github.com/uptick/gitops/commit/ba34cf4076b32f8246445cc58b4335d40a03ea60))
|
|
43
|
+
* fix broken semaphore env parsing ([cad0239](https://github.com/uptick/gitops/commit/cad0239128fb4867e0567783df868ad0bf86e091))
|
|
44
|
+
* **gitop-server:** Use json patch to update deployment status ([df69596](https://github.com/uptick/gitops/commit/df695968a1327da77e70cda0330364e08889fa25))
|
|
45
|
+
* gitops ingress update for eks 1.22+ ([d23dc35](https://github.com/uptick/gitops/commit/d23dc35bad0ab6b1d6faa93f97e3a18f1c2db973))
|
|
46
|
+
* **gitops_server:** Fix uninstall not removing apps ([f30e90e](https://github.com/uptick/gitops/commit/f30e90e961386d4f46257ac572ced6eacae5883c))
|
|
47
|
+
* **gitops_server:** treat suspended servers as removed ([743abaa](https://github.com/uptick/gitops/commit/743abaa231817de2903ec7a6e7c03be68a0ddfea))
|
|
48
|
+
* **gitops-server:** Don't raise exception if deployment doesn't exist ([91f11b8](https://github.com/uptick/gitops/commit/91f11b859e67074c8066470e3ab9b981f5816f00))
|
|
49
|
+
* **server:** fix checking out branch refs for charts ([35c0fb4](https://github.com/uptick/gitops/commit/35c0fb448480306dad153f6c7dd1c889469241b9))
|
|
50
|
+
* **slack:** forgot to await slack user ([f9b923f](https://github.com/uptick/gitops/commit/f9b923f3a8716e5523d8fb3654bcee8e1b21d515))
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
### Dependencies
|
|
54
|
+
|
|
55
|
+
* Bumped uvicorn and mypy ([be74598](https://github.com/uptick/gitops/commit/be74598a5c34c67d006613ae033910e763522be3))
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
CLUSTER_NAME = os.getenv("CLUSTER_NAME", "")
|
|
4
|
+
# Namespace to search/deploy into
|
|
5
|
+
CLUSTER_NAMESPACE = os.getenv("CLUSTER_NAMESPACE", "")
|
|
6
|
+
ACCOUNT_ID = os.getenv("ACCOUNT_ID", "")
|
|
7
|
+
GITHUB_WEBHOOK_KEY = os.getenv("GITHUB_WEBHOOK_KEY", "")
|
|
8
|
+
|
|
9
|
+
SLACK_API_USERS_URL = os.environ.get("SLACK_API_USERS_URL", "https://slack.com/api/users.list")
|
|
10
|
+
SLACK_TOKEN = os.environ.get("SLACK_TOKEN")
|
|
11
|
+
# The slack channel ID starts with C
|
|
12
|
+
SLACK_CHANNEL_ID = os.environ.get("SLACK_CHANNEL_ID", "")
|
|
13
|
+
|
|
14
|
+
# How many parallel deploys can be done at once
|
|
15
|
+
GITOPS_MAX_PARALLEL_DEPLOYS = os.environ.get("GITOPS_MAX_PARALLEL_DEPLOYS", "5")
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import dataclasses
|
|
2
2
|
import logging
|
|
3
|
-
import os
|
|
4
3
|
from collections.abc import Iterable
|
|
5
4
|
|
|
6
5
|
import httpx
|
|
6
|
+
import slack_sdk
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
from gitops_server import settings
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
SLACK_TOKEN = os.environ.get("SLACK_TOKEN")
|
|
10
|
+
logger = logging.getLogger("gitops")
|
|
11
|
+
client = slack_sdk.WebClient(token=settings.SLACK_TOKEN)
|
|
13
12
|
|
|
14
13
|
|
|
15
14
|
@dataclasses.dataclass
|
|
@@ -28,31 +27,43 @@ class SlackGroup(SlackUser):
|
|
|
28
27
|
return f"<!subteam^{self.id}|{self.name}>"
|
|
29
28
|
|
|
30
29
|
|
|
31
|
-
async def post(message: str) -> None:
|
|
32
|
-
"""Post a message to a slack channel
|
|
30
|
+
async def post(message: str) -> str | None:
|
|
31
|
+
"""Post a message to a slack channel"""
|
|
32
|
+
logger.info("POSTING TO SLACK")
|
|
33
|
+
if settings.SLACK_TOKEN and settings.SLACK_CHANNEL_ID:
|
|
34
|
+
response = client.chat_postMessage(channel=settings.SLACK_CHANNEL_ID, text=message)
|
|
35
|
+
if response.status_code >= 300:
|
|
36
|
+
logger.warning("Failed to post a message to slack (see below):")
|
|
37
|
+
logger.error(f"{message}", exc_info=True)
|
|
38
|
+
else:
|
|
39
|
+
return response.data["ts"] # type: ignore
|
|
40
|
+
return None
|
|
41
|
+
|
|
33
42
|
|
|
34
|
-
|
|
35
|
-
|
|
43
|
+
async def update(*, ts: str, message: str) -> str | None:
|
|
44
|
+
"""Update an existing message to a slack channel
|
|
45
|
+
|
|
46
|
+
https://api.slack.com/methods/chat.update
|
|
36
47
|
"""
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
48
|
+
if settings.SLACK_TOKEN and settings.SLACK_CHANNEL_ID:
|
|
49
|
+
response = client.chat_update(channel=settings.SLACK_CHANNEL_ID, ts=ts, text=message)
|
|
50
|
+
if response.status_code >= 300:
|
|
51
|
+
logger.warning("Failed to post a message to slack (see below):")
|
|
52
|
+
logger.error(f"{message}", exc_info=True)
|
|
53
|
+
else:
|
|
54
|
+
return response.data["ts"] # type: ignore
|
|
55
|
+
return None
|
|
45
56
|
|
|
46
57
|
|
|
47
58
|
async def find_commiter_slack_user(name: str, email: str) -> SlackUser | None:
|
|
48
59
|
"""Find a slack user by name or email using the slack API"""
|
|
49
|
-
if not SLACK_TOKEN:
|
|
60
|
+
if not settings.SLACK_TOKEN:
|
|
50
61
|
return None
|
|
51
62
|
|
|
52
63
|
async with httpx.AsyncClient() as client:
|
|
53
64
|
response = await client.get(
|
|
54
|
-
f"{SLACK_API_USERS_URL}?limit=5&pretty=1",
|
|
55
|
-
headers={"Authorization": f"Bearer {SLACK_TOKEN}"},
|
|
65
|
+
f"{settings.SLACK_API_USERS_URL}?limit=5&pretty=1",
|
|
66
|
+
headers={"Authorization": f"Bearer {settings.SLACK_TOKEN}"},
|
|
56
67
|
params={"name": name, "email": email},
|
|
57
68
|
)
|
|
58
69
|
data = response.json()
|