1

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
  • pom.xml has below lines of code - Commented Sep 2, 2024 at 16:44
  • Are the these reports generated inside the docker container? If that's the case and you are not mounting that path as a volume, then GitLab's runner won't have visibility of your files as those are being generated inside docker Commented Sep 3, 2024 at 7:30

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.