Accessing Windows "C:\Program Files\..." path in pipeline

*This is the executable path I am trying to use in my pipeline: C:\Program Files\Coverity\Coverity Reports\bin\cov-generate-security-report.exe

I have tried many variations but to no avail.

coverity_scan:  
  stage: coverity_scan
  variables:
    cov_generate_security_report: '"/c/Program Files/Coverity/Coverity Reports/bin/cov-generate-security-report.exe"'
  script:
    - '%cov_generate_security_report% Report.yaml --output OUTPUT.pdf --auth-key-file cred.txt'

Error:

$ %cov_generate_security_report% Report.yaml --output OUTPUT.pdf --auth-key-file cred.txt
%cov_generate_security_report% : The term '%cov_generate_security_report%' is not recognized as the name of a cmdlet, 
function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the 
path is correct and try again

Ref: How to specify c:\program files (x86) on command line (#331) · Issues · GitLab.org / gitlab-runner · GitLab

Other variations I tried:

  variables:
    cov-generate-security-report: 'c:\"Program Files"\Coverity\Coverity Reports\bin\cov-generate-security-report.exe'
  script:
    - '%cov-generate-security-report% Report.yaml --output OUTPUT.pdf --auth-key-file cred.txt'

  variables:
    cov-generate-security-report: '"/c/Program\ Files/Coverity/Coverity Reports/bin/cov-generate-security-report.exe"'
  script:
    - '%cov-generate-security-report% Report.yaml --output OUTPUT.pdf --auth-key-file cred.txt'

  script:
    - '"C:\Program Files\Coverity\Coverity Reports\bin\cov-generate-security-report.exe" Report.yaml --output OUTPUT.pdf --auth-key-file cred.txt'

Versions

  • GitLab Enterprise Edition v17.4.2-ee
  • Self-managed

I will really appreciate any help.

So the issue is now resolved. The problem was I was specifying image in my pipeline but it wasn’t required since the Windows runner was actually the host itself on which all commands had to be executed. Once I removed the default.image property, all went fine.