Skip to content

Commit b4df15f

Browse files
authored
implement jira v3 and auth changes (#1022)
* implement jira v3 and auth changes Signed-off-by: Frank Jogeleit <[email protected]> * update tests Signed-off-by: Frank Jogeleit <[email protected]> --------- Signed-off-by: Frank Jogeleit <[email protected]>
1 parent 7160064 commit b4df15f

File tree

10 files changed

+233
-72
lines changed

10 files changed

+233
-72
lines changed

charts/policy-reporter/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ description: |
55
It creates Prometheus Metrics and can send rule validation events to different targets like Loki, Elasticsearch, Slack or Discord
66
77
type: application
8-
version: 3.2.2
9-
appVersion: 3.2.1
8+
version: 3.2.3
9+
appVersion: 3.2.2
1010

1111
icon: https://github.com/kyverno/kyverno/raw/main/img/logo.png
1212
home: https://kyverno.github.io/policy-reporter

charts/policy-reporter/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Policy Reporter watches for PolicyReport Resources.
44
It creates Prometheus Metrics and can send rule validation events to different targets like Loki, Elasticsearch, Slack or Discord
55

6-
![Version: 3.2.2](https://img.shields.io/badge/Version-3.2.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 3.2.1](https://img.shields.io/badge/AppVersion-3.2.1-informational?style=flat-square)
6+
![Version: 3.2.3](https://img.shields.io/badge/Version-3.2.3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 3.2.2](https://img.shields.io/badge/AppVersion-3.2.2-informational?style=flat-square)
77

88
## Documentation
99

@@ -257,9 +257,11 @@ Open `http://localhost:8082/` in your browser.
257257
| target.jira.username | string | `""` | JIRA username |
258258
| target.jira.password | string | `""` | JIRA password (use password or apiToken, not both) |
259259
| target.jira.apiToken | string | `""` | JIRA API token (use password or apiToken, not both) |
260+
| target.jira.apiVersion | string | `"v3"` | JIRA static labels |
260261
| target.jira.projectKey | string | `""` | JIRA project key |
261262
| target.jira.issueType | string | `""` | JIRA issue type (default: "Bug") |
262263
| target.jira.components | list | `[]` | JIRA component names list |
264+
| target.jira.labels | list | `[]` | JIRA static labels |
263265
| target.jira.summaryTemplate | string | `""` | JIRA summary go template, available values: result, customfield default: "{{ if result.ResourceString }}{{ result.ResourceString }}: {{ end }}Policy Violation: {{ result.Policy }}" |
264266
| target.jira.certificate | string | `""` | Server Certificate file path Can be added under extraVolumes |
265267
| target.jira.skipTLS | bool | `false` | Skip TLS verification |

charts/policy-reporter/templates/_helpers.tpl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,10 +224,20 @@ config:
224224
username: {{ .username | quote }}
225225
password: {{ .password | quote }}
226226
apiToken: {{ .apiToken | quote }}
227+
apiVersion: {{ .apiVersion | quote }}
228+
summaryTemplate: {{ .summaryTemplate | quote }}
227229
projectKey: {{ .projectKey | quote }}
228230
issueType: {{ .issueType | quote }}
229231
certificate: {{ .certificate | quote }}
230232
skipTLS: {{ .skipTLS }}
233+
{{- with .labels }}
234+
labels:
235+
{{- toYaml . | nindent 4 }}
236+
{{- end }}
237+
{{- with .components }}
238+
components:
239+
{{- toYaml . | nindent 4 }}
240+
{{- end }}
231241
{{ include "target" . }}
232242
{{- end }}
233243

charts/policy-reporter/templates/policyreporter.kyverno.io_targetconfigs.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,8 @@ spec:
224224
properties:
225225
apiToken:
226226
type: string
227+
apiVersion:
228+
type: string
227229
certificate:
228230
type: string
229231
components:
@@ -234,6 +236,10 @@ spec:
234236
type: string
235237
issueType:
236238
type: string
239+
labels:
240+
items:
241+
type: string
242+
type: array
237243
password:
238244
type: string
239245
projectKey:

charts/policy-reporter/values.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,12 +630,16 @@ target:
630630
password: ""
631631
# -- JIRA API token (use password or apiToken, not both)
632632
apiToken: ""
633+
# -- JIRA static labels
634+
apiVersion: "v3"
633635
# -- JIRA project key
634636
projectKey: ""
635637
# -- JIRA issue type (default: "Bug")
636638
issueType: ""
637639
# -- JIRA component names list
638640
components: []
641+
# -- JIRA static labels
642+
labels: []
639643
# -- JIRA summary go template, available values: result, customfield
640644
# default: "{{ if result.ResourceString }}{{ result.ResourceString }}: {{ end }}Policy Violation: {{ result.Policy }}"
641645
summaryTemplate: ""

config/crds/policyreporter.kyverno.io_targetconfigs.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,8 @@ spec:
223223
properties:
224224
apiToken:
225225
type: string
226+
apiVersion:
227+
type: string
226228
certificate:
227229
type: string
228230
components:
@@ -233,6 +235,10 @@ spec:
233235
type: string
234236
issueType:
235237
type: string
238+
labels:
239+
items:
240+
type: string
241+
type: array
236242
password:
237243
type: string
238244
projectKey:

pkg/crd/api/targetconfig/v1alpha1/configs.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ type JiraOptions struct {
4545
// +optional
4646
SummaryTemplate string `mapstructure:"summaryTemplate" json:"summaryTemplate"`
4747
// +optional
48+
APIVersion string `mapstructure:"apiVersion" json:"apiVersion"`
49+
// +optional
50+
Labels []string `mapstructure:"labels" json:"labels"`
51+
// +optional
4852
Components []string `mapstructure:"components" json:"components"`
4953
// +optional
5054
SkipTLS bool `mapstructure:"skipTLS" json:"skipTLS"`

pkg/target/factory/factory.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,8 @@ func (f *TargetFactory) CreateJiraTarget(config, parent *targetconfig.Config[v1a
635635
IssueType: config.Config.IssueType,
636636
Components: config.Config.Components,
637637
SummaryTemplate: config.Config.SummaryTemplate,
638+
APIVersion: config.Config.APIToken,
639+
Labels: config.Config.Labels,
638640
SkipTLS: config.Config.SkipTLS,
639641
Certificate: config.Config.Certificate,
640642
CustomFields: config.CustomFields,

0 commit comments

Comments
 (0)