Gitlab build fails with jdk-17

Gitlab build fails with JDK-17 corretto

Compile stage of the Gitlab fails with an error :

  • *Compile stage fails with an error Executing “step_script” stage of the job script00:01

[30]$ make build

[31]/scripts-30180636-4504423081/step_script: eval: line 154: make: not found

[33]Cleaning up project directory and file based variables00:00

[35]ERROR: Job failed: command terminated with exit code 127*

** The config is like this

.maven:
  image: registry.gitlab.com/<context-root>/docker-base-images/java-corretto-17:latest

variables:
  MAVEN_CLI_OPTS: " -s $CI_PROJECT_DIR/.m2/settings.xml -Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository"
  PROJECT_CHANNEL: $CI_COMMIT_REF_SLUG
  MAVEN_REPO_PATH: $CI_PROJECT_DIR/.m2/repository
  CI_DEBUG_TRACE: "true"
  CI_DEBUG_SERVICES: "true"

stages:
  - build
  - test
  - release

cache:
  key: maven-repository
  paths:
    - .m2/repository
    - code/**/target/

compile:
  extends: .maven
  stage: build
  variables:
    EXTRA_MAVEN_OPTS: -Dcheckstyle.skip=true -Dtests.unit.skip=true -Dtests.integration.skip=true
  script:
    - make build
  artifacts:
    paths:
      - code/**/*.jar
    expire_in: 1 week
  • *What troubleshooting steps have you already taken? Can you link to any docs or other resources so we know where you have been? Enabled the debug traces and compare the logs and nothing of significant difference could be found however The build from JDK 11 branch has the GitLab syntax like this

export SECRET_DETECTION_EXCLUDED_PATHS=‘'’‘'’

where as the one with Java 17

export SECRET_DETECTION_EXCLUDED_PATHS=‘"’‘"’*

Thanks for taking the time to be thorough in your request, it really helps! :blush:

Hey!

Looks like make is not part of your docker image (libraries are probably missing). Depending on base of your Docker image (Ubuntu/Debian, etc), you will need to install libraries that include tools like make. E.g. for Ubuntu should be:

apt-get update && apt-get install make

But it can also be that some references (paths) are missing, but that I cannot tell unless you share your Dockerfile with us.

Advice (what I do all the time) - I like to develop and test all my scripts locally first. E.g. inside of the project, I run the image with mounted volumes… in your case something like (this will work in Powershell):

docker run -it -v ${pwd}:/src registry.gitlab.com/<context-root>/docker-base-images/java-corretto-17:latest bash

and then I try out command by command what I would specify in the script part of .gitlab-ci.yml:

cd /src   # required only locally because I mounted project into /src
make build

Here it’s also easier to debug and find out how you can resolve your problems because you have a bit more of an output. After you fix it, you can either do the same in your script, or in this case (when some libraries are missing) - you can add them directly to your Dockerfile and then try again.

Hope this helps! :slight_smile:

1 Like

Thank you very much for the reply. Adding the below script had resolved the issue.

before_script:

  • apk add --no-cache make
  • apk add --no-cache bash
2 Likes