You can use Harness CI to upload artifacts, such as Docker images or test results. Build and Push steps build your codebase and then push the resulting artifact to a container registry or cloud storage repo. Upload Artifact steps upload any artifact.
Build and Push
Build and Push steps build your codebase and then push the artifact to a repo. You can:
- Build and Push to Docker Hub
- Build and Push to Azure Container Registry (ACR)
- Build and Push to Amazon Elastic Container Registry (ECR)
- Build and Push to Google Artifact Registry (GAR)
- Build and Push to Google Container Registry (GCR)
- Build and Push to GitHub Container Registry (GHCR)
For other upload locations, you can use a script in a Run step to build and upload the artifact.
Video: Add a Build and Push step
The following video demonstrates how to add a Build and Push step to a Harness CI pipeline.
Kubernetes cluster build infrastructures require root access
With Kubernetes cluster build infrastructures, Build and Push steps use kaniko. Other build infrastructures use drone-docker. Kaniko requires root access to build the Docker image. It doesn't support non-root users.
If your build runs as non-root (
runAsNonRoot: true), and you want to run the Build and Push step as root, you can set Run as User to
0 on the Build and Push step to use the root user for that individual step only.
If your security policy doesn't allow running as root, go to Build and push with non-root users.
Upload Artifact steps upload artifacts. These steps don't include build commands. You can:
- Upload Artifacts to JFrog
- Upload Artifacts to GCS
- Upload Artifacts to S3
- Upload Artifacts to Sonatype Nexus
For other upload locations, you can use a script in a Run step to upload the artifact.