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

Support regex match and replace in claim template #34

Open
LeoQuote opened this issue Dec 11, 2023 · 0 comments · May be fixed by #35
Open

Support regex match and replace in claim template #34

LeoQuote opened this issue Dec 11, 2023 · 0 comments · May be fixed by #35
Labels
enhancement New feature or request

Comments

@LeoQuote
Copy link

LeoQuote commented Dec 11, 2023

What feature do you want to see added?

Currently only specific environment variables are available in claim template, users can join variables but cannot extract part of environment.

for example users can define aud claim as “Jenkins:${JOB_NAME}” but we cannot delete the tailing “main” and get pure org name and repo name in job_name like “Jenkins/foo/main”, which is typically in multi branch pipelines of GitHub repo.

my thought would be implementing a new claim template type , supporting following arguments:

  1. Original text like the other types, supporting macros just like other type
  2. Regex expression that used to match the original text, eg: “(\w+)/.*”
  3. Replacement that used to construct the final text, eg: “$1:jenkins” , $1 represents the first matched group.

Maybe related to #6

Upstream changes

No response

Are you interested in contributing this feature?

Yes

@LeoQuote LeoQuote added the enhancement New feature or request label Dec 11, 2023
@LeoQuote LeoQuote linked a pull request Dec 25, 2023 that will close this issue
8 tasks
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 a pull request may close this issue.

1 participant