mirror of https://github.com/dapr/community.git
Using file output binding.
Signed-off-by: Artur Souza <artursouza.ms@outlook.com>
This commit is contained in:
parent
a42af6351e
commit
113945f8a9
|
@ -1,21 +0,0 @@
|
|||
apiVersion: dapr.io/v1alpha1
|
||||
kind: Component
|
||||
metadata:
|
||||
name: dapr-github-metrics-binding
|
||||
spec:
|
||||
type: bindings.azure.blobstorage
|
||||
version: v1
|
||||
metadata:
|
||||
- name: storageAccount
|
||||
secretKeyRef:
|
||||
name: GITHUB_METRICS_STORAGE_ACCOUNT
|
||||
key: GITHUB_METRICS_STORAGE_ACCOUNT
|
||||
- name: storageAccessKey
|
||||
secretKeyRef:
|
||||
name: GITHUB_METRICS_STORAGE_ACCESS_KEY
|
||||
key: GITHUB_METRICS_STORAGE_ACCESS_KEY
|
||||
- name: container
|
||||
value: metrics
|
||||
|
||||
auth:
|
||||
secretStore: env-secret-store
|
|
@ -0,0 +1,15 @@
|
|||
apiVersion: dapr.io/v1alpha1
|
||||
kind: Component
|
||||
metadata:
|
||||
name: dapr-github-metrics-binding
|
||||
spec:
|
||||
type: bindings.localstorage
|
||||
version: v1
|
||||
metadata:
|
||||
- name: rootPath
|
||||
secretKeyRef:
|
||||
name: GITHUB_METRICS_PATH
|
||||
key: GITHUB_METRICS_PATH
|
||||
|
||||
auth:
|
||||
secretStore: env-secret-store
|
|
@ -34,7 +34,6 @@ my_repos=[
|
|||
|
||||
expected_triage_labels=[
|
||||
('P0', 'P1', 'P2', 'P3'),
|
||||
('size/xs', 'size/s', 'size/m', 'size/l', 'size/xl'),
|
||||
('pinned', 'triaged/resolved')
|
||||
]
|
||||
|
||||
|
@ -106,10 +105,10 @@ triaged_under_5_days_ratio = triaged_under_5_days_count / total_count
|
|||
|
||||
output = json.dumps({
|
||||
'date': now.strftime('%Y-%m-%d'),
|
||||
'last_30days_total_issues': total_count,
|
||||
'last_30days_total_issues_triaged': triaged_count,
|
||||
'last_30days_total_issues_triaged_in_5_days': triaged_under_5_days_count,
|
||||
'last_30days_total_issues_triaged_in_5_days_percentage': triaged_under_5_days_ratio * 100.0,
|
||||
'last_30days_total_bugs': total_count,
|
||||
'last_30days_total_bugs_triaged': triaged_count,
|
||||
'last_30days_total_bugs_triaged_within_5_days': triaged_under_5_days_count,
|
||||
'last_30days_percentage_bugs_triaged_within_5_days': triaged_under_5_days_ratio * 100.0,
|
||||
'last_30days_average_days_to_triage': average_days_to_triage,
|
||||
'last_30days_expected_average_days_to_triage': expected_average_days_to_triage,
|
||||
})
|
||||
|
@ -120,7 +119,7 @@ print("%d issues, %lf %% triaged, %.2lf days on average, %lf %% triaged under 5
|
|||
print(output)
|
||||
with DaprClient() as d:
|
||||
d.wait(60)
|
||||
filename = now.strftime('%Y/%m/%d') + '/last_30days_bugs_triage_metrics.json'
|
||||
filename = now.strftime('%Y/%m/%d') + '/github_issues_metrics.json'
|
||||
resp = d.invoke_binding(
|
||||
binding_name='dapr-github-metrics-binding',
|
||||
operation='create',
|
|
@ -22,16 +22,14 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
env:
|
||||
DAPR_CLI_VER: 1.7.0
|
||||
DAPR_RUNTIME_VER: 1.7.2
|
||||
DAPR_RUNTIME_VER: 1.7.4
|
||||
DAPR_INSTALL_URL: https://raw.githubusercontent.com/dapr/cli/v1.7.0/install/install.sh
|
||||
ARCHIVE_OUTDIR: dist/archives
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
- name: Set up Dapr CLI
|
||||
run: wget -q ${{ env.DAPR_INSTALL_URL }} -O - | /bin/bash -s ${{ env.DAPR_CLI_VER }}
|
||||
- name: Set up Go ${{ env.GOVER }}
|
||||
if: env.DAPR_REF != '' || env.DAPR_CLI_REF != ''
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ env.GOVER }}
|
||||
- name: Initialize Dapr runtime ${{ env.DAPR_RUNTIME_VER }}
|
||||
run: |
|
||||
dapr uninstall --all
|
||||
|
@ -39,10 +37,14 @@ jobs:
|
|||
- name: Install utilities dependencies
|
||||
run: |
|
||||
echo "PATH=$PATH:$HOME/.local/bin" >> $GITHUB_ENV
|
||||
pip3 install dapr PyGitHub
|
||||
working-directory: ./.github/scripts
|
||||
pip3 install dapr humanize PyGitHub
|
||||
- name: Extract metrics
|
||||
env:
|
||||
GITHUB_METRICS_STORAGE_ACCOUNT: ${{ secrets.GITHUB_METRICS_STORAGE_ACCOUNT }}
|
||||
GITHUB_METRICS_STORAGE_ACCESS_KEY: ${{ secrets.GITHUB_METRICS_STORAGE_ACCESS_KEY }}
|
||||
GITHUB_METRICS_PATH: ${{ env.ARCHIVE_OUTDIR }}
|
||||
run: |
|
||||
dapr run --components-path=.components/ python3 github_metrics.py
|
||||
dapr run --components-path=./.github/scripts/.components/ python3 ./.github/scripts/github_issues_metrics.py
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@master
|
||||
with:
|
||||
name: dapr_github_metrics
|
||||
path: ${{ env.ARCHIVE_OUTDIR }}
|
Loading…
Reference in New Issue