Search code examples
javacontinuous-integrationgitlab-cikeytool

Illegal option: -cacerts for keytool in gitlab-ci with gradle:jdk8


I use the next configuration in gitlab-ci.yml :

image: gradle:jdk11
stages:
  - build
  - publish
before_script:
  - wget -P /tmp http://www.some.com/SOME.crt
 - keytool -importcert -trustcacerts -file /tmp/SOME.crt -cacerts -alias "Some" -storepass changeit -noprompt

All works fine. But I need to change java version to 8. I edit my configuration to image: gradle:jdk8 and got error:

....
Illegal option: -cacerts

My gitlab configuration understanding is very poor. How I can fix configuration to use image gradle:jdk8 ?


Solution

  • The keytool -importcert command does have a -cacerts option, but I never seen it used in combination with -trustcacerts.

    The documentation does mention:

    -cacerts cacerts
    

    Operates on the cacerts keystore.
    This option is equivalent to "-keystore path_to_cacerts -storetype type_of_cacerts".

    An error will be reported if the -keystore or -storetype option is used with the -cacerts option.