We have a condition in our template to replace "parameter.reponame" if it has a "-" to an underscore "_" . Is there any way in which I can also replace "." to an underscore "_" if it exists in a repo name.
Template :
- ${{ each environment in parameters.environmentList }}:
- job: checkmarxScan_${{ replace(environment.repoName, '-', '_') }}
workspace:
clean: all
steps:
- checkout: none
- powershell : #Code#
Main Pipeline : Where the parameters are given
name: $(BuildID)
trigger: none
pool: Azure pipelines
jobs:
- template: checkmarx-scan.yml
parameters:
environmentList:
- repoName: Repo.name, repo-name
branch: develop
scaExclusion:
sastFolderExclusion:
sastFileExclusion:
emailId:
If you have to replace multiple characters you can use replace
function multiple times:
replace(replace(environment.repoName, '-', '_'), '.', '_')
It's not pretty, but it works.