Github issue form: add label based on dropdown - github

I'm currently looking at the new YAML based issue templates at Github and would like to achieve a system where a label is assigned to the issue dependent on the value the issue creator selects from a dropdown.
I couldn't find anything on this.
For example I have the following bug template:
name: Bug Report
description: File a bug report
labels: [triage]
body:
- type: dropdown
id: bug-type
attributes:
label: Project
multiple: true
options:
- API
- WebUI
validations:
required: true
How could I add a label "api" and/or "webui" based on the selection of the dropdown?

Related

How to use conditions in OpenAPI Generator's Mustache templates?

I'm using OAS3 generator for Java as a Maven plugin to generate POJOs, controllers, delegates etc for my APIs with the Mustache templates from the openapi-generator repository: https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/JavaSpring/apiController.mustache
I'm trying to edit this template so that the "#Controller" annotation is generated only if a condition is met. I've searched for multiple solutions for this and one of them was using "vendorExtensions".
I've made the following contract with x-generateController vendorExtension:
openapi: 3.0.0
info:
title: User API
description: API for user changes
contact:
name: xxx
url: xxx
email: xxx
license:
name: xxx
url: xxx
version: 1.0.0
tags:
- name: user
x-generateController: True
paths:
/users:
...
And then in the Mustache template file I have put the following:
{{#vendorExtensions.x-generateController}}
#Controller("{{classname}}")
{{/vendorExtensions.x-generateController}}
The generator works just fine without this condition but it seems like it doesn't take into account x-generateController. In fact, if I try to just place it as a comment like this:
// {{vendorExtensions.x-generateController}}
I get only "// " and an empty space. I've also tried putting it at the "endpoint level" and not in the "info level" and the problem is the same.
Is there anything more that I should've done in the configuration? Is there any alternative for a condition in the Mustache template?

Loki groups rules get content log

I want to notify when a log type error occurs and send its log content, will it be possible to add it in the labels or annotations of the loki rules and send it to alertmanager?
This would be my test rule, but I still don’t see how to add the content of the registry
groups:
- name: rate-alerting
rules:
- alert: testRule
expr: |
sum by (message)
(rate({app="_development"} | json | level = "error"[1m] ))
> 0.02
for: 1m
labels:
severity:...
team: ...
category: ...
annotations:
title: "title Alert"
description: "content log"
I would like to be able to obtain the content of the log to be able to notify it
You are groupping by message, so you can use it in the annotation, e.g:
annotations:
description: "{{ $labels.message }}"
Whole log line is not available in your query, so you can't use it.

Create Github Actions choice input options with key and value

I want to create a GitHub Action that manually runs database migrations for different environments.
On the documentation I found a way to set the data source URL using option inputs, as follows
workflow_dispatch:
inputs:
dataSourceUrl:
description: 'Data source URL for each environment'
required: true
type: choice
options:
- jdbc:postgresql://10.xxx.xxx.xx:5433/database_dev
- jdbc:postgresql://10.xxx.xxx.xx:5433/database_test
- jdbc:postgresql://10.xxx.xxx.xx:5433/database_stage
- jdbc:postgresql://10.xxx.xxx.xx:5433/database
But the best way I image doing it would be if the options were a key/value pair, so on the GitHub UI it would show options like Dev, Tests, Stage and Prod instead of the URL.
Would be something like:
options:
- option1:
- key: dev
- value: jdbc:postgresql://10.xxx.xxx.xx:5433/database_dev
- option2:
- key: test
- value: jdbc:postgresql://10.xxx.xxx.xx:5433/database_test
Does anyone knows how I can do that?

Custom field name not showing in Filebeat

Below is how im trying to add a custom fiels name in my filebeat 7.2.0
filebeat.inputs:
- type: log
enabled: true
paths:
- D:\Oasis\Logs\Admin_Log\*
- D:\Oasis\Logs\ERA_Log\*
- D:\OasisServices\Logs\*
processors:
- add_fields:
fields:
application: oasis
and with this, im expecting a new field called application whose data entries will be 'oasis'.
But i dont get any.
I also tried
fields:
application: oasis/'oasis'
Help me with this.
If you want to add a customized field for every log, you should put the "fields" configuration in the same level of type. Try the following:
- type: log
enabled: true
paths:
- D:\Oasis\Logs\Admin_Log\*
- D:\Oasis\Logs\ERA_Log\*
- D:\OasisServices\Logs\*
fields.application: oasis
There are two ways to add custom fields on filebeat, using the fields option and using the add_fields processor.
To add fields using the fields option, your configuration needs to be something like the one below.
filebeat.inputs:
- type: log
paths:
- 'D:/path/to/your/files/*'
fields:
custom_field: 'custom field value'
fields_under_root: true
To add fields using the add_fields processor, you can try the following configuration.
filebeat.inputs:
- type: log
paths:
- 'D:/path/to/your/files/*'
processors:
- add_fields:
target: ''
fields:
custom_field: 'custom field value'
Both configurations will create a field named custom_field with the value custom field value in the root of your document.
The fields option can be used per input and the add_fields processor is applied to all the data exported by the filebeat instance.
Just remember to pay attention to the indentation of your configuration, if it is wrong filebeat won't work correctly or even start.

Do AWS-SAM templates support lifecycleconfiguration settings?

Does anyone know if SAM templates support Lifecycleconfigruation settings? I see within standard cloudformation definitions you can define the lifecycle of objects like:
BucketName: "Mys3Bucket"
LifecycleConfiguration:
Rules:
- AbortIncompleteMultipartUpload:
DaysAfterInitiation: 7
Status: Enabled
- ExpirationInDays: 14
...
But this seems to fail when used in a SAM template. Am I doing something wrong or is this not part of the serverless application model definition?
It works for me using the SAM CLI 1.15.0, although documentation seems sparse (hence my landing on this question while trying to figure it out).
The SAM template snippet below successfully creates a bucket and sets an appropriate lifecycle rule.
Resources:
Bucket1:
Type: 'AWS::S3::Bucket'
Properties:
BucketName: !Sub "${BucketName}"
AccessControl: Private
VersioningConfiguration:
Status: Enabled
LifecycleConfiguration:
Rules:
- ExpirationInDays: 6
Status: Enabled