Send artifact information to Harness SEI
Step by step guide to send artifact information to Harness SEI
This page provides step-by-step instructions on how you can set up a GitHub Actions workflow to allow Harness SEI to ingest the data for the artifacts and environment variables from GitHub Actions.
Prerequisites
A GitHub repository for your project
A Harness SEI API Key and SEI Integration ID
Access to GitHub Actions for the repository
Familiarity with environment variables and GitHub Actions configuration
Set up the workflow
Follow these steps to set up the workflow:
Create an SEI API Key
Go to your SEI account and create an API Key.
Give the API Key a Name and Description.
Set the role as
Ingestion.
Create Organization/Repository Secret
To securely store the SEI API Key, you can create a GitHub secret in either your organization or your repository, depending on your preference.
For Organization Secret, go to creating secrets in an organization. Give the secret a name (e.g.,
SEI_API_KEY) and store the SEI API Key value.For Repository Secret, go to creating secrets in a repository. Give the secret a name (e.g.,
GITHUB_SECRETS) and store the SEI API Key value.
Create the GitHub Actions Integration and make a note of the Integration ID, which you will need in the next steps. For more information, go to configure the integration on the cloud.
Append the following steps to your existing GitHub Actions workflow configuration:
- name: Push artifacts to SEI Endpoint id: push_artifacts env: base_url: "https://app.harness.io/gateway/sei/api/v1" # Change the URL based on your environment (e.g., eu1, asia1, etc.) payload: '{"integration_id":"<INTEGRATION_ID>","repository":"${{ github.repository }}","job_run_number":"${{ github.run_number }}","job_name":"${{ github.workflow }}","artifacts":[{"name":"<ADD_IMAGE_NAME>", "location":"<ADD_LOCATION>", "tag":"<ADD_TAG>", "digest":"<ADD_DIGEST>","type":"<ADD_TYPE>", "artifact_created_at":"<ADD_ARTIFACT_CREATED_AT>"}]}' run: curl '${{ env.base_url }}/v1/cicd/push_artifacts' -H 'accept:application/json' -H 'authorization:Apikey ${{ secrets.SEI_API_KEY }}' -H 'content-type:application/json' --data-raw '${{ env.payload }}' --compressed --globoff - name: Push params to SEI Endpoint id: push_params env: base_url: "https://app.harness.io/gateway/sei/api/v1" # Change the URL based on your environment (e.g., eu1, asia1, etc.) payload: '{"integration_id":"<INTEGRATION_ID>","repository":"${{ github.repository }}","job_run_number":"${{ github.run_number }}","job_name":"${{ github.workflow }}","params":[{"name":"<ADD_NAME>","type":"<ADD_TYPE>","value":"<ADD_VALUE>"}]}' run: curl '${{ env.base_url }}/v1/cicd/push_job_run_params' -H 'accept:application/json' -H 'authorization:Apikey ${{ secrets.SEI_API_KEY }}' -H 'content-type:application/json' --data-raw '${{ env.payload }}' --compressed --globoffMake sure to update the
INTEGRATION_IDin the workflow step with your actual SEI Integration ID. Also, update theBASE_URLaccording to your environment:Base URL (PROD2): https://app.harness.io/gratis/sei/api/v1/
Base URL (PROD1): https://app.harness.io/prod1/sei/api/v1/
If there is an issue with the Harness SEI endpoint (e.g., if the endpoint is down, 500 Internal Server Error), and you want the workflow run to fail if artifacts are not sent to Harness SEI, use the -f flag in the curl command.
curl -f <REQUEST>Refer to the metadata below to request and ingest the artifact data from GitHub Actions into Harness SEI.
MetadataDescriptionname
Image name of the artifact (e.g., ghcr.io/organization/repository:v0.1.1 where the repository is the image name)
location
Location of the artifact (e.g., ghcr.io/organization)
tag
Tag of the image (e.g., ghcr.io/organization/repository:v0.1.1 where v0.1.1 is the tag/qualifier).
digest
Digest/Hash of the generated artifact (e.g., sha256.).
type
Type of the generated artifact (optional). If CD is Harness, set type as "container" for correlation.
artifact_created_at
Creation time of the artifact in UTC format (optional).
name,location,tag, anddigestof the artifact are required fields.If
type,artifact_created_at, ordigestare not available you can remove those fields from the object.typeandartifact_created_atare optional fields.
Refer to the metadata below to ingest the environment variables data from GHA into SEI. All the keys mentioned are required fields.
KeysDescriptionname
The environment variable name.
type
The type of the environment variable (string/integer).
value
The associated value for the environment variable.
Here's a sample GitHub Actions workflow:
Last updated
Was this helpful?