Skip to content

Commit 26a9d8c

Browse files
authored
Merge pull request #2 from gapitio/gapit
merge: add gapit branch as main branch
2 parents 943a624 + dc87394 commit 26a9d8c

78 files changed

Lines changed: 819 additions & 443 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/docker.yml

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,42 @@
1-
name: Docker Build and Push
1+
name: Docker
22

33
on:
44
push:
55
branches: [ master, release/* ]
6+
tags: [ '**' ]
7+
8+
env:
9+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
610

711
jobs:
812
build:
13+
name: Build & Push
914
runs-on: ubuntu-latest
1015
env:
11-
REPOSITORY_URL: docker.pkg.github.com
12-
IMAGE_NAME: ${{ github.repository }}/alerta-cli
13-
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
16+
REPOSITORY_URL: ghcr.io
17+
IMAGE_NAME: ${{ github.repository_owner }}/alerta-cli
1418
steps:
1519
- name: Checkout
16-
uses: actions/checkout@v2
17-
- name: Variables
18-
id: vars
19-
run: echo "::set-output name=SHORT_COMMIT_ID::$(git rev-parse --short HEAD)"
20+
uses: actions/checkout@v4
2021
- name: Build image
2122
id: docker-build
2223
run: >-
2324
docker build
2425
-t $IMAGE_NAME
25-
-t $REPOSITORY_URL/$IMAGE_NAME:${{ steps.vars.outputs.SHORT_COMMIT_ID }}
26+
-t $REPOSITORY_URL/$IMAGE_NAME:$(cat VERSION)
27+
-t $REPOSITORY_URL/$IMAGE_NAME:$(git rev-parse --short HEAD)
2628
-t $REPOSITORY_URL/$IMAGE_NAME:latest .
2729
- name: Docker Login
28-
env:
29-
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
30-
DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
31-
run: docker login $REPOSITORY_URL --username "$DOCKER_USERNAME" --password "$DOCKER_PASSWORD"
30+
uses: docker/login-action@v2
31+
with:
32+
registry: ${{ env.REPOSITORY_URL }}
33+
username: ${{ github.actor }}
34+
password: ${{ secrets.GITHUB_TOKEN }}
3235
- name: Publish Image
3336
id: docker-push
34-
run: docker push $REPOSITORY_URL/$IMAGE_NAME
37+
run: docker push --all-tags $REPOSITORY_URL/$IMAGE_NAME
3538

36-
- uses: act10ns/slack@v1
39+
- uses: act10ns/slack@v2
3740
with:
3841
status: ${{ job.status }}
3942
steps: ${{ toJson(steps) }}

.github/workflows/release.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags: [ 'v*' ]
6+
7+
env:
8+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
9+
10+
jobs:
11+
test:
12+
name: Test
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Set up Python 3.11
18+
uses: actions/setup-python@v5
19+
with:
20+
python-version: 3.11
21+
- name: Install dependencies
22+
id: install-deps
23+
run: |
24+
python3 -m pip install --upgrade pip
25+
pip install flake8 pytest
26+
pip install -r requirements.txt
27+
pip install -r requirements-dev.txt
28+
pip install .
29+
- name: Pre-commit hooks
30+
id: hooks
31+
run: |
32+
pre-commit run -a --show-diff-on-failure
33+
- name: Test with pytest
34+
id: test
35+
run: |
36+
pytest --cov=alertaclient tests/unit
37+
- uses: act10ns/slack@v2
38+
with:
39+
status: ${{ job.status }}
40+
steps: ${{ toJson(steps) }}
41+
if: failure()
42+
43+
release:
44+
name: Publish
45+
needs: test
46+
runs-on: ubuntu-latest
47+
48+
steps:
49+
- uses: actions/checkout@v4
50+
- name: Set up Python 3.11
51+
uses: actions/setup-python@v5
52+
with:
53+
python-version: 3.11
54+
- name: Build
55+
id: build
56+
run: |
57+
python3 -m pip install --upgrade build
58+
python3 -m build
59+
zip alerta-api.zip -r dist/*
60+
tar cvfz alerta-api.tar.gz dist/*
61+
- name: Release
62+
id: create-release
63+
uses: softprops/action-gh-release@v2
64+
with:
65+
token: ${{ secrets.GITHUB_TOKEN }}
66+
tag_name: ${{ github.ref }}
67+
name: Release ${{ github.ref }}
68+
draft: false
69+
prerelease: ${{ contains(github.ref_name, '-') }}
70+
files: |
71+
./alerta-api.zip
72+
./alerta-api.tar.gz
73+
74+
- uses: act10ns/slack@v2
75+
with:
76+
status: ${{ job.status }}
77+
steps: ${{ toJson(steps) }}
78+
79+
- name: Test Install
80+
run: |
81+
python3 -m pip install --upgrade alerta
82+
python3 -m pip freeze
Lines changed: 13 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,26 @@
1-
name: CI Tests
1+
name: Tests
22

33
on:
44
push:
5-
branches: [ master, release/* ]
65
pull_request:
76
branches: [ master ]
87

8+
env:
9+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
10+
REPOSITORY_URL: docker.pkg.github.com
11+
912
jobs:
1013
test:
1114
runs-on: ubuntu-latest
12-
env:
13-
REPOSITORY_URL: docker.pkg.github.com
14-
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
1515

1616
strategy:
1717
matrix:
18-
python-version: [3.6, 3.7, 3.8, 3.9]
18+
python-version: ['3.10', '3.11', '3.12']
1919

2020
steps:
21-
- name: Checkout
22-
uses: actions/checkout@v2
23-
- name: Python ${{ matrix.python-version }}
24-
uses: actions/setup-python@v2
21+
- uses: actions/checkout@v4
22+
- name: Set up Python ${{ matrix.python-version }}
23+
uses: actions/setup-python@v5
2524
with:
2625
python-version: ${{ matrix.python-version }}
2726
- name: Install dependencies
@@ -41,30 +40,17 @@ jobs:
4140
run: |
4241
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
4342
flake8 . --count --exit-zero --max-complexity=50 --max-line-length=127 --statistics
44-
- name: Type Check
45-
id: types
46-
run: |
47-
python -m mypy alertaclient/
4843
- name: Test with pytest
4944
id: unit-test
50-
env:
51-
DATABASE_URL: postgres://postgres:postgres@localhost:5432/alerta
5245
run: |
5346
pytest --cov=alertaclient tests/unit
54-
- name: Docker Login
55-
env:
56-
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
57-
DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
58-
run: |
59-
docker login $REPOSITORY_URL --username "$DOCKER_USERNAME" --password "$DOCKER_PASSWORD"
6047
- name: Integration Test
6148
id: integration-test
6249
run: |
63-
docker-compose -f docker-compose.ci.yaml build sut
64-
docker-compose -f docker-compose.ci.yaml up --exit-code-from sut
65-
docker-compose -f docker-compose.ci.yaml rm --stop --force
66-
67-
- uses: act10ns/slack@v1
50+
docker compose -f docker-compose.ci.yaml build sut
51+
docker compose -f docker-compose.ci.yaml up --exit-code-from sut
52+
docker compose -f docker-compose.ci.yaml rm --stop --force
53+
- uses: act10ns/slack@v2
6854
with:
6955
status: ${{ job.status }}
7056
steps: ${{ toJson(steps) }}

.pre-commit-config.yaml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
repos:
2-
- repo: https://github.com/pre-commit/mirrors-autopep8
3-
rev: v1.5.1
2+
- repo: https://github.com/hhatto/autopep8
3+
rev: v2.0.4
44
hooks:
55
- id: autopep8
66
- repo: https://github.com/pre-commit/pre-commit-hooks.git
7-
rev: v2.5.0
7+
rev: v4.5.0
88
hooks:
99
- id: check-added-large-files
1010
- id: check-ast
@@ -17,25 +17,25 @@ repos:
1717
- id: debug-statements
1818
- id: double-quote-string-fixer
1919
- id: end-of-file-fixer
20-
- id: flake8
2120
- id: fix-encoding-pragma
2221
args: ['--remove']
2322
- id: pretty-format-json
2423
args: ['--autofix']
2524
- id: name-tests-test
2625
args: ['--django']
26+
exclude: ^tests/helpers/
2727
- id: requirements-txt-fixer
2828
- id: trailing-whitespace
29+
- repo: https://github.com/pycqa/flake8
30+
rev: 6.1.0
31+
hooks:
32+
- id: flake8
2933
- repo: https://github.com/asottile/pyupgrade
30-
rev: v1.27.0
34+
rev: v3.21.2
3135
hooks:
3236
- id: pyupgrade
3337
args: ['--py3-plus']
34-
- repo: https://github.com/asottile/seed-isort-config
35-
rev: v1.9.4
36-
hooks:
37-
- id: seed-isort-config
38-
- repo: https://github.com/pre-commit/mirrors-isort
39-
rev: v4.3.21
38+
- repo: https://github.com/PyCQA/isort
39+
rev: 7.0.0
4040
hooks:
4141
- id: isort

CHANGELOG.md

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,37 @@
1-
## Unreleased
1+
## v8.5.2 (2023-03-18)
2+
3+
### Refactor
4+
5+
- convert formatted strings to f-strings (#272)
6+
7+
## v8.5.1 (2021-11-21)
8+
9+
### Feat
10+
11+
- Add a --alert flag to alert keys to alert on expired and expiring key (#274)
12+
- Add option to use custom value when creating API key (#270)
13+
14+
### Refactor
15+
16+
- convert formatted strings to f-strings (#272)
17+
- assign api key directly (#271)
18+
19+
## v8.5.0 (2021-04-18)
20+
21+
### Fix
22+
23+
- improve alert note command (#263)
24+
- consistent use of ID as metavar (#262)
25+
- add scopes cmd and minor fixes (#257)
26+
- **build**: run tests against correct branch
27+
28+
### Feat
29+
30+
- add examples for group cmd (#261)
31+
- add and remove users to/from groups (#260)
32+
- add option to list users to group cmd (#259)
33+
- add option to list groups to user cmd (#258)
34+
- add alerts command for list alert attributes (#256)
35+
- show user details (#255)
36+
- add option to show decoded auth token claims (#254)
37+
- **auth**: add HMAC authentication as config option (#248)

0 commit comments

Comments
 (0)