-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Karate-Tools] Initial OSS Release (4.0.0)
- Loading branch information
Showing
864 changed files
with
100,054 additions
and
201 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Auto detect text files and perform LF normalization | ||
* text=auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
name: Bug Report | ||
about: Use this template to report a bug | ||
title: '' | ||
labels: kind/bug | ||
assignees: '' | ||
|
||
--- | ||
|
||
### Detailed description | ||
|
||
A clear and concise description of what the problem is. | ||
|
||
### Expected behaviour | ||
|
||
Expected behaviour one the problem is fixed. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
name: Feature request | ||
about: Suggest an idea/feature for this project | ||
title: '' | ||
labels: 'kind/feature' | ||
assignees: '' | ||
|
||
--- | ||
|
||
### Motivation | ||
|
||
Describe here the motivation of the request. | ||
|
||
### Acceptance criteria | ||
|
||
- [ ] A check list of tasks to be done to assume the issue addressed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# PR Checklist | ||
|
||
Please check if your PR fulfills the following requirements: | ||
|
||
- [ ] Tests for the changes have been added (for bug fixes / features) | ||
- [ ] Docs have been added / updated (for bug fixes / features) | ||
|
||
## PR Type | ||
|
||
What kind of change does this PR introduce? | ||
|
||
<!-- Please check the one that applies to this PR using "x". --> | ||
|
||
- [ ] Bugfix | ||
- [ ] Feature | ||
- [ ] Other... Please describe: | ||
|
||
## What is the current behavior? | ||
<!-- Please describe the current behavior that you are modifying, or link to a relevant issue. --> | ||
|
||
Issue Number: N/A | ||
|
||
## What is the new behavior? | ||
|
||
## Does this PR introduce a breaking change? | ||
|
||
- [ ] Yes | ||
- [ ] No | ||
|
||
<!-- If this PR contains a breaking change, please describe the impact and migration path for existing applications below. --> | ||
|
||
## Other information |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"env": { | ||
"commonjs": true, | ||
"es6": true, | ||
"jest": true, | ||
"node": true | ||
}, | ||
"extends": "eslint:recommended", | ||
"globals": { | ||
"Atomics": "readonly", | ||
"SharedArrayBuffer": "readonly" | ||
}, | ||
"parserOptions": { | ||
"ecmaVersion": 2018 | ||
}, | ||
"rules": { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
nodejs 20.10.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
# Configuration Resolver | ||
|
||
Resolves configuration properties from a bunch of different sources (files, environment variables, action inputs, etc.) using a hierarchical property precedence and merge. | ||
|
||
## An Use Case | ||
Image you have a configuration file (yaml) with: | ||
|
||
```yaml | ||
superproperty: super value | ||
``` | ||
and you want to be able to "override" this property, from an environment variable, or better, from your workflow input. Then, you can use it as: | ||
```yaml | ||
#... your workflow inputs ... | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
SUPERPROPERTY: | ||
description: 'This is your super property' | ||
required: true | ||
default: 'DEFAULT' # It means, get the value if found on a file | ||
#... your workflow code ... | ||
- name: Resolve Configuration | ||
id: config | ||
uses: ./.github/actions/resolvers/config-resolver | ||
with: | ||
files: | | ||
your_properties_file.yml | ||
input-vars: "${{ toJSON(github.event.inputs) }}" # it injects all workflows inputs | ||
#... more workflow code ... | ||
``` | ||
|
||
Then, if you leaves the `SUPERPROPERTY`input to "DEFAULT" when running your workflow, the value of `steps.config.outputs.config.superproperty` will be the value on the file as `super value`. But, if you provided `SUPERPROPERTY` input value to "Override value" then, `steps.config.outputs.config.superproperty` value will be "Override value". | ||
|
||
You will found also, an specific high-level output for input properties on `steps.config.outputs.inputs`, so in the latest example, you can get the value from `steps.config.outputs.inputs.SUPERPROPERTY`. | ||
|
||
## About Merging precedence | ||
|
||
The "merging" precedence it's on the **order** in which you provide the input files to the action. It means, if you have two files with same property defined, the latest provided file will set the property value. | ||
|
||
```yaml | ||
# file one.yml | ||
myproperty: value one | ||
# file two.yml | ||
myproperty: value two | ||
# Action call | ||
- name: Resolve Configuration | ||
id: config | ||
uses: ./.github/actions/resolvers/config-resolver | ||
with: | ||
files: | | ||
one.yml | ||
two.yml | ||
# value of myproperty on steps.config.outputs.config.myproperty will be "value two" | ||
``` | ||
|
||
## [Inputs](#inputs) | ||
|
||
- [files](#files) | ||
- [search-string](#search-string) | ||
- [input-vars](#input-vars) | ||
- [indentation-char](#indentation-char) | ||
- [debug](#debug) | ||
- [create-annotations](#create-annotations) | ||
|
||
## [Outputs](#outputs) | ||
|
||
- [inputs](#inputs) | ||
- [config](#config) | ||
|
||
## [Examples usage](#examples) | ||
|
||
<h2 style="font-weight: bold" id="inputs">Inputs</h2> | ||
|
||
<h3 style="font-weight: bold" id="search-string">search-string</h3> | ||
|
||
**Required** Default to "DEFAULT" (literal). | ||
If an input var contains this literal, it means that a value will be searched in configuration files and get that value. **Warning**: if set as literal but value is not found in configuration files, the action **will fail**. | ||
If an input value doesn't contains this literal, then, the value is returned as-is. | ||
|
||
<h3 style="font-weight: bold" id="files">files</h3> | ||
|
||
**Required** List of files (one on each line) to load into the output JSON object. | ||
It has to be specified as long-string `: |` crlf separated. | ||
|
||
<h3 style="font-weight: bold" id="input-vars">input-vars</h3> | ||
|
||
**OPTIONAL** List of variables in format KEY=VALUE. Key can contains indentation-char. | ||
**IF** variable contains `input-trigger-string` it means that a value will be searched in configuration files and get that value. **Warning**: if set as literal but value is not found in configuration files, the action **will fail**. | ||
If an input value doesn't contains this `input-trigger-string`, then, the value is returned as-is. | ||
|
||
<h3 style="font-weight: bold" id="indentation-char">indentation-char</h3> | ||
|
||
**OPTIONAL** Indentation token in input-vars variable names. Default value is "_" | ||
|
||
<h3 style="font-weight: bold" id="create-annotations">create-annotations</h3> | ||
|
||
**OPTIONAL** Specify if action should create annotations into the run. Default value is `false`. Since theres a limit on the amount of annotations per run, and since as much annotations the hardest to search them into the Run screen, use it carefuly. | ||
Current annotations are: | ||
* Config-Resolver:: Input-Vars (inputs.input-vars) | ||
* Config-Resolver:: Resolved Inputs (outputs.inputs) | ||
* Config-Resolver:: Resolved Configs (outputs.config) | ||
|
||
<h3 style="font-weight: bold" id="debug">debug</h3> | ||
|
||
**OPTIONAL** Specify debug mode. It adds more output. Take care, it can publish sensitive invormation if it's not properly cypher in your env variables. Default value is `false`. | ||
|
||
<h2 style="font-weight: bold" id="outputs">Outputs</h2> | ||
|
||
<h3 style="font-weight: bold" id="inputs">inputs</h3> | ||
|
||
Each variable with same name as each `input-vars` but with resolved value. | ||
|
||
<h3 style="font-weight: bold" id="config">config</h3> | ||
|
||
A JSON object that contains all the processed files as JSON objects with replaced properties from input-vars | ||
|
||
<h2 style="font-weight: bold" id="examples">Examples usage</h2> | ||
|
||
```yaml | ||
# Having jacoco.yml as | ||
# jacoco: | ||
# enabled: true | ||
# version: 8 | ||
# input-vars | ||
# JACOCO_VERIONS=9 | ||
- name: Get configurations | ||
id: test-config | ||
uses: ./.github/actions/config-resolver | ||
with: | ||
input-vars: "${{ toJSON(github.event.inputs) }}" | ||
indentation-char: "_" | ||
files: | | ||
code/config_test/e2e/test_config.yml | ||
code/config_test/e2e/jacoco.yml | ||
code/platform.yml | ||
code/application.yml | ||
- name: Using a configuration | ||
if: ${{ fromJSON(steps.test-config.outputs.config.jacoco).enabled }} # it will get true | ||
run: | | ||
# it will get 9 instead of 8 | ||
<some_command> ${{ fromJSON(steps.test-config.outputs.config.jacoco).version }} | ||
``` | ||
## Developer | ||
### Build | ||
```shell | ||
npm run prepare | ||
``` | ||
it will update everything under dist folder where the "real" action will be. | ||
|
||
### Publish | ||
|
||
After `prepare` makes sure that you commit `dist` folder changes as part of your commits. Then, just push to the repo. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Configuration Resolver | ||
description: 'Resolv configuration from files and variables' | ||
|
||
inputs: | ||
files: | ||
description: "List of files (one on each line) to load into the output JSON object" | ||
required: true | ||
input-vars: | ||
description: 'List of variables in format KEY=VALUE. Key can contains indentation-char' | ||
required: false | ||
default: "" # empty list | ||
indentation-char: | ||
description: "Indentation token in input-vars variable names" | ||
required: false | ||
default: "_" | ||
search-string: | ||
description: 'if an input var contains this value, it will look for a default value in configuratio files. It will fail if not found.' | ||
required: false | ||
default: "DEFAULT" | ||
create-annotations: | ||
description: 'Create annotations into the run that shows information about: Input Vars (from inputs.input-vars), Resolved Input Vars (from outputs.inputs) and Resolved Config (from outputs.config).' | ||
debug: | ||
description: "Specify debug mode. It adds more output. Take care, it can publish sensitive invormation if it's not properly cypher in your env variables" | ||
default: true | ||
outputs: | ||
inputs: | ||
description: "Same inputs with same name and with replaced value in case of contains search-string, same input value otherwise" | ||
config: | ||
description: "A JSON object that contains all the processed files as JSON objects with replaced properties from input-vars" | ||
runs: | ||
using: 'node20' | ||
main: 'dist/index.js' |
Oops, something went wrong.