Do you use GitHub Actions for your CI/CD workflows? Or build using Docker containers? If so, you’ll probably be excited to hear that MongoDB has released: 1. An official GitHub Action and 2. A dedicated Docker image for the Atlas CLI. Together, these two releases make it easier than ever to develop applications with MongoDB Atlas.
Since MongoDB announced the Atlas CLI at MongoDB World in 2022, it has become one of our most popular tools for building with the Atlas developer data platform. One of the great things about the Atlas CLI is that it not only caters to the individual developer wanting a mouseless terminal experience—it also makes it easy to programmatically manage Atlas resources throughout the entire development lifecycle. With the new releases for the Atlas CLI with GitHub Actions and Docker, you can easily use the Atlas CLI to build with Atlas while still working natively within your preferred CI/CD platforms.
Within GitHub Actions, you now have access to a dedicated Action that allows you to seamlessly manage Atlas resources using your favorite Atlas CLI commands. You can use the predefined workflows available or create custom workflows leveraging native Atlas CLI commands. For example, with one of the predefined workflows you can: create a project, set up the Atlas CLI with an Atlas deployment, retrieve your connection string, and tear down your project and deployment.
If you use a platform other than GitHub Actions to manage your CI/CD pipelines, or simply use Docker in your toolchain, you can now also use the Atlas CLI by pulling the Docker image with just one command:
docker pull mongodb/atlas
From there, you can enter an interactive shell to run Atlas CLI commands as you normally would:
docker run --rm -it mongodb/atlas bash
You can also find detailed information in the MongoDB Documentation on how to run Docker in interactive mode or as a daemon (detached mode) for working with the Atlas CLI.