Publish an Allure Report to the Artifacts tab
This tutorial provides an example pipeline that builds a Java Maven application and generates an Allure Report that you can view in the Harness UI.
Artifact tab publishing is supported in the Kubernetes infrastructure only.
This pipeline has five steps that do the following:
Runs the Maven tests present in the project.
Generates the Allure Report using the
allure-resultsgenerated as part of step 1. The Allure tool is present in the
solutis/allure:2.9.0Docker image used as part of the step.
Combines the Allure Report into a single HTML file.
Viewing an Allure Report in a browser requires running a web server via the
allure opencommand. But this won't allow viewing the report after the CI pipeline is complete.
Use the allure-combine tool to convert the Allure Report into a single HTML file. Running
complete.htmlfile. This step uses the
shubham149/allure-combine:latestDocker image with the
allure-combinetool present in it.
Publishes the report to a Google Cloud Storage (GCS) bucket.
Uses static web hosting in GCS to display the Allure Report on the Artifacts tab.
plugins/artifact-metadata-publisherplugin adds the input URLs to the Artifacts tab in the Harness UI.
To run this pipeline in your project, do the following.
Create a file secret with your GCP authorization credentials. Do the following:
a. Create a service account key as described in the Google Cloud documentation.
b. Create a Harness secret for your key.
Create the following connectors if you don't have them:
- GitHub Connector
- GCP Connector Use the file secret you just created for the GCP credentials.
- Docker Hub Connector
You can choose to download Harness images from the Harness Image Registry instead of Docker Hub.
Create a publicly available bucket in GCS to store the report.
Update the report URL with your GCS bucket name. See
YOUR_GCS_BUCKET_NAMEin steps 4 and 5 in the YAML pipeline below.
name: "allure test report publisher "
name: Allure test publisher
# STEP 1: run Maven tests
name: Run tests
command: ./mvnw clean test site
# STEP 2: Generate allure report
allure generate allure-results --clean -o allure-report
# STEP 3: Combine allure report
name: combine report
cp target/allure-report/complete.html .
# STEP 4: Upload to GPS
# STEP 5: Publish upload report url in artifact tab
name: publish metadata for allure report