Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

My artifacts are not being loaded to the next pipeline step

Anauê Curi
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 2, 2024

Hello community,

I have a pipeline where I need to add a step to upload the file jacoco.csv to a S3 bucket.

I use a custom java 8 image as my base image and I suppose this is the root cause of the issue, but I have not found any article or post with a similar issue.

 

My docker image:

# Use OpenJDK 8 as the base image
FROM openjdk:8

# Install Maven, jq, and Git
RUN apt-get update && \
    apt-get install -y maven jq git python3-pip && \
    apt-get clean

# Install AWS CLI using pip
RUN pip3 install --upgrade awscli

# Set the working directory
WORKDIR /app

# Copy the source code to the working directory (if needed)
COPY . /app

# Default command to be executed when starting the container
CMD ["bash"]

 

My pipeline code (I added a find command to find the file I want to copy):

image: 
  name: powin/devops:bitbucket-java8
  username: $DOCKERHUB_USERNAME
  password: $DOCKERHUB_TOKEN

pipelines:    
  branches:
    main:
    - step:
        name: Main Build Step
        description: Performs release:prepare and release:perform
        caches:
          - maven
        script:
          - export TAG_BEFORE_RELEASE=$(git describe --abbrev=0 --tags)
          - echo "Current tag $TAG_BEFORE_RELEASE"
          - |
            mvn --batch-mode release:prepare -DscmCommentPrefix="[skip ci][maven-release-plugin]" -DskipTests -s settings.xml
          - |  
            mvn --batch-mode release:perform -DscmCommentPrefix="[skip ci][maven-release-plugin]" -DskipTests -s settings.xml
          - find / -name jacoco* -print  
        after-script:
          - |
            if [ "$BITBUCKET_EXIT_CODE" -ne 0 ]; then
              chmod +x rollback.sh
              ./rollback.sh
              exit 1
            else
              echo "The release was completed successfully"
            fi
        artifacts:
          - target/site/jacoco/jacoco.csv
    - step:
        name: Upload Jacoco Data to S3
        script:
          - find / -name jacoco* -print
          - aws s3 cp target/site/jacoco/jacoco.csv s3://devqa-jacoco-reports/${BITBUCKET_REPO_SLUG}/

Find result of the Main Build Step:

+ find / -name jacoco* -print/root/.m2/repository/org/jacoco
/root/.m2/repository/org/jacoco/jacoco-maven-plugin
/root/.m2/repository/org/jacoco/jacoco-maven-plugin/0.8.4/jacoco-maven-plugin-0.8.4.pom
/root/.m2/repository/org/jacoco/jacoco-maven-plugin/0.8.4/jacoco-maven-plugin-0.8.4.jar.sha1
/root/.m2/repository/org/jacoco/jacoco-maven-plugin/0.8.4/jacoco-maven-plugin-0.8.4.jar
/root/.m2/repository/org/jacoco/jacoco-maven-plugin/0.8.4/jacoco-maven-plugin-0.8.4.pom.sha1
/opt/atlassian/pipelines/agent/build/target/checkout/target/jacoco.exec
/opt/atlassian/pipelines/agent/build/target/checkout/target/site/jacoco
/opt/atlassian/pipelines/agent/build/target/checkout/target/site/jacoco/jacoco-resources
/opt/atlassian/pipelines/agent/build/target/checkout/target/site/jacoco/jacoco.xml
/opt/atlassian/pipelines/agent/build/target/checkout/target/site/jacoco/jacoco.csv
/opt/atlassian/pipelines/agent/build/target/checkout/target/site/jacoco/jac

Find result of the Upload Jacoco Data to S3 Step:

+ find / -name jacoco* -print

It is empty.

Does anyone know what I did wrong?

Thank you.

1 answer

0 votes
Anauê Curi
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 2, 2024

Hi,

I found the issue. I should have informed the artifact as below in the pipeline script:

 

        artifacts:
          - target/**

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events