Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add transformer definition #168

Merged
merged 8 commits into from
Feb 1, 2021
Merged

Add transformer definition #168

merged 8 commits into from
Feb 1, 2021

Conversation

olblak
Copy link
Member

@olblak olblak commented Jan 31, 2021

Fix #160
Fix #152

Add the parameter transformers for every stage definitions, "source", "condition", and "target".
A "transformers" contains a list of transformer rule which are applied successively to the source value.
Each transformer applies a different rule

We also deprecated string manipulation like prefix/postfix/replacer defined outside a transformers definition

transformer

  • addPrefix, add a prefix to the source value
  • addSuffix, add a suffix to the source value
  • trimPrefix, remove the source value prefix
  • trimSuffix, remove the source value suffix
  • replacer, replace a substring by another one in the source value
  • find, return the first occurrence that matches the regex
source:
  name: "Get latest jenkins weekly version"
  kind: jenkins
  transformers:
    - addPrefix: "alpha-"
    - addSuffix: "-jdk11"
    - trimSuffix: "-jdk11"
    - suffix: "-jdk11"
    - replacer:
        from: "-jdk11"
        to: "-jdk15"
    - replacers:
        - from: "-jdk15"
          to: "-jdk17"
  spec:
    release: weekly
targets:
  targetID:
    name: "Update file file"
    kind: file
    spec:
      file: TODO

This rule should generate the value "alpha-2.277-jdk11"

Signed-off-by: Olivier Vernin olivier@vernin.me

Deprecate prefix

Deprecated replacer

Deprecated postfix

Signed-off-by: Olivier Vernin <olivier@vernin.me>
@olblak olblak added the enhancement New feature or request label Jan 31, 2021
@olblak olblak self-assigned this Jan 31, 2021
Signed-off-by: Olivier Vernin <olivier@vernin.me>
Signed-off-by: Olivier Vernin <olivier@vernin.me>
Signed-off-by: Olivier Vernin <olivier@vernin.me>
Signed-off-by: Olivier Vernin <olivier@vernin.me>
Signed-off-by: Olivier Vernin <olivier@vernin.me>
@olblak
Copy link
Member Author

olblak commented Feb 1, 2021

Add "add" to prefix and suffix

olblak and others added 2 commits February 1, 2021 15:35
@olblak olblak merged commit 0b629e6 into main Feb 1, 2021
@olblak olblak deleted the modifiers branch February 1, 2021 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add transformers parameter Add string matcher
1 participant