Hi all,
I hope you’re doing well. I am currently working on a project where we have integrated GitLab CI/CD pipelines for automating various tasks, including license scanning. However, I am facing an issue with the license_scanning
job, and I could really use some assistance from the community.
Here’s the error I am encountering:
$ cat <<EOF> "$SETUP_CMD" # collapsed multi-line command
$ /run.sh analyze .
Selecting previously unselected package asdf.
(Reading database ... 20275 files and directories currently installed.)
Preparing to unpack .../asdf_0.7.8-1_amd64.deb ...
Unpacking asdf (0.7.8-1) ...
Setting up asdf (0.7.8-1) ...
Running '/opt/gitlab/custom_setup.sh' to install project dependencies…
You must specify a name and a version to install
Unknown release: openjdk-
/opt/gitlab/custom_setup.sh: line 6: mvn: command not found
Uploading artifacts for failed job
00:00
Uploading artifacts...
WARNING: gl-license-scanning-report.json: no matching files
ERROR: No files to upload
Cleaning up project directory and file based variables
00:01
ERROR: Job failed: exit code 1
I have included the Security/License-Scanning.gitlab-ci.yml
template in my .gitlab-ci.yml
file, and the license_scanning
job is defined with specific settings for license scanning.
Here’s the relevant part of my .gitlab-ci.yml
:
yamlCopy code
include:
- template: Security/License-Scanning.gitlab-ci.yml
license_scanning:
stage: test
tags:
- aker_internal
needs:
- Version updates - compile version
dependencies: []
variables:
ASDF_JAVA_VERSION: openjdk-$CI_JAVA_RELEASE
ASDF_MAVEN_VERSION: $CI_MAVEN_VERSION
LM_JAVA_VERSION: $ASDF_JAVA_VERSION
LICENSE_FINDER_CLI_OPTS: '--recursive'
MAVEN_OPTS: ""
MAVEN_CLI_OPTS: "-DskipTests --batch-mode -ntp"
SETUP_CMD: "/opt/gitlab/custom_setup.sh"
before_script:
- |-
cat <<EOF> "$SETUP_CMD"
# Install the versions of Maven and Java we use
asdf install maven $ASDF_MAVEN_VERSION
asdf install java $ASDF_JAVA_VERSION
# This is to workaround issue where a GitLab pipeline tries to download our modules from public repositories
# which does not happen when running the container outside of a pipeline:
mvn install ${MAVEN_CLI_OPTS} -Dmaven.test.skip=true -f "$MAVEN_ROOT" ${MAVEN_SETTINGS_FILE:+-s "$MAVEN_ROOT/$MAVEN_SETTINGS_FILE"}
EOF
chmod +x "$SETUP_CMD"
rules:
- !reference [.workflow_rules, standard_workflow]
I suspect that there might be an issue with the custom setup or the availability of Maven (mvn
) during the job execution. The job seems to fail when trying to install the project dependencies.
If anyone has encountered a similar problem or has experience with GitLab CI/CD and license scanning, your insights and suggestions would be greatly appreciated. I’m open to any ideas or potential solutions to resolve this issue.
Thank you all for your time and support!
Best regards,