Compare commits

...

340 Commits

Author SHA1 Message Date
Florian Hussonnois
6f1cd3d69e fix(core): fix search lookup for endDate field 2025-07-24 20:22:22 +02:00
Roman Acevedo
076434cc7c chore: remove frontend codecov in CI 2025-07-24 18:44:44 +02:00
Barthélémy Ledoux
69d2b97416 feat(flows): playground (#10042)
Co-authored-by: Loïc Mathieu <loikeseke@gmail.com>
2025-07-24 18:00:13 +02:00
Roman Acevedo
a7b07e5556 chore: update utility scripts still referencing old maven repo 2025-07-24 16:16:41 +02:00
Barthélémy Ledoux
ee6a2ae9a3 fix(flows): parse JSON when switching from string to object (#10255) 2025-07-24 15:48:52 +02:00
Florian Hussonnois
e36925c879 fix(system): fix and cleanup StorageInterface (kestra-io/kestra-ee#4488)
Allow tenantId to be null in storage for cluster-wide
operations on object storage

Related-to: kestra-io/kestra-ee#4488
2025-07-24 15:40:00 +02:00
Piyush Bhaskar
df63fc56fc fix(ai): shortcut to submit and for newline (#10325) 2025-07-24 19:01:18 +05:30
Loïc Mathieu
eb22d3f6ee feat(logs): allow purging log by execution ID
Part-of: https://github.com/kestra-io/kestra-ee/issues/4468
2025-07-24 15:12:27 +02:00
Roman Acevedo
150145692f fix(cli): tenantService was injected directly, this is not working in cli 2025-07-24 13:56:04 +02:00
Roman Acevedo
a900d8f5bb fix(cli): when picoli was throwing InitializationException the java process was not stopped 2025-07-24 13:56:04 +02:00
Loïc Mathieu
3e70aacb9c fix(executions): breakpoint on ForEach
We should be able to put a breakpoint without value, easier for the playground
2025-07-24 13:46:51 +02:00
Piyush Bhaskar
31658a1862 fix(core): prevent default if suggestion is active (#10320) 2025-07-24 16:18:25 +05:30
Miloš Paunović
694ee7ed86 chore(deps): regular dependency update (#10314)
Performing a weekly round of dependency updates in the NPM ecosystem to keep everything up to date.
2025-07-24 12:09:22 +02:00
Piyush Bhaskar
83fb225577 fix(executions): update query parameter for state filtering (#10315) 2025-07-24 14:40:24 +05:30
Miloš Paunović
1d89f53526 chore(flows): show small execution charts on flow listing (#10054)
Co-authored-by: YannC. <ycoornaert@kestra.io>
2025-07-24 10:18:27 +02:00
Roman Acevedo
6d72804a54 fix(filters): left menu current page disabling was not working
- fixes https://github.com/kestra-io/kestra/issues/9476
2025-07-24 10:01:52 +02:00
Piyush Bhaskar
26bd7dab97 fix(core): check null uri (#10309) 2025-07-24 12:46:15 +05:30
dependabot[bot]
1925d7832c build(deps): bump axios in /ui in the npm_and_yarn group (#10305)
Bumps the npm_and_yarn group in /ui with 1 update: [axios](https://github.com/axios/axios).


Updates `axios` from 1.10.0 to 1.11.0
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/v1.10.0...v1.11.0)

---
updated-dependencies:
- dependency-name: axios
  dependency-version: 1.11.0
  dependency-type: direct:production
  dependency-group: npm_and_yarn
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-07-24 08:42:03 +02:00
Piyush Bhaskar
379649785d fix(secrets): show namespace column (#10222)
* fix(secrets): show namespace column

* fix(secrets): update condition
2025-07-24 11:02:41 +05:30
Roman Acevedo
302ec94bee feat(tests): testsuite run persistence 2025-07-23 20:16:03 +02:00
Malaydewangan09
02f97dfd88 feat(*): add new plugins 2025-07-23 19:52:51 +05:30
dependabot[bot]
ac9f44b766 build(deps): bump flyingSaucerVersion from 9.13.0 to 9.13.1
---
updated-dependencies:
- dependency-name: org.xhtmlrenderer:flying-saucer-core
  dependency-version: 9.13.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: org.xhtmlrenderer:flying-saucer-pdf
  dependency-version: 9.13.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-23 16:18:32 +02:00
dependabot[bot]
c287304264 build(deps): bump com.google.cloud:libraries-bom from 26.63.0 to 26.64.0
---
updated-dependencies:
- dependency-name: com.google.cloud:libraries-bom
  dependency-version: 26.64.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-23 16:17:37 +02:00
Loïc Mathieu
6510cdfbdc fix(core): revert unwanted changes
These changes should not have been added to https://github.com/kestra-io/kestra/pull/10230.

They have not been properly tested even if they seem to be meaningful
2025-07-23 16:16:39 +02:00
dependabot[bot]
298e9f3ab7 build(deps): bump com.microsoft.playwright:playwright
---
updated-dependencies:
- dependency-name: com.microsoft.playwright:playwright
  dependency-version: 1.54.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-23 15:37:11 +02:00
Nicolas K.
45291eb2c4 fix(cli): #10062 add tenant to load flows properly at the startup (#10290)
* fix(cli): #10062 add tenant to load flows properly at the startup

* fix(cli): #10062 add fallback tenant to ee service

* fix(cli): #10062 use tenant id in all cli

---------

Co-authored-by: nKwiatkowski <nkwiatkowski@kestra.io>
2025-07-23 15:36:10 +02:00
dependabot[bot]
ebd47b31b1 build(deps): bump software.amazon.awssdk:bom from 2.32.1 to 2.32.6
Bumps software.amazon.awssdk:bom from 2.32.1 to 2.32.6.

---
updated-dependencies:
- dependency-name: software.amazon.awssdk:bom
  dependency-version: 2.32.6
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-23 15:35:36 +02:00
dependabot[bot]
48a3a3cbbf build(deps): bump jacksonVersion from 2.19.1 to 2.19.2
Bumps `jacksonVersion` from 2.19.1 to 2.19.2.

Updates `com.fasterxml.jackson:jackson-bom` from 2.19.1 to 2.19.2
- [Commits](https://github.com/FasterXML/jackson-bom/compare/jackson-bom-2.19.1...jackson-bom-2.19.2)

Updates `com.fasterxml.jackson.core:jackson-core` from 2.19.1 to 2.19.2
- [Commits](https://github.com/FasterXML/jackson-core/compare/jackson-core-2.19.1...jackson-core-2.19.2)

Updates `com.fasterxml.jackson.core:jackson-databind` from 2.19.1 to 2.19.2
- [Commits](https://github.com/FasterXML/jackson/commits)

Updates `com.fasterxml.jackson.core:jackson-annotations` from 2.19.1 to 2.19.2
- [Commits](https://github.com/FasterXML/jackson/commits)

Updates `com.fasterxml.jackson.module:jackson-module-parameter-names` from 2.19.1 to 2.19.2
- [Commits](https://github.com/FasterXML/jackson-modules-java8/compare/jackson-modules-java8-2.19.1...jackson-modules-java8-2.19.2)

Updates `com.fasterxml.jackson.dataformat:jackson-dataformat-yaml` from 2.19.1 to 2.19.2
- [Commits](https://github.com/FasterXML/jackson-dataformats-text/compare/jackson-dataformats-text-2.19.1...jackson-dataformats-text-2.19.2)

Updates `com.fasterxml.jackson.dataformat:jackson-dataformat-smile` from 2.19.1 to 2.19.2
- [Commits](https://github.com/FasterXML/jackson-dataformats-binary/compare/jackson-dataformats-binary-2.19.1...jackson-dataformats-binary-2.19.2)

Updates `com.fasterxml.jackson.dataformat:jackson-dataformat-cbor` from 2.19.1 to 2.19.2
- [Commits](https://github.com/FasterXML/jackson-dataformats-binary/compare/jackson-dataformats-binary-2.19.1...jackson-dataformats-binary-2.19.2)

Updates `com.fasterxml.jackson.dataformat:jackson-dataformat-ion` from 2.19.1 to 2.19.2
- [Commits](https://github.com/FasterXML/jackson-dataformat-ion/commits)

Updates `com.fasterxml.jackson.dataformat:jackson-dataformat-xml` from 2.19.1 to 2.19.2
- [Commits](https://github.com/FasterXML/jackson-dataformat-xml/compare/jackson-dataformat-xml-2.19.1...jackson-dataformat-xml-2.19.2)

Updates `com.fasterxml.jackson.datatype:jackson-datatype-guava` from 2.19.1 to 2.19.2
- [Commits](https://github.com/FasterXML/jackson-datatypes-collections/compare/jackson-datatypes-collections-2.19.1...jackson-datatypes-collections-2.19.2)

Updates `com.fasterxml.jackson.datatype:jackson-datatype-jsr310` from 2.19.1 to 2.19.2

Updates `com.fasterxml.jackson.datatype:jackson-datatype-jdk8` from 2.19.1 to 2.19.2

---
updated-dependencies:
- dependency-name: com.fasterxml.jackson:jackson-bom
  dependency-version: 2.19.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.fasterxml.jackson.core:jackson-core
  dependency-version: 2.19.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.fasterxml.jackson.core:jackson-databind
  dependency-version: 2.19.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.fasterxml.jackson.core:jackson-annotations
  dependency-version: 2.19.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.fasterxml.jackson.module:jackson-module-parameter-names
  dependency-version: 2.19.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.fasterxml.jackson.dataformat:jackson-dataformat-yaml
  dependency-version: 2.19.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.fasterxml.jackson.dataformat:jackson-dataformat-smile
  dependency-version: 2.19.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.fasterxml.jackson.dataformat:jackson-dataformat-cbor
  dependency-version: 2.19.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.fasterxml.jackson.dataformat:jackson-dataformat-ion
  dependency-version: 2.19.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.fasterxml.jackson.dataformat:jackson-dataformat-xml
  dependency-version: 2.19.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.fasterxml.jackson.datatype:jackson-datatype-guava
  dependency-version: 2.19.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.fasterxml.jackson.datatype:jackson-datatype-jsr310
  dependency-version: 2.19.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.fasterxml.jackson.datatype:jackson-datatype-jdk8
  dependency-version: 2.19.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-23 15:34:08 +02:00
dependabot[bot]
fc7b7738bd build(deps): bump com.mysql:mysql-connector-j from 8.0.33 to 9.3.0
Bumps [com.mysql:mysql-connector-j](https://github.com/mysql/mysql-connector-j) from 8.0.33 to 9.3.0.
- [Changelog](https://github.com/mysql/mysql-connector-j/blob/release/9.x/CHANGES)
- [Commits](https://github.com/mysql/mysql-connector-j/compare/8.0.33...9.3.0)

---
updated-dependencies:
- dependency-name: com.mysql:mysql-connector-j
  dependency-version: 9.3.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-23 15:33:48 +02:00
dependabot[bot]
06ffa6602b build(deps): bump commons-io:commons-io from 2.19.0 to 2.20.0
---
updated-dependencies:
- dependency-name: commons-io:commons-io
  dependency-version: 2.20.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-23 15:33:10 +02:00
Piyush Bhaskar
1336cca81a refactor(template): migrate template module to pinia (#10226) 2025-07-23 18:33:38 +05:30
Loïc Mathieu
f0ab8a3067 fix(system)*: don't mix constructor injection with field injection
Field injection are resolved after constructor injection so setting threadCount was never used.
2025-07-23 13:31:06 +02:00
github-actions[bot]
3cfd5ebe4d chore(core): localize to languages other than english (#10291)
Extended localization support by adding translations for multiple languages using English as the base. This enhances accessibility and usability for non-English-speaking users while keeping English as the source reference.

Co-authored-by: GitHub Action <actions@github.com>
2025-07-23 16:39:21 +05:30
Piyush Bhaskar
f97ad45cef feat(execution): "Debug Expression" for Trigger Variables (#10242)
* feat(execution): "Debug Expression" for Trigger Variables

* fix(ui): improve layout and text.

---------

Co-authored-by: Miloš Paunović <paun992@hotmail.com>
2025-07-23 16:00:33 +05:30
Piyush Bhaskar
2a9a0c7484 fix(executions): fixes file preview (#10252)
* fix(executions): fixes file preview

* fix: remove stored file preview

---------

Co-authored-by: Bart Ledoux <bledoux@kestra.io>
2025-07-23 15:49:17 +05:30
Piyush Bhaskar
9eeffa089c chore(version): bump ui-libs to version 0.0.222 (#10285) 2025-07-23 12:46:03 +05:30
YannC
19df58c6da feat: hide community button on EE edition (#10251) 2025-07-23 08:57:19 +02:00
Piyush Bhaskar
d190522bfd fix(executions): fixes execution selection action button (#10257) 2025-07-23 12:00:17 +05:30
Loïc Mathieu
cbd48b0075 chore(plugins): rename Langchain4j plugin to AI 2025-07-22 16:07:27 +02:00
YannC
ea1603f051 feat(pebble): create a in expression to look for a string in a list (#9817)
* feat(pebble): create a in expression to look for a string in a list

close #9813
2025-07-22 15:43:25 +02:00
YannC
d24f6059d9 chore(test): Improved TestsUtils and added more tests for coverage in… (#9776)
* chore(test): Improved TestsUtils and added more tests for coverage in ExecutionControllerRunnerTest

* fix: revert testUtils + reduce sleep time

* fix: replace 2s sleep to 250ms
2025-07-22 15:08:49 +02:00
YannC.
12c8db40ae feat: action to check if tag is latest in github release 2025-07-22 14:45:38 +02:00
Piyush Bhaskar
3660e1a990 fix(logs): update query filter to show logs ns and flowwise (#10248) 2025-07-22 17:54:20 +05:30
Miloš Paunović
ca96c7b5dc fix(namespaces)*: prevent overwriting namespace file content with undefined string (#10247) 2025-07-22 14:23:44 +02:00
bishalbera
d9bdcc5b20 feat(cli): added skip-deprecated flag in plugindoc command 2025-07-22 13:38:48 +02:00
Piyush Bhaskar
c31fae4cc9 fix(triggers): ensure clearing the selection. (#10245) 2025-07-22 15:58:49 +05:30
Miloš Paunović
87480d81b8 chore(core): add missing translation key/value pairs (#10243) 2025-07-22 11:44:53 +02:00
Nicolas K.
251a821322 fix(repositories): make filter service protected (#10241)
Co-authored-by: nKwiatkowski <nkwiatkowski@kestra.io>
2025-07-22 11:36:57 +02:00
dependabot[bot]
3d0b2b7f01 build(deps): bump the npm_and_yarn group in /ui with 3 updates (#10236)
---
updated-dependencies:
- dependency-name: vue-i18n
  dependency-version: 11.1.10
  dependency-type: direct:production
  dependency-group: npm_and_yarn
- dependency-name: "@intlify/core-base"
  dependency-version: 11.1.10
  dependency-type: indirect
  dependency-group: npm_and_yarn
- dependency-name: form-data
  dependency-version: 4.0.4
  dependency-type: indirect
  dependency-group: npm_and_yarn
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-07-22 10:37:07 +02:00
Miloš Paunović
0811258d2e fix(executions): make sure outputs do not overflow over right drawer (#10238)
Closes https://github.com/kestra-io/kestra/issues/10232.
2025-07-22 10:12:02 +02:00
Loïc Mathieu
aecd4cc5dd fix(tests): strengthen awaitExecution predicate
In some test situation, awaitExecution may receive old messages so we strenghten the predicate to be sure to wait for the correct execution: the one that ends successfully
2025-07-22 10:08:00 +02:00
YannC.
b1d41f6f47 fix: handle label filter with and instead or for flow
close #4390
2025-07-22 09:42:45 +02:00
Piyush Bhaskar
a9d215996b fix(core): do not show release notes button for ee specific plugins (#10235)
* fix(core): do not show button for ee specific plugins

* fix(core): refactor for improved readability
2025-07-22 12:16:49 +05:30
Emil Shakirov
812c8b5718 feat(core): add a Pebble function to generate KSUID 2025-07-21 18:17:58 +02:00
Nicolas K.
bc3d534ba6 fix(pebble): #8953 add more flexible day number conversion method (#10205)
Co-authored-by: nKwiatkowski <nkwiatkowski@kestra.io>
2025-07-21 15:25:09 +02:00
Roman Acevedo
ef4f1bdd1f fix(flows): remove flows date filters UI, they do not exist
- fixes https://github.com/kestra-io/kestra/issues/10201
2025-07-21 12:46:35 +02:00
Loïc Mathieu
6bc1e3ec4d fix(executions)*: restart with finally or afterExecution
When a flow fail and is restarted and contains either a finally or an afterExecution block, those are not resetted so the restart will skip all task and terminate the flow.
The fix will reset the status of those tasks so they are restarted.

Fixes #10155
2025-07-21 12:21:25 +02:00
skayliu
80d394fd6a fix(pebble): fix typo 2025-07-21 12:17:18 +02:00
skayliu
30c4f11b8a fix(pebble): fix typo 2025-07-21 12:17:18 +02:00
skayliu
7bd21887d1 feat(pebble): add millisecond date time format 2025-07-21 12:17:18 +02:00
Roman Acevedo
770438eb66 feat(tests): use Flow YAML autocompletion
- fixes https://github.com/kestra-io/kestra-ee/issues/3900
2025-07-21 11:50:42 +02:00
github-actions[bot]
a8838102ec chore(core): localize to languages other than english (#10221)
Extended localization support by adding translations for multiple languages using English as the base. This enhances accessibility and usability for non-English-speaking users while keeping English as the source reference.

Co-authored-by: GitHub Action <actions@github.com>
2025-07-21 11:15:10 +02:00
Piyush Bhaskar
19161cc078 feat(core): update titles , add button slot for license (#10218) 2025-07-21 13:31:45 +05:30
Piyush Bhaskar
6c48571101 feat(core): implement backend validation for login for configs and also fixes PH event (#10196)
* feat(core): implement backend validation for login for configs

* fix(auth): simplify authentication check  and api route

* fix: access auth properly

Co-authored-by: Barthélémy Ledoux <bledoux@kestra.io>

* fix(ui): improve  auth validation handling and routing

* fix(core): fixes PH event  and initialization for setup process.

---------

Co-authored-by: Barthélémy Ledoux <bledoux@kestra.io>
2025-07-21 13:21:17 +05:30
Loïc Mathieu
c09dafca01 fix(executions): support unicode file name inside the internal storage
Fixes #9550
2025-07-21 09:51:07 +02:00
yuri1969
3a3dadd8e9 fix(tests): timezone issue
Test failed at certain moments when runnin in a non-`Europe/Lisbon` TZ.
2025-07-21 09:03:21 +02:00
skayliu
68c1abb6f2 chore(deps): relocate mysql driver 2025-07-18 12:29:43 +02:00
skayliu
cfea378104 refactor(pebble): Stronger the uuid function from v4 to v7 2025-07-18 12:29:43 +02:00
Barthélémy Ledoux
d1badab05b fix(core): check if logged in before requesting usages (#10194)
* fix(core): check if logged in before requesting usages

* fix: avoid calls to get resources when auth not initialized yet
2025-07-18 15:37:49 +05:30
Nicolas K.
581442c427 feat(security) #10180 open basic auth validation endpoint (#10190)
* feat(security) #10180 open basic auth validation endpoint

* feat(security) #10180 add unit test

---------

Co-authored-by: nKwiatkowski <nkwiatkowski@kestra.io>
2025-07-18 11:23:30 +02:00
MilosPaunovic
02430a00b5 feat: introduce ui changes for keeping filename on file input 2025-07-18 11:16:25 +02:00
Loïc Mathieu
f7c5fd3984 feat(executions): use the uploaded file name for inputs of type FILE
Use the part name for the input ID, this is a BC.
Use the filename attribute of the part for creating the file inside the internal storage.
Detect previous usage of part name and filename and emit a deprecation warning.
2025-07-18 11:16:25 +02:00
Piyush Bhaskar
3f4b39ec4f feat(core): add troubleshooting button and doc (#10191)
* feat(core): add troubleshooting button and doc

* fix: add ?

* fix: type warn

* chore(core): localize to languages other than english (#10193)

Extended localization support by adding translations for multiple languages using English as the base. This enhances accessibility and usability for non-English-speaking users while keeping English as the source reference.

Co-authored-by: GitHub Action <actions@github.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: GitHub Action <actions@github.com>
2025-07-18 14:42:28 +05:30
Piyush Bhaskar
ddfe637828 fix(core): adjust word wrap and prevent newlines in input (#10176)
Co-authored-by: Miloš Paunović <paun992@hotmail.com>
2025-07-18 13:58:16 +05:30
Piyush Bhaskar
e09a89ac03 fix(core): update text from user to account. (#10187)
* fix(core): update text from user to account.

* chore(core): localize to languages other than english (#10188)

Extended localization support by adding translations for multiple languages using English as the base. This enhances accessibility and usability for non-English-speaking users while keeping English as the source reference.

Co-authored-by: GitHub Action <actions@github.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: GitHub Action <actions@github.com>
Co-authored-by: Miloš Paunović <paun992@hotmail.com>
2025-07-18 13:47:37 +05:30
github-actions[bot]
bbb5c2a6e0 chore(core): localize to languages other than english (#10189)
Extended localization support by adding translations for multiple languages using English as the base. This enhances accessibility and usability for non-English-speaking users while keeping English as the source reference.

Co-authored-by: GitHub Action <actions@github.com>
2025-07-18 10:07:50 +02:00
Piyush Bhaskar
bbf22d8813 fix(ai): show prompt window only if ai is enabled in configs (#10172) 2025-07-18 13:19:47 +05:30
Piyush Bhaskar
243522372d refactor(ai): migrate ai store from Vuex to Pinia (#10174) 2025-07-18 13:14:15 +05:30
Roman Acevedo
2a24e29bd9 feat(filters): prevent saving a search with duplicated label
- fixes https://github.com/kestra-io/kestra/issues/9026
2025-07-18 09:19:55 +02:00
Miloš Paunović
d7d52cba5a chore(core): move expand all buttons to the left side (#10186)
Closes https://github.com/kestra-io/kestra-ee/issues/4394.
2025-07-18 08:46:44 +02:00
MilosPaunovic
8319ad7439 feat(executions): work on the ui for execution dependencies 2025-07-17 17:45:15 +02:00
Loïc Mathieu
4996ccdefd feat(system): add a between-items timeout on all our SSE connections
This avoid potential connection leak by closing them if nothing happen inside it.
These is very unlickly to happen but as some follow endpoint may have races, for ex an execution ends between the time we fetch it and start listening to its event, this is better to add this as a safety net.
2025-07-17 17:45:15 +02:00
Loïc Mathieu
66889a3d92 feat(executions): execution dependencies
Part-of: https://github.com/kestra-io/kestra-ee/issues/4230
2025-07-17 17:45:15 +02:00
Loïc Mathieu
fc0b52dbd0 feat(executions): add execution outputs inside the expression context
Closes https://github.com/kestra-io/kestra-ee/issues/3999
2025-07-17 17:44:55 +02:00
Piyush Bhaskar
c7b9e1846e fix(core): improve handling of setup completion and display values (#10141) 2025-07-17 16:30:39 +02:00
Nicolas K.
fe485243f7 fix(security) #10133 add password validation and save error in database for the front to use (#10177)
Co-authored-by: nKwiatkowski <nkwiatkowski@kestra.io>
2025-07-17 16:29:57 +02:00
Anna Geller
8637bb847f fix(docker-compose): add info about password policy to docker compose example 2025-07-17 16:12:08 +02:00
Nicolas K.
c8d89dbdd4 fix(security) #10133 server error when no basic auth configuration persisted (#10175)
Co-authored-by: nKwiatkowski <nkwiatkowski@kestra.io>
2025-07-17 15:28:15 +02:00
Miloš Paunović
71e3b19f02 chore(core): add back the missing translation keys (#10170) 2025-07-17 13:04:33 +02:00
Miloš Paunović
5457c216c8 chore(core): remove non-matching translation keys (#10169) 2025-07-17 13:01:10 +02:00
github-actions[bot]
aa2d88fcbb chore(core): localize to languages other than english (#10160)
Extended localization support by adding translations for multiple languages using English as the base. This enhances accessibility and usability for non-English-speaking users while keeping English as the source reference.

Co-authored-by: GitHub Action <actions@github.com>
2025-07-17 12:31:16 +02:00
Piyush Bhaskar
393faed512 fix(plugins): adjust font sizes for collapsible body (#10164) 2025-07-17 15:29:20 +05:30
Barthélémy Ledoux
0e8e65af7c feat(flows): add setting to disable hovers in editor (#10159) 2025-07-17 10:54:04 +02:00
Piyush Bhaskar
133151377f fix(triggers): only updates the trigger that matches both flow and trigger Id (#10158) 2025-07-17 14:19:21 +05:30
Loïc Mathieu
fa2bf8fc5c feat(execution): allow to wait for execution completion into a Webhook
Closes #10147
2025-07-17 10:47:53 +02:00
Piyush Bhaskar
614c7b2226 fix(core): fixes some design tweaks for Ai Agent (#9875)
* fix(core): fixes some design tweaks for Ai Agent

* minor tweaks

* fix: show prompt only  when AI is enabled.

* fix: dark button

* remove

* fix(core): repair GlobalSearch

* fix(ai): swap shortcut to CTRL + ALT + SHIFT + K to avoid collisions

* fix: add key shortcuts in dropdown

* fix(ui): update AI width , toggle shortcut and editor top spacing

* fix: en.json

---------

Co-authored-by: brian.mulier <bmmulier@hotmail.fr>
Co-authored-by: Miloš Paunović <paun992@hotmail.com>
2025-07-17 12:48:45 +05:30
Loïc Mathieu
05cb79f4b6 feat(executions): provide a task run caching mechanism
Closes https://github.com/kestra-io/kestra-ee/issues/3580
2025-07-17 09:16:55 +02:00
Nicolas K.
278dbd8b82 fix(security) #10133 ignore enable=true flag from basic auth config (#10148)
Co-authored-by: nKwiatkowski <nkwiatkowski@kestra.io>
2025-07-16 17:28:48 +02:00
Loïc Mathieu
98d1ab57cc feat(execution): add execution ID to the latest execution
Needed for the new playground functionality.
2025-07-16 16:54:45 +02:00
Nicolas K.
f2fd9f398d fix(security) #10133 basic auth config always takes priority (#10145)
Co-authored-by: nKwiatkowski <nkwiatkowski@kestra.io>
2025-07-16 15:27:34 +02:00
Piyush Bhaskar
b72381e2cb fix(ai): refine card styles; add button disabled state colors across UI. (#10142) 2025-07-16 18:40:20 +05:30
Piyush Bhaskar
14e853ce40 refactor(store): remove unused graph store module (#10144) 2025-07-16 18:39:21 +05:30
Loïc Mathieu
7ebf5989a5 feat(flows): add an API endpoint for listing flow properties
Closes #9524

The new endpoint allow for properties only JSON schema for all base types.
2025-07-16 14:36:19 +02:00
Barthélémy Ledoux
b70faea505 refactor: migrate executions store from vuex to pinia (#10093)
Co-authored-by: Piyush-r-bhaskar <impiyush0012@gmail.com>
2025-07-16 14:14:38 +02:00
dependabot[bot]
f54ed8a488 build(deps): bump io.micrometer:micrometer-core from 1.15.1 to 1.15.2
Bumps [io.micrometer:micrometer-core](https://github.com/micrometer-metrics/micrometer) from 1.15.1 to 1.15.2.
- [Release notes](https://github.com/micrometer-metrics/micrometer/releases)
- [Commits](https://github.com/micrometer-metrics/micrometer/compare/v1.15.1...v1.15.2)

---
updated-dependencies:
- dependency-name: io.micrometer:micrometer-core
  dependency-version: 1.15.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-16 12:48:13 +02:00
dependabot[bot]
6a796b0a25 build(deps): bump com.gorylenko.gradle-git-properties
Bumps com.gorylenko.gradle-git-properties from 2.5.0 to 2.5.2.

---
updated-dependencies:
- dependency-name: com.gorylenko.gradle-git-properties
  dependency-version: 2.5.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-16 12:14:00 +02:00
Loïc Mathieu
ec7e65d794 fix(system): possible NPE when computing flowable task outputs 2025-07-16 11:22:38 +02:00
Piyush Bhaskar
0c5e190350 fix(ui): reorder collapse items and refine connection properties to show only non required in collapsed (#9673) 2025-07-16 14:49:13 +05:30
Piyush Bhaskar
1014cdefeb refactor(service): migrate service.js to pinia (#9760)
* refactor(service): migrate service.js to pinia

* fix scope of i18n

Co-authored-by: Barthélémy Ledoux <bledoux@kestra.io>

---------

Co-authored-by: Barthélémy Ledoux <bledoux@kestra.io>
2025-07-16 14:48:51 +05:30
Loïc Mathieu
efdc29f30a feat(executions): add preview for local files and namespace fles
Closes #9740
2025-07-16 11:05:13 +02:00
dependabot[bot]
a44b7f78fb build(deps): bump org.opensearch.client:opensearch-java
---
updated-dependencies:
- dependency-name: org.opensearch.client:opensearch-java
  dependency-version: 3.2.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-16 10:57:57 +02:00
Bart Ledoux
90eb0ffa4f fix: basePath is now a function 2025-07-16 10:27:33 +02:00
dependabot[bot]
85b5002acf build(deps): bump org.apache.logging.log4j:log4j-to-slf4j
Bumps org.apache.logging.log4j:log4j-to-slf4j from 2.25.0 to 2.25.1.

---
updated-dependencies:
- dependency-name: org.apache.logging.log4j:log4j-to-slf4j
  dependency-version: 2.25.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-16 09:54:02 +02:00
dependabot[bot]
4fd66d7781 build(deps): bump com.vanniktech.maven.publish from 0.33.0 to 0.34.0
Bumps [com.vanniktech.maven.publish](https://github.com/vanniktech/gradle-maven-publish-plugin) from 0.33.0 to 0.34.0.
- [Release notes](https://github.com/vanniktech/gradle-maven-publish-plugin/releases)
- [Changelog](https://github.com/vanniktech/gradle-maven-publish-plugin/blob/main/CHANGELOG.md)
- [Commits](https://github.com/vanniktech/gradle-maven-publish-plugin/compare/0.33.0...0.34.0)

---
updated-dependencies:
- dependency-name: com.vanniktech.maven.publish
  dependency-version: 0.34.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-16 09:53:25 +02:00
dependabot[bot]
362858e4d7 build(deps): bump org.apache.commons:commons-lang3 from 3.17.0 to 3.18.0
Bumps org.apache.commons:commons-lang3 from 3.17.0 to 3.18.0.

---
updated-dependencies:
- dependency-name: org.apache.commons:commons-lang3
  dependency-version: 3.18.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-16 09:52:56 +02:00
dependabot[bot]
06e4c9f110 build(deps): bump software.amazon.awssdk:bom from 2.31.77 to 2.32.1
Bumps software.amazon.awssdk:bom from 2.31.77 to 2.32.1.

---
updated-dependencies:
- dependency-name: software.amazon.awssdk:bom
  dependency-version: 2.32.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-16 09:52:09 +02:00
dependabot[bot]
a71e46169f build(deps): bump software.amazon.awssdk.crt:aws-crt
---
updated-dependencies:
- dependency-name: software.amazon.awssdk.crt:aws-crt
  dependency-version: 0.38.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-16 09:51:23 +02:00
Barthélémy Ledoux
4e1c4b7708 fix: curl feature needs baseUrl as a function (#10092) 2025-07-15 18:43:12 +02:00
Barthélémy Ledoux
75f5348db1 fix(executions): restore taskruns store (#10090) 2025-07-15 15:37:34 +02:00
Piyush Bhaskar
5b5b616def fix(secrets): circle masked input to replace squarefont. (#10088) 2025-07-15 19:05:24 +05:30
Miloš Paunović
ec360bd658 fix(core): remove icons from no code input selector (#10080)
Closes https://github.com/kestra-io/kestra/issues/10075.

Co-authored-by: Bart Ledoux <bledoux@kestra.io>
2025-07-15 15:05:48 +02:00
Piyush Bhaskar
4f2a37c31f fix(core): fixes user with no rights is able to access the dashboard route (#9361)
* fix(core): allow custom logo slot in sidebar.

* fix: use boolean prop instead of slot
2025-07-15 18:11:35 +05:30
Barthélémy Ledoux
90d572ef33 fix(flow): autocomplete output values in pebble editor (#10083) 2025-07-15 14:25:56 +02:00
Biplab Bera
ceecab1811 chore(executions): improve the file input dialog (#9894)
Co-authored-by: Miloš Paunović <paun992@hotmail.com>
2025-07-15 13:35:25 +02:00
Miloš Paunović
25592ec203 refactor(dashboards): minor improvements of dashboard components code (#10085) 2025-07-15 13:24:35 +02:00
github-actions[bot]
d935333c5b chore(core): localize to languages other than english (#10086)
Extended localization support by adding translations for multiple languages using English as the base. This enhances accessibility and usability for non-English-speaking users while keeping English as the source reference.

Co-authored-by: GitHub Action <actions@github.com>
2025-07-15 13:11:07 +02:00
Malay Dewangan
e2571ba523 feat(executions): Allow unqueuing to states other than RUNNING #5939 (#8381)
* feat(executions): added the ui part for being able to unqueue exeution to different state

---------

Co-authored-by: MilosPaunovic <paun992@hotmail.com>
2025-07-15 16:18:35 +05:30
Loïc Mathieu
94dc1cea25 feat(tenants): provide an endpoint that list all tenants dependencies
Part-of: https://github.com/kestra-io/kestra-ee/issues/3515
2025-07-15 12:39:17 +02:00
Piyush Bhaskar
87bb87bbbc fix(ai): update styling for Accept/Decline (#10082) 2025-07-15 16:04:30 +05:30
Miloš Paunović
47955fc3c3 fix(core): remove deprecated properties from no code task selector (#10079)
Closes https://github.com/kestra-io/kestra/issues/10077.
Closes https://github.com/kestra-io/kestra-ee/issues/4355.
2025-07-15 11:33:14 +02:00
Anusha G H
be23ac591c chore(executions): remove cancel button from resume dialog (#10051)
Co-authored-by: Anusha G H <anushah@sahaj.ai>
Co-authored-by: Miloš Paunović <paun992@hotmail.com>
2025-07-15 10:56:36 +02:00
Miloš Paunović
578e34ee17 chore(deps): update the element-plus package and remove patch file for it (#10069) 2025-07-15 10:41:06 +02:00
skayliu
05959ee28c feat(pebble): add a timestampMilli pebble function (#10064)
* feat(pebble): add a timestampMilli pebble function

* feat(test): add a timestampMilli pebble function test

* fix(docs): fix typo

* feat(docs): add a timestampMilli pebble function docs

---------

Co-authored-by: Miloš Paunović <paun992@hotmail.com>
2025-07-15 10:32:44 +02:00
Piyush Bhaskar
ae2ce394c9 fix(core): secrets as a tab. (#10072) 2025-07-15 13:30:44 +05:30
Miloš Paunović
a3fa2051ce fix(executions): add missing uuid property (#10078) 2025-07-15 08:50:46 +02:00
Anna Geller
6fb0858710 fix: basic auth commented out by default to load setup page first 2025-07-14 14:19:49 +02:00
Anna Geller
df94a248e2 fix(docker-compose): cut the removed enabled flag 2025-07-14 14:08:30 +02:00
Piyush Bhaskar
f826d9ac8e fix(ui): update label styles for better visual (#10070)
* fix(ui): update label styles for better visual

* fix: remove light color
2025-07-14 16:35:20 +05:30
Piyush Bhaskar
8d652d5185 fix(core): show plugin toc properly (#10068) 2025-07-14 12:13:01 +05:30
Piyush Bhaskar
c4680836a6 fix(ui): properly update theme switching (#10065) 2025-07-12 19:15:15 +05:30
brian-mulier-p
77f0f5bb87 fix(core): add an exception to avoid popping challenge in case of wrong credentials on login page (#10061) 2025-07-11 17:22:07 +02:00
brian-mulier-p
c68808582b fix(core): add proxy so that origin is the same as request url for workers (#10053) 2025-07-11 16:44:03 +02:00
brian-mulier-p
3a10a52320 feat(core): hide deprecated elements in doc, autocompletion (only types), nocode (#10020)
closes #7206
closes #8786
closes #9322
2025-07-11 16:41:45 +02:00
François Delbrayelle
0a6bfd1389 fix(gradle): be able to use publishToMavenLocal (#10047) 2025-07-11 16:20:20 +02:00
Piyush Bhaskar
b7201055a8 refactor(core): migrate misc store module to pinia (#10048) 2025-07-11 19:13:38 +05:30
Roman Acevedo
710f9a3373 test(e2e): include E2E tests in PR CI (#10036)
* test(e2e): include E2E tests in PR CI

* Update e2e.yml to fix report

* tests(e2e): video and trace on failure

* tests(e2e): unflaky assertion exec

* tests(e2e): slowMo 100ms
2025-07-11 14:31:10 +02:00
brian.mulier
0402362499 fix(core): strict samesite for basic auth cookie 2025-07-11 12:07:49 +02:00
brian-mulier-p
15d3caf62c fix(core): basic auth is now handled through cookies, header then challenge so that SSE sends it (#10043) 2025-07-11 10:56:12 +02:00
Loïc Mathieu
4dc1e52b08 chore(system): avoid calling allTaskWithChild when computing plugin defaults 2025-07-11 09:38:34 +02:00
Roman Acevedo
6f62988135 build: remove codecov for ui #10038
As discussed with Bart it is not helping us, it is often red and the conf is not right, and anyway he believes codecov on frontend is not easy and perfect

from Bart: Nuance: I believe that having code coverage on Frontend is a great tool to see where we should track more, but having it as a metric is very unproductive.

The only thing I care about being tested are:

if a component renders at all
what it looks like
... interactions
None of this is covered by code lines.

We could have a demand for 10% coverage of every patch and that's it.
2025-07-11 09:09:27 +02:00
Roman Acevedo
8080bbf964 test(storage): unflaky StorageTestSuite.filesByPrefix 2025-07-11 09:06:32 +02:00
Barthélémy Ledoux
565bee96c9 fix(core): login setup failures when baseUrl is empty (#10041)
Co-authored-by: Piyush-r-bhaskar <impiyush0012@gmail.com>
2025-07-10 16:29:45 +02:00
Piyush Bhaskar
44f93c0b13 fix(core): streamlining base URL creation (#10039)
* refactor(core): streamlining base URL creation

* fix: less changes

---------

Co-authored-by: Bart Ledoux <bledoux@kestra.io>
2025-07-10 19:50:04 +05:30
Loïc Mathieu
51f831586a chore(system): avoid calling TaskRun.toStringState() when not needed
This methods do a lot of potentialy big String concatenation so it's better to not call it unless necessary.
2025-07-10 16:06:39 +02:00
Loïc Mathieu
93b9932469 test(executions): improve reliability of the ExecutionControllerRunnerTest 2025-07-10 16:06:26 +02:00
Loïc Mathieu
d10b11ed1f fix(system): merge flowable outputs when terminated
A flowable may compute its outputs before it is terminated. In this case, they can be wiped out when we compute the outputs when terminated.
So we need to merge the maps.
2025-07-10 16:06:26 +02:00
Roman Acevedo
f57ab7a828 feat(tests): impl disabling testcase 2025-07-10 15:32:47 +02:00
Loïc Mathieu
b97f93f2f9 feat(system): use available processor count number of executor threads 2025-07-10 14:59:48 +02:00
Nicolas K.
8094756601 fix(security): use the login/pass of basicAuth for all api urls (#10027)
Co-authored-by: nKwiatkowski <nkwiatkowski@kestra.io>
Co-authored-by: Bart Ledoux <bledoux@kestra.io>
2025-07-10 13:51:27 +02:00
Loïc Mathieu
0de5236f8a fix(flows): possible NPE at flow validation 2025-07-10 12:40:45 +02:00
Piyush Bhaskar
1b7034d154 fix(ui): fixes color for icon and label in light theme (#10032) 2025-07-10 15:50:59 +05:30
Barthélémy Ledoux
732f1d95d7 fix: patch element plus for tabs (#10034) 2025-07-10 11:49:11 +02:00
Miloš Paunović
aa3b118cb5 feat(dashboards): implement the table data export functionality (#9911)
Co-authored-by: Roman Acevedo <roman.acevedo62@gmail.com>
2025-07-10 10:13:25 +02:00
Piyush Bhaskar
2543ad7216 fix(triggers): disable backfill execution based on yaml definition (#10026) 2025-07-10 13:35:33 +05:30
Nicolas K.
98463335aa fix(security): remove the authorization header (#10025)
Co-authored-by: nKwiatkowski <nkwiatkowski@kestra.io>
2025-07-10 09:49:07 +02:00
Nicolas K.
d46ebe2b4a fix(security): add back www-authenticate header (#10018)
* fix(security): add back www-authenticate header

* fix basic auth again

* fix: if setup is not done go to setup

* fix(security): don't persist basic auth config if already persisted

---------

Co-authored-by: nKwiatkowski <nkwiatkowski@kestra.io>
Co-authored-by: Bart Ledoux <bledoux@kestra.io>
2025-07-10 09:27:42 +02:00
Roman Acevedo
fb96fc2f05 chore(tests): add validation on assertions 2025-07-09 18:25:36 +02:00
Roman Acevedo
910bceb900 fix(webserver): server exceptions were not logged when no message
some libraries or even java code throw Exceptions with a 'null' message (but with a stacktrace), in this case our logger was not logging anything
2025-07-09 17:18:58 +02:00
Roman Acevedo
b6475d8552 feat(tests): allow disabling a TestSuite preventing it to run 2025-07-09 17:08:08 +02:00
brian-mulier-p
e136e1ca9a fix(core): trim expressions in select & multiselect to be able to use '|' instead of '>-' (#10017)
closes #10016
2025-07-09 16:36:24 +02:00
Piyush Bhaskar
0f6ae24b8e fix(ui): fixes basic auth handling (#10010)
Co-authored-by: Bart Ledoux <bledoux@kestra.io>
2025-07-09 15:18:39 +02:00
brian-mulier-p
cc7f1e25e3 feat(kv): add an optional description (#9886)
closes #9606
2025-07-09 15:08:12 +02:00
Miloš Paunović
63dbff1e7a chore(dashboards): improve chart data loading and uniform look on preview tab (#10014) 2025-07-09 14:53:23 +02:00
YannC
9c6b59c362 fix: bring back lastexecution endpoint (#9973) 2025-07-09 13:48:47 +02:00
Miloš Paunović
72341b8090 chore(core): allow displaying topology horizontally (#10012)
Closes https://github.com/kestra-io/kestra/issues/9980.
2025-07-09 13:11:17 +02:00
yuri
0c730843c6 docs(schedule): mention Sunday day-of-the-week alias (#9961) 2025-07-09 11:39:28 +02:00
Loïc Mathieu
05b50c22e3 feat(executions): allow suspending an execution at a breakpoint
- When creating an execution, you can pass a breakpoint of the form `taskId.value` and an execution kind.
- An execution with a breakpoint will be suspended in the `BREAKPOINT` state when arriving at the point where the breakpoint task should be executed
- You can resume an execution from a breakpoint, this would resume the execution and remove the existing breakpoint. At this time a new breakpoint can be passed.
- You can pass a breakpoint when replaying an execution.

Part-of: https://github.com/kestra-io/kestra-ee/issues/1547
2025-07-09 10:56:00 +02:00
dependabot[bot]
cf4f6554e6 build(deps): bump software.amazon.awssdk:bom from 2.31.75 to 2.31.77
Bumps software.amazon.awssdk:bom from 2.31.75 to 2.31.77.

---
updated-dependencies:
- dependency-name: software.amazon.awssdk:bom
  dependency-version: 2.31.77
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-09 10:55:39 +02:00
Roman Acevedo
7ec1439bb7 chore: add useful scripts for RC 2025-07-09 10:19:05 +02:00
Miloš Paunović
d1b025253a chore(deps): regular dependency update (#10011)
Performing a weekly round of dependency updates in the NPM ecosystem to keep everything up to date.
2025-07-09 10:02:12 +02:00
dependabot[bot]
aa272418cf build(deps): bump com.github.docker-java:docker-java from 3.5.2 to 3.5.3
---
updated-dependencies:
- dependency-name: com.github.docker-java:docker-java
  dependency-version: 3.5.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-09 09:22:56 +02:00
dependabot[bot]
ef098c2489 build(deps): bump aquasecurity/trivy-action from 0.31.0 to 0.32.0
Bumps [aquasecurity/trivy-action](https://github.com/aquasecurity/trivy-action) from 0.31.0 to 0.32.0.
- [Release notes](https://github.com/aquasecurity/trivy-action/releases)
- [Commits](https://github.com/aquasecurity/trivy-action/compare/0.31.0...0.32.0)

---
updated-dependencies:
- dependency-name: aquasecurity/trivy-action
  dependency-version: 0.32.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-09 09:21:47 +02:00
Devesh Kumar
c671414958 fix(flows): issue where flows with task IDs longer than the supported database column length would cause the application to shut down. 2025-07-08 17:28:06 +02:00
github-actions[bot]
6bb42641a1 chore(core): localize to languages other than english (#9975)
Extended localization support by adding translations for multiple languages using English as the base. This enhances accessibility and usability for non-English-speaking users while keeping English as the source reference.

Co-authored-by: GitHub Action <actions@github.com>
2025-07-08 16:24:28 +02:00
Loïc Mathieu
acca4ddd55 fix(system): EE compilation 2025-07-08 15:40:32 +02:00
Piyush Bhaskar
e75a4a7500 feat(ui): introducing OSS auth (#9972)
Co-authored-by: Barthélémy Ledoux <bledoux@kestra.io>
2025-07-08 15:29:58 +02:00
Nicolas K.
4afa7dc969 fix(security) #4311 filter only kestra endpoints (#9971)
Co-authored-by: nKwiatkowski <nkwiatkowski@kestra.io>
2025-07-08 15:13:33 +02:00
github-actions[bot]
c953e24931 chore(core): localize to languages other than english (#9969)
Extended localization support by adding translations for multiple languages using English as the base. This enhances accessibility and usability for non-English-speaking users while keeping English as the source reference.

Co-authored-by: GitHub Action <actions@github.com>
2025-07-08 18:19:14 +05:30
nKwiatkowski
b70545967e Merge remote-tracking branch 'origin/develop' into develop 2025-07-08 14:15:31 +02:00
Barthélémy Ledoux
02302fa54c fix(flows): autocomplete nocode outputs in pebble (#9955) 2025-07-08 14:10:11 +02:00
Nicolas K.
ff8c224554 fix(security) #4311 add basic auth whitelist for config and add new c… (#9968)
* chore(core): localize to languages other than english (#9966)

Extended localization support by adding translations for multiple languages using English as the base. This enhances accessibility and usability for non-English-speaking users while keeping English as the source reference.

Co-authored-by: GitHub Action <actions@github.com>

* fix(security) #4311 add basic auth whitelist for config and add new config parameter for basic auth initialized

* fix(security) #4311 failing unit tests

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: GitHub Action <actions@github.com>
Co-authored-by: nKwiatkowski <nkwiatkowski@kestra.io>
2025-07-08 14:02:17 +02:00
Piyush-r-bhaskar
f54c46e238 Revert "feat(core): introducing OSS authentication user creation and login logout (#9683)"
This reverts commit 97b01ab6a4.
2025-07-08 16:51:43 +05:30
github-actions[bot]
750fa4cc8c chore(core): localize to languages other than english (#9966)
Extended localization support by adding translations for multiple languages using English as the base. This enhances accessibility and usability for non-English-speaking users while keeping English as the source reference.

Co-authored-by: GitHub Action <actions@github.com>
2025-07-08 11:40:44 +02:00
Piyush Bhaskar
97b01ab6a4 feat(core): introducing OSS authentication user creation and login logout (#9683)
* feat(core): introducing OSS authentication

* use pinia

* fix: error message

* fix logo

* fix import

* fix: i18n

* feat: show dialog fter 30days and send to login page if basicauth is true

* fix: minor tweaks

* fix(ui): ensure email and password are required.
2025-07-08 14:12:32 +05:30
Nicolas K.
eafaf32938 feat(security)!: make basic auth required on OSS (#9688)
* feat(security)!: make basic auth required on OSS

* clean(security)!: put the auth filter code into a publisher

* clean(security)!: add unit tests

* fix(core): merge

---------

Co-authored-by: nKwiatkowski <nkwiatkowski@kestra.io>
2025-07-08 10:41:47 +02:00
Loïc Mathieu
6a4397fdfd fix(system): avoid creating multiple worker job queue
We created miltiple worker job queue because the bean was in the prototype scope.
This was needed only for tests as they are closing it.
Switching to singleton and rebuilding the context of the test that needs it fixes the issue.
2025-07-08 10:35:50 +02:00
YannC.
2109fa8116 fix(ci): Avoid retag latest docker image being true by default 2025-07-08 10:19:34 +02:00
Piyush Bhaskar
7de415e54f refactor(core): migrating doc store module to pinia (#9882) 2025-07-08 13:37:01 +05:30
Piyush Bhaskar
a7307b6a0c fix(ui): openGroup to directly open the first plugin element (#9964) 2025-07-08 13:36:19 +05:30
Barthélémy Ledoux
63613572a5 chore: update ui-libs for documentation collapsible warns (#9954) 2025-07-08 09:08:07 +02:00
Piyush Bhaskar
157e942499 refactor(core): migrate taskrun to Pinia (#9953)
* refactor(core): migrate taskrun to Pinia

* refactor(core): migrate taskrun to Pinia
2025-07-08 12:33:34 +05:30
Piyush Bhaskar
27d1069acd fix(ui): fixes merge snafu and warning lastExecutionByFlowReady (#9962) 2025-07-08 11:54:37 +05:30
brian-mulier-p
4a8b3d4d7d fix(plugins): plugin search is now searching in all element types (#9899) 2025-07-07 20:05:27 +02:00
Loïc Mathieu
475c8d3ce2 fix(webserver)*: bulk set labels remove existing labels
FIxes #9764
2025-07-07 15:21:47 +02:00
AJ Emerich
093ae3ae39 docs(dashboard-data): fix indentations for dashboard data plugins (#9918)
Closes https://github.com/kestra-io/kestra-ee/issues/3646
2025-07-07 15:10:17 +02:00
Piyush Bhaskar
6585d2446a fix(dashboards): include required prop to amend pages using dashboard sections component (#9949)
Co-authored-by: MilosPaunovic <paun992@hotmail.com>
2025-07-07 13:36:04 +02:00
Loïc Mathieu
2a53f55c3d fix(system): force running after execution tasks even if the execution is killed
Fixes #9852
2025-07-07 12:38:08 +02:00
Ludovic DEHON
f9b10407f0 chore(build): try to remove the noise for code coverage 2025-07-07 12:34:05 +02:00
Miloš Paunović
d63039f7f9 fix(core): introduce the missing translation key/value pairs for certain languages (#9943) 2025-07-07 12:23:31 +02:00
Miloš Paunović
3c4c1ed275 refactor(core): improve translation pull request description (#9938) 2025-07-07 12:05:09 +02:00
Miloš Paunović
ce1f8a5cc3 refactor(core): remove default reviewers on translation pull requests and add frontend team mention (#9935) 2025-07-07 12:00:17 +02:00
Miloš Paunović
c4581d1442 refactor(core): change default reviewers on translation pull requests to frontend team (#9931) 2025-07-07 11:47:32 +02:00
Miloš Paunović
5c9bb7a110 refactor(core): change default reviewers on translation pull requests (#9929) 2025-07-07 11:42:33 +02:00
Miloš Paunović
c145a0224b refactor(core): open translation pull request on the selected branch instead of develop (#9924) 2025-07-07 11:37:53 +02:00
Miloš Paunović
64121eb24d refactor(core): open translation pull request on the selected branch instead of develop (#9922) 2025-07-07 11:33:21 +02:00
Piyush Bhaskar
fdd7906412 fix(core): fix icon size and handle long title (#9916) 2025-07-07 14:58:27 +05:30
Miloš Paunović
ad87583939 refactor(dashboards): strengthen types for dashboard store module (#9917) 2025-07-07 11:24:21 +02:00
Miloš Paunović
250ada9689 refactor(core): open translation pull request on the selected branch instead of develop (#9919) 2025-07-07 11:22:58 +02:00
github-actions[bot]
e814c68703 chore(core): localize to languages other than english (#9915)
Extended localization support by adding translations for multiple languages using English as the base. This enhances accessibility and usability for non-English-speaking users while keeping English as the source reference.

Co-authored-by: GitHub Action <actions@github.com>
2025-07-07 10:58:44 +02:00
Miloš Paunović
932be71d47 chore(dashboards): improve the chart editing functionality (#9914) 2025-07-07 10:56:55 +02:00
Roman Acevedo
0c9b5222d6 fix(iam): tenant deletion raised error about mandatory tenantID in request context 2025-07-07 10:41:52 +02:00
github-actions[bot]
ad52c59f2e chore(core): localize to languages other than english (#9910)
Extended localization support by adding translations for multiple languages using English as the base. This enhances accessibility and usability for non-English-speaking users while keeping English as the source reference.

Co-authored-by: GitHub Action <actions@github.com>
2025-07-07 10:39:56 +02:00
Miloš Paunović
2e9a1478e8 chore(dashboards): add the button tooltip for dashboard edition link (#9909) 2025-07-07 10:38:06 +02:00
Florian Hussonnois
833fa56270 fix(webserver): fix reason in ErrorController (#9897)
The exception message is already included in the payload returned from the response, so we don't have to include it in the HTTP Reason phrase. This leads to a wrong error message format in the UI which is in the form {Reason}: {Error Message}. With the current code Reason=Error Message
2025-07-07 10:12:06 +02:00
Miloš Paunović
34af565257 feat(dashboards): introduce the edit icon on hover for each separate dashboard chart (#9908)
Closes https://github.com/kestra-io/kestra-ee/issues/3419.
2025-07-07 10:07:36 +02:00
Piyush Bhaskar
d61d697665 chore(flows): remove breadcrumbs (#9877)
* chore(core): remove Breadcrumbs

* chore(core): remove no code breadcrumbs related code and logic

---------

Co-authored-by: Miloš Paunović <paun992@hotmail.com>
2025-07-07 13:29:54 +05:30
yuri1969
d698ef56bf fix(cli): prevent NPE on commands defaulting to help 2025-07-07 09:22:47 +02:00
Nicolas K.
b544e257c3 feat(cicd): migrate fetching plugins to maven central (#9902)
Co-authored-by: nKwiatkowski <nkwiatkowski@kestra.io>
2025-07-04 17:15:14 +02:00
brian.mulier
2b49c88eab fix(ai): move AI popup button to right + gray placeholder
closes #9890
2025-07-04 17:05:27 +02:00
Miloš Paunović
82a8a118c0 refactor(core): simlify code in plugin documentation (#9900) 2025-07-04 16:24:32 +02:00
yuri
6d9ef2bb38 fix(cli): enforce server command validator (#7418)
With addition of the eagerly initialized BasicAuth bean the validator's order needed to be enforced.
2025-07-04 16:20:56 +02:00
Daniel Rivas
2b3324797b test(processor): add edge-case tests for ServicesFiles utility (#8828) 2025-07-04 16:17:22 +02:00
github-actions[bot]
281e1ef979 chore(core): localize to languages other than english (#9901)
Extended localization support by adding translations for multiple languages using English as the base. This enhances accessibility and usability for non-English-speaking users while keeping English as the source reference.

Co-authored-by: GitHub Action <actions@github.com>
2025-07-04 16:09:40 +02:00
Barthélémy Ledoux
3637f4f646 perf(ui): only load the schemaType once per page (#9619) 2025-07-04 15:56:20 +02:00
Barthélémy Ledoux
dfc0bcbb45 fix(ui): fix types of axios (#9676) 2025-07-04 15:40:53 +02:00
Barthélémy Ledoux
c6e01a7ecd fix(flows): bring back clear selection (#9893) 2025-07-04 15:39:13 +02:00
Piyush Bhaskar
f60cc48230 refactor(core): migrates trigger module to pinia (#9896) 2025-07-04 17:17:59 +05:30
Miloš Paunović
abc4e16372 feat(dashboards): initial work on adding buttons to chart cards (#9892)
Relates to https://github.com/kestra-io/kestra/issues/9148.
Relates to https://github.com/kestra-io/kestra/issues/9368.
Relates to https://github.com/kestra-io/kestra-ee/issues/3419.
2025-07-04 09:43:22 +02:00
Miloš Paunović
0e2d5376b7 refactor(dashboards): move the dashboard selector to proper place and clean up the code (#9883)
Relates to https://github.com/kestra-io/kestra/issues/9149.
Closes https://github.com/kestra-io/kestra/issues/9872.
2025-07-04 08:29:47 +02:00
brian.mulier
eb8c5ec494 fix(tests): move back wiremock port due to hardcoded in application.yml 2025-07-03 17:52:41 +02:00
nKwiatkowski
5d92300849 feat(cicd): #4006 add javadoc and sources to cli release 2025-07-03 14:58:40 +02:00
brian.mulier
75df4be0ef fix(core): avoid crashing AI Agent when having multiple versions of same plugin
closes #9871
2025-07-03 14:55:24 +02:00
Barthélémy Ledoux
739a873cb2 fix(flows): make sure expression can accept null values (#9876) 2025-07-03 11:55:23 +02:00
Bart Ledoux
046dc6cac8 fix(core): update some broken translations 2025-07-03 11:26:36 +02:00
Barthélémy Ledoux
ae442632a9 tests: run all tests (#9868) 2025-07-03 10:30:00 +02:00
github-actions[bot]
70622ca176 chore(core): localize to languages other than english (#9645)
Co-authored-by: GitHub Action <actions@github.com>
2025-07-03 10:15:19 +02:00
Loïc Mathieu
0c90d6d548 feat(triggers): add failOnTriggerError to create a failed execution on trigger error
Closes #7856
2025-07-03 09:55:23 +02:00
MilosPaunovic
2d27386c77 feat(flows): allow expanding all flow dependencies at once 2025-07-03 09:54:22 +02:00
Loïc Mathieu
e2c629a0d7 feat(flows): allow expanding flow dependencies
Part-of: https://github.com/kestra-io/kestra-ee/issues/4229
2025-07-03 09:54:22 +02:00
Loïc Mathieu
96163d4e6f fix(flows): Kill on cascade on SLA violation
FIxes #9801
2025-07-03 09:16:36 +02:00
YannC
6ec08bd9c8 fix!: Remove stats controllers (#9861)
* fix: Remove stats controllers

* fix: clean frontend + tests
2025-07-02 17:02:22 +02:00
brian.mulier
8691c90c9c fix(ai): short-circuit cases where relevant plugin identifier fails to identify ones 2025-07-02 16:37:48 +02:00
brian.mulier
b57e9ae7a0 fix(core): typo 2025-07-02 15:25:39 +02:00
github-actions[bot]
a61853332d chore(core): localize to languages other than english (#9862)
Extended localization support by adding translations for multiple languages using English as the base. This enhances accessibility and usability for non-English-speaking users while keeping English as the source reference.

Co-authored-by: GitHub Action <actions@github.com>
2025-07-02 18:30:18 +05:30
Piyush Bhaskar
796be656fa fix(flows): include flow count in export success message. (#9860) 2025-07-02 18:22:49 +05:30
brian.mulier
6e7f3a681a fix(tests): avoid wiremock port collision 2025-07-02 14:06:58 +02:00
Barthélémy Ledoux
665a413d84 fix(flows): open subtask from topology (#9804) 2025-07-02 13:33:30 +02:00
Piyush Bhaskar
c8e61ba3e1 refactor(core): migrates core.js to pinia (#9858)
* refactor(core): migrates core.js to pinia

* fix: remove declaration

* fix: message in axios
2025-07-02 16:44:30 +05:30
Loïc Mathieu
bf8d47f19d feat(flows): remove worker grou validation
No longer invalidate a flow if a task or a trigger set a worker group.

Closes #9808
2025-07-02 13:02:49 +02:00
Roman Acevedo
dcc5c34493 docs(tests,flows): set loosely types fields like input and variable as additional properties
this make the generated openapi spec match batter the existing API
2025-07-02 12:31:15 +02:00
dependabot[bot]
882ac34768 build(deps): bump software.amazon.awssdk:bom from 2.31.70 to 2.31.75
Bumps software.amazon.awssdk:bom from 2.31.70 to 2.31.75.

---
updated-dependencies:
- dependency-name: software.amazon.awssdk:bom
  dependency-version: 2.31.75
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-02 12:16:21 +02:00
dependabot[bot]
e236909e33 build(deps): bump com.azure:azure-sdk-bom from 1.2.35 to 1.2.36
Bumps [com.azure:azure-sdk-bom](https://github.com/azure/azure-sdk-for-java) from 1.2.35 to 1.2.36.
- [Release notes](https://github.com/azure/azure-sdk-for-java/releases)
- [Commits](https://github.com/azure/azure-sdk-for-java/compare/azure-sdk-bom_1.2.35...azure-sdk-bom_1.2.36)

---
updated-dependencies:
- dependency-name: com.azure:azure-sdk-bom
  dependency-version: 1.2.36
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-02 11:59:51 +02:00
dependabot[bot]
67518bc2cb build(deps): bump com.gradleup.shadow from 8.3.7 to 8.3.8
Bumps [com.gradleup.shadow](https://github.com/GradleUp/shadow) from 8.3.7 to 8.3.8.
- [Release notes](https://github.com/GradleUp/shadow/releases)
- [Commits](https://github.com/GradleUp/shadow/compare/8.3.7...8.3.8)

---
updated-dependencies:
- dependency-name: com.gradleup.shadow
  dependency-version: 8.3.8
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-02 11:58:27 +02:00
Miloš Paunović
05787efd90 fix(namespaces)*: take pagination into account when browsing namespace flows (#9849)
Closes https://github.com/kestra-io/kestra/issues/9805.
2025-07-02 11:47:48 +02:00
Miloš Paunović
90c74fceb2 chore(deps): regular dependency update (#9855)
Performing a weekly round of dependency updates in the NPM ecosystem to keep everything up to date.
2025-07-02 11:46:42 +02:00
dependabot[bot]
b1cad2fd93 build(deps): bump org.testcontainers:testcontainers
Bumps [org.testcontainers:testcontainers](https://github.com/testcontainers/testcontainers-java) from 1.21.2 to 1.21.3.
- [Release notes](https://github.com/testcontainers/testcontainers-java/releases)
- [Changelog](https://github.com/testcontainers/testcontainers-java/blob/main/CHANGELOG.md)
- [Commits](https://github.com/testcontainers/testcontainers-java/compare/1.21.2...1.21.3)

---
updated-dependencies:
- dependency-name: org.testcontainers:testcontainers
  dependency-version: 1.21.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-02 11:44:30 +02:00
dependabot[bot]
0687808430 build(deps): bump com.google.cloud:libraries-bom from 26.62.0 to 26.63.0
---
updated-dependencies:
- dependency-name: com.google.cloud:libraries-bom
  dependency-version: 26.63.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-02 11:42:20 +02:00
dependabot[bot]
90d30bb920 build(deps): bump com.github.docker-java:docker-java from 3.5.1 to 3.5.2
Bumps [com.github.docker-java:docker-java](https://github.com/docker-java/docker-java) from 3.5.1 to 3.5.2.
- [Release notes](https://github.com/docker-java/docker-java/releases)
- [Changelog](https://github.com/docker-java/docker-java/blob/main/CHANGELOG.md)
- [Commits](https://github.com/docker-java/docker-java/compare/3.5.1...3.5.2)

---
updated-dependencies:
- dependency-name: com.github.docker-java:docker-java
  dependency-version: 3.5.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-02 11:41:39 +02:00
dependabot[bot]
fcf5215ccc build(deps): bump flyingSaucerVersion from 9.12.1 to 9.13.0
---
updated-dependencies:
- dependency-name: org.xhtmlrenderer:flying-saucer-core
  dependency-version: 9.13.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
- dependency-name: org.xhtmlrenderer:flying-saucer-pdf
  dependency-version: 9.13.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-02 11:40:10 +02:00
dependabot[bot]
856db91609 build(deps): bump com.google.adk:google-adk from 0.1.0 to 0.2.0
---
updated-dependencies:
- dependency-name: com.google.adk:google-adk
  dependency-version: 0.2.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-02 11:39:44 +02:00
Nicolas K.
2b83fc7d4d feat(cicd): #4006 change signing method (#9854)
Co-authored-by: nKwiatkowski <nkwiatkowski@kestra.io>
2025-07-02 11:13:23 +02:00
Loïc Mathieu
d22b7e9b98 fix(system): fix ExecutionControllerRunnerTest.resumeExecutionPaused() 2025-07-02 11:00:26 +02:00
brian-mulier-p
515dbdbf54 fix(core): remove prerendering + restrict only secret function in debug expression (#9816) 2025-07-02 10:52:14 +02:00
github-actions[bot]
2735986c57 chore(core): localize to languages other than english (#9812)
Extended localization support by adding translations for multiple languages using English as the base. This enhances accessibility and usability for non-English-speaking users while keeping English as the source reference.

Co-authored-by: GitHub Action <actions@github.com>
2025-07-01 18:25:58 +02:00
brian.mulier
deb2fdcd9e fix(core): add config from backend that sends whether the AI feature is configured or not 2025-07-01 16:30:08 +02:00
brian-mulier-p
5677a6bdbe feat(core): add Pebble HTTP function (#9786)
closes kestra-io/kestra-ee#4218
2025-07-01 16:27:13 +02:00
Nicolas K.
6a8225d2fb feat(cicd): #4006 migrate to maven central (#9807)
Co-authored-by: nKwiatkowski <nkwiatkowski@kestra.io>
2025-07-01 16:17:08 +02:00
brian-mulier-p
f402aa7643 feat(core): introduce AI agent (#9733)
closes kestra-io/kestra-ee#3458
2025-07-01 15:43:54 +02:00
Miloš Paunović
65316da4e8 fix(dashboards): properly show default charts on logs page (#9800)
Closes https://github.com/kestra-io/kestra/issues/9612.
2025-07-01 15:28:43 +02:00
AJ Emerich
a152204f55 docs(dashboards): fix example indentations (#9802)
Closes https://github.com/kestra-io/kestra/issues/9790
2025-07-01 15:21:23 +02:00
Nicolas K.
c6e5cdfd93 feat(cicd): #4006 migrate sonatype to maven central (#9803)
Co-authored-by: nKwiatkowski <nkwiatkowski@kestra.io>
2025-07-01 15:00:34 +02:00
Barthélémy Ledoux
7fcf94f12a fix(flows): finish YAML_UTILS refactoring (#9795) 2025-07-01 14:29:37 +02:00
YannC.
c4082dbc1b feat(triggers): avoid clearing selection when refreshing in triggers list 2025-07-01 14:20:55 +02:00
YannC.
1d7574b155 fix(triggers): correctly replace the update triggers when disabling 2025-07-01 14:18:13 +02:00
Miloš Paunović
436b770d21 chore(dashboards): move store module from vuex to pinia (#9796) 2025-07-01 14:07:23 +02:00
Piyush Bhaskar
0e382b2492 chore(logs): remove double scrollbar on the logs page (#9670)
Co-authored-by: Miloš Paunović <paun992@hotmail.com>
2025-07-01 13:21:41 +02:00
Loïc Mathieu
47b10b4a79 feat(system): repoll immediatly when a poll returns resutls in the queue 2025-07-01 12:11:52 +02:00
Loïc Mathieu
30792302aa chore(flows): rename retry maxAttempt to maxAttemps
Keep maxAttempt as deprecated to avoid any breaking changes.

Closes #9729
2025-07-01 11:25:46 +02:00
Barthélémy Ledoux
6bcfbaa1df fix(flows): restore dag open tabs after hard refresh (#9792) 2025-07-01 10:16:02 +02:00
Barthélémy Ledoux
8d6547865d fix(flow): avoid calling icons api more than once (#9784) 2025-07-01 10:15:49 +02:00
Piyush Bhaskar
7ba0780b4f feat(core): add useDataTableActions composable (#9777)
Co-authored-by: Miloš Paunović <paun992@hotmail.com>
2025-07-01 12:40:55 +05:30
Roman Acevedo
5493f53892 fix(system): revert Property type changed to string in openapi spec
this may cause issue with jsonSchema generation. So, to not take any risk I reverted it and will do a hack in SDK
2025-06-30 18:46:35 +02:00
Roman Acevedo
39e08abf26 fix(tests): deleted db serialization was broken in recent commit 2025-06-30 18:43:22 +02:00
François Delbrayelle
ff66471f37 feat(gemini): add the plugin to .plugins 2025-06-30 17:00:02 +02:00
Loïc Mathieu
8109493f19 feat(flows): add resumed information to the Pause task
Add who resume the Pause task and when.
Part-of: https://github.com/kestra-io/kestra-ee/issues/2806
2025-06-30 16:22:34 +02:00
Barthélémy Ledoux
2b59d9ec21 refactor(ui): migrate bookmarks store to pinia (#9685) 2025-06-30 16:15:10 +02:00
brian-mulier-p
0beac5e9f2 fix(core): increase max encode size to avoid icons fetch timeout (#9782) 2025-06-30 15:40:10 +02:00
Loïc Mathieu
5f7ecba4c7 feat(flows): allow setting worker group at the flow level
Part-of: https://github.com/kestra-io/kestra-ee/issues/4141
2025-06-30 14:58:45 +02:00
Loïc Mathieu
c56f377019 fix(system)*: mitigate possible deadlock for execution delay and SLA
In case multiple instances of the executor are started, the execution delay loop and the monitoring SLA loop have a risk of duplicate execution resume or execution SLA violation computation.
This could create some race conditions and duplicate execution update.
But this may also risk to create some deadlocks as two instances of the executor may try to lock the same exection to restart it (or fail it due to SLA).
2025-06-30 14:33:06 +02:00
Miloš Paunović
9530e820e8 chore(deps): regular dependency update (#9779)
Performing a weekly round of dependency updates in the NPM ecosystem to keep everything up to date.
2025-06-30 13:21:27 +02:00
Sjoerd Smink
09adee6017 Update Request.java multiline JSON example 2025-06-30 11:21:22 +02:00
yashmurthy98
12f3e2ea68 fix(guides): crawl into sub-folders 2025-06-30 11:05:21 +02:00
rajatsingh23
8c32ff74c9 chore(dashboards): always updating chart previews on dashboard creation (#9536)
Co-authored-by: Miloš Paunović <paun992@hotmail.com>
2025-06-30 10:23:06 +02:00
François Delbrayelle
023d005e63 fix(taskrunner): abstract task runner (#9769) 2025-06-30 09:19:32 +02:00
Piyush Bhaskar
9a86bb1125 feat(core): add button to copy all logs to clipboard (#9763) 2025-06-30 11:24:48 +05:30
Piyush Bhaskar
99fca84e31 fix(ui): adjust logo in collapsed state (#9761) 2025-06-30 11:22:51 +05:30
Roman Acevedo
bfe4d7b983 fix(tests): TestSuite fields were almost all required in openapi spec 2025-06-27 17:37:58 +02:00
Roman Acevedo
31d372df55 feat(system): make Property a string in openapi spec generation
we already return Serialize as a string, we need to indicated to openapi generator that it is in fact Serialized as such
2025-06-27 17:30:20 +02:00
Roman Acevedo
70b9ddee28 fix(tests): testcases were not fully validated 2025-06-27 15:52:40 +02:00
Loïc Mathieu
d44a203bed feat(flows): supports the nsfile:// protocol
Automatically fetch namespace files from URI with the 'nsfile' scheme.
The authority allow to fetch file from another namespace.

The following has been done:
- Supports using nsfile inside `from`
- Supports using nsfile inside input files
- Supports using nsfile as a FILE input defaults
- Supports using nsfile inside the Pebble files functions

Closes: #9741
2025-06-27 15:26:38 +02:00
Roman Acevedo
2cb361a7c6 build: lower codecev default targets to make it more pertinent 2025-06-27 11:07:52 +02:00
brian.mulier
b19737f20a fix(core): remove tenant from plugins URLs 2025-06-27 10:52:28 +02:00
Nicolas K.
7373f3ee5b feat(namespaces): #3568 add new folderPerNamespace attribute to namespaceFiles (#9752)
Co-authored-by: nKwiatkowski <nkwiatkowski@kestra.io>
2025-06-27 10:46:14 +02:00
Nicolas K.
f8670ef216 feat(api): #4108 remove tenant id from trigger body and plugin URL (#9749)
Co-authored-by: nKwiatkowski <nkwiatkowski@kestra.io>
2025-06-27 10:42:17 +02:00
Barthélémy Ledoux
c9debbd869 remove unused constant (#9751) 2025-06-27 10:32:03 +02:00
Loïc Mathieu
4149ef4f3e feat(flows): allow reading local files inside the file functions
Supports the 'file://' protocol inside the read(), isFileEmpty(), fileExists() and fileSize() Pebble functions.

Closes #9739
2025-06-27 09:45:34 +02:00
Piyush Bhaskar
8e50da83c3 refactor(stat): migrate stat store from Vuex to Pinia (#9750) 2025-06-26 16:39:40 +02:00
Barthélémy Ledoux
00b1e320b9 fix(plugins): finish pinia migration of plugins store (#9746) 2025-06-26 16:39:18 +02:00
Loïc Mathieu
c4e762506c feat(cluster): persist maintenance mode in the database
Part-of: https://github.com/kestra-io/kestra-ee/issues/3735
2025-06-26 14:31:05 +02:00
Barthélémy Ledoux
d7f6addb79 fix(flows): make autocomplete work in pebble (#9742) 2025-06-26 11:00:55 +02:00
Piyush Bhaskar
b2f8c89e02 refactor(layout): migrate layout.js from vuex to Pinia. (#9687)
* refactor(layout): migrate layout.js from vuex to Pinia.

* refactor(layout): replace getters with direct state access.
2025-06-26 13:37:43 +05:30
Piyush Bhaskar
83e1d77230 refactor(store): migrate Blueprints to Pinia (#9735)
* refactor(store): migrate Blueprints to Pinia

* fix: remove blueprints from declaration
2025-06-26 13:32:02 +05:30
Piyush Bhaskar
dafebc76a3 feat(tenant): all routes on /main tenant (#9664)
* feat(tenant): all  routes on /main tenant

* fix: remove params

* fix: setup tenant router in main
2025-06-26 11:35:44 +05:30
Malaydewangan09
a1e53443a5 feat(scripts): enable script/cli plugins to override final task state 2025-06-25 23:17:44 +05:30
brian.mulier
076ae2e933 fix(core): use namespace prefix instead of equals
On the namespace/flows, namespace/executions pages and when having a default namespace on Logs page

closes kestra-io/kestra-ee#4200
2025-06-25 17:48:21 +02:00
François Delbrayelle
bb7b9edaf2 feat(devtools): copy plugin jars to plugins dir (#9738) 2025-06-25 17:01:31 +02:00
Loïc Mathieu
5aa1b20138 chore(system): call the close runnable later 2025-06-25 14:34:14 +02:00
Loïc Mathieu
cf01f4f0e8 feat(flows): support local files as FILE input default value
Closes #9681
2025-06-25 13:55:49 +02:00
Loïc Mathieu
201912fa22 feat(flows): support local files in input files
Closes https://github.com/kestra-io/plugin-scripts/issues/268
2025-06-25 10:49:10 +02:00
dependabot[bot]
d4891d1c11 build(deps): bump opensearchRestVersion from 3.0.0 to 3.1.0
Bumps `opensearchRestVersion` from 3.0.0 to 3.1.0.

Updates `org.opensearch.client:opensearch-rest-client` from 3.0.0 to 3.1.0
- [Release notes](https://github.com/opensearch-project/OpenSearch/releases)
- [Changelog](https://github.com/opensearch-project/OpenSearch/blob/main/CHANGELOG.md)
- [Commits](https://github.com/opensearch-project/OpenSearch/compare/3.0.0...3.1.0)

Updates `org.opensearch.client:opensearch-rest-high-level-client` from 3.0.0 to 3.1.0
- [Release notes](https://github.com/opensearch-project/OpenSearch/releases)
- [Changelog](https://github.com/opensearch-project/OpenSearch/blob/main/CHANGELOG.md)
- [Commits](https://github.com/opensearch-project/OpenSearch/compare/3.0.0...3.1.0)

---
updated-dependencies:
- dependency-name: org.opensearch.client:opensearch-rest-client
  dependency-version: 3.1.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
- dependency-name: org.opensearch.client:opensearch-rest-high-level-client
  dependency-version: 3.1.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-06-25 10:30:40 +02:00
dependabot[bot]
bff6865806 build(deps): bump software.amazon.awssdk:bom from 2.31.65 to 2.31.70
Bumps software.amazon.awssdk:bom from 2.31.65 to 2.31.70.

---
updated-dependencies:
- dependency-name: software.amazon.awssdk:bom
  dependency-version: 2.31.70
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-06-25 10:30:25 +02:00
dependabot[bot]
ebc887908c build(deps): bump org.jsoup:jsoup from 1.20.1 to 1.21.1
Bumps [org.jsoup:jsoup](https://github.com/jhy/jsoup) from 1.20.1 to 1.21.1.
- [Release notes](https://github.com/jhy/jsoup/releases)
- [Changelog](https://github.com/jhy/jsoup/blob/master/CHANGES.md)
- [Commits](https://github.com/jhy/jsoup/compare/jsoup-1.20.1...jsoup-1.21.1)

---
updated-dependencies:
- dependency-name: org.jsoup:jsoup
  dependency-version: 1.21.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-06-25 10:30:07 +02:00
dependabot[bot]
710d2f6c2b build(deps): bump com.gradleup.shadow from 8.3.6 to 8.3.7
Bumps [com.gradleup.shadow](https://github.com/GradleUp/shadow) from 8.3.6 to 8.3.7.
- [Release notes](https://github.com/GradleUp/shadow/releases)
- [Commits](https://github.com/GradleUp/shadow/compare/8.3.6...8.3.7)

---
updated-dependencies:
- dependency-name: com.gradleup.shadow
  dependency-version: 8.3.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-06-25 10:29:48 +02:00
dependabot[bot]
48de33d04b build(deps): bump org.testcontainers:testcontainers
Bumps [org.testcontainers:testcontainers](https://github.com/testcontainers/testcontainers-java) from 1.21.1 to 1.21.2.
- [Release notes](https://github.com/testcontainers/testcontainers-java/releases)
- [Changelog](https://github.com/testcontainers/testcontainers-java/blob/main/CHANGELOG.md)
- [Commits](https://github.com/testcontainers/testcontainers-java/compare/1.21.1...1.21.2)

---
updated-dependencies:
- dependency-name: org.testcontainers:testcontainers
  dependency-version: 1.21.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-06-25 10:29:24 +02:00
dependabot[bot]
59b837e873 build(deps): bump com.microsoft.playwright:playwright
Bumps [com.microsoft.playwright:playwright](https://github.com/microsoft/playwright-java) from 1.52.0 to 1.53.0.
- [Release notes](https://github.com/microsoft/playwright-java/releases)
- [Commits](https://github.com/microsoft/playwright-java/compare/v1.52.0...v1.53.0)

---
updated-dependencies:
- dependency-name: com.microsoft.playwright:playwright
  dependency-version: 1.53.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-06-25 10:29:02 +02:00
brian-mulier-p
7463be3496 fix(variables): put fixtures files with arbitrary key and extract it back as root level "files" variable (#9689) 2025-06-24 17:29:39 +02:00
Rishi Jat
aedfbdc46a fix(ui): remove Close Task button in NoCode editor (#9661)
Co-authored-by: Bart Ledoux <bledoux@kestra.io>
2025-06-24 15:22:02 +02:00
Anna Geller
9a8363ce69 fix(api-docs): tenant info in API docs (#9675)
* fix(api-docs): tenant info in API docs

* fix: descriptions
2025-06-23 19:26:16 +02:00
Ludovic DEHON
d08d345719 test(core): fix falling test on schedule 2025-06-23 18:52:51 +02:00
Loïc Mathieu
9813d60954 fix(system): possible NPE on trigger when computing variables 2025-06-23 18:12:09 +02:00
623 changed files with 42259 additions and 29341 deletions

View File

@@ -27,11 +27,6 @@ In the meantime, you can move onto the next step...
- Create a `.env.development.local` file in the `ui` folder and paste the following:
```bash
# This lets the frontend know what the backend URL is but you are free to change this to your actual server URL e.g. hosted version of Kestra.
VITE_APP_API_URL=http://localhost:8080
```
- Navigate into the `ui` folder and run `npm install` to install the dependencies for the frontend project.
- Now go to the `cli/src/main/resources` folder and create a `application-override.yml` file.
@@ -74,9 +69,6 @@ kestra:
path: /tmp/kestra-wd/tmp
anonymous-usage-report:
enabled: false
server:
basic-auth:
enabled: false
datasources:
postgres:

View File

@@ -80,7 +80,6 @@ python3 -m pip install virtualenv
The frontend is made with [Vue.js](https://vuejs.org/) and located on the `/ui` folder.
- `npm install`
- create a file `ui/.env.development.local` with content `VITE_APP_API_URL=http://localhost:8080` (or your actual server url)
- `npm run dev` will start the development server with hot reload.
- The server start by default on port 5173 and is reachable on `http://localhost:5173`
- You can run `npm run build` in order to build the front-end that will be delivered from the backend (without running the `npm run dev`) above.

View File

@@ -43,9 +43,6 @@ jobs:
with:
node-version: "20.x"
- name: Check keys matching
run: node ui/src/translations/check.js
- name: Set up Git
run: |
git config --global user.name "GitHub Action"
@@ -64,4 +61,7 @@ jobs:
fi
git commit -m "chore(core): localize to languages other than english" -m "Extended localization support by adding translations for multiple languages using English as the base. This enhances accessibility and usability for non-English-speaking users while keeping English as the source reference."
git push -u origin $BRANCH_NAME || (git push origin --delete $BRANCH_NAME && git push -u origin $BRANCH_NAME)
gh pr create --title "Translations from en.json" --body "This PR was created automatically by a GitHub Action." --base develop --head $BRANCH_NAME --assignee anna-geller --reviewer anna-geller
gh pr create --title "Translations from en.json" --body $'This PR was created automatically by a GitHub Action.\n\nSomeone from the @kestra-io/frontend team needs to review and merge.' --base ${{ github.ref_name }} --head $BRANCH_NAME
- name: Check keys matching
run: node ui/src/translations/check.js

View File

@@ -7,7 +7,7 @@ on:
description: 'Retag latest Docker images'
required: true
type: string
default: "true"
default: "false"
options:
- "true"
- "false"
@@ -69,7 +69,7 @@ jobs:
fi
if [[ "${{ env.PLUGIN_VERSION }}" == *"-SNAPSHOT" ]]; then
echo "plugins=--repositories=https://s01.oss.sonatype.org/content/repositories/snapshots ${{ matrix.image.plugins }}" >> $GITHUB_OUTPUT;
echo "plugins=--repositories=https://central.sonatype.com/repository/maven-snapshots/ ${{ matrix.image.plugins }}" >> $GITHUB_OUTPUT;
else
echo "plugins=${{ matrix.image.plugins }}" >> $GITHUB_OUTPUT
fi

View File

@@ -36,6 +36,15 @@ jobs:
with:
path: kestra
# Setup build
- uses: kestra-io/actions/.github/actions/setup-build@main
name: Setup - Build
id: build
with:
java-enabled: true
node-enabled: true
python-enabled: true
- name: Install Npm dependencies
run: |
cd kestra/ui
@@ -44,8 +53,8 @@ jobs:
- name: Run E2E Tests
run: |
cd kestra/ui
npm run test:e2e
cd kestra
sh build-and-start-e2e-tests.sh
- name: Upload Playwright Report as Github artifact
# 'With this report, you can analyze locally the results of the tests. see https://playwright.dev/docs/ci-intro#html-report'
@@ -53,7 +62,7 @@ jobs:
if: ${{ !cancelled() }}
with:
name: playwright-report
path: kestra/playwright-report/
path: kestra/ui/playwright-report/
retention-days: 7
# Allure check
# TODO I don't know what it should do
@@ -74,4 +83,4 @@ jobs:
# baseUrl: "https://internal.dev.kestra.io"
# prefix: ${{ format('{0}/{1}', github.repository, 'allure/java') }}
# copyLatest: true
# ignoreMissingResults: true
# ignoreMissingResults: true

View File

@@ -56,6 +56,10 @@ jobs:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GOOGLE_SERVICE_ACCOUNT: ${{ secrets.GOOGLE_SERVICE_ACCOUNT }}
e2e-tests:
name: E2E - Tests
uses: ./.github/workflows/e2e.yml
end:
name: End
runs-on: ubuntu-latest

View File

@@ -87,7 +87,7 @@ jobs:
# Run Trivy image scan for Docker vulnerabilities, see https://github.com/aquasecurity/trivy-action
- name: Docker Vulnerabilities Check
uses: aquasecurity/trivy-action@0.31.0
uses: aquasecurity/trivy-action@0.32.0
with:
image-ref: kestra/kestra:develop
format: 'template'
@@ -132,7 +132,7 @@ jobs:
# Run Trivy image scan for Docker vulnerabilities, see https://github.com/aquasecurity/trivy-action
- name: Docker Vulnerabilities Check
uses: aquasecurity/trivy-action@0.31.0
uses: aquasecurity/trivy-action@0.32.0
with:
image-ref: kestra/kestra:latest
format: table

View File

@@ -68,7 +68,7 @@ jobs:
if [[ $TAG = "master" || $TAG == v* ]]; then
echo "plugins=$PLUGINS" >> $GITHUB_OUTPUT
else
echo "plugins=--repositories=https://s01.oss.sonatype.org/content/repositories/snapshots $PLUGINS" >> $GITHUB_OUTPUT
echo "plugins=--repositories=https://central.sonatype.com/repository/maven-snapshots/ $PLUGINS" >> $GITHUB_OUTPUT
fi
# Build

View File

@@ -39,7 +39,6 @@ jobs:
key: playwright-${{ hashFiles('ui/package-lock.json') }}
- name: Npm - install
shell: bash
if: steps.cache-node-modules.outputs.cache-hit != 'true'
working-directory: ui
run: npm ci
@@ -52,35 +51,20 @@ jobs:
workdir: ui
- name: Npm - Run build
shell: bash
working-directory: ui
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: npm run build
- name: Run front-end unit tests
working-directory: ui
run: npm run test:unit -- --coverage
- name: Storybook - Install Playwright
shell: bash
working-directory: ui
if: steps.cache-playwright.outputs.cache-hit != 'true'
run: npx playwright install --with-deps
- name: Run front-end unit tests
shell: bash
- name: Run storybook component tests
working-directory: ui
run: npm run test:cicd
- name: Codecov - Upload coverage reports
uses: codecov/codecov-action@v5
if: ${{ !cancelled() && github.event.pull_request.head.repo.full_name == github.repository }}
continue-on-error: true
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: frontend
- name: Codecov - Upload test results
uses: codecov/test-results-action@v1
if: ${{ !cancelled() }}
continue-on-error: true
with:
token: ${{ secrets.CODECOV_TOKEN && github.event.pull_request.head.repo.full_name == github.repository }}
flags: frontend
run: npm run test:storybook -- --coverage

View File

@@ -41,12 +41,25 @@ jobs:
name: exe
path: build/executable
- name: Check if current tag is latest
id: is_latest
run: |
latest_tag=$(git tag | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | sed 's/^v//' | sort -V | tail -n1)
current_tag="${GITHUB_REF_NAME#v}"
if [ "$current_tag" = "$latest_tag" ]; then
echo "latest=true" >> $GITHUB_OUTPUT
else
echo "latest=false" >> $GITHUB_OUTPUT
fi
env:
GITHUB_REF_NAME: ${{ github.ref_name }}
# GitHub Release
- name: Create GitHub release
uses: ./actions/.github/actions/github-release
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
env:
MAKE_LATEST: ${{ steps.is_latest.outputs.latest }}
GITHUB_TOKEN: ${{ secrets.GH_PERSONAL_TOKEN }}
SLACK_RELEASES_WEBHOOK_URL: ${{ secrets.SLACK_RELEASES_WEBHOOK_URL }}

View File

@@ -112,12 +112,12 @@ jobs:
echo "plugins=${{ matrix.image.plugins }}" >> $GITHUB_OUTPUT
elif [[ $TAG = "develop" ]]; then
TAG="develop";
echo "plugins=--repositories=https://s01.oss.sonatype.org/content/repositories/snapshots $PLUGINS" >> $GITHUB_OUTPUT
echo "plugins=--repositories=https://central.sonatype.com/repository/maven-snapshots/ $PLUGINS" >> $GITHUB_OUTPUT
else
TAG="build-${{ github.run_id }}";
echo "plugins=--repositories=https://s01.oss.sonatype.org/content/repositories/snapshots $PLUGINS" >> $GITHUB_OUTPUT
echo "plugins=--repositories=https://central.sonatype.com/repository/maven-snapshots/ $PLUGINS" >> $GITHUB_OUTPUT
fi
echo "tag=${TAG}${{ matrix.image.tag }}" >> $GITHUB_OUTPUT
# Build Docker Image

View File

@@ -39,8 +39,8 @@ jobs:
- name: Publish - Release package to Maven Central
shell: bash
env:
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USER }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USER }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_GPG_KEYID: ${{ secrets.SONATYPE_GPG_KEYID }}
SONATYPE_GPG_PASSWORD: ${{ secrets.SONATYPE_GPG_PASSWORD }}
SONATYPE_GPG_FILE: ${{ secrets.SONATYPE_GPG_FILE}}
@@ -50,7 +50,7 @@ jobs:
echo "signing.password=${SONATYPE_GPG_PASSWORD}" >> ~/.gradle/gradle.properties
echo "signing.secretKeyRingFile=${HOME}/.gradle/secring.gpg" >> ~/.gradle/gradle.properties
echo ${SONATYPE_GPG_FILE} | base64 -d > ~/.gradle/secring.gpg
./gradlew publishToSonatype ${{ startsWith(github.ref, 'refs/tags/v') && 'closeAndReleaseSonatypeStagingRepository' || '' }}
./gradlew publishToMavenCentral
# Gradle dependency
- name: Java - Gradle dependency graph

View File

@@ -3,10 +3,12 @@
# Format: <RepositoryName>:<GroupId>:<ArtifactId>:<Version>
#
# Uncomment the lines corresponding to the plugins to be installed:
#plugin-ai:io.kestra.plugin:plugin-ai:LATEST
#plugin-airbyte:io.kestra.plugin:plugin-airbyte:LATEST
#plugin-airflow:io.kestra.plugin:plugin-airflow:LATEST
#plugin-amqp:io.kestra.plugin:plugin-amqp:LATEST
#plugin-ansible:io.kestra.plugin:plugin-ansible:LATEST
#plugin-anthropic:io.kestra.plugin:plugin-anthropic:LATEST
#plugin-aws:io.kestra.plugin:plugin-aws:LATEST
#plugin-azure:io.kestra.plugin:plugin-azure:LATEST
#plugin-cassandra:io.kestra.plugin:plugin-cassandra:LATEST
@@ -29,6 +31,7 @@
#plugin-fivetran:io.kestra.plugin:plugin-fivetran:LATEST
#plugin-fs:io.kestra.plugin:plugin-fs:LATEST
#plugin-gcp:io.kestra.plugin:plugin-gcp:LATEST
#plugin-gemini:io.kestra.plugin:plugin-gemini:LATEST
#plugin-git:io.kestra.plugin:plugin-git:LATEST
#plugin-github:io.kestra.plugin:plugin-github:LATEST
#plugin-googleworkspace:io.kestra.plugin:plugin-googleworkspace:LATEST
@@ -63,21 +66,23 @@
#plugin-kafka:io.kestra.plugin:plugin-kafka:LATEST
#plugin-kestra:io.kestra.plugin:plugin-kestra:LATEST
#plugin-kubernetes:io.kestra.plugin:plugin-kubernetes:LATEST
#plugin-langchain4j:io.kestra.plugin:plugin-langchain4j:LATEST
#plugin-ldap:io.kestra.plugin:plugin-ldap:LATEST
#plugin-linear:io.kestra.plugin:plugin-linear:LATEST
#plugin-malloy:io.kestra.plugin:plugin-malloy:LATEST
#plugin-meilisearch:io.kestra.plugin:plugin-meilisearch:LATEST
#plugin-minio:io.kestra.plugin:plugin-minio:LATEST
#plugin-mistral:io.kestra.plugin:plugin-mistral:LATEST
#plugin-modal:io.kestra.plugin:plugin-modal:LATEST
#plugin-mongodb:io.kestra.plugin:plugin-mongodb:LATEST
#plugin-mqtt:io.kestra.plugin:plugin-mqtt:LATEST
#plugin-nats:io.kestra.plugin:plugin-nats:LATEST
#plugin-neo4j:io.kestra.plugin:plugin-neo4j:LATEST
#plugin-notifications:io.kestra.plugin:plugin-notifications:LATEST
#plugin-notion:io.kestra.plugin:plugin-notion:LATEST
#plugin-ollama:io.kestra.plugin:plugin-ollama:LATEST
#plugin-openai:io.kestra.plugin:plugin-openai:LATEST
#plugin-opensearch:io.kestra.plugin:plugin-opensearch:LATEST
#plugin-perplexity:io.kestra.plugin:plugin-perplexity:LATEST
#plugin-powerbi:io.kestra.plugin:plugin-powerbi:LATEST
#plugin-pulsar:io.kestra.plugin:plugin-pulsar:LATEST
#plugin-redis:io.kestra.plugin:plugin-redis:LATEST

View File

@@ -77,7 +77,7 @@ install-plugins:
else \
${KESTRA_BASEDIR}/bin/kestra plugins install $$CURRENT_PLUGIN \
--plugins ${KESTRA_BASEDIR}/plugins \
--repositories=https://s01.oss.sonatype.org/content/repositories/snapshots || exit 1; \
--repositories=https://central.sonatype.com/repository/maven-snapshots || exit 1; \
fi \
done < $$PLUGIN_LIST
@@ -130,9 +130,6 @@ datasources:
username: kestra
password: k3str4
kestra:
server:
basic-auth:
enabled: false
encryption:
secret-key: 3ywuDa/Ec61VHkOX3RlI9gYq7CaD0mv0Pf3DHtAXA6U=
repository:

46
build-and-start-e2e-tests.sh Executable file
View File

@@ -0,0 +1,46 @@
#!/bin/bash
set -e
# E2E main script that can be run on a dev computer or in the CI
# it will build the backend of the current git repo and the frontend
# create a docker image out of it
# run tests on this image
LOCAL_IMAGE_VERSION="local-e2e"
echo "Running E2E"
echo "Start time: $(date '+%Y-%m-%d %H:%M:%S')"
start_time=$(date +%s)
echo ""
echo "Building the image for this current repository"
make build-docker VERSION=$LOCAL_IMAGE_VERSION
end_time=$(date +%s)
elapsed=$(( end_time - start_time ))
echo ""
echo "building elapsed time: ${elapsed} seconds"
echo ""
echo "Start time: $(date '+%Y-%m-%d %H:%M:%S')"
start_time2=$(date +%s)
echo "cd ./ui"
cd ./ui
echo "npm i"
npm i
echo 'sh ./run-e2e-tests.sh --kestra-docker-image-to-test "kestra/kestra:$LOCAL_IMAGE_VERSION"'
sh ./run-e2e-tests.sh --kestra-docker-image-to-test "kestra/kestra:$LOCAL_IMAGE_VERSION"
end_time2=$(date +%s)
elapsed2=$(( end_time2 - start_time2 ))
echo ""
echo "Tests elapsed time: ${elapsed2} seconds"
echo ""
total_elapsed=$(( elapsed + elapsed2 ))
echo "Total elapsed time: ${total_elapsed} seconds"
echo ""
exit 0

View File

@@ -16,7 +16,7 @@ plugins {
id "java"
id 'java-library'
id "idea"
id "com.gradleup.shadow" version "8.3.6"
id "com.gradleup.shadow" version "8.3.8"
id "application"
// test
@@ -31,12 +31,10 @@ plugins {
id 'com.github.node-gradle.node' version '7.1.0'
// release
id "io.github.gradle-nexus.publish-plugin" version "2.0.0"
id 'net.researchgate.release' version '3.1.0'
id "com.gorylenko.gradle-git-properties" version "2.5.0"
id "com.gorylenko.gradle-git-properties" version "2.5.2"
id 'signing'
id 'ru.vyarus.pom' version '3.0.0' apply false
id 'ru.vyarus.github-info' version '2.0.0' apply false
id "com.vanniktech.maven.publish" version "0.34.0"
// OWASP dependency check
id "org.owasp.dependencycheck" version "12.1.3" apply false
@@ -73,6 +71,11 @@ dependencies {
* Dependencies
**********************************************************************************************************************/
allprojects {
tasks.withType(GenerateModuleMetadata).configureEach {
suppressedValidationErrors.add('enforced-platform')
}
if (it.name != 'platform') {
group = "io.kestra"
@@ -145,6 +148,7 @@ allprojects {
implementation group: 'com.fasterxml.jackson.module', name: 'jackson-module-parameter-names'
implementation group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-guava'
implementation group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jsr310'
implementation group: 'com.fasterxml.uuid', name: 'java-uuid-generator'
// kestra
implementation group: 'com.devskiller.friendly-id', name: 'friendly-id'
@@ -414,6 +418,7 @@ distTar.dependsOn shadowJar
startScripts.dependsOn shadowJar
startShadowScripts.dependsOn jar
shadowJar.dependsOn 'ui:assembleFrontend'
shadowJar.dependsOn jar
/**********************************************************************************************************************\
* Executable Jar
@@ -484,24 +489,11 @@ tasks.register('runStandalone', JavaExec) {
/**********************************************************************************************************************\
* Publish
**********************************************************************************************************************/
nexusPublishing {
repositoryDescription = "${project.group}:${rootProject.name}:${project.version}"
useStaging = !project.version.endsWith("-SNAPSHOT")
repositories {
sonatype {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
}
}
}
subprojects {subProject ->
subprojects {
if (it.name != 'jmh-benchmarks') {
apply plugin: "maven-publish"
if (subProject.name != 'jmh-benchmarks' && subProject.name != rootProject.name) {
apply plugin: 'signing'
apply plugin: 'ru.vyarus.pom'
apply plugin: 'ru.vyarus.github-info'
apply plugin: "com.vanniktech.maven.publish"
javadoc {
options {
@@ -535,66 +527,104 @@ subprojects {
}
}
github {
user 'kestra-io'
license 'Apache'
repository 'kestra'
site 'https://kestra.io'
//These modules should not be published
def unpublishedModules = ["jdbc-mysql", "jdbc-postgres", "webserver"]
if (subProject.name in unpublishedModules){
return
}
maven.pom {
description = 'The modern, scalable orchestrator & scheduler open source platform'
mavenPublishing {
publishToMavenCentral(true)
signAllPublications()
developers {
developer {
id = "tchiotludo"
name = "Ludovic Dehon"
coordinates(
"${rootProject.group}",
subProject.name == "cli" ? rootProject.name : subProject.name,
"${rootProject.version}"
)
pom {
name = project.name
description = "${project.group}:${project.name}:${rootProject.version}"
url = "https://github.com/kestra-io/${rootProject.name}"
licenses {
license {
name = "The Apache License, Version 2.0"
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
}
}
developers {
developer {
id = "tchiotludo"
name = "Ludovic Dehon"
email = "ldehon@kestra.io"
}
}
scm {
connection = 'scm:git:'
url = "https://github.com/kestra-io/${rootProject.name}"
}
}
}
publishing {
publications {
sonatypePublication(MavenPublication) {
version project.version
afterEvaluate {
publishing {
publications {
withType(MavenPublication).configureEach { publication ->
if (project.name.contains('cli')) {
groupId "io.kestra"
artifactId "kestra"
artifact shadowJar
artifact executableJar
} else if (project.name.contains('platform')){
groupId project.group
artifactId project.name
} else {
from components.java
groupId project.group
artifactId project.name
artifact sourcesJar
artifact javadocJar
artifact testsJar
if (subProject.name == "platform") {
// Clear all artifacts except the BOM
publication.artifacts.clear()
}
}
}
}
}
signing {
// only sign JARs that we publish to Sonatype
required { gradle.taskGraph.hasTask("publishSonatypePublicationPublicationToSonatypeRepository") }
sign publishing.publications.sonatypePublication
}
if (subProject.name == 'cli') {
tasks.withType(GenerateModuleMetadata).configureEach {
// Suppression this validation error as we want to enforce the Kestra platform
suppressedValidationErrors.add('enforced-platform')
/* Make sure the special publication is wired *after* every plugin */
subProject.afterEvaluate {
/* 1. Remove the default java component so Gradle stops expecting
the standard cli-*.jar, sources, javadoc, etc. */
components.removeAll { it.name == "java" }
/* 2. Replace the publications artifacts with shadow + exec */
publishing.publications.withType(MavenPublication).configureEach { pub ->
pub.artifacts.clear()
// main shadow JAR built at root
pub.artifact(rootProject.tasks.named("shadowJar").get()) {
extension = "jar"
}
// executable ZIP built at root
pub.artifact(rootProject.tasks.named("executableJar").get().archiveFile) {
classifier = "exec"
extension = "zip"
}
pub.artifact(tasks.named("sourcesJar").get())
pub.artifact(tasks.named("javadocJar").get())
}
/* 3. Disable Gradle-module metadata for this publication to
avoid the “artifact removed from java component” error. */
tasks.withType(GenerateModuleMetadata).configureEach { it.enabled = false }
/* 4. Make every publish task in :cli wait for the two artifacts */
tasks.matching { it.name.startsWith("publish") }.configureEach {
dependsOn rootProject.tasks.named("shadowJar")
dependsOn rootProject.tasks.named("executableJar")
}
}
}
}
}
/**********************************************************************************************************************\
* Version
**********************************************************************************************************************/

View File

@@ -37,4 +37,4 @@ dependencies {
//test
testImplementation "org.wiremock:wiremock-jetty12"
}
}

View File

@@ -1,7 +1,5 @@
package io.kestra.cli;
import static io.kestra.core.tenant.TenantService.MAIN_TENANT;
import io.micronaut.core.annotation.Nullable;
import io.micronaut.http.HttpHeaders;
import io.micronaut.http.HttpRequest;
@@ -16,16 +14,15 @@ import io.micronaut.http.netty.body.NettyJsonHandler;
import io.micronaut.json.JsonMapper;
import jakarta.inject.Inject;
import jakarta.inject.Named;
import lombok.Builder;
import lombok.Value;
import lombok.extern.jackson.Jacksonized;
import picocli.CommandLine;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import lombok.Builder;
import lombok.Value;
import lombok.extern.jackson.Jacksonized;
import picocli.CommandLine;
public abstract class AbstractApiCommand extends AbstractCommand {
@CommandLine.Option(names = {"--server"}, description = "Kestra server url", defaultValue = "http://localhost:8080")
@@ -37,7 +34,7 @@ public abstract class AbstractApiCommand extends AbstractCommand {
@CommandLine.Option(names = {"--user"}, paramLabel = "<user:password>", description = "Server user and password")
protected String user;
@CommandLine.Option(names = {"--tenant"}, description = "Tenant identifier (EE only, when multi-tenancy is enabled)")
@CommandLine.Option(names = {"--tenant"}, description = "Tenant identifier (EE only)")
protected String tenantId;
@CommandLine.Option(names = {"--api-token"}, description = "API Token (EE only).")
@@ -87,12 +84,12 @@ public abstract class AbstractApiCommand extends AbstractCommand {
return request;
}
protected String apiUri(String path) {
protected String apiUri(String path, String tenantId) {
if (path == null || !path.startsWith("/")) {
throw new IllegalArgumentException("'path' must be non-null and start with '/'");
}
return tenantId == null ? "/api/v1/" + MAIN_TENANT + path : "/api/v1/" + tenantId + path;
return "/api/v1/" + tenantId + path;
}
@Builder

View File

@@ -40,7 +40,7 @@ import picocli.CommandLine.Option;
)
@Slf4j
@Introspected
abstract public class AbstractCommand implements Callable<Integer> {
public abstract class AbstractCommand implements Callable<Integer> {
@Inject
private ApplicationContext applicationContext;
@@ -93,7 +93,7 @@ abstract public class AbstractCommand implements Callable<Integer> {
this.startupHook.start(this);
}
if (this.pluginsPath != null && loadExternalPlugins()) {
if (pluginRegistryProvider != null && this.pluginsPath != null && loadExternalPlugins()) {
pluginRegistry = pluginRegistryProvider.get();
pluginRegistry.registerIfAbsent(pluginsPath);

View File

@@ -1,5 +1,6 @@
package io.kestra.cli;
import io.kestra.cli.services.TenantIdSelectorService;
import io.kestra.core.models.validations.ModelValidator;
import io.kestra.core.models.validations.ValidateConstraintViolation;
import io.kestra.core.serializers.YamlParser;
@@ -9,6 +10,7 @@ import io.micronaut.http.MediaType;
import io.micronaut.http.MutableHttpRequest;
import io.micronaut.http.client.exceptions.HttpClientResponseException;
import io.micronaut.http.client.netty.DefaultHttpClient;
import jakarta.inject.Inject;
import picocli.CommandLine;
import java.io.IOException;
@@ -31,6 +33,9 @@ public abstract class AbstractValidateCommand extends AbstractApiCommand {
@CommandLine.Parameters(index = "0", description = "the directory containing files to check")
protected Path directory;
@Inject
private TenantIdSelectorService tenantService;
/** {@inheritDoc} **/
@Override
protected boolean loadExternalPlugins() {
@@ -112,7 +117,7 @@ public abstract class AbstractValidateCommand extends AbstractApiCommand {
try(DefaultHttpClient client = client()) {
MutableHttpRequest<String> request = HttpRequest
.POST(apiUri("/flows/validate"), body).contentType(MediaType.APPLICATION_YAML);
.POST(apiUri("/flows/validate", tenantService.getTenantId(tenantId)), body).contentType(MediaType.APPLICATION_YAML);
List<ValidateConstraintViolation> validations = client.toBlocking().retrieve(
this.requestOptions(request),

View File

@@ -66,8 +66,14 @@ public class App implements Callable<Integer> {
ApplicationContext applicationContext = App.applicationContext(cls, args);
// Call Picocli command
int exitCode = new CommandLine(cls, new MicronautFactory(applicationContext)).execute(args);
int exitCode = 0;
try {
exitCode = new CommandLine(cls, new MicronautFactory(applicationContext)).execute(args);
} catch (CommandLine.InitializationException e){
System.err.println("Could not initialize picoli ComandLine, err: " + e.getMessage());
e.printStackTrace();
exitCode = 1;
}
applicationContext.close();
// exit code

View File

@@ -2,11 +2,13 @@ package io.kestra.cli.commands.flows;
import io.kestra.cli.AbstractApiCommand;
import io.kestra.cli.AbstractValidateCommand;
import io.kestra.cli.services.TenantIdSelectorService;
import io.micronaut.http.HttpRequest;
import io.micronaut.http.MediaType;
import io.micronaut.http.MutableHttpRequest;
import io.micronaut.http.client.exceptions.HttpClientResponseException;
import io.micronaut.http.client.netty.DefaultHttpClient;
import jakarta.inject.Inject;
import lombok.extern.slf4j.Slf4j;
import picocli.CommandLine;
@@ -23,6 +25,9 @@ public class FlowCreateCommand extends AbstractApiCommand {
@CommandLine.Parameters(index = "0", description = "The file containing the flow")
public Path flowFile;
@Inject
private TenantIdSelectorService tenantService;
@SuppressWarnings("deprecation")
@Override
public Integer call() throws Exception {
@@ -34,7 +39,7 @@ public class FlowCreateCommand extends AbstractApiCommand {
try(DefaultHttpClient client = client()) {
MutableHttpRequest<String> request = HttpRequest
.POST(apiUri("/flows"), body).contentType(MediaType.APPLICATION_YAML);
.POST(apiUri("/flows", tenantService.getTenantId(tenantId)), body).contentType(MediaType.APPLICATION_YAML);
client.toBlocking().retrieve(
this.requestOptions(request),

View File

@@ -2,10 +2,12 @@ package io.kestra.cli.commands.flows;
import io.kestra.cli.AbstractApiCommand;
import io.kestra.cli.AbstractValidateCommand;
import io.kestra.cli.services.TenantIdSelectorService;
import io.micronaut.http.HttpRequest;
import io.micronaut.http.MutableHttpRequest;
import io.micronaut.http.client.exceptions.HttpClientResponseException;
import io.micronaut.http.client.netty.DefaultHttpClient;
import jakarta.inject.Inject;
import lombok.extern.slf4j.Slf4j;
import picocli.CommandLine;
@@ -23,6 +25,9 @@ public class FlowDeleteCommand extends AbstractApiCommand {
@CommandLine.Parameters(index = "1", description = "The ID of the flow")
public String id;
@Inject
private TenantIdSelectorService tenantService;
@SuppressWarnings("deprecation")
@Override
public Integer call() throws Exception {
@@ -30,7 +35,7 @@ public class FlowDeleteCommand extends AbstractApiCommand {
try(DefaultHttpClient client = client()) {
MutableHttpRequest<String> request = HttpRequest
.DELETE(apiUri("/flows/" + namespace + "/" + id ));
.DELETE(apiUri("/flows/" + namespace + "/" + id, tenantService.getTenantId(tenantId)));
client.toBlocking().exchange(
this.requestOptions(request)

View File

@@ -2,7 +2,7 @@ package io.kestra.cli.commands.flows;
import io.kestra.cli.AbstractApiCommand;
import io.kestra.cli.AbstractValidateCommand;
import io.micronaut.context.ApplicationContext;
import io.kestra.cli.services.TenantIdSelectorService;
import io.micronaut.http.HttpRequest;
import io.micronaut.http.HttpResponse;
import io.micronaut.http.MediaType;
@@ -25,9 +25,8 @@ import java.nio.file.Path;
public class FlowExportCommand extends AbstractApiCommand {
private static final String DEFAULT_FILE_NAME = "flows.zip";
// @FIXME: Keep it for bug in micronaut that need to have inject on top level command to inject on abstract classe
@Inject
private ApplicationContext applicationContext;
private TenantIdSelectorService tenantService;
@CommandLine.Option(names = {"--namespace"}, description = "The namespace of flows to export")
public String namespace;
@@ -41,7 +40,7 @@ public class FlowExportCommand extends AbstractApiCommand {
try(DefaultHttpClient client = client()) {
MutableHttpRequest<Object> request = HttpRequest
.GET(apiUri("/flows/export/by-query") + (namespace != null ? "?namespace=" + namespace : ""))
.GET(apiUri("/flows/export/by-query", tenantService.getTenantId(tenantId)) + (namespace != null ? "?namespace=" + namespace : ""))
.accept(MediaType.APPLICATION_OCTET_STREAM);
HttpResponse<byte[]> response = client.toBlocking().exchange(this.requestOptions(request), byte[].class);

View File

@@ -1,7 +1,8 @@
package io.kestra.cli.commands.flows;
import com.google.common.collect.ImmutableMap;
import io.kestra.cli.AbstractCommand;
import io.kestra.cli.AbstractApiCommand;
import io.kestra.cli.services.TenantIdSelectorService;
import io.kestra.core.models.flows.Flow;
import io.kestra.core.repositories.FlowRepositoryInterface;
import io.kestra.core.repositories.LocalFlowRepositoryLoader;
@@ -30,7 +31,7 @@ import java.util.concurrent.TimeoutException;
description = "Test a flow"
)
@Slf4j
public class FlowTestCommand extends AbstractCommand {
public class FlowTestCommand extends AbstractApiCommand {
@Inject
private ApplicationContext applicationContext;
@@ -76,6 +77,7 @@ public class FlowTestCommand extends AbstractCommand {
FlowRepositoryInterface flowRepository = applicationContext.getBean(FlowRepositoryInterface.class);
FlowInputOutput flowInputOutput = applicationContext.getBean(FlowInputOutput.class);
RunnerUtils runnerUtils = applicationContext.getBean(RunnerUtils.class);
TenantIdSelectorService tenantService = applicationContext.getBean(TenantIdSelectorService.class);
Map<String, Object> inputs = new HashMap<>();
@@ -89,7 +91,7 @@ public class FlowTestCommand extends AbstractCommand {
try {
runner.run();
repositoryLoader.load(file.toFile());
repositoryLoader.load(tenantService.getTenantId(tenantId), file.toFile());
List<Flow> all = flowRepository.findAllForAllTenants();
if (all.size() != 1) {

View File

@@ -2,11 +2,13 @@ package io.kestra.cli.commands.flows;
import io.kestra.cli.AbstractApiCommand;
import io.kestra.cli.AbstractValidateCommand;
import io.kestra.cli.services.TenantIdSelectorService;
import io.micronaut.http.HttpRequest;
import io.micronaut.http.MediaType;
import io.micronaut.http.MutableHttpRequest;
import io.micronaut.http.client.exceptions.HttpClientResponseException;
import io.micronaut.http.client.netty.DefaultHttpClient;
import jakarta.inject.Inject;
import lombok.extern.slf4j.Slf4j;
import picocli.CommandLine;
@@ -29,6 +31,9 @@ public class FlowUpdateCommand extends AbstractApiCommand {
@CommandLine.Parameters(index = "2", description = "The ID of the flow")
public String id;
@Inject
private TenantIdSelectorService tenantService;
@SuppressWarnings("deprecation")
@Override
public Integer call() throws Exception {
@@ -40,7 +45,7 @@ public class FlowUpdateCommand extends AbstractApiCommand {
try(DefaultHttpClient client = client()) {
MutableHttpRequest<String> request = HttpRequest
.PUT(apiUri("/flows/" + namespace + "/" + id ), body).contentType(MediaType.APPLICATION_YAML);
.PUT(apiUri("/flows/" + namespace + "/" + id, tenantService.getTenantId(tenantId)), body).contentType(MediaType.APPLICATION_YAML);
client.toBlocking().retrieve(
this.requestOptions(request),

View File

@@ -2,6 +2,7 @@ package io.kestra.cli.commands.flows;
import io.kestra.cli.AbstractApiCommand;
import io.kestra.cli.AbstractValidateCommand;
import io.kestra.cli.services.TenantIdSelectorService;
import io.kestra.core.serializers.YamlParser;
import io.micronaut.core.type.Argument;
import io.micronaut.http.HttpRequest;
@@ -9,6 +10,7 @@ import io.micronaut.http.MediaType;
import io.micronaut.http.MutableHttpRequest;
import io.micronaut.http.client.exceptions.HttpClientResponseException;
import io.micronaut.http.client.netty.DefaultHttpClient;
import jakarta.inject.Inject;
import jakarta.validation.ConstraintViolationException;
import lombok.extern.slf4j.Slf4j;
import picocli.CommandLine;
@@ -36,6 +38,9 @@ public class FlowUpdatesCommand extends AbstractApiCommand {
@CommandLine.Option(names = {"--namespace"}, description = "The parent namespace of the flows, if not set, every namespace are allowed.")
public String namespace;
@Inject
private TenantIdSelectorService tenantIdSelectorService;
@SuppressWarnings("deprecation")
@Override
public Integer call() throws Exception {
@@ -66,7 +71,7 @@ public class FlowUpdatesCommand extends AbstractApiCommand {
namespaceQuery = "&namespace=" + namespace;
}
MutableHttpRequest<String> request = HttpRequest
.POST(apiUri("/flows/bulk") + "?allowNamespaceChild=true&delete=" + delete + namespaceQuery, body).contentType(MediaType.APPLICATION_YAML);
.POST(apiUri("/flows/bulk", tenantIdSelectorService.getTenantId(tenantId)) + "?allowNamespaceChild=true&delete=" + delete + namespaceQuery, body).contentType(MediaType.APPLICATION_YAML);
List<UpdateResult> updated = client.toBlocking().retrieve(
this.requestOptions(request),

View File

@@ -1,6 +1,7 @@
package io.kestra.cli.commands.flows;
import io.kestra.cli.AbstractValidateCommand;
import io.kestra.cli.services.TenantIdSelectorService;
import io.kestra.core.models.flows.FlowWithSource;
import io.kestra.core.models.validations.ModelValidator;
import io.kestra.core.services.FlowService;
@@ -22,6 +23,9 @@ public class FlowValidateCommand extends AbstractValidateCommand {
@Inject
private FlowService flowService;
@Inject
private TenantIdSelectorService tenantService;
@Override
public Integer call() throws Exception {
return this.call(
@@ -35,7 +39,7 @@ public class FlowValidateCommand extends AbstractValidateCommand {
FlowWithSource flow = (FlowWithSource) object;
List<String> warnings = new ArrayList<>();
warnings.addAll(flowService.deprecationPaths(flow).stream().map(deprecation -> deprecation + " is deprecated").toList());
warnings.addAll(flowService.warnings(flow, this.tenantId));
warnings.addAll(flowService.warnings(flow, tenantService.getTenantId(tenantId)));
return warnings;
},
(Object object) -> {

View File

@@ -3,6 +3,7 @@ package io.kestra.cli.commands.flows.namespaces;
import io.kestra.cli.AbstractValidateCommand;
import io.kestra.cli.commands.AbstractServiceNamespaceUpdateCommand;
import io.kestra.cli.commands.flows.IncludeHelperExpander;
import io.kestra.cli.services.TenantIdSelectorService;
import io.kestra.core.serializers.YamlParser;
import io.micronaut.core.type.Argument;
import io.micronaut.http.HttpRequest;
@@ -10,6 +11,7 @@ import io.micronaut.http.MediaType;
import io.micronaut.http.MutableHttpRequest;
import io.micronaut.http.client.exceptions.HttpClientResponseException;
import io.micronaut.http.client.netty.DefaultHttpClient;
import jakarta.inject.Inject;
import jakarta.validation.ConstraintViolationException;
import lombok.extern.slf4j.Slf4j;
import picocli.CommandLine;
@@ -30,6 +32,9 @@ public class FlowNamespaceUpdateCommand extends AbstractServiceNamespaceUpdateCo
@CommandLine.Option(names = {"--override-namespaces"}, negatable = true, description = "Replace namespace of all flows by the one provided")
public boolean override = false;
@Inject
private TenantIdSelectorService tenantService;
@SuppressWarnings("deprecation")
@Override
public Integer call() throws Exception {
@@ -59,7 +64,7 @@ public class FlowNamespaceUpdateCommand extends AbstractServiceNamespaceUpdateCo
}
try(DefaultHttpClient client = client()) {
MutableHttpRequest<String> request = HttpRequest
.POST(apiUri("/flows/") + namespace + "?delete=" + delete, body).contentType(MediaType.APPLICATION_YAML);
.POST(apiUri("/flows/", tenantService.getTenantId(tenantId)) + namespace + "?delete=" + delete, body).contentType(MediaType.APPLICATION_YAML);
List<UpdateResult> updated = client.toBlocking().retrieve(
this.requestOptions(request),

View File

@@ -2,12 +2,14 @@ package io.kestra.cli.commands.namespaces.files;
import io.kestra.cli.AbstractApiCommand;
import io.kestra.cli.AbstractValidateCommand;
import io.kestra.cli.services.TenantIdSelectorService;
import io.kestra.core.utils.KestraIgnore;
import io.micronaut.http.HttpRequest;
import io.micronaut.http.MediaType;
import io.micronaut.http.client.exceptions.HttpClientResponseException;
import io.micronaut.http.client.multipart.MultipartBody;
import io.micronaut.http.client.netty.DefaultHttpClient;
import jakarta.inject.Inject;
import lombok.extern.slf4j.Slf4j;
import picocli.CommandLine;
@@ -34,6 +36,9 @@ public class NamespaceFilesUpdateCommand extends AbstractApiCommand {
@CommandLine.Option(names = {"--delete"}, negatable = true, description = "Whether missing should be deleted")
public boolean delete = false;
@Inject
private TenantIdSelectorService tenantService;
private static final String KESTRA_IGNORE_FILE = ".kestraignore";
@Override
@@ -44,7 +49,7 @@ public class NamespaceFilesUpdateCommand extends AbstractApiCommand {
try (var files = Files.walk(from); DefaultHttpClient client = client()) {
if (delete) {
client.toBlocking().exchange(this.requestOptions(HttpRequest.DELETE(apiUri("/namespaces/") + namespace + "/files?path=" + to, null)));
client.toBlocking().exchange(this.requestOptions(HttpRequest.DELETE(apiUri("/namespaces/", tenantService.getTenantId(tenantId)) + namespace + "/files?path=" + to, null)));
}
KestraIgnore kestraIgnore = new KestraIgnore(from);
@@ -62,7 +67,7 @@ public class NamespaceFilesUpdateCommand extends AbstractApiCommand {
client.toBlocking().exchange(
this.requestOptions(
HttpRequest.POST(
apiUri("/namespaces/") + namespace + "/files?path=" + destination,
apiUri("/namespaces/", tenantService.getTenantId(tenantId)) + namespace + "/files?path=" + destination,
body
).contentType(MediaType.MULTIPART_FORM_DATA)
)

View File

@@ -3,11 +3,13 @@ package io.kestra.cli.commands.namespaces.kv;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.kestra.cli.AbstractApiCommand;
import io.kestra.cli.services.TenantIdSelectorService;
import io.kestra.core.serializers.JacksonMapper;
import io.micronaut.http.HttpRequest;
import io.micronaut.http.MediaType;
import io.micronaut.http.MutableHttpRequest;
import io.micronaut.http.client.netty.DefaultHttpClient;
import jakarta.inject.Inject;
import lombok.extern.slf4j.Slf4j;
import picocli.CommandLine;
import picocli.CommandLine.Option;
@@ -42,6 +44,9 @@ public class KvUpdateCommand extends AbstractApiCommand {
@Option(names = {"-f", "--file-value"}, description = "The file from which to read the value to set. If this is provided, it will take precedence over any specified value.")
public Path fileValue;
@Inject
private TenantIdSelectorService tenantService;
@Override
public Integer call() throws Exception {
super.call();
@@ -56,7 +61,7 @@ public class KvUpdateCommand extends AbstractApiCommand {
Duration ttl = expiration == null ? null : Duration.parse(expiration);
MutableHttpRequest<String> request = HttpRequest
.PUT(apiUri("/namespaces/") + namespace + "/kv/" + key, value)
.PUT(apiUri("/namespaces/", tenantService.getTenantId(tenantId)) + namespace + "/kv/" + key, value)
.contentType(MediaType.APPLICATION_JSON_TYPE);
if (ttl != null) {

View File

@@ -18,6 +18,8 @@ import java.nio.file.Paths;
import java.util.Base64;
import java.util.List;
import static io.kestra.core.models.Plugin.isDeprecated;
@CommandLine.Command(
name = "doc",
description = "Generate documentation for all plugins currently installed"
@@ -38,6 +40,9 @@ public class PluginDocCommand extends AbstractCommand {
@CommandLine.Option(names = {"--schema"}, description = "Also write JSON Schema for each task")
private boolean schema = false;
@CommandLine.Option(names = {"--skip-deprecated"},description = "Skip deprecated plugins when generating documentations")
private boolean skipDeprecated = false;
@Override
public Integer call() throws Exception {
super.call();
@@ -45,6 +50,11 @@ public class PluginDocCommand extends AbstractCommand {
PluginRegistry registry = pluginRegistryProvider.get();
List<RegisteredPlugin> plugins = core ? registry.plugins() : registry.externalPlugins();
if (skipDeprecated) {
plugins = plugins.stream()
.filter(plugin -> !isDeprecated(plugin.getClass()))
.toList();
}
boolean hasFailures = false;
for (RegisteredPlugin registeredPlugin : plugins) {

View File

@@ -2,6 +2,7 @@ package io.kestra.cli.commands.servers;
import com.google.common.collect.ImmutableMap;
import io.kestra.cli.services.FileChangedEventListener;
import io.kestra.cli.services.TenantIdSelectorService;
import io.kestra.core.contexts.KestraContext;
import io.kestra.core.models.ServerType;
import io.kestra.core.repositories.LocalFlowRepositoryLoader;
@@ -44,6 +45,9 @@ public class StandAloneCommand extends AbstractServerCommand {
@CommandLine.Option(names = {"-f", "--flow-path"}, description = "the flow path containing flow to inject at startup (when running with a memory flow repository)")
private File flowPath;
@CommandLine.Option(names = "--tenant", description = "Tenant identifier, Required to load flows from path with the enterprise edition")
private String tenantId;
@CommandLine.Option(names = {"--worker-thread"}, description = "the number of worker threads, defaults to four times the number of available processors. Set it to 0 to avoid starting a worker.")
private int workerThread = defaultWorkerThread();
@@ -98,7 +102,8 @@ public class StandAloneCommand extends AbstractServerCommand {
if (flowPath != null) {
try {
LocalFlowRepositoryLoader localFlowRepositoryLoader = applicationContext.getBean(LocalFlowRepositoryLoader.class);
localFlowRepositoryLoader.load(null, this.flowPath);
TenantIdSelectorService tenantIdSelectorService = applicationContext.getBean(TenantIdSelectorService.class);
localFlowRepositoryLoader.load(tenantIdSelectorService.getTenantId(this.tenantId), this.flowPath);
} catch (IOException e) {
throw new CommandLine.ParameterException(this.spec.commandLine(), "Invalid flow path", e);
}

View File

@@ -2,8 +2,8 @@ package io.kestra.cli.commands.templates;
import io.kestra.cli.AbstractApiCommand;
import io.kestra.cli.AbstractValidateCommand;
import io.kestra.cli.services.TenantIdSelectorService;
import io.kestra.core.models.templates.TemplateEnabled;
import io.micronaut.context.ApplicationContext;
import io.micronaut.http.HttpRequest;
import io.micronaut.http.HttpResponse;
import io.micronaut.http.MediaType;
@@ -27,9 +27,8 @@ import java.nio.file.Path;
public class TemplateExportCommand extends AbstractApiCommand {
private static final String DEFAULT_FILE_NAME = "templates.zip";
// @FIXME: Keep it for bug in micronaut that need to have inject on top level command to inject on abstract classe
@Inject
private ApplicationContext applicationContext;
private TenantIdSelectorService tenantService;
@CommandLine.Option(names = {"--namespace"}, description = "The namespace of templates to export")
public String namespace;
@@ -43,7 +42,7 @@ public class TemplateExportCommand extends AbstractApiCommand {
try(DefaultHttpClient client = client()) {
MutableHttpRequest<Object> request = HttpRequest
.GET(apiUri("/templates/export/by-query") + (namespace != null ? "?namespace=" + namespace : ""))
.GET(apiUri("/templates/export/by-query", tenantService.getTenantId(tenantId)) + (namespace != null ? "?namespace=" + namespace : ""))
.accept(MediaType.APPLICATION_OCTET_STREAM);
HttpResponse<byte[]> response = client.toBlocking().exchange(this.requestOptions(request), byte[].class);

View File

@@ -2,6 +2,7 @@ package io.kestra.cli.commands.templates.namespaces;
import io.kestra.cli.AbstractValidateCommand;
import io.kestra.cli.commands.AbstractServiceNamespaceUpdateCommand;
import io.kestra.cli.services.TenantIdSelectorService;
import io.kestra.core.models.templates.Template;
import io.kestra.core.models.templates.TemplateEnabled;
import io.kestra.core.serializers.YamlParser;
@@ -10,6 +11,7 @@ import io.micronaut.http.HttpRequest;
import io.micronaut.http.MutableHttpRequest;
import io.micronaut.http.client.exceptions.HttpClientResponseException;
import io.micronaut.http.client.netty.DefaultHttpClient;
import jakarta.inject.Inject;
import lombok.extern.slf4j.Slf4j;
import picocli.CommandLine;
@@ -27,6 +29,9 @@ import jakarta.validation.ConstraintViolationException;
@TemplateEnabled
public class TemplateNamespaceUpdateCommand extends AbstractServiceNamespaceUpdateCommand {
@Inject
private TenantIdSelectorService tenantService;
@Override
public Integer call() throws Exception {
super.call();
@@ -44,7 +49,7 @@ public class TemplateNamespaceUpdateCommand extends AbstractServiceNamespaceUpda
try (DefaultHttpClient client = client()) {
MutableHttpRequest<List<Template>> request = HttpRequest
.POST(apiUri("/templates/") + namespace + "?delete=" + delete, templates);
.POST(apiUri("/templates/", tenantService.getTenantId(tenantId)) + namespace + "?delete=" + delete, templates);
List<UpdateResult> updated = client.toBlocking().retrieve(
this.requestOptions(request),

View File

@@ -0,0 +1,19 @@
package io.kestra.cli.services;
import static io.kestra.core.tenant.TenantService.MAIN_TENANT;
import io.kestra.core.exceptions.KestraRuntimeException;
import jakarta.inject.Singleton;
import org.apache.commons.lang3.StringUtils;
@Singleton
public class TenantIdSelectorService {
//For override purpose in Kestra EE
public String getTenantId(String tenantId) {
if (StringUtils.isNotBlank(tenantId) && !MAIN_TENANT.equals(tenantId)){
throw new KestraRuntimeException("Tenant id can only be 'main'");
}
return MAIN_TENANT;
}
}

View File

@@ -27,6 +27,7 @@ micronaut:
write-idle-timeout: 60m
idle-timeout: 60m
netty:
max-zstd-encode-size: 67108864 # increased to 64MB from the default of 32MB
max-chunk-size: 10MB
max-header-size: 32768 # increased from the default of 8k
responses:
@@ -183,7 +184,6 @@ kestra:
server:
basic-auth:
enabled: false
# These URLs will not be authenticated, by default we open some of the Micronaut default endpoints but not all for security reasons
open-urls:
- "/ping"
@@ -228,4 +228,4 @@ otel:
- /health
- /env
- /prometheus
propagators: tracecontext, baggage
propagators: tracecontext, baggage

View File

@@ -108,6 +108,34 @@ class FlowCreateOrUpdateCommandTest {
}
}
@Test
void should_fail_with_incorrect_tenant() {
URL directory = FlowCreateOrUpdateCommandTest.class.getClassLoader().getResource("flows");
ByteArrayOutputStream err = new ByteArrayOutputStream();
System.setErr(new PrintStream(err));
try (ApplicationContext ctx = ApplicationContext.run(Environment.CLI, Environment.TEST)) {
EmbeddedServer embeddedServer = ctx.getBean(EmbeddedServer.class);
embeddedServer.start();
String[] args = {
"--server",
embeddedServer.getURL().toString(),
"--user",
"myuser:pass:word",
"--tenant", "incorrect",
directory.getPath(),
};
PicocliRunner.call(FlowUpdatesCommand.class, ctx, args);
assertThat(err.toString()).contains("Tenant id can only be 'main'");
err.reset();
}
}
@Test
void helper() {
URL directory = FlowCreateOrUpdateCommandTest.class.getClassLoader().getResource("helper");

View File

@@ -0,0 +1,33 @@
package io.kestra.cli.commands.servers;
import static org.assertj.core.api.Assertions.assertThat;
import io.kestra.cli.App;
import io.micronaut.configuration.picocli.PicocliRunner;
import io.micronaut.context.ApplicationContext;
import io.micronaut.context.env.Environment;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import org.junit.jupiter.api.Test;
public class TenantIdSelectorServiceTest {
@Test
void should_fail_without_tenant_id() {
ByteArrayOutputStream err = new ByteArrayOutputStream();
System.setErr(new PrintStream(err));
try (ApplicationContext ctx = ApplicationContext.run(Environment.CLI, Environment.TEST)) {
String[] start = {
"server", "standalone",
"-f", "unused",
"--tenant", "wrong_tenant"
};
PicocliRunner.call(App.class, ctx, start);
assertThat(err.toString()).contains("Tenant id can only be 'main'");
err.reset();
}
}
}

View File

@@ -17,7 +17,7 @@ kestra:
central:
url: https://repo.maven.apache.org/maven2/
sonatype:
url: https://s01.oss.sonatype.org/content/repositories/snapshots/
url: https://central.sonatype.com/repository/maven-snapshots/
server:
liveness:
enabled: false

View File

@@ -56,21 +56,23 @@ component_management:
name: Tests
paths:
- tests/**
- component_id: ui
name: Ui
paths:
- ui/**
- component_id: webserver
name: Webserver
paths:
- webserver/**
ignore:
- ui/**
# we are not mature yet to have a ui code coverage
flag_management:
default_rules:
carryforward: true
statuses:
- type: project
target: 80%
threshold: 1%
target: 70%
threshold: 10%
- type: patch
target: 90%
target: 75%
threshold: 10%

View File

@@ -37,6 +37,7 @@ dependencies {
implementation 'nl.basjes.gitignore:gitignore-reader'
implementation group: 'dev.failsafe', name: 'failsafe'
implementation 'com.github.ben-manes.caffeine:caffeine'
implementation 'com.github.ksuid:ksuid:1.1.3'
api 'org.apache.httpcomponents.client5:httpclient5'
// plugins
@@ -74,7 +75,9 @@ dependencies {
testImplementation "io.micronaut:micronaut-http-server-netty"
testImplementation "io.micronaut:micronaut-management"
testImplementation "org.testcontainers:testcontainers:1.21.1"
testImplementation "org.testcontainers:junit-jupiter:1.21.1"
testImplementation "org.testcontainers:testcontainers:1.21.3"
testImplementation "org.testcontainers:junit-jupiter:1.21.3"
testImplementation "org.bouncycastle:bcpkix-jdk18on:1.81"
testImplementation "org.wiremock:wiremock-jetty12"
}

View File

@@ -0,0 +1,26 @@
package io.kestra.core.debug;
import jakarta.annotation.Nullable;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
@AllArgsConstructor
@NoArgsConstructor
@Getter
public class Breakpoint {
@NotNull
private String id;
@Nullable
private String value;
public static Breakpoint of(String breakpoint) {
if (breakpoint.indexOf('.') > 0) {
return new Breakpoint(breakpoint.substring(0, breakpoint.indexOf('.')), breakpoint.substring(breakpoint.indexOf('.') + 1));
} else {
return new Breakpoint(breakpoint, null);
}
}
}

View File

@@ -6,14 +6,17 @@ import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.ToString;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import java.util.concurrent.ConcurrentHashMap;
@Getter
@EqualsAndHashCode
@ToString
public class ClassPluginDocumentation<T> extends AbstractClassDocumentation<T> {
private static final Map<PluginDocIdentifier, ClassPluginDocumentation<?>> CACHE = new ConcurrentHashMap<>();
private String icon;
private String group;
protected String docLicense;
@@ -78,8 +81,12 @@ public class ClassPluginDocumentation<T> extends AbstractClassDocumentation<T> {
}
}
public static <T> ClassPluginDocumentation<T> of(JsonSchemaGenerator jsonSchemaGenerator, PluginClassAndMetadata<T> plugin, boolean allProperties) {
return new ClassPluginDocumentation<>(jsonSchemaGenerator, plugin, allProperties);
public static <T> ClassPluginDocumentation<T> of(JsonSchemaGenerator jsonSchemaGenerator, PluginClassAndMetadata<T> plugin, String version, boolean allProperties) {
//noinspection unchecked
return (ClassPluginDocumentation<T>) CACHE.computeIfAbsent(
new PluginDocIdentifier(plugin.type(), version, allProperties),
(key) -> new ClassPluginDocumentation<>(jsonSchemaGenerator, plugin, allProperties)
);
}
@AllArgsConstructor
@@ -90,5 +97,11 @@ public class ClassPluginDocumentation<T> extends AbstractClassDocumentation<T> {
String unit;
String description;
}
private record PluginDocIdentifier(String pluginClassAndVersion, boolean allProperties) {
public PluginDocIdentifier(Class<?> pluginClass, String version, boolean allProperties) {
this(pluginClass.getName() + ":" + version, allProperties);
}
}
}

View File

@@ -227,7 +227,7 @@ public class DocumentationGenerator {
baseCls,
null
);
return ClassPluginDocumentation.of(jsonSchemaGenerator, metadata, true);
return ClassPluginDocumentation.of(jsonSchemaGenerator, metadata, registeredPlugin.version(), true);
})
.map(pluginDocumentation -> {
try {

View File

@@ -24,6 +24,7 @@ public class JsonSchemaCache {
private final JsonSchemaGenerator jsonSchemaGenerator;
private final ConcurrentMap<CacheKey, Map<String, Object>> schemaCache = new ConcurrentHashMap<>();
private final ConcurrentMap<SchemaType, Map<String, Object>> propertiesCache = new ConcurrentHashMap<>();
private final Map<SchemaType, Class<?>> classesBySchemaType = new HashMap<>();
@@ -44,7 +45,7 @@ public class JsonSchemaCache {
public Map<String, Object> getSchemaForType(final SchemaType type,
final boolean arrayOf) {
return schemaCache.computeIfAbsent(new CacheKey(type, arrayOf), (key) -> {
return schemaCache.computeIfAbsent(new CacheKey(type, arrayOf), key -> {
Class<?> cls = Optional.ofNullable(classesBySchemaType.get(type))
.orElseThrow(() -> new IllegalArgumentException("Cannot found schema for type '" + type + "'"));
@@ -52,6 +53,16 @@ public class JsonSchemaCache {
});
}
public Map<String, Object> getPropertiesForType(final SchemaType type) {
return propertiesCache.computeIfAbsent(type, key -> {
Class<?> cls = Optional.ofNullable(classesBySchemaType.get(type))
.orElseThrow(() -> new IllegalArgumentException("Cannot found properties for type '" + type + "'"));
return jsonSchemaGenerator.properties(null, cls);
});
}
// must be public as it's used in EE
public void registerClassForType(final SchemaType type, final Class<?> clazz) {
classesBySchemaType.put(type, clazz);
}

View File

@@ -88,12 +88,16 @@ public class JsonSchemaGenerator {
}
public <T> Map<String, Object> schemas(Class<? extends T> cls, boolean arrayOf) {
return this.schemas(cls, arrayOf, Collections.emptyList());
}
public <T> Map<String, Object> schemas(Class<? extends T> cls, boolean arrayOf, List<String> allowedPluginTypes) {
SchemaGeneratorConfigBuilder builder = new SchemaGeneratorConfigBuilder(
SchemaVersion.DRAFT_7,
OptionPreset.PLAIN_JSON
);
this.build(builder, true);
this.build(builder, true, allowedPluginTypes);
SchemaGeneratorConfig schemaGeneratorConfig = builder.build();
@@ -240,6 +244,10 @@ public class JsonSchemaGenerator {
}
protected void build(SchemaGeneratorConfigBuilder builder, boolean draft7) {
this.build(builder, draft7, Collections.emptyList());
}
protected void build(SchemaGeneratorConfigBuilder builder, boolean draft7, List<String> allowedPluginTypes) {
// builder.withObjectMapper(builder.getObjectMapper().configure(SerializationFeature.WRITE_DURATIONS_AS_TIMESTAMPS, false));
builder
.with(new JakartaValidationModule(
@@ -456,7 +464,7 @@ public class JsonSchemaGenerator {
.withSubtypeResolver((declaredType, context) -> {
TypeContext typeContext = context.getTypeContext();
return this.subtypeResolver(declaredType, typeContext);
return this.subtypeResolver(declaredType, typeContext, allowedPluginTypes);
});
// description as Markdown
@@ -533,7 +541,7 @@ public class JsonSchemaGenerator {
return null;
}
return this.subtypeResolver(declaredType, typeContext);
return this.subtypeResolver(declaredType, typeContext, allowedPluginTypes);
});
}
@@ -616,11 +624,12 @@ public class JsonSchemaGenerator {
return false;
}
protected List<ResolvedType> subtypeResolver(ResolvedType declaredType, TypeContext typeContext) {
protected List<ResolvedType> subtypeResolver(ResolvedType declaredType, TypeContext typeContext, List<String> allowedPluginTypes) {
if (declaredType.getErasedType() == Task.class) {
return getRegisteredPlugins()
.stream()
.flatMap(registeredPlugin -> registeredPlugin.getTasks().stream())
.filter(p -> allowedPluginTypes.isEmpty() || allowedPluginTypes.contains(p.getName()))
.filter(Predicate.not(io.kestra.core.models.Plugin::isInternal))
.flatMap(clz -> safelyResolveSubtype(declaredType, clz, typeContext).stream())
.toList();
@@ -628,6 +637,7 @@ public class JsonSchemaGenerator {
return getRegisteredPlugins()
.stream()
.flatMap(registeredPlugin -> registeredPlugin.getTriggers().stream())
.filter(p -> allowedPluginTypes.isEmpty() || allowedPluginTypes.contains(p.getName()))
.filter(Predicate.not(io.kestra.core.models.Plugin::isInternal))
.flatMap(clz -> safelyResolveSubtype(declaredType, clz, typeContext).stream())
.toList();
@@ -635,6 +645,7 @@ public class JsonSchemaGenerator {
return getRegisteredPlugins()
.stream()
.flatMap(registeredPlugin -> registeredPlugin.getConditions().stream())
.filter(p -> allowedPluginTypes.isEmpty() || allowedPluginTypes.contains(p.getName()))
.filter(Predicate.not(io.kestra.core.models.Plugin::isInternal))
.flatMap(clz -> safelyResolveSubtype(declaredType, clz, typeContext).stream())
.toList();
@@ -643,6 +654,7 @@ public class JsonSchemaGenerator {
.stream()
.flatMap(registeredPlugin -> registeredPlugin.getConditions().stream())
.filter(ScheduleCondition.class::isAssignableFrom)
.filter(p -> allowedPluginTypes.isEmpty() || allowedPluginTypes.contains(p.getName()))
.filter(Predicate.not(io.kestra.core.models.Plugin::isInternal))
.flatMap(clz -> safelyResolveSubtype(declaredType, clz, typeContext).stream())
.toList();
@@ -650,6 +662,7 @@ public class JsonSchemaGenerator {
return getRegisteredPlugins()
.stream()
.flatMap(registeredPlugin -> registeredPlugin.getTaskRunners().stream())
.filter(p -> allowedPluginTypes.isEmpty() || allowedPluginTypes.contains(p.getName()))
.filter(Predicate.not(io.kestra.core.models.Plugin::isInternal))
.map(typeContext::resolve)
.toList();
@@ -657,6 +670,7 @@ public class JsonSchemaGenerator {
return getRegisteredPlugins()
.stream()
.flatMap(registeredPlugin -> registeredPlugin.getLogExporters().stream())
.filter(p -> allowedPluginTypes.isEmpty() || allowedPluginTypes.contains(p.getName()))
.filter(Predicate.not(io.kestra.core.models.Plugin::isInternal))
.map(typeContext::resolve)
.toList();
@@ -666,6 +680,7 @@ public class JsonSchemaGenerator {
.flatMap(registeredPlugin -> registeredPlugin.getAdditionalPlugins().stream())
// for additional plugins, we have one subtype by type of additional plugins (for ex: embedding store for Langchain4J), so we need to filter on the correct subtype
.filter(cls -> declaredType.getErasedType().isAssignableFrom(cls))
.filter(p -> allowedPluginTypes.isEmpty() || allowedPluginTypes.contains(p.getName()))
.filter(cls -> cls != declaredType.getErasedType())
.filter(Predicate.not(io.kestra.core.models.Plugin::isInternal))
.map(typeContext::resolve)
@@ -674,6 +689,7 @@ public class JsonSchemaGenerator {
return getRegisteredPlugins()
.stream()
.flatMap(registeredPlugin -> registeredPlugin.getCharts().stream())
.filter(p -> allowedPluginTypes.isEmpty() || allowedPluginTypes.contains(p.getName()))
.filter(Predicate.not(io.kestra.core.models.Plugin::isInternal))
.<ResolvedType>mapMulti((clz, consumer) -> {
if (DataChart.class.isAssignableFrom(clz)) {
@@ -740,12 +756,16 @@ public class JsonSchemaGenerator {
}
protected <T> Map<String, Object> generate(Class<? extends T> cls, @Nullable Class<T> base) {
return this.generate(cls, base, Collections.emptyList());
}
protected <T> Map<String, Object> generate(Class<? extends T> cls, @Nullable Class<T> base, List<String> allowedPluginTypes) {
SchemaGeneratorConfigBuilder builder = new SchemaGeneratorConfigBuilder(
SchemaVersion.DRAFT_2019_09,
OptionPreset.PLAIN_JSON
);
this.build(builder, false);
this.build(builder, false, allowedPluginTypes);
// we don't return base properties unless specified with @PluginProperty and hidden is false
builder

View File

@@ -23,29 +23,25 @@ public class Plugin {
private String group;
private String version;
private Map<String, String> manifest;
private List<String> tasks;
private List<String> triggers;
private List<String> conditions;
private List<String> controllers;
private List<String> storages;
private List<String> secrets;
private List<String> taskRunners;
private List<String> guides;
private List<String> aliases;
private List<String> apps;
private List<String> appBlocks;
private List<String> charts;
private List<String> dataFilters;
private List<String> logExporters;
private List<String> additionalPlugins;
private List<PluginElementMetadata> tasks;
private List<PluginElementMetadata> triggers;
private List<PluginElementMetadata> conditions;
private List<PluginElementMetadata> controllers;
private List<PluginElementMetadata> storages;
private List<PluginElementMetadata> secrets;
private List<PluginElementMetadata> taskRunners;
private List<PluginElementMetadata> apps;
private List<PluginElementMetadata> appBlocks;
private List<PluginElementMetadata> charts;
private List<PluginElementMetadata> dataFilters;
private List<PluginElementMetadata> logExporters;
private List<PluginElementMetadata> additionalPlugins;
private List<PluginSubGroup.PluginCategory> categories;
private String subGroup;
public static Plugin of(RegisteredPlugin registeredPlugin, @Nullable String subgroup) {
return Plugin.of(registeredPlugin, subgroup, true);
}
public static Plugin of(RegisteredPlugin registeredPlugin, @Nullable String subgroup, boolean includeDeprecated) {
Plugin plugin = new Plugin();
plugin.name = registeredPlugin.name();
PluginSubGroup subGroupInfos = null;
@@ -90,18 +86,18 @@ public class Plugin {
plugin.subGroup = subgroup;
Predicate<Class<?>> packagePredicate = c -> subgroup == null || c.getPackageName().equals(subgroup);
plugin.tasks = filterAndGetClassName(registeredPlugin.getTasks(), includeDeprecated, packagePredicate);
plugin.triggers = filterAndGetClassName(registeredPlugin.getTriggers(), includeDeprecated, packagePredicate);
plugin.conditions = filterAndGetClassName(registeredPlugin.getConditions(), includeDeprecated, packagePredicate);
plugin.storages = filterAndGetClassName(registeredPlugin.getStorages(), includeDeprecated, packagePredicate);
plugin.secrets = filterAndGetClassName(registeredPlugin.getSecrets(), includeDeprecated, packagePredicate);
plugin.taskRunners = filterAndGetClassName(registeredPlugin.getTaskRunners(), includeDeprecated, packagePredicate);
plugin.apps = filterAndGetClassName(registeredPlugin.getApps(), includeDeprecated, packagePredicate);
plugin.appBlocks = filterAndGetClassName(registeredPlugin.getAppBlocks(), includeDeprecated, packagePredicate);
plugin.charts = filterAndGetClassName(registeredPlugin.getCharts(), includeDeprecated, packagePredicate);
plugin.dataFilters = filterAndGetClassName(registeredPlugin.getDataFilters(), includeDeprecated, packagePredicate);
plugin.logExporters = filterAndGetClassName(registeredPlugin.getLogExporters(), includeDeprecated, packagePredicate);
plugin.additionalPlugins = filterAndGetClassName(registeredPlugin.getAdditionalPlugins(), includeDeprecated, packagePredicate);
plugin.tasks = filterAndGetTypeWithMetadata(registeredPlugin.getTasks(), packagePredicate);
plugin.triggers = filterAndGetTypeWithMetadata(registeredPlugin.getTriggers(), packagePredicate);
plugin.conditions = filterAndGetTypeWithMetadata(registeredPlugin.getConditions(), packagePredicate);
plugin.storages = filterAndGetTypeWithMetadata(registeredPlugin.getStorages(), packagePredicate);
plugin.secrets = filterAndGetTypeWithMetadata(registeredPlugin.getSecrets(), packagePredicate);
plugin.taskRunners = filterAndGetTypeWithMetadata(registeredPlugin.getTaskRunners(), packagePredicate);
plugin.apps = filterAndGetTypeWithMetadata(registeredPlugin.getApps(), packagePredicate);
plugin.appBlocks = filterAndGetTypeWithMetadata(registeredPlugin.getAppBlocks(), packagePredicate);
plugin.charts = filterAndGetTypeWithMetadata(registeredPlugin.getCharts(), packagePredicate);
plugin.dataFilters = filterAndGetTypeWithMetadata(registeredPlugin.getDataFilters(), packagePredicate);
plugin.logExporters = filterAndGetTypeWithMetadata(registeredPlugin.getLogExporters(), packagePredicate);
plugin.additionalPlugins = filterAndGetTypeWithMetadata(registeredPlugin.getAdditionalPlugins(), packagePredicate);
return plugin;
}
@@ -111,17 +107,18 @@ public class Plugin {
* Those classes are only filtered from the documentation to ensure backward compatibility.
*
* @param list The list of classes?
* @param includeDeprecated whether to include deprecated plugins or not
* @return a filtered streams.
*/
private static List<String> filterAndGetClassName(final List<? extends Class<?>> list, boolean includeDeprecated, Predicate<Class<?>> clazzFilter) {
private static List<PluginElementMetadata> filterAndGetTypeWithMetadata(final List<? extends Class<?>> list, Predicate<Class<?>> clazzFilter) {
return list
.stream()
.filter(not(io.kestra.core.models.Plugin::isInternal))
.filter(p -> includeDeprecated || !io.kestra.core.models.Plugin.isDeprecated(p))
.filter(clazzFilter)
.map(Class::getName)
.filter(c -> !c.startsWith("org.kestra."))
.filter(c -> !c.getName().startsWith("org.kestra."))
.map(c -> new PluginElementMetadata(c.getName(), io.kestra.core.models.Plugin.isDeprecated(c) ? true : null))
.toList();
}
public record PluginElementMetadata(String cls, Boolean deprecated) {
}
}

View File

@@ -0,0 +1,25 @@
package io.kestra.core.exceptions;
/**
* General exception that can be thrown when an AI service replies with an error.
* When propagated in the context of a REST API call, this exception should
* result in an HTTP 422 UNPROCESSABLE_ENTITY response.
*/
public class AiException extends KestraRuntimeException {
/**
* Creates a new {@link AiException} instance.
*/
public AiException() {
super();
}
/**
* Creates a new {@link AiException} instance.
*
* @param aiErrorMessage the AI error message.
*/
public AiException(final String aiErrorMessage) {
super(aiErrorMessage);
}
}

View File

@@ -0,0 +1,35 @@
package io.kestra.core.exceptions;
import java.io.Serial;
import java.util.List;
import lombok.Getter;
/**
* General exception that can be throws when a resource fail validation.
*/
public class ValidationErrorException extends KestraRuntimeException {
@Serial
private static final long serialVersionUID = 1L;
private static final String VALIDATION_ERROR_MESSAGE = "Resource fails validation";
@Getter
private transient final List<String> invalids;
/**
* Creates a new {@link ValidationErrorException} instance.
*
* @param invalids the invalid filters.
*/
public ValidationErrorException(final List<String> invalids) {
super(VALIDATION_ERROR_MESSAGE);
this.invalids = invalids;
}
public String formatedInvalidObjects(){
if (invalids == null || invalids.isEmpty()){
return VALIDATION_ERROR_MESSAGE;
}
return String.join(", ", invalids);
}
}

View File

@@ -8,6 +8,7 @@ import io.kestra.core.http.client.apache.*;
import io.kestra.core.http.client.configurations.HttpConfiguration;
import io.kestra.core.runners.RunContext;
import io.kestra.core.serializers.JacksonMapper;
import io.micronaut.http.MediaType;
import jakarta.annotation.Nullable;
import lombok.Builder;
import lombok.extern.slf4j.Slf4j;
@@ -279,10 +280,12 @@ public class HttpClient implements Closeable {
private <T> T bodyHandler(Class<?> cls, HttpEntity entity) throws IOException, ParseException {
if (entity == null) {
return null;
} else if (cls.isAssignableFrom(String.class)) {
} else if (String.class.isAssignableFrom(cls)) {
return (T) EntityUtils.toString(entity);
} else if (cls.isAssignableFrom(Byte[].class)) {
} else if (Byte[].class.isAssignableFrom(cls)) {
return (T) ArrayUtils.toObject(EntityUtils.toByteArray(entity));
} else if (MediaType.APPLICATION_YAML.equals(entity.getContentType()) || "application/yaml".equals(entity.getContentType())) {
return (T) JacksonMapper.ofYaml().readValue(entity.getContent(), cls);
} else {
return (T) JacksonMapper.ofJson(false).readValue(entity.getContent(), cls);
}

View File

@@ -9,6 +9,7 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Streams;
import io.kestra.core.debug.Breakpoint;
import io.kestra.core.exceptions.InternalException;
import io.kestra.core.models.DeletedInterface;
import io.kestra.core.models.Label;
@@ -120,6 +121,9 @@ public class Execution implements DeletedInterface, TenantInterface {
@Nullable
ExecutionKind kind;
@Nullable
List<Breakpoint> breakpoints;
/**
* Factory method for constructing a new {@link Execution} object for the given {@link Flow}.
*
@@ -221,7 +225,8 @@ public class Execution implements DeletedInterface, TenantInterface {
this.scheduleDate,
this.traceParent,
this.fixtures,
this.kind
this.kind,
this.breakpoints
);
}
@@ -247,7 +252,8 @@ public class Execution implements DeletedInterface, TenantInterface {
this.scheduleDate,
this.traceParent,
this.fixtures,
this.kind
this.kind,
this.breakpoints
);
}
@@ -286,7 +292,34 @@ public class Execution implements DeletedInterface, TenantInterface {
this.scheduleDate,
this.traceParent,
this.fixtures,
this.kind
this.kind,
this.breakpoints
);
}
public Execution withBreakpoints(List<Breakpoint> newBreakpoints) {
return new Execution(
this.tenantId,
this.id,
this.namespace,
this.flowId,
this.flowRevision,
this.taskRunList,
this.inputs,
this.outputs,
this.labels,
this.variables,
this.state,
this.parentId,
this.originalId,
this.trigger,
this.deleted,
this.metadata,
this.scheduleDate,
this.traceParent,
this.fixtures,
this.kind,
newBreakpoints
);
}
@@ -312,7 +345,8 @@ public class Execution implements DeletedInterface, TenantInterface {
this.scheduleDate,
this.traceParent,
this.fixtures,
this.kind
this.kind,
this.breakpoints
);
}
@@ -824,7 +858,7 @@ public class Execution implements DeletedInterface, TenantInterface {
* @param e the current exception
* @return the {@link ILoggingEvent} waited to generate {@link LogEntry}
*/
public static ILoggingEvent loggingEventFromException(Exception e) {
public static ILoggingEvent loggingEventFromException(Throwable e) {
LoggingEvent loggingEvent = new LoggingEvent();
loggingEvent.setLevel(ch.qos.logback.classic.Level.ERROR);
loggingEvent.setThrowableProxy(new ThrowableProxy(e));

View File

@@ -3,8 +3,9 @@ package io.kestra.core.models.executions;
/**
* Describe the kind of execution:
* - TEST: created by a test
* - PLAYGROUND: created by a playground
* - NORMAL: anything else, for backward compatibility NORMAL is not persisted but null is used instead
*/
public enum ExecutionKind {
NORMAL, TEST
NORMAL, TEST, PLAYGROUND
}

View File

@@ -7,6 +7,7 @@ import io.kestra.core.models.tasks.ResolvedTask;
import io.kestra.core.models.tasks.retrys.AbstractRetry;
import io.kestra.core.utils.IdUtils;
import io.swagger.v3.oas.annotations.Hidden;
import jakarta.annotation.Nullable;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import lombok.*;
@@ -62,6 +63,11 @@ public class TaskRun implements TenantInterface {
@With
Boolean dynamic;
// Set it to true to force execution even if the execution is killed
@Nullable
@With
Boolean forceExecution;
@Deprecated
public void setItems(String items) {
// no-op for backward compatibility
@@ -81,7 +87,8 @@ public class TaskRun implements TenantInterface {
this.outputs,
this.state.withState(state),
this.iteration,
this.dynamic
this.dynamic,
this.forceExecution
);
}
@@ -99,7 +106,8 @@ public class TaskRun implements TenantInterface {
this.outputs,
newState,
this.iteration,
this.dynamic
this.dynamic,
this.forceExecution
);
}
@@ -121,7 +129,8 @@ public class TaskRun implements TenantInterface {
this.outputs,
this.state.withState(State.Type.FAILED),
this.iteration,
this.dynamic
this.dynamic,
this.forceExecution
);
}
@@ -245,7 +254,7 @@ public class TaskRun implements TenantInterface {
* @return The next retry date, null if maxAttempt || maxDuration is reached
*/
public Instant nextRetryDate(AbstractRetry retry, Execution execution) {
if (retry.getMaxAttempt() != null && execution.getMetadata().getAttemptNumber() >= retry.getMaxAttempt()) {
if (retry.getMaxAttempts() != null && execution.getMetadata().getAttemptNumber() >= retry.getMaxAttempts()) {
return null;
}
@@ -265,7 +274,7 @@ public class TaskRun implements TenantInterface {
* @return The next retry date, null if maxAttempt || maxDuration is reached
*/
public Instant nextRetryDate(AbstractRetry retry) {
if (this.attempts == null || this.attempts.isEmpty() || (retry.getMaxAttempt() != null && this.attemptNumber() >= retry.getMaxAttempt())) {
if (this.attempts == null || this.attempts.isEmpty() || (retry.getMaxAttempts() != null && this.attemptNumber() >= retry.getMaxAttempts())) {
return null;
}

View File

@@ -3,6 +3,8 @@ package io.kestra.core.models.flows;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.kestra.core.models.Label;
import io.kestra.core.models.annotations.PluginProperty;
import io.kestra.core.models.tasks.WorkerGroup;
import io.kestra.core.serializers.ListOrMapOfLabelDeserializer;
import io.kestra.core.serializers.ListOrMapOfLabelSerializer;
import io.swagger.v3.oas.annotations.Hidden;
@@ -60,6 +62,9 @@ public abstract class AbstractFlow implements FlowInterface {
@Schema(implementation = Object.class, oneOf = {List.class, Map.class})
List<Label> labels;
@Schema(additionalProperties = Schema.AdditionalPropertiesValue.TRUE)
Map<String, Object> variables;
@Valid
private WorkerGroup workerGroup;
}

View File

@@ -19,7 +19,6 @@ import io.kestra.core.models.tasks.retrys.AbstractRetry;
import io.kestra.core.models.triggers.AbstractTrigger;
import io.kestra.core.models.validations.ManualConstraintViolation;
import io.kestra.core.serializers.JacksonMapper;
import io.kestra.core.services.FlowService;
import io.kestra.core.utils.ListUtils;
import io.kestra.core.validations.FlowValidation;
import io.micronaut.core.annotation.Introspected;
@@ -30,8 +29,6 @@ import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty;
import lombok.*;
import lombok.experimental.SuperBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.*;
import java.util.stream.Collectors;
@@ -70,6 +67,8 @@ public class Flow extends AbstractFlow implements HasUID {
@Valid
@NotEmpty
@Schema(additionalProperties = Schema.AdditionalPropertiesValue.TRUE)
List<Task> tasks;
@Valid
@@ -187,19 +186,32 @@ public class Flow extends AbstractFlow implements HasUID {
.toList();
}
public List<Task> allErrorsWithChilds() {
public List<Task> allErrorsWithChildren() {
var allErrors = allTasksWithChilds().stream()
.filter(task -> task.isFlowable() && ((FlowableTask<?>) task).getErrors() != null)
.flatMap(task -> ((FlowableTask<?>) task).getErrors().stream())
.collect(Collectors.toCollection(ArrayList::new));
if (this.getErrors() != null && !this.getErrors().isEmpty()) {
if (!ListUtils.isEmpty(this.getErrors())) {
allErrors.addAll(this.getErrors());
}
return allErrors;
}
public List<Task> allFinallyWithChildren() {
var allFinally = allTasksWithChilds().stream()
.filter(task -> task.isFlowable() && ((FlowableTask<?>) task).getFinally() != null)
.flatMap(task -> ((FlowableTask<?>) task).getFinally().stream())
.collect(Collectors.toCollection(ArrayList::new));
if (!ListUtils.isEmpty(this.getFinally())) {
allFinally.addAll(this.getFinally());
}
return allFinally;
}
public Task findParentTasksByTaskId(String taskId) {
return allTasksWithChilds()
.stream()

View File

@@ -11,6 +11,7 @@ import io.kestra.core.models.HasUID;
import io.kestra.core.models.Label;
import io.kestra.core.models.TenantInterface;
import io.kestra.core.models.flows.sla.SLA;
import io.kestra.core.models.tasks.WorkerGroup;
import io.kestra.core.serializers.JacksonMapper;
import java.util.AbstractMap;
@@ -42,6 +43,8 @@ public interface FlowInterface extends FlowId, DeletedInterface, TenantInterface
Map<String, Object> getVariables();
WorkerGroup getWorkerGroup();
default Concurrency getConcurrency() {
return null;
}

View File

@@ -168,6 +168,11 @@ public class State {
return this.current.isPaused();
}
@JsonIgnore
public boolean isBreakpoint() {
return this.current.isBreakpoint();
}
@JsonIgnore
public boolean isRetrying() {
return this.current.isRetrying();
@@ -216,7 +221,8 @@ public class State {
QUEUED,
RETRYING,
RETRIED,
SKIPPED;
SKIPPED,
BREAKPOINT;
public boolean isTerminated() {
return this == Type.FAILED || this == Type.WARNING || this == Type.SUCCESS || this == Type.KILLED || this == Type.CANCELLED || this == Type.RETRIED || this == Type.SKIPPED;
@@ -242,6 +248,10 @@ public class State {
return this == Type.PAUSED;
}
public boolean isBreakpoint() {
return this == Type.BREAKPOINT;
}
public boolean isRetrying() {
return this == Type.RETRYING || this == Type.RETRIED;
}

View File

@@ -21,6 +21,7 @@ public class FileInput extends Input<URI> {
private static final String DEFAULT_EXTENSION = ".upl";
@Builder.Default
@Deprecated(since = "0.24", forRemoval = true)
public String extension = DEFAULT_EXTENSION;
@Override

View File

@@ -108,7 +108,7 @@ public class MultiselectInput extends Input<List<String>> implements ItemTypeInt
private List<String> renderExpressionValues(final Function<String, Object> renderer) {
Object result;
try {
result = renderer.apply(expression);
result = renderer.apply(expression.trim());
} catch (Exception e) {
throw ManualConstraintViolation.toConstraintViolationException(
"Cannot render 'expression'. Cause: " + e.getMessage(),

View File

@@ -86,7 +86,7 @@ public class SelectInput extends Input<String> implements RenderableInput {
private List<String> renderExpressionValues(final Function<String, Object> renderer) {
Object result;
try {
result = renderer.apply(expression);
result = renderer.apply(expression.trim());
} catch (Exception e) {
throw ManualConstraintViolation.toConstraintViolationException(
"Cannot render 'expression'. Cause: " + e.getMessage(),

View File

@@ -136,7 +136,7 @@ public class Data {
Structured data items can be defined in the following ways:
- A single item as a map (a document).
- A list of items as a list of maps (a list of documents).
- A URI, supported schemes are `kestra` for internal storage files, and `file` for host local files.
- A URI, supported schemes are `kestra` for internal storage files, `file` for host local files, and `nsfile` for namespace files.
- A JSON String that will then be serialized either as a single item or a list of items.""";
@Schema(

View File

@@ -1,15 +1,14 @@
package io.kestra.core.models.property;
import io.kestra.core.runners.DefaultRunContext;
import io.kestra.core.runners.LocalPath;
import io.kestra.core.runners.RunContext;
import io.kestra.core.storages.Namespace;
import io.kestra.core.storages.StorageContext;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.nio.file.Path;
import java.util.Collections;
import java.util.List;
/**
@@ -17,8 +16,7 @@ import java.util.List;
* It supports reading from the following schemes: {@link #SUPPORTED_SCHEMES}.
*/
public class URIFetcher {
private static final String FILE_SCHEME = "file";
private static final List<String> SUPPORTED_SCHEMES = List.of(StorageContext.KESTRA_SCHEME, FILE_SCHEME);
private static final List<String> SUPPORTED_SCHEMES = List.of(StorageContext.KESTRA_SCHEME, LocalPath.FILE_SCHEME, Namespace.NAMESPACE_FILE_SCHEME);
private final URI uri;
@@ -68,6 +66,14 @@ public class URIFetcher {
return SUPPORTED_SCHEMES.stream().anyMatch(scheme -> uri.startsWith(scheme + "://"));
}
/**
* Whether the URI is supported by the Fetcher.
* A supported URI is a URI which scheme is one of the {@link #SUPPORTED_SCHEMES}.
*/
public static boolean supports(URI uri) {
return uri.getScheme() != null && SUPPORTED_SCHEMES.contains(uri.getScheme());
}
/**
* Fetch the resource pointed by this SmartURI
*
@@ -82,23 +88,11 @@ public class URIFetcher {
// we need to first check the protocol, then create one reader by protocol
return switch (uri.getScheme()) {
case StorageContext.KESTRA_SCHEME -> runContext.storage().getFile(uri);
case FILE_SCHEME -> {
Path path = Path.of(uri).toRealPath(); // toRealPath() will protect about path traversal issues
Path workingDirectory = runContext.workingDir().path();
if (!path.startsWith(workingDirectory)) {
// we need to check that it's on an allowed path
List<String> globalAllowedPaths = ((DefaultRunContext) runContext).getApplicationContext().getProperty("kestra.plugins.allowed-paths", List.class, Collections.emptyList());
if (globalAllowedPaths.stream().noneMatch(path::startsWith)) {
// if not globally allowed, we check it's allowed for this specific plugin
List<String> pluginAllowedPaths = (List<String>) runContext.pluginConfiguration("allowed-paths").orElse(Collections.emptyList());
if (pluginAllowedPaths.stream().noneMatch(path::startsWith)) {
throw new SecurityException("The path " + path + " is not authorized. " +
"Only files inside the working directory are allowed by default, other path must be allowed either globally inside the Kestra configuration using the `kestra.plugins.allowed-paths` property, " +
"or by plugin using the `allowed-paths` plugin configuration.");
}
}
}
yield new FileInputStream(path.toFile());
case LocalPath.FILE_SCHEME -> runContext.localPath().get(uri);
case Namespace.NAMESPACE_FILE_SCHEME -> {
var namespace = uri.getAuthority() == null ? runContext.storage().namespace() : runContext.storage().namespace(uri.getAuthority());
var nsFileUri = namespace.get(Path.of(uri.getPath())).uri();
yield runContext.storage().getFile(nsFileUri);
}
default -> throw new IllegalArgumentException("Scheme not supported: " + uri.getScheme());
};

View File

@@ -0,0 +1,20 @@
package io.kestra.core.models.tasks;
import io.micronaut.core.annotation.Introspected;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import java.time.Duration;
@Getter
@NoArgsConstructor
@AllArgsConstructor
@Introspected
public class Cache {
@NotNull
private Boolean enabled;
private Duration ttl;
}

View File

@@ -7,7 +7,12 @@ import java.util.Map;
public interface InputFilesInterface {
@Schema(
title = "The files to create on the local filesystem. It can be a map or a JSON object.",
title = "The files to create on the working. It can be a map or a JSON object.",
description = """
Each file can be defined:
- Inline with its content
- As a URI, supported schemes are `kestra` for internal storage files, `file` for host local files, and `nsfile` for namespace files.
""",
oneOf = {Map.class, String.class}
)
@PluginProperty(dynamic = true)

View File

@@ -49,4 +49,10 @@ public class NamespaceFiles {
)
@Builder.Default
private Property<FileExistComportment> ifExists = Property.ofValue(FileExistComportment.OVERWRITE);
@Schema(
title = "Whether to mount file into the root of the working directory, or create a folder per namespace"
)
@Builder.Default
private Property<Boolean> folderPerNamespace = Property.ofValue(false);
}

View File

@@ -11,6 +11,7 @@ import io.kestra.core.models.tasks.retrys.AbstractRetry;
import io.kestra.core.runners.RunContext;
import io.kestra.plugin.core.flow.WorkingDirectory;
import jakarta.validation.Valid;
import jakarta.validation.constraints.Size;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
@@ -28,6 +29,7 @@ import static io.kestra.core.utils.Rethrow.throwFunction;
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
@Plugin
abstract public class Task implements TaskInterface {
@Size(max = 256, message = "Task id must be at most 256 characters")
protected String id;
protected String type;
@@ -72,6 +74,10 @@ abstract public class Task implements TaskInterface {
@PluginProperty(hidden = true, group = PluginProperty.CORE_GROUP)
private boolean allowWarning = false;
@PluginProperty(hidden = true, group = PluginProperty.CORE_GROUP)
@Valid
private Cache taskCache;
public Optional<Task> findById(String id) {
if (this.getId().equals(id)) {
return Optional.of(this);

View File

@@ -1,6 +1,5 @@
package io.kestra.core.models.tasks;
import io.kestra.core.validations.WorkerGroupValidation;
import io.micronaut.core.annotation.Introspected;
import lombok.AllArgsConstructor;
import lombok.Getter;
@@ -10,7 +9,6 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor
@AllArgsConstructor
@Introspected
@WorkerGroupValidation
public class WorkerGroup {
private String key;

View File

@@ -29,8 +29,18 @@ public abstract class AbstractRetry {
private Duration maxDuration;
@Deprecated(forRemoval = true)
public Integer getMaxAttempt() {
return maxAttempts;
}
@Deprecated(forRemoval = true)
public void setMaxAttempt(@Min(1) Integer maxAttempt) {
this.maxAttempts = maxAttempt;
}
@Min(1)
private Integer maxAttempt;
private Integer maxAttempts;
@Builder.Default
private Boolean warningOnRetry = false;
@@ -46,8 +56,8 @@ public abstract class AbstractRetry {
builder.withMaxDuration(maxDuration);
}
if (this.maxAttempt != null) {
builder.withMaxAttempts(this.maxAttempt);
if (this.maxAttempts != null) {
builder.withMaxAttempts(this.maxAttempts);
}
return builder;
}

View File

@@ -100,7 +100,7 @@ abstract public class PluginUtilsService {
@SuppressWarnings("unchecked")
public static Map<String, String> transformInputFiles(RunContext runContext, Map<String, Object> additionalVars, @NotNull Object inputFiles) throws IllegalVariableEvaluationException, JsonProcessingException {
if (inputFiles instanceof Map) {
Map<String, String> castedInputFiles = (Map<String, String>) ((Map<?, ?>) inputFiles);
Map<String, String> castedInputFiles = (Map<String, String>) inputFiles;
Map<String, String> nullFilteredInputFiles = new HashMap<>();
castedInputFiles.forEach((key, val) -> {
if (val != null) {
@@ -110,7 +110,6 @@ abstract public class PluginUtilsService {
return runContext.renderMap(nullFilteredInputFiles, additionalVars);
} else if (inputFiles instanceof String inputFileString) {
return JacksonMapper.ofJson(false).readValue(
runContext.render(inputFileString, additionalVars),
MAP_TYPE_REFERENCE

View File

@@ -30,7 +30,7 @@ import static io.kestra.core.utils.Rethrow.throwFunction;
* Helper class for task runners and script tasks.
*/
public final class ScriptService {
private static final Pattern INTERNAL_STORAGE_PATTERN = Pattern.compile("(kestra:\\/\\/[-a-zA-Z0-9%._\\+~#=/]*)");
private static final Pattern INTERNAL_STORAGE_PATTERN = Pattern.compile("(kestra:\\/\\/[-\\p{Alnum}._\\+~#=/]*)", Pattern.UNICODE_CHARACTER_CLASS);
// These are the three common additional variables task runners must provide for variable rendering.
public static final String VAR_WORKING_DIR = "workingDir";

View File

@@ -1,7 +1,6 @@
package io.kestra.core.models.topologies;
import io.kestra.core.models.TenantInterface;
import io.kestra.core.models.flows.Flow;
import io.kestra.core.models.flows.FlowInterface;
import io.swagger.v3.oas.annotations.Hidden;
import lombok.AllArgsConstructor;
@@ -11,6 +10,8 @@ import lombok.experimental.SuperBuilder;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import java.util.Objects;
@Getter
@AllArgsConstructor
@SuperBuilder(toBuilder = true)
@@ -26,6 +27,18 @@ public class FlowNode implements TenantInterface {
String id;
@Override
public boolean equals(Object o) {
if (o == null || getClass() != o.getClass()) return false;
FlowNode flowNode = (FlowNode) o;
return Objects.equals(uid, flowNode.uid);
}
@Override
public int hashCode() {
return Objects.hash(uid);
}
public static FlowNode of(FlowInterface flow) {
return FlowNode.builder()
.uid(flow.uidWithoutRevision())

View File

@@ -78,6 +78,10 @@ abstract public class AbstractTrigger implements TriggerInterface {
@PluginProperty(hidden = true, group = PluginProperty.CORE_GROUP)
private boolean logToFile = false;
@Builder.Default
@PluginProperty(hidden = true, group = PluginProperty.CORE_GROUP)
private boolean failOnTriggerError = false;
/**
* For backward compatibility: we rename minLogLevel to logLevel.
* @deprecated use {@link #logLevel} instead

View File

@@ -8,6 +8,7 @@ import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.SuperBuilder;
@@ -20,6 +21,7 @@ import java.util.List;
@NoArgsConstructor
@Introspected
public class TriggerContext {
@Setter
@Pattern(regexp = "^[a-z0-9][a-z0-9_-]")
private String tenantId;

View File

@@ -119,6 +119,7 @@ public abstract class TriggerService {
.id(id)
.namespace(context.getNamespace())
.flowId(context.getFlowId())
.tenantId(context.getTenantId())
.flowRevision(flowRevision)
.state(new State())
.trigger(executionTrigger)

View File

@@ -249,9 +249,9 @@ public class PluginScanner {
}
private static void addGuides(Path root, List<String> guides) throws IOException {
try (var stream = Files.walk(root, 1)) {
try (var stream = Files.walk(root)) { // remove depth limit to walk recursively
stream
.skip(1) // first element is the root element
.filter(Files::isRegularFile)
.sorted(Comparator.comparing(path -> path.getName(path.getParent().getNameCount()).toString()))
.forEach(guide -> {
var guideName = guide.getName(guide.getParent().getNameCount()).toString();

View File

@@ -33,6 +33,20 @@ import static io.kestra.core.utils.Rethrow.throwFunction;
@EqualsAndHashCode
@Builder
public class RegisteredPlugin {
public static final String TASKS_GROUP_NAME = "tasks";
public static final String TRIGGERS_GROUP_NAME = "triggers";
public static final String CONDITIONS_GROUP_NAME = "conditions";
public static final String STORAGES_GROUP_NAME = "storages";
public static final String SECRETS_GROUP_NAME = "secrets";
public static final String TASK_RUNNERS_GROUP_NAME = "task-runners";
public static final String APPS_GROUP_NAME = "apps";
public static final String APP_BLOCKS_GROUP_NAME = "app-blocks";
public static final String CHARTS_GROUP_NAME = "charts";
public static final String DATA_FILTERS_GROUP_NAME = "data-filters";
public static final String DATA_FILTERS_KPI_GROUP_NAME = "data-filters-kpi";
public static final String LOG_EXPORTERS_GROUP_NAME = "log-exporters";
public static final String ADDITIONAL_PLUGINS_GROUP_NAME = "additional-plugins";
private final ExternalPlugin externalPlugin;
private final Manifest manifest;
private final ClassLoader classLoader;
@@ -160,19 +174,19 @@ public class RegisteredPlugin {
public Map<String, List<Class>> allClassGrouped() {
Map<String, List<Class>> result = new HashMap<>();
result.put("tasks", Arrays.asList(this.getTasks().toArray(Class[]::new)));
result.put("triggers", Arrays.asList(this.getTriggers().toArray(Class[]::new)));
result.put("conditions", Arrays.asList(this.getConditions().toArray(Class[]::new)));
result.put("storages", Arrays.asList(this.getStorages().toArray(Class[]::new)));
result.put("secrets", Arrays.asList(this.getSecrets().toArray(Class[]::new)));
result.put("task-runners", Arrays.asList(this.getTaskRunners().toArray(Class[]::new)));
result.put("apps", Arrays.asList(this.getApps().toArray(Class[]::new)));
result.put("app-blocks", Arrays.asList(this.getAppBlocks().toArray(Class[]::new)));
result.put("charts", Arrays.asList(this.getCharts().toArray(Class[]::new)));
result.put("data-filters", Arrays.asList(this.getDataFilters().toArray(Class[]::new)));
result.put("data-filters-kpi", Arrays.asList(this.getDataFiltersKPI().toArray(Class[]::new)));
result.put("log-exporters", Arrays.asList(this.getLogExporters().toArray(Class[]::new)));
result.put("additional-plugins", Arrays.asList(this.getAdditionalPlugins().toArray(Class[]::new)));
result.put(TASKS_GROUP_NAME, Arrays.asList(this.getTasks().toArray(Class[]::new)));
result.put(TRIGGERS_GROUP_NAME, Arrays.asList(this.getTriggers().toArray(Class[]::new)));
result.put(CONDITIONS_GROUP_NAME, Arrays.asList(this.getConditions().toArray(Class[]::new)));
result.put(STORAGES_GROUP_NAME, Arrays.asList(this.getStorages().toArray(Class[]::new)));
result.put(SECRETS_GROUP_NAME, Arrays.asList(this.getSecrets().toArray(Class[]::new)));
result.put(TASK_RUNNERS_GROUP_NAME, Arrays.asList(this.getTaskRunners().toArray(Class[]::new)));
result.put(APPS_GROUP_NAME, Arrays.asList(this.getApps().toArray(Class[]::new)));
result.put(APP_BLOCKS_GROUP_NAME, Arrays.asList(this.getAppBlocks().toArray(Class[]::new)));
result.put(CHARTS_GROUP_NAME, Arrays.asList(this.getCharts().toArray(Class[]::new)));
result.put(DATA_FILTERS_GROUP_NAME, Arrays.asList(this.getDataFilters().toArray(Class[]::new)));
result.put(DATA_FILTERS_KPI_GROUP_NAME, Arrays.asList(this.getDataFiltersKPI().toArray(Class[]::new)));
result.put(LOG_EXPORTERS_GROUP_NAME, Arrays.asList(this.getLogExporters().toArray(Class[]::new)));
result.put(ADDITIONAL_PLUGINS_GROUP_NAME, Arrays.asList(this.getAdditionalPlugins().toArray(Class[]::new)));
return result;
}

View File

@@ -24,6 +24,8 @@ public interface DashboardRepositoryInterface {
List<Dashboard> findAll(String tenantId);
List<Dashboard> findAllWithNoAcl(String tenantId);
default Dashboard save(Dashboard dashboard, String source) {
return this.save(null, dashboard, source);
}

View File

@@ -5,7 +5,6 @@ import io.kestra.core.models.executions.Execution;
import io.kestra.core.models.executions.TaskRun;
import io.kestra.core.models.executions.statistics.DailyExecutionStatistics;
import io.kestra.core.models.executions.statistics.ExecutionCount;
import io.kestra.core.models.executions.statistics.ExecutionCountStatistics;
import io.kestra.core.models.executions.statistics.Flow;
import io.kestra.core.models.flows.FlowScope;
import io.kestra.core.models.flows.State;
@@ -130,29 +129,6 @@ public interface ExecutionRepositoryInterface extends SaveRepositoryInterface<Ex
boolean isTaskRun
);
List<Execution> lastExecutions(
@Nullable String tenantId,
@Nullable List<FlowFilter> flows
);
Map<String, Map<String, List<DailyExecutionStatistics>>> dailyGroupByFlowStatistics(
@Nullable String query,
@Nullable String tenantId,
@Nullable String namespace,
@Nullable String flowId,
@Nullable List<FlowFilter> flows,
@Nullable ZonedDateTime startDate,
@Nullable ZonedDateTime endDate,
boolean groupByNamespaceOnly
);
Map<String, ExecutionCountStatistics> executionCountsGroupedByNamespace(
@Nullable String tenantId,
@Nullable String namespace,
@Nullable ZonedDateTime startDate,
@Nullable ZonedDateTime endDate
);
@Getter
@SuperBuilder
@NoArgsConstructor
@@ -183,4 +159,9 @@ public interface ExecutionRepositoryInterface extends SaveRepositoryInterface<Ex
CHILD,
MAIN
}
List<Execution> lastExecutions(
@Nullable String tenantId,
@Nullable List<FlowFilter> flows
);
}

View File

@@ -3,18 +3,12 @@ package io.kestra.core.repositories;
import io.kestra.core.models.QueryFilter;
import io.kestra.core.models.SearchResult;
import io.kestra.core.models.executions.Execution;
import io.kestra.core.models.flows.Flow;
import io.kestra.core.models.flows.FlowForExecution;
import io.kestra.core.models.flows.FlowInterface;
import io.kestra.core.models.flows.FlowScope;
import io.kestra.core.models.flows.FlowWithSource;
import io.kestra.core.models.flows.GenericFlow;
import io.kestra.core.models.flows.*;
import io.micronaut.data.model.Pageable;
import jakarta.annotation.Nullable;
import jakarta.validation.ConstraintViolationException;
import java.util.List;
import java.util.Map;
import java.util.Optional;
public interface FlowRepositoryInterface {
@@ -109,6 +103,8 @@ public interface FlowRepositoryInterface {
List<FlowWithSource> findAllWithSource(String tenantId);
List<FlowWithSource> findAllWithSourceWithNoAcl(String tenantId);
List<Flow> findAllForAllTenants();
List<FlowWithSource> findAllWithSourceForAllTenants();
@@ -121,14 +117,6 @@ public interface FlowRepositoryInterface {
*/
int count(@Nullable String tenantId);
/**
* Counts the total number of flows for the given namespace.
*
* @param tenantId the tenant ID.
* @return The count.
*/
int countForNamespace(@Nullable String tenantId, @Nullable String namespace);
List<Flow> findByNamespace(String tenantId, String namespace);
List<Flow> findByNamespacePrefix(String tenantId, String namespacePrefix);

View File

@@ -10,5 +10,7 @@ public interface FlowTopologyRepositoryInterface {
List<FlowTopology> findByNamespace(String tenantId, String namespace);
List<FlowTopology> findAll(String tenantId);
FlowTopology save(FlowTopology flowTopology);
}

View File

@@ -3,16 +3,14 @@ package io.kestra.core.repositories;
import io.kestra.core.models.QueryFilter;
import io.kestra.core.models.executions.Execution;
import io.kestra.core.models.executions.LogEntry;
import io.kestra.core.models.executions.statistics.LogStatistics;
import io.kestra.core.utils.DateUtils;
import io.kestra.plugin.core.dashboard.data.Logs;
import io.micronaut.data.model.Pageable;
import jakarta.annotation.Nullable;
import org.slf4j.event.Level;
import reactor.core.publisher.Flux;
import java.time.ZonedDateTime;
import java.util.List;
import reactor.core.publisher.Flux;
public interface LogRepositoryInterface extends SaveRepositoryInterface<LogEntry>, QueryBuilderInterface<Logs.Fields> {
/**
@@ -90,17 +88,6 @@ public interface LogRepositoryInterface extends SaveRepositoryInterface<LogEntry
Flux<LogEntry> findAllAsync(@Nullable String tenantId);
List<LogStatistics> statistics(
@Nullable String query,
@Nullable String tenantId,
@Nullable String namespace,
@Nullable String flowId,
@Nullable Level minLevel,
@Nullable ZonedDateTime startDate,
@Nullable ZonedDateTime endDate,
@Nullable DateUtils.GroupType groupBy
);
LogEntry save(LogEntry log);
Integer purge(Execution execution);
@@ -109,5 +96,5 @@ public interface LogRepositoryInterface extends SaveRepositoryInterface<LogEntry
void deleteByQuery(String tenantId, String namespace, String flowId, String triggerId);
int deleteByQuery(String tenantId, String namespace, String flowId, List<Level> logLevels, ZonedDateTime startDate, ZonedDateTime endDate);
int deleteByQuery(String tenantId, String namespace, String flowId, String executionId, List<Level> logLevels, ZonedDateTime startDate, ZonedDateTime endDate);
}

View File

@@ -12,6 +12,8 @@ public interface TemplateRepositoryInterface {
List<Template> findAll(String tenantId);
List<Template> findAllWithNoAcl(String tenantId);
List<Template> findAllForAllTenants();
ArrayListTotal<Template> find(

View File

@@ -41,15 +41,6 @@ public interface TriggerRepositoryInterface extends QueryBuilderInterface<Trigge
*/
int count(@Nullable String tenantId);
/**
* Counts the total number of triggers for the given namespace.
*
* @param tenantId the tenant of the triggers
* @param namespace the namespace
* @return The count.
*/
int countForNamespace(@Nullable String tenantId, @Nullable String namespace);
/**
* Find all triggers that match the query, return a flux of triggers
* as the search is not paginated

View File

@@ -15,7 +15,6 @@ import io.kestra.core.storages.Storage;
import io.kestra.core.storages.StorageInterface;
import io.kestra.core.storages.kv.KVStore;
import io.kestra.core.utils.ListUtils;
import io.kestra.core.utils.MapUtils;
import io.kestra.core.utils.VersionProvider;
import io.micronaut.context.ApplicationContext;
import io.micronaut.core.annotation.Introspected;
@@ -56,6 +55,7 @@ public class DefaultRunContext extends RunContext {
private Optional<String> secretKey;
private WorkingDir workingDir;
private Validator validator;
private LocalPath localPath;
private Map<String, Object> variables;
private List<AbstractMetricEntry<?>> metrics = new ArrayList<>();
@@ -153,6 +153,7 @@ public class DefaultRunContext extends RunContext {
this.kvStoreService = applicationContext.getBean(KVStoreService.class);
this.secretKey = applicationContext.getProperty("kestra.encryption.secret-key", String.class);
this.validator = applicationContext.getBean(Validator.class);
this.localPath = applicationContext.getBean(LocalPathFactory.class).createLocalPath(this);
}
}
@@ -573,6 +574,11 @@ public class DefaultRunContext extends RunContext {
return isInitialized.get();
}
@Override
public LocalPath localPath() {
return localPath;
}
/**
* Builder class for constructing new {@link DefaultRunContext} objects.
*/

View File

@@ -30,5 +30,5 @@ public class ExecutionRunning {
return IdUtils.fromPartsAndSeparator('|', this.tenantId, this.namespace, this.flowId, this.execution.getId());
}
public enum ConcurrencyState { CREATED, RUNNING, QUEUED }
public enum ConcurrencyState { CREATED, RUNNING, QUEUED, CANCELLED, FAILED }
}

View File

@@ -85,7 +85,8 @@ public class Executor {
}
public Boolean canBeProcessed() {
return !(this.getException() != null || this.getFlow() == null || this.getFlow() instanceof FlowWithException || this.getFlow().getTasks() == null || this.getExecution().isDeleted() || this.getExecution().getState().isPaused());
return !(this.getException() != null || this.getFlow() == null || this.getFlow() instanceof FlowWithException || this.getFlow().getTasks() == null ||
this.getExecution().isDeleted() || this.getExecution().getState().isPaused() || this.getExecution().getState().isBreakpoint());
}
public Executor withFlow(FlowWithSource flow) {

View File

@@ -1,5 +1,6 @@
package io.kestra.core.runners;
import io.kestra.core.debug.Breakpoint;
import io.kestra.core.exceptions.InternalException;
import io.kestra.core.metrics.MetricRegistry;
import io.kestra.core.models.Label;
@@ -18,6 +19,7 @@ import io.kestra.core.storages.StorageContext;
import io.kestra.core.test.flow.TaskFixture;
import io.kestra.core.trace.propagation.RunContextTextMapSetter;
import io.kestra.core.utils.ListUtils;
import io.kestra.core.utils.MapUtils;
import io.kestra.core.utils.TruthUtils;
import io.kestra.plugin.core.flow.LoopUntil;
import io.kestra.plugin.core.flow.Pause;
@@ -260,8 +262,10 @@ public class ExecutorService {
// Compute outputs for the parent Flowable task if a terminated state was resolved
if (workerTaskResult.getTaskRun().getState().isTerminated()) {
try {
// as flowable tasks can save outputs during iterative execution, we must merge the maps here
Output outputs = flowableParent.outputs(runContext);
Variables variables = variablesService.of(StorageContext.forTask(workerTaskResult.getTaskRun()), outputs);
Map<String, Object> outputMap = MapUtils.merge(workerTaskResult.getTaskRun().getOutputs(), outputs == null ? null : outputs.toMap());
Variables variables = variablesService.of(StorageContext.forTask(workerTaskResult.getTaskRun()), outputMap);
return Optional.of(new WorkerTaskResult(workerTaskResult
.getTaskRun()
.withOutputs(variables)
@@ -735,6 +739,7 @@ public class ExecutorService {
List<TaskRun> afterExecutionNexts = FlowableUtils.resolveSequentialNexts(executor.getExecution(), afterExecutionResolvedTasks)
.stream()
.map(throwFunction(NextTaskRun::getTaskRun))
.map(taskRun -> taskRun.withForceExecution(true)) // forceExecution so it would be executed even if the execution is killed
.toList();
if (!afterExecutionNexts.isEmpty()) {
return executor.withTaskRun(afterExecutionNexts, "handleAfterExecution ");
@@ -818,7 +823,7 @@ public class ExecutorService {
.executionKind(executor.getExecution().getKind())
.build();
// Get worker group
Optional<WorkerGroup> workerGroup = workerGroupService.resolveGroupFromJob(workerTask);
Optional<WorkerGroup> workerGroup = workerGroupService.resolveGroupFromJob(executor.getFlow(), workerTask);
if (workerGroup.isPresent()) {
// Check if the worker group exist
String tenantId = executor.getFlow().getTenantId();
@@ -887,13 +892,38 @@ public class ExecutorService {
this.addWorkerTaskResults(executor, workerTaskResults);
}
if (workerTasks.isEmpty() || hasMockedWorkerTask) {
return executor;
}
Executor executorToReturn = executor;
// suspend on breakpoint: if a breakpoint is for a CREATED taskrun, set the execution state to BREAKPOINT and ends here
if (!ListUtils.isEmpty(executor.getExecution().getBreakpoints())) {
List<Breakpoint> breakpoints = executor.getExecution().getBreakpoints();
if (executor.getExecution()
.getTaskRunList()
.stream()
.anyMatch(taskRun -> shouldSuspend(taskRun, breakpoints))
) {
List<TaskRun> newTaskRuns = executor.getExecution().getTaskRunList().stream().map(
taskRun -> {
if (shouldSuspend(taskRun, breakpoints)) {
return taskRun.withState(State.Type.BREAKPOINT);
}
return taskRun;
}
).toList();
Execution newExecution = executor.getExecution().withTaskRunList(newTaskRuns).withState(State.Type.BREAKPOINT);
executorToReturn = executorToReturn.withExecution(newExecution, "handleBreakpoint");
logService.logExecution(
newExecution,
Level.INFO,
"Flow is suspended at a breakpoint."
);
}
}
// Ends FAILED or CANCELLED task runs by creating worker task results
List<WorkerTask> endedTasks = workerTasks.get(true);
if (endedTasks != null && !endedTasks.isEmpty()) {
@@ -907,7 +937,7 @@ public class ExecutorService {
// Send other TaskRun to the worker (create worker tasks)
List<WorkerTask> processingTasks = workerTasks.get(false);
if (processingTasks != null && !processingTasks.isEmpty()) {
if (processingTasks != null && !processingTasks.isEmpty() && !executor.getExecution().getState().isBreakpoint()) {
executorToReturn = executorToReturn.withWorkerTasks(processingTasks, "handleWorkerTask");
metricRegistry.counter(MetricRegistry.METRIC_EXECUTOR_TASKRUN_CREATED_COUNT, MetricRegistry.METRIC_EXECUTOR_TASKRUN_CREATED_COUNT_DESCRIPTION, metricRegistry.tags(executor.getExecution())).increment(processingTasks.size());
@@ -916,6 +946,11 @@ public class ExecutorService {
return executorToReturn;
}
private boolean shouldSuspend(TaskRun taskRun, List<Breakpoint> breakpoints) {
return taskRun.getState().getCurrent().isCreated() && breakpoints.stream()
.anyMatch(breakpoint -> taskRun.getTaskId().equals(breakpoint.getId()) && (breakpoint.getValue() == null || Objects.equals(taskRun.getValue(), breakpoint.getValue())));
}
private Executor handleExecutableTask(final Executor executor) {
List<SubflowExecution<?>> executions = new ArrayList<>();
List<SubflowExecutionResult> subflowExecutionResults = new ArrayList<>();
@@ -1138,71 +1173,83 @@ public class ExecutorService {
}
public void log(Logger log, Boolean in, WorkerJob value) {
if (value instanceof WorkerTask workerTask) {
log.debug(
"{} {} : {}",
in ? "<< IN " : ">> OUT",
workerTask.getClass().getSimpleName(),
workerTask.getTaskRun().toStringState()
);
} else if (value instanceof WorkerTrigger workerTrigger) {
log.debug(
"{} {} : {}",
in ? "<< IN " : ">> OUT",
workerTrigger.getClass().getSimpleName(),
workerTrigger.getTriggerContext().uid()
);
if (log.isDebugEnabled()) { // taskRun().toStringState() is costly so we avoid calling it if not needed
if (value instanceof WorkerTask workerTask) {
log.debug(
"{} {} : {}",
in ? "<< IN " : ">> OUT",
workerTask.getClass().getSimpleName(),
workerTask.getTaskRun().toStringState()
);
} else if (value instanceof WorkerTrigger workerTrigger) {
log.debug(
"{} {} : {}",
in ? "<< IN " : ">> OUT",
workerTrigger.getClass().getSimpleName(),
workerTrigger.getTriggerContext().uid()
);
}
}
}
public void log(Logger log, Boolean in, WorkerTaskResult value) {
log.debug(
"{} {} : {}",
in ? "<< IN " : ">> OUT",
value.getClass().getSimpleName(),
value.getTaskRun().toStringState()
);
if (log.isDebugEnabled()) { // taskRun().toStringState() is costly so we avoid calling it if not needed
log.debug(
"{} {} : {}",
in ? "<< IN " : ">> OUT",
value.getClass().getSimpleName(),
value.getTaskRun().toStringState()
);
}
}
public void log(Logger log, Boolean in, SubflowExecutionResult value) {
log.debug(
"{} {} : {}",
in ? "<< IN " : ">> OUT",
value.getClass().getSimpleName(),
value.getParentTaskRun().toStringState()
);
if (log.isDebugEnabled()) { // taskRun().toStringState() is costly so we avoid calling it if not needed
log.debug(
"{} {} : {}",
in ? "<< IN " : ">> OUT",
value.getClass().getSimpleName(),
value.getParentTaskRun().toStringState()
);
}
}
public void log(Logger log, Boolean in, SubflowExecutionEnd value) {
log.debug(
"{} {} : {}",
in ? "<< IN " : ">> OUT",
value.getClass().getSimpleName(),
value.toStringState()
);
if (log.isDebugEnabled()) { // taskRun().toStringState() is costly so we avoid calling it if not needed
log.debug(
"{} {} : {}",
in ? "<< IN " : ">> OUT",
value.getClass().getSimpleName(),
value.toStringState()
);
}
}
public void log(Logger log, Boolean in, Execution value) {
log.debug(
"{} {} [key='{}']\n{}",
in ? "<< IN " : ">> OUT",
value.getClass().getSimpleName(),
value.getId(),
value.toStringState()
);
if (log.isDebugEnabled()) { // taskRun().toStringState() is costly so we avoid calling it if not needed
log.debug(
"{} {} [key='{}']\n{}",
in ? "<< IN " : ">> OUT",
value.getClass().getSimpleName(),
value.getId(),
value.toStringState()
);
}
}
public void log(Logger log, Boolean in, Executor value) {
log.debug(
"{} {} [key='{}', from='{}', offset='{}', crc32='{}']\n{}",
in ? "<< IN " : ">> OUT",
value.getClass().getSimpleName(),
value.getExecution().getId(),
value.getFrom(),
value.getOffset(),
value.getExecution().toCrc32State(),
value.getExecution().toStringState()
);
if (log.isDebugEnabled()) { // taskRun().toStringState() is costly so we avoid calling it if not needed
log.debug(
"{} {} [key='{}', from='{}', offset='{}', crc32='{}']\n{}",
in ? "<< IN " : ">> OUT",
value.getClass().getSimpleName(),
value.getExecution().getId(),
value.getFrom(),
value.getOffset(),
value.getExecution().toCrc32State(),
value.getExecution().toStringState()
);
}
}
public void log(Logger log, Boolean in, ExecutionKilledExecution value) {
@@ -1296,7 +1343,7 @@ public class ExecutorService {
.state(ExecutionKilled.State.REQUESTED)
.executionState(state)
.executionId(execution.getId())
.isOnKillCascade(false) // TODO we may offer the choice to the user here
.isOnKillCascade(true)
.tenantId(execution.getTenantId())
.build()
);

View File

@@ -1,12 +1,13 @@
package io.kestra.core.runners;
import io.kestra.core.models.property.URIFetcher;
import io.kestra.core.models.tasks.runners.PluginUtilsService;
import io.kestra.core.serializers.FileSerde;
import io.kestra.core.utils.IdUtils;
import org.apache.commons.io.IOUtils;
import org.slf4j.Logger;
import java.io.File;
import java.io.FileOutputStream;
import java.io.*;
import java.net.URI;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -40,10 +41,13 @@ public abstract class FilesService {
}
if (input == null) {
file.createNewFile();
if(!file.createNewFile()) {
throw new RuntimeException("Unable to create the file: " + file.getName());
}
} else {
if (input.startsWith("kestra://")) {
try (var is = runContext.storage().getFile(URI.create(input));
if (URIFetcher.supports(input)) {
var uri = URIFetcher.of(input);
try (var is = new BufferedInputStream(uri.fetch(runContext), FileSerde.BUFFER_SIZE);
var out = new FileOutputStream(file)) {
IOUtils.copyLarge(is, out);
}

View File

@@ -17,6 +17,7 @@ import io.kestra.core.models.flows.Type;
import io.kestra.core.models.flows.input.FileInput;
import io.kestra.core.models.flows.input.InputAndValue;
import io.kestra.core.models.flows.input.ItemTypeInterface;
import io.kestra.core.models.property.URIFetcher;
import io.kestra.core.models.tasks.common.EncryptedString;
import io.kestra.core.models.validations.ManualConstraintViolation;
import io.kestra.core.serializers.JacksonMapper;
@@ -137,19 +138,30 @@ public class FlowInputOutput {
.publishOn(Schedulers.boundedElastic())
.<AbstractMap.SimpleEntry<String, String>>handle((input, sink) -> {
if (input instanceof CompletedFileUpload fileUpload) {
boolean oldStyleInput = false;
if ("files".equals(fileUpload.getName())) {
// we are maybe in an old-style usage of the input, let's check if there is an input named after the filename
oldStyleInput = inputs.stream().anyMatch(i -> i.getId().equals(fileUpload.getFilename()));
}
if (oldStyleInput) {
var runContext = runContextFactory.of(null, execution);
runContext.logger().warn("Using a deprecated way to upload a FILE input. You must set the input 'id' as part name and set the name of the file using the regular 'filename' part attribute.");
}
String inputId = oldStyleInput ? fileUpload.getFilename() : fileUpload.getName();
String fileName = oldStyleInput ? FileInput.findFileInputExtension(inputs, fileUpload.getFilename()) : fileUpload.getFilename();
if (!uploadFiles) {
final String fileExtension = FileInput.findFileInputExtension(inputs, fileUpload.getFilename());
URI from = URI.create("kestra://" + StorageContext
.forInput(execution, fileUpload.getFilename(), fileUpload.getFilename() + fileExtension)
.forInput(execution, inputId, fileName)
.getContextStorageURI()
);
fileUpload.discard();
sink.next(new AbstractMap.SimpleEntry<>(fileUpload.getFilename(), from.toString()));
sink.next(new AbstractMap.SimpleEntry<>(inputId, from.toString()));
} else {
try {
final String fileExtension = FileInput.findFileInputExtension(inputs, fileUpload.getFilename());
final String fileExtension = FileInput.findFileInputExtension(inputs, fileName);
String prefix = StringUtils.leftPad(fileUpload.getFilename() + "_", 3, "_");
String prefix = StringUtils.leftPad(fileName + "_", 3, "_");
File tempFile = File.createTempFile(prefix, fileExtension);
try (var inputStream = fileUpload.getInputStream();
var outputStream = new FileOutputStream(tempFile)) {
@@ -158,8 +170,8 @@ public class FlowInputOutput {
sink.error(new KestraRuntimeException("Can't upload file: " + fileUpload.getFilename()));
return;
}
URI from = storageInterface.from(execution, fileUpload.getFilename(), tempFile);
sink.next(new AbstractMap.SimpleEntry<>(fileUpload.getFilename(), from.toString()));
URI from = storageInterface.from(execution, inputId, fileName, tempFile);
sink.next(new AbstractMap.SimpleEntry<>(inputId, from.toString()));
} finally {
if (!tempFile.delete()) {
tempFile.deleteOnExit();
@@ -425,10 +437,10 @@ public class FlowInputOutput {
case FILE -> {
URI uri = URI.create(current.toString().replace(File.separator, "/"));
if (uri.getScheme() != null && uri.getScheme().equals("kestra")) {
if (URIFetcher.supports(uri)) {
yield uri;
} else {
yield storageInterface.from(execution, id, new File(current.toString()));
yield storageInterface.from(execution, id, current.toString().substring(current.toString().lastIndexOf("/") + 1), new File(current.toString()));
}
}
case JSON -> JacksonMapper.toObject(current.toString());

View File

@@ -0,0 +1,47 @@
package io.kestra.core.runners;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.nio.file.attribute.BasicFileAttributes;
/**
* Get access to local paths of the host machine.
* <p>
* All methods of this class check allowed paths and protect against path traversal.
* All paths must be allowed via the {@link #ALLOWED_PATHS_CONFIG} configuration property or via plugin configuration.
*/
public interface LocalPath {
String FILE_SCHEME = "file";
String FILE_PROTOCOL = FILE_SCHEME + "://";
String LOCAL_FILES_CONFIG = "kestra.local-files";
String ALLOWED_PATHS_CONFIG = LocalPath.LOCAL_FILES_CONFIG + ".allowed-paths";
String ENABLE_FILE_FUNCTIONS_CONFIG = LocalPath.LOCAL_FILES_CONFIG + ".enable-file-functions";
String ENABLE_PREVIEW_CONFIG = LocalPath.LOCAL_FILES_CONFIG + ".enable-preview";
/**
* Get an InputStream of a local file denoted by this URI.
*
* @param uri a file URI
* @throws SecurityException if the file is not allowed globally or specifically for this plugin.
*/
InputStream get(URI uri) throws IOException;
/**
* Return true if the local file denoted by this URI exists.
*
* @param uri a file URI
* @throws SecurityException if the file is not allowed globally or specifically for this plugin.
*/
boolean exists(URI uri) throws IOException;
/**
* Get a local file attributes.
*
* @param uri a file URI
* @throws SecurityException if the file is not allowed globally or specifically for this plugin.
*/
BasicFileAttributes getAttributes(URI uri) throws IOException;
}

View File

@@ -0,0 +1,134 @@
package io.kestra.core.runners;
import io.micronaut.context.annotation.Value;
import jakarta.inject.Inject;
import jakarta.inject.Singleton;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.Collections;
import java.util.List;
@Singleton
public class LocalPathFactory {
private final List<String> globalAllowedPaths;
@Inject
public LocalPathFactory(@Value("${" + LocalPath.ALLOWED_PATHS_CONFIG + ":}") List<String> globalAllowedPaths) {
this.globalAllowedPaths = globalAllowedPaths;
}
/**
* Create a LocalPath based on a RunContext, this is the preferred way as it would be allowed to check
* working directory and plugin configuration.
* If no RunContext is available {@link #createLocalPath()} can be used instead but this LocalPath would only be able to check
* paths globally allowed inside the Kestra configuration.
*/
public LocalPath createLocalPath(RunContext runContext) {
return new RunContextLocalPath(globalAllowedPaths, runContext);
}
/**
* Create a LocalPath.
* If a RunContext is available, this is preferable to use {@link #createLocalPath(RunContext)} as it would be possible to
* check for paths inside the working directory or allowed inside the plugin configuration.
*/
public LocalPath createLocalPath() {
return new DefaultLocalPath(globalAllowedPaths);
}
abstract static class AbstractLocalPath implements LocalPath {
@Override
public InputStream get(URI uri) throws IOException {
if (!LocalPath.FILE_SCHEME.equals(uri.getScheme())) {
throw new IllegalArgumentException("The uri '" + uri + "' is not a valid file URI.");
}
Path path = checkPath(uri);
return new FileInputStream(path.toFile());
}
@Override
public boolean exists(URI uri) throws IOException {
if (!LocalPath.FILE_SCHEME.equals(uri.getScheme())) {
throw new IllegalArgumentException("The uri '" + uri + "' is not a valid file URI.");
}
Path path = checkPath(uri);
return Files.exists(path);
}
@Override
public BasicFileAttributes getAttributes(URI uri) throws IOException {
if (!LocalPath.FILE_SCHEME.equals(uri.getScheme())) {
throw new IllegalArgumentException("The uri '" + uri + "' is not a valid file URI.");
}
Path path = checkPath(uri);
return Files.readAttributes(path, BasicFileAttributes.class);
}
/**
* Check the URI then return it as a Path.
* Based on the available context, implementors should:
* - check if the file is inside the working directory
* - check globally allowed paths
* - check if plugin allowed paths
*/
protected abstract Path checkPath(URI uri) throws IOException;
}
static class RunContextLocalPath extends AbstractLocalPath {
private final List<String> globalAllowedPaths;
private final RunContext runContext;
RunContextLocalPath(List<String> globalAllowedPaths, RunContext runContext) {
this.globalAllowedPaths = globalAllowedPaths;
this.runContext = runContext;
}
@Override
@SuppressWarnings("unchecked")
protected Path checkPath(URI uri) throws IOException {
Path workingDirectory = runContext.workingDir().path(true);
Path path = Path.of(uri).toRealPath(); // toRealPath() will protect about path traversal issues
// We allow working directory or globally allowed path
if (!path.startsWith(workingDirectory) && globalAllowedPaths.stream().noneMatch(path::startsWith)) {
// if not globally allowed, we check if it's allowed for this specific plugin
List<String> pluginAllowedPaths = (List<String>) runContext.pluginConfiguration("allowed-paths").orElse(Collections.emptyList());
if (pluginAllowedPaths.stream().noneMatch(path::startsWith)) {
throw new SecurityException("The path " + path + " is not authorized. " +
"Only files inside the working directory are allowed by default, other path must be allowed either globally inside the Kestra configuration using the `" + LocalPath.ALLOWED_PATHS_CONFIG + "` property, " +
"or by plugin using the `allowed-paths` plugin configuration.");
}
}
return path;
}
}
static class DefaultLocalPath extends AbstractLocalPath {
private final List<String> globalAllowedPaths;
DefaultLocalPath(List<String> globalAllowedPaths) {
this.globalAllowedPaths = globalAllowedPaths;
}
@Override
protected Path checkPath(URI uri) throws IOException {
Path path = Path.of(uri).toRealPath(); // toRealPath() will protect about path traversal issues
// we only allow globally allowed as we don't have a run context to get the working directory nor the plugin configuration
if (globalAllowedPaths.stream().noneMatch(path::startsWith)) {
throw new SecurityException("The path " + path + " is not authorized. " +
"Path must be allowed either globally inside the Kestra configuration using the `" + LocalPath.ALLOWED_PATHS_CONFIG + "` property.");
}
return path;
}
}
}

View File

@@ -199,7 +199,10 @@ public class LocalWorkingDir implements WorkingDir {
if (Files.exists(newFilePath)) {
switch (comportment) {
case OVERWRITE -> copyFile(inputStream, newFilePath);
case OVERWRITE -> {
log.info("File {} already exist. It will be overwritten", newFilePath);
copyFile(inputStream, newFilePath);
}
case FAIL -> throw new FileAlreadyExistsException("File " + newFilePath + " already exist");
case WARN -> log.warn("File {} already exist. It will be ignore", newFilePath);
case IGNORE -> {}

View File

@@ -13,7 +13,6 @@ import org.slf4j.Logger;
import java.net.URI;
import java.security.GeneralSecurityException;
import java.time.Instant;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@@ -180,6 +179,11 @@ public abstract class RunContext {
return new StateStore(this, true);
}
/**
* Get access to local paths of the host machine.
*/
public abstract LocalPath localPath();
public record FlowInfo(String tenantId, String namespace, String id, Integer revision) {
}

View File

@@ -108,6 +108,10 @@ public class RunContextFactory {
}
public RunContext of(FlowInterface flow, Task task, Execution execution, TaskRun taskRun, boolean decryptVariables) {
return this.of(flow, task, execution, taskRun, decryptVariables, variableRenderer);
}
public RunContext of(FlowInterface flow, Task task, Execution execution, TaskRun taskRun, boolean decryptVariables, VariableRenderer variableRenderer) {
RunContextLogger runContextLogger = runContextLoggerFactory.create(taskRun, task, execution.getKind());
return newBuilder()
@@ -127,6 +131,7 @@ public class RunContextFactory {
.withKvStoreService(kvStoreService)
.withSecretInputs(secretInputsFromFlow(flow))
.withTask(task)
.withVariableRenderer(variableRenderer)
.build();
}

View File

@@ -28,6 +28,7 @@ import java.util.function.Consumer;
*/
public final class RunVariables {
public static final String SECRET_CONSUMER_VARIABLE_NAME = "addSecretConsumer";
public static final String FIXTURE_FILES_KEY = "io.kestra.datatype:test_fixtures_files";
/**
* Creates an immutable map representation of the given {@link Task}.
@@ -214,7 +215,7 @@ public final class RunVariables {
executionMap.put("id", execution.getId());
if (execution.getState() != null) { // can occurs in tests
if (execution.getState() != null) { // can occur in tests
executionMap.put("state", execution.getState().getCurrent());
}
@@ -224,6 +225,10 @@ public final class RunVariables {
Optional.ofNullable(execution.getOriginalId())
.ifPresent(originalId -> executionMap.put("originalId", originalId));
if (execution.getOutputs() != null) {
executionMap.put("outputs", execution.getOutputs());
}
builder.put("execution", executionMap.build());
if (execution.getTaskRunList() != null) {
@@ -299,7 +304,7 @@ public final class RunVariables {
// temporal hack to add back the `schedule`variables
// will be removed in 2.0
if (trigger.getType().equals(Schedule.class.getName())) {
if (Schedule.class.getName().equals(execution.getTrigger().getType())) {
// add back its variables inside the `schedule` variables
builder.put("schedule", execution.getTrigger().getVariables());
}
@@ -321,13 +326,18 @@ public final class RunVariables {
}
// variables
if (execution != null && execution.getVariables() != null) {
builder.put("vars", execution.getVariables());
}
else if (execution == null && flow != null && flow.getVariables() != null) {
// flow variables are added to the execution variables at execution creation time so they must only be added if the execution is null
builder.put("vars", flow.getVariables());
}
Optional.ofNullable(execution)
.map(Execution::getVariables)
.or(() -> Optional.ofNullable(flow).map(FlowInterface::getVariables))
.map(HashMap::new)
.ifPresent(variables -> {
Object fixtureFiles = variables.remove(FIXTURE_FILES_KEY);
builder.put("vars", ImmutableMap.copyOf(variables));
if (fixtureFiles != null) {
builder.put("files", fixtureFiles);
}
});
// Kestra configuration
if (kestraConfiguration != null) {

View File

@@ -2,22 +2,27 @@ package io.kestra.core.runners;
import io.kestra.core.exceptions.IllegalVariableEvaluationException;
import io.kestra.core.runners.pebble.*;
import io.kestra.core.runners.pebble.functions.RenderingFunctionInterface;
import io.micronaut.context.ApplicationContext;
import io.micronaut.context.annotation.ConfigurationProperties;
import io.micronaut.core.annotation.Nullable;
import io.pebbletemplates.pebble.PebbleEngine;
import io.pebbletemplates.pebble.error.AttributeNotFoundException;
import io.pebbletemplates.pebble.error.PebbleException;
import io.pebbletemplates.pebble.extension.AbstractExtension;
import io.pebbletemplates.pebble.extension.Extension;
import io.pebbletemplates.pebble.extension.Function;
import io.pebbletemplates.pebble.template.PebbleTemplate;
import jakarta.inject.Inject;
import jakarta.inject.Singleton;
import lombok.Getter;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Proxy;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@Singleton
public class VariableRenderer {
@@ -29,18 +34,26 @@ public class VariableRenderer {
@Inject
public VariableRenderer(ApplicationContext applicationContext, @Nullable VariableConfiguration variableConfiguration) {
this(applicationContext, variableConfiguration, Collections.emptyList());
}
public VariableRenderer(ApplicationContext applicationContext, @Nullable VariableConfiguration variableConfiguration, List<String> functionsToMask) {
this.variableConfiguration = variableConfiguration != null ? variableConfiguration : new VariableConfiguration();
PebbleEngine.Builder pebbleBuilder = new PebbleEngine.Builder()
.registerExtensionCustomizer(ExtensionCustomizer::new)
.strictVariables(true)
.cacheActive(this.variableConfiguration.getCacheEnabled())
.newLineTrimming(false)
.autoEscaping(false);
applicationContext.getBeansOfType(AbstractExtension.class)
.forEach(pebbleBuilder::extension);
List<Extension> extensions = applicationContext.getBeansOfType(Extension.class).stream()
.map(e -> functionsToMask.stream().anyMatch(excludedFunction -> e.getFunctions().containsKey(excludedFunction))
? extensionWithMaskedFunctions(e, functionsToMask)
: e)
.toList();
extensions.forEach(pebbleBuilder::extension);
if (this.variableConfiguration.getCacheEnabled()) {
pebbleBuilder.templateCache(new PebbleLruCache(this.variableConfiguration.getCacheSize()));
@@ -49,8 +62,63 @@ public class VariableRenderer {
this.pebbleEngine = pebbleBuilder.build();
}
public static IllegalVariableEvaluationException properPebbleException(PebbleException e) {
if (e instanceof AttributeNotFoundException current) {
private Extension extensionWithMaskedFunctions(Extension initialExtension, List<String> maskedFunctions) {
return (Extension) Proxy.newProxyInstance(
initialExtension.getClass().getClassLoader(),
new Class[]{Extension.class},
(proxy, method, methodArgs) -> {
if (method.getName().equals("getFunctions")) {
return initialExtension.getFunctions().entrySet().stream()
.map(entry -> {
if (maskedFunctions.contains(entry.getKey())) {
return Map.entry(entry.getKey(), this.maskedFunctionProxy(entry.getValue()));
} else if (RenderingFunctionInterface.class.isAssignableFrom(entry.getValue().getClass())) {
return Map.entry(entry.getKey(), this.variableRendererProxy(entry.getValue()));
}
return entry;
}).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
}
return method.invoke(initialExtension, methodArgs);
}
);
}
private Function variableRendererProxy(Function initialFunction) {
return (Function) Proxy.newProxyInstance(
initialFunction.getClass().getClassLoader(),
new Class[]{Function.class, RenderingFunctionInterface.class},
(functionProxy, functionMethod, functionArgs) -> {
if (functionMethod.getName().equals("variableRenderer")) {
return this;
}
return functionMethod.invoke(initialFunction, functionArgs);
}
);
}
private Function maskedFunctionProxy(Function initialFunction) {
return (Function) Proxy.newProxyInstance(
initialFunction.getClass().getClassLoader(),
new Class[]{Function.class},
(functionProxy, functionMethod, functionArgs) -> {
Object result;
try {
result = functionMethod.invoke(initialFunction, functionArgs);
} catch (InvocationTargetException e) {
throw e.getCause();
}
if (functionMethod.getName().equals("execute")) {
return "******";
}
return result;
}
);
}
public static IllegalVariableEvaluationException properPebbleException(PebbleException initialExtension) {
if (initialExtension instanceof AttributeNotFoundException current) {
return new IllegalVariableEvaluationException(
"Unable to find `" + current.getAttributeName() +
"` used in the expression `" + current.getFileName() +
@@ -58,7 +126,7 @@ public class VariableRenderer {
);
}
return new IllegalVariableEvaluationException(e);
return new IllegalVariableEvaluationException(initialExtension);
}
public String render(String inline, Map<String, Object> variables) throws IllegalVariableEvaluationException {
@@ -133,10 +201,10 @@ public class VariableRenderer {
/**
* This method can be used in fallback for rendering an input string.
*
* @param e The exception that was throw by the default variable renderer.
* @param inline The expression to be rendered.
* @param variables The context variables.
* @return The rendered string.
* @param e The exception that was throw by the default variable renderer.
* @param inline The expression to be rendered.
* @param variables The context variables.
* @return The rendered string.
*/
protected String alternativeRender(Exception e, String inline, Map<String, Object> variables) throws IllegalVariableEvaluationException {
return null;

View File

@@ -1,5 +1,6 @@
package io.kestra.core.runners;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Throwables;
@@ -10,6 +11,7 @@ import io.kestra.core.metrics.MetricRegistry;
import io.kestra.core.models.Label;
import io.kestra.core.models.executions.*;
import io.kestra.core.models.flows.State;
import io.kestra.core.models.tasks.Output;
import io.kestra.core.models.tasks.RunnableTask;
import io.kestra.core.models.tasks.Task;
import io.kestra.core.models.triggers.*;
@@ -18,6 +20,7 @@ import io.kestra.core.serializers.JacksonMapper;
import io.kestra.core.server.*;
import io.kestra.core.services.LabelService;
import io.kestra.core.services.LogService;
import io.kestra.core.services.MaintenanceService;
import io.kestra.core.services.VariablesService;
import io.kestra.core.services.WorkerGroupService;
import io.kestra.core.storages.StorageContext;
@@ -42,7 +45,14 @@ import org.apache.commons.lang3.time.StopWatch;
import org.slf4j.Logger;
import org.slf4j.event.Level;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.nio.file.Files;
import java.nio.file.Path;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.time.Duration;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
@@ -55,6 +65,9 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream;
import static io.kestra.core.models.flows.State.Type.*;
import static io.kestra.core.server.Service.ServiceState.TERMINATED_FORCED;
@@ -94,6 +107,10 @@ public class Worker implements Service, Runnable, AutoCloseable {
@Named(QueueFactoryInterface.TRIGGER_NAMED)
private QueueInterface<Trigger> triggerQueue;
@Inject
@Named(QueueFactoryInterface.WORKERTASKLOG_NAMED)
private QueueInterface<LogEntry> logQueue;
@Inject
@Named(QueueFactoryInterface.CLUSTER_EVENT_NAMED)
private Optional<QueueInterface<ClusterEvent>> clusterEventQueue;
@@ -158,6 +175,9 @@ public class Worker implements Service, Runnable, AutoCloseable {
private TracerFactory tracerFactory;
private Tracer tracer;
@Inject
private MaintenanceService maintenanceService;
/**
* Creates a new {@link Worker} instance.
*
@@ -285,8 +305,12 @@ public class Worker implements Service, Runnable, AutoCloseable {
));
this.clusterEventQueue.ifPresent(clusterEventQueueInterface -> this.receiveCancellations.addFirst(clusterEventQueueInterface.receive(this::clusterEventQueue)));
if (this.maintenanceService.isInMaintenanceMode()) {
enterMaintenance();
} else {
setState(ServiceState.RUNNING);
}
setState(ServiceState.RUNNING);
if (workerGroupKey != null) {
log.info("Worker started with {} thread(s) in group '{}'", numThreads, workerGroupKey);
}
@@ -304,21 +328,25 @@ public class Worker implements Service, Runnable, AutoCloseable {
ClusterEvent clusterEvent = either.getLeft();
log.info("Cluster event received: {}", clusterEvent);
switch (clusterEvent.eventType()) {
case MAINTENANCE_ENTER -> {
this.executionKilledQueue.pause();
this.workerJobQueue.pause();
this.setState(ServiceState.MAINTENANCE);
}
case MAINTENANCE_EXIT -> {
this.executionKilledQueue.resume();
this.workerJobQueue.resume();
this.setState(ServiceState.RUNNING);
}
case MAINTENANCE_ENTER -> enterMaintenance();
case MAINTENANCE_EXIT -> exitMaintenance();
}
}
private void enterMaintenance() {
this.executionKilledQueue.pause();
this.workerJobQueue.pause();
this.setState(ServiceState.MAINTENANCE);
}
private void exitMaintenance() {
this.executionKilledQueue.resume();
this.workerJobQueue.resume();
this.setState(ServiceState.RUNNING);
}
private void setState(final ServiceState state) {
this.state.set(state);
Map<String, Object> properties = new HashMap<>();
@@ -338,7 +366,7 @@ public class Worker implements Service, Runnable, AutoCloseable {
} else if ("trigger".equals(type)) {
// try to deserialize the triggerContext to fail it
var triggerContext = MAPPER.treeToValue(json.get("triggerContext"), TriggerContext.class);
var workerTriggerResult = WorkerTriggerResult.builder().triggerContext(triggerContext).success(false).execution(Optional.empty()).build();
var workerTriggerResult = WorkerTriggerResult.builder().triggerContext(triggerContext).execution(Optional.empty()).build();
this.workerTriggerResultQueue.emit(workerTriggerResult);
}
} catch (IOException | QueueException e) {
@@ -477,11 +505,23 @@ public class Worker implements Service, Runnable, AutoCloseable {
logError(workerTrigger, e);
try {
Execution execution = workerTrigger.getTrigger().isFailOnTriggerError() ? TriggerService.generateExecution(workerTrigger.getTrigger(), workerTrigger.getConditionContext(), workerTrigger.getTriggerContext(), (Output) null)
.withState(FAILED) : null;
if (execution != null) {
RunContextLogger.logEntries(Execution.loggingEventFromException(e), LogEntry.of(execution))
.forEach(log -> {
try {
logQueue.emitAsync(log);
} catch (QueueException ex) {
// fail silently
}
});
}
this.workerTriggerResultQueue.emit(
WorkerTriggerResult.builder()
.success(false)
.triggerContext(workerTrigger.getTriggerContext())
.trigger(workerTrigger.getTrigger())
.execution(Optional.ofNullable(execution))
.build()
);
} catch (QueueException ex) {
@@ -518,7 +558,6 @@ public class Worker implements Service, Runnable, AutoCloseable {
try {
this.workerTriggerResultQueue.emit(
WorkerTriggerResult.builder()
.success(false)
.execution(Optional.of(execution))
.triggerContext(workerTrigger.getTriggerContext())
.trigger(workerTrigger.getTrigger())
@@ -629,7 +668,7 @@ public class Worker implements Service, Runnable, AutoCloseable {
));
}
if (killedExecution.contains(workerTask.getTaskRun().getExecutionId())) {
if (! Boolean.TRUE.equals(workerTask.getTaskRun().getForceExecution()) && killedExecution.contains(workerTask.getTaskRun().getExecutionId())) {
WorkerTaskResult workerTaskResult = new WorkerTaskResult(workerTask.getTaskRun().withState(KILLED));
try {
this.workerTaskResultQueue.emit(workerTaskResult);
@@ -654,9 +693,44 @@ public class Worker implements Service, Runnable, AutoCloseable {
workerTask = workerTask.withTaskRun(workerTask.getTaskRun().withState(RUNNING));
DefaultRunContext runContext = runContextInitializer.forWorker((DefaultRunContext) workerTask.getRunContext(), workerTask);
Optional<String> hash = Optional.empty();
if (workerTask.getTask().getTaskCache() != null && workerTask.getTask().getTaskCache().getEnabled()) {
runContext.logger().debug("Task output caching is enabled for task '{}''", workerTask.getTask().getId());
hash = hashTask(runContext, workerTask.getTask());
if (hash.isPresent()) {
try {
Optional<InputStream> cacheFile = runContext.storage().getCacheFile(hash.get(), workerTask.getTaskRun().getValue(), workerTask.getTask().getTaskCache().getTtl());
if (cacheFile.isPresent()) {
runContext.logger().info("Skipping task execution for task '{}' as there is an existing cache entry for it", workerTask.getTask().getId());
try (ZipInputStream archive = new ZipInputStream(cacheFile.get())) {
if (archive.getNextEntry() != null) {
byte[] cache = archive.readAllBytes();
Map<String, Object> outputMap = JacksonMapper.ofIon().readValue(cache, JacksonMapper.MAP_TYPE_REFERENCE);
Variables variables = variablesService.of(StorageContext.forTask(workerTask.getTaskRun()), outputMap);
TaskRunAttempt attempt = TaskRunAttempt.builder()
.state(new io.kestra.core.models.flows.State().withState(SUCCESS))
.workerId(this.id)
.build();
List<TaskRunAttempt> attempts = this.addAttempt(workerTask, attempt);
TaskRun taskRun = workerTask.getTaskRun().withAttempts(attempts).withOutputs(variables).withState(SUCCESS);
WorkerTaskResult workerTaskResult = new WorkerTaskResult(taskRun);
this.workerTaskResultQueue.emit(workerTaskResult);
return workerTaskResult;
}
}
}
} catch (IOException | RuntimeException | QueueException e) {
// in case of any exception, log an error and continue
runContext.logger().error("Unexpected exception while loading the cache for task '{}', the task will be executed instead.", workerTask.getTask().getId(), e);
}
}
}
try {
// run
workerTask = this.runAttempt(workerTask);
workerTask = this.runAttempt(runContext, workerTask);
// get last state
TaskRunAttempt lastAttempt = workerTask.getTaskRun().lastAttempt();
@@ -691,6 +765,28 @@ public class Worker implements Service, Runnable, AutoCloseable {
WorkerTaskResult workerTaskResult = new WorkerTaskResult(workerTask.getTaskRun(), dynamicTaskRuns);
this.workerTaskResultQueue.emit(workerTaskResult);
// upload the cache file, hash may not be present if we didn't succeed in computing it
if (workerTask.getTask().getTaskCache() != null && workerTask.getTask().getTaskCache().getEnabled() && hash.isPresent() &&
(state == State.Type.SUCCESS || state == State.Type.WARNING)) {
runContext.logger().info("Uploading a cache entry for task '{}'", workerTask.getTask().getId());
try (ByteArrayOutputStream bos = new ByteArrayOutputStream();
ZipOutputStream archive = new ZipOutputStream(bos)) {
var zipEntry = new ZipEntry("outputs.ion");
archive.putNextEntry(zipEntry);
archive.write(JacksonMapper.ofIon().writeValueAsBytes(workerTask.getTaskRun().getOutputs()));
archive.closeEntry();
archive.finish();
Path archiveFile = runContext.workingDir().createTempFile( ".zip");
Files.write(archiveFile, bos.toByteArray());
URI uri = runContext.storage().putCacheFile(archiveFile.toFile(), hash.get(), workerTask.getTaskRun().getValue());
runContext.logger().debug("Caching entry uploaded in URI {}", uri);
} catch (IOException | RuntimeException e) {
// in case of any exception, log an error and continue
runContext.logger().error("Unexpected exception while uploading the cache entry for task '{}', the task not be cached.", workerTask.getTask().getId(), e);
}
}
return workerTaskResult;
} catch (QueueException e) {
// If there is a QueueException it can either be caused by the message limit or another queue issue.
@@ -719,6 +815,22 @@ public class Worker implements Service, Runnable, AutoCloseable {
}
}
private Optional<String> hashTask(RunContext runContext, Task task) {
try {
var map = JacksonMapper.toMap(task);
var rMap = runContext.render(map);
var json = JacksonMapper.ofJson().writeValueAsBytes(rMap);
MessageDigest digest = MessageDigest.getInstance("SHA-256");
digest.update(json);
byte[] bytes = digest.digest();
return Optional.of(HexFormat.of().formatHex(bytes));
} catch (RuntimeException | IllegalVariableEvaluationException | JsonProcessingException |
NoSuchAlgorithmException e) {
runContext.logger().error("Unable to create the cache key for the task '{}'", task.getId(), e);
return Optional.empty();
}
}
private List<TaskRun> dynamicWorkerResults(List<WorkerTaskResult> dynamicWorkerResults) {
return dynamicWorkerResults
.stream()
@@ -774,9 +886,7 @@ public class Worker implements Service, Runnable, AutoCloseable {
}
}
private WorkerTask runAttempt(final WorkerTask workerTask) throws QueueException {
DefaultRunContext runContext = runContextInitializer.forWorker((DefaultRunContext) workerTask.getRunContext(), workerTask);
private WorkerTask runAttempt(RunContext runContext, final WorkerTask workerTask) throws QueueException {
Logger logger = runContext.logger();
if (!(workerTask.getTask() instanceof RunnableTask<?> task)) {
@@ -1038,18 +1148,16 @@ public class Worker implements Service, Runnable, AutoCloseable {
}
}
/**
* This method should only be used on tests.
* It shut down the worker without waiting for tasks to end,
* and without closing the queue, so tests can launch and shutdown a worker manually without closing the queue.
*/
@VisibleForTesting
public void shutdown() {
// initiate shutdown
shutdown.compareAndSet(false, true);
try {
// close the WorkerJob queue to stop receiving new JobTask execution.
workerJobQueue.close();
} catch (IOException e) {
log.error("Failed to close the WorkerJobQueue");
}
// close all queues and shutdown now
this.receiveCancellations.forEach(Runnable::run);
this.executorService.shutdownNow();

View File

@@ -25,9 +25,6 @@ public class WorkerTriggerResult implements HasUID {
@NotNull
AbstractTrigger trigger;
@Builder.Default
Boolean success = true;
/**
* {@inheritDoc}
*/

View File

@@ -17,9 +17,11 @@ public abstract class AbstractDate {
private static final Map<String, DateTimeFormatter> FORMATTERS = ImmutableMap.<String, DateTimeFormatter>builder()
.put("iso", DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSSSSXXX"))
.put("iso_milli", DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSXXX"))
.put("iso_sec", DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssXXX"))
.put("sql", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSSSSS"))
.put("sql_seq", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))
.put("sql_milli", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS"))
.put("sql_sec", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))
.put("iso_date_time", DateTimeFormatter.ISO_DATE_TIME)
.put("iso_date", DateTimeFormatter.ISO_DATE)
.put("iso_time", DateTimeFormatter.ISO_TIME)

Some files were not shown because too many files have changed in this diff Show More