Repository navigation
Onboarding Guide for CI CD Deployment

Welcome to the Customer Onboarding Guide for integrating Moonshot into your existing Continuous Integration and Continuous Deployment (CI/CD) pipelines.
Moonshot is a powerful AI safety evaluation tool designed to seamlessly integrate into CI/CD pipelines, automate safety testing, and ensure the reliability of AI-driven applications.
This guide provides step-by-step instructions on integrating Moonshot with different CI/CD platforms.
Continuous Integration (CI) is a development practice where developers regularly merge code changes into a central repository. Automated builds and tests are then run to catch errors early in the development cycle.
Continuous Deployment (CD) extends this practice by automatically deploying the integrated code to production, ensuring that new features and bug fixes are delivered to users quickly and consistently.
- Automation Testing: Automate various AI safety testing whenever a new model or update is deployed.
- Security & Compliance: Detect potential AI risks and ensure compliance with AI governance policies before deployment while generating logs and reports for governance and audit.
- Streamlined Deployment: Reduce bottlenecks and human intervention by integrating on-demand & scheduled AI safety checks directly into CI/CD.
- Scalability, Cloud-Readiness & Extensibility: Run multiple evaluations at scale across different cloud services and easily add new tests as AI regulations evolve.
- Flexibility & Customizability:** Modular, plugin-based design allows dynamic running of selected tests based on governance policies while keeping the base image lightweight.
- Cost & Resource Efficiency: CI/CD optimization techniques such as caching and parallel execution reduce compute, storage and operation cost.
- Competitive Advantage & Business Benefits: Automated AI safety testing allows faster time-to-market, improves developer productivity with reduced manual safety testing, and ensures reliability with a better user experience in production.
In summary, Moonshot’s Docker image can seamlessly integrate into your CI/CD pipeline to provide a consistent, reproducible environment for your builds and tests.
docker pull ghcr.io/aiverify-foundation/moonshot:latestAWS ECR:
aws ecr get-login-password --region <your-region> | docker login --username AWS --password-stdin <your-aws-account-id>.dkr.ecr.<your-region>.amazonaws.comAzure Container Registry (ACR):
az acr login --name moonshotGoogle Artifact Registry:
gcloud auth configure-docker <your-location>-docker.pkg.devAWS CLI:
aws ecr create-repository --repository-name moonshot --region <your-region>
Azure CLI:
Note
ACR typically auto-creates repositories when you push, so explicit creation is unnecessary.
Google Artifact Registry:
gcloud artifacts repositories create moonshot \
--repository-format=docker \
--location=<your-region> \
--description="Docker repository for Moonshot"AWS ECR:
docker tag ghcr.io/aiverify-foundation/moonshot:latest <your-aws-account-id>.dkr.ecr.<your-region>.amazonaws.com/moonshot:latestACR:
docker tag ghcr.io/aiverify-foundation/moonshot:latest moonshot.azurecr.io/moonshot:latestGoogle Artifact Registry:
docker tag ghcr.io/aiverify-foundation/moonshot:latest <location>-docker.pkg.dev/<project-id>/moonshot/moonshot:latestAWS ECR:
docker push <your-aws-account-id>.dkr.ecr.<your-region>.[amazonaws.com/moonshot:latest](http://amazonaws.com/moonshot:latest)ACR:
docker push moonshot.azurecr.io/moonshot:latestGoogle Artifact Registry:
docker push <location>-docker.pkg.dev/<project-id>/<repository-name>/moonshot:latestImportant
Ensure that Moonshot's Docker image is available in your container registry, whether public or private, and that your CI tool has the necessary permissions to pull it.
Important
This step sets up environment variables -- a prerequisite before proceeding. Additional configuration specific to your CI/CD tool may be required.
Set up your CI config file:
1. Specify moonshot as the base image in your CI config
For example:
-
GitHub Actions: Set
container: your_container_registry/moonshot:latestin your Moonshot workflow filemy_moonshot_workflow.yaml. -
GitLab CI/CD: Set
image: your_container_registry/moonshot:latestin.gitlab-ci.yaml. -
Other CI/CD platforms: Please refer to your tool's documentation for specifying Docker container images to use
moonshot:latest.
2. Specify all your environment variables that would be in the runner in your CI config
Here is a list of variables and files you may want to configure before running Moonshot.
Note
By default, MS_TEST_CONFIG_PATH and MS_CONFIG_PATH will point to the default paths for tests.yaml and moonshot_config.yaml that are in Moonshot's Docker image.
| Variable Name | Description | Example Value |
|---|---|---|
OPENAI_API_KEY |
Key used to access OpenAI’s API | sk-proj-****** |
MS_TEST_CONFIG_PATH |
S3 location for the tests.yaml file |
Recommended: s3://my-s3-bucket/my_tests.yaml Default: tests.yaml |
MS_CONFIG_PATH |
S3 location for the moonshot_config.yaml file |
Recommended: s3://my-s3-bucket/my_moonshot_config.yaml Default: /app/moonshot_config.yaml |
AWS_ACCESS_KEY_ID |
AWS credentials for using S3 | <your-aws-access-key-id> |
AWS_SECRET_ACCESS_KEY |
AWS credentials for using S3 | <your-aws-secret-access-key> |
3. Specify cd /app as the first step in your job script
A typical configuration for using moonshot in a workflow might look like this:
jobs:
run-moonshot-in-ci:
permissions:
id-token: write
contents: read
packages: read
runs-on: ubuntu-latest
container: <your_moonshot_image>
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ap-southeast-1
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
- name: Run Moonshot
run: |
cd /app
export OPENAI_API_KEY="${{ secrets.OPENAI_TOKEN }}"
export MS_TEST_CONFIG_PATH=${{ secrets.S3_URI }}
export MS_CONFIG_PATH=${{ secrets.S3_URI }}
moonshot run my-run-1 qa-tests my-gpt-4o-mini
- name: Upload Moonshot Results
uses: actions/upload-artifact@v4
with:
name: test-results
path: /app/data/results/*
GitHub Actions Example
Tip
To use Moonshot for your use case, you should configure MS_TEST_CONFIG_PATH and MS_CONFIG_PATH to point to your my_tests.yaml and my_moonshot_config.yaml stored in your S3.
Tip
You can refer to this guide for more information on Moonshot's command to run tests.
Understanding Inputs and Outputs for Moonshot Image
| Variable Name | Description | Example Value |
|---|---|---|
OPENAI_API_KEY |
Key used to access OpenAI’s API | sk-proj-****** |
MS_TEST_CONFIG_PATH |
S3 location for the tests.yaml file |
Recommended: s3://my-s3-bucket/my_tests.yaml Default: tests.yaml |
MS_CONFIG_PATH |
S3 location for the moonshot_config.yaml file |
Recommended: s3://my-s3-bucket/my_moonshot_config.yaml Default: /app/moonshot_config.yaml |
AWS_ACCESS_KEY_ID |
AWS credentials for using S3 | <your-aws-access-key-id> |
AWS_SECRET_ACCESS_KEY |
AWS credentials for using S3 | <your-aws-secret-access-key> |
Note
Moonshot currently only supports reading config files hosted in S3.
Output results would be written into the image's /app/data/results folder. The expected output files would be <run_id>.json and ms.log.
Set your artifact path as app/data/results/* in your CI config, as your results would be written to this path.
Example paths for the output files:
-
/app/data/results/my_run.json(result file) -
/app/data/results/ms.log(log file)
You can download the output files directly through your CI tool or store them in your cloud storage.
Congratulations! You have successfully run Moonshot as a CodeBuild project via AWS Console UI!
Integrating our Project Moonshot into your existing CI/CD pipeline is essential for modern AI development.
It enables faster, more reliable, and consistent validation of large language models (LLMs) and your LLM-based applications, ensuring safety, quality and performance. With this guide, you will establish an efficient CI/CD pipeline that automates LLM application testing, enhances your AI development workflow, and delivers accurate and robust AI-driven applications to your users.
Thank you for choosing our software. We wish you the best of luck in your AI safety testing journey!
- AI Verify Evals Toolkit Installation Guide
- AI Verify Evals Toolkit User Guide
- AI Verify Evals Toolkit Developer Guide
- Onboarding Guide for CI/CD Deployment
- Basic User Guide - Moonshot Configurations
- Basic User Guide - Running Moonshot Tests
- Advanced User Guide - Create Custom Connectors for your Application Endpoint
- Advanced User Guide - Create Custom Evaluation Metrics for your Tests
- Expert User Guide - Create Custom Moonshot Tests