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:
/root/.m2/repository/org/jacoco
<span>/root/.m2/repository/org/jacoco/jacoco-maven-plugin</span>
<span>/root/.m2/repository/org/jacoco/jacoco-maven-plugin/0.8.4/jacoco-maven-plugin-0.8.4.pom</span>
<span>/root/.m2/repository/org/jacoco/jacoco-maven-plugin/0.8.4/jacoco-maven-plugin-0.8.4.jar.sha1</span>
<span>/root/.m2/repository/org/jacoco/jacoco-maven-plugin/0.8.4/jacoco-maven-plugin-0.8.4.jar</span>
<span>/root/.m2/repository/org/jacoco/jacoco-maven-plugin/0.8.4/jacoco-maven-plugin-0.8.4.pom.sha1</span>
<span>/opt/atlassian/pipelines/agent/build/target/checkout/target/jacoco.exec</span>
<span>/opt/atlassian/pipelines/agent/build/target/checkout/target/site/jacoco</span>
<span>/opt/atlassian/pipelines/agent/build/target/checkout/target/site/jacoco/jacoco-resources</span>
<span>/opt/atlassian/pipelines/agent/build/target/checkout/target/site/jacoco/jacoco.xml</span>
<span>/opt/atlassian/pipelines/agent/build/target/checkout/target/site/jacoco/jacoco.csv</span>
<span>/opt/atlassian/pipelines/agent/build/target/checkout/target/site/jacoco/jac</span><span>+ find / -name jacoco* -print</span>
Find result of the Upload Jacoco Data to S3 Step:
<span>+ find / -name jacoco* -print</span>
It is empty.
Does anyone know what I did wrong?
Thank you.