Code-snippet-
gitlab-ci.yml
test:
extends: .exec_template
stage: test
script:
- chmod 755 -R build_unit_test.sh
- ./build_unit_test.sh
coverage: '/Total.*?([0-9]{1,3})%/'
artifacts:
paths:
- ${CI_PROJECT_DIR}/java/target
From above shell file, I’m doing docker build which in turn sets the maven installation and run mvn clean install and mvn jacoco report.
The path locations in Dockerfile is maintained as /proj-name/java/target whereas paths in gitlab-ci.yml is expecting /builds/pkg-name/proj-name and other than this location it gives and error of:
Uploading artifacts...
WARNING: /builds/pkg-name/proj-name/java/target: no matching files. Ensure that the artifact path is relative to the working directory (/builds/pkg-name/proj-name)
ERROR: No files to upload
pom.xml changes-
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.9</version>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<!-- attached to Maven test phase -->
<execution>
<id>report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
<execution>
<id>post-unit-test</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<dataFile>target/jacoco.exec</dataFile>
<outputDirectory>target/reports</outputDirectory>
</configuration>
</execution>
</executions>
<configuration>
<systemPropertyVariables>
<jacoco-agent.destfile>target/jacoco.exec</jacoco-agent.destfile>
</systemPropertyVariables>
</configuration>
</plugin>
Please suggest how we can change the path for Browse click of latest job artifacts.
2