Create a CI/CD pipeline for Ruby on Rails by using Azure DevOps Starter
Configure continuous integration (CI) and continuous delivery (CD) for your Ruby on Rails app by using Azure DevOps Starter. DevOps Starter simplifies the initial configuration of an Azure DevOps build and release pipeline.
If you don't have an Azure subscription, you can get one free through Visual Studio Dev Essentials.
Sign in to the Azure portal
Azure DevOps Starter creates a CI/CD pipeline in Azure Repos. You can create a new Azure DevOps organization or use an existing organization. DevOps Starter also creates Azure resources in the Azure subscription of your choice.
Sign in to the Azure portal.
In the search box, type DevOps Starter, and then select. Click on Add to create a new one.
Select a sample app and Azure service
Select the Ruby sample app.
Select the Ruby on Rails application framework. When you're done, select Next.
Web App on Linux is the default deployment target. Optionally, you can select Web App for Containers. The application framework, which you chose previously, dictates the type of Azure service deployment target that's available here.
Select the target service of your choice, and then select Next.
Configure Azure DevOps and an Azure subscription
Create a new free Azure DevOps organization or choose an existing organization.
Enter a name for your Azure DevOps project.
Select your Azure subscription and location, enter a name for your app, and then select Done.
After a few minutes, the DevOps Starter dashboard is displayed in the Azure portal. A sample app is set up in a repo in your Azure DevOps organization, a build is executed, and your app is deployed to Azure.
The dashboard provides visibility into your code repo, your CI/CD pipeline, and your app in Azure. At the right, select Browse to view your running app.
Commit your code changes and execute the CI/CD
Azure DevOps Starter creates a Git repo in Azure Pipelines or GitHub. To view the repo and make code changes to your app, do the following:
On the DevOps Starter dashboard, at the left, select the link for your main branch. The link opens a view to the newly created Git repo.
To view the repo clone URL, select Clone at the top right. You can clone your Git repo in your favorite IDE. In the next few steps, you can use the web browser to make and commit code changes directly to the main branch.
At the left, go to the app/views/pages/home.html.erb file, and then select Edit.
Make a change to the file. For example, modify some text within one of the div tags.
Select Commit, and then save your changes.
In your browser, go to the DevOps Starter dashboard. A build should be in progress. The changes you made are automatically built and deployed via a CI/CD pipeline.
Examine the Azure Pipelines CI/CD pipeline
Azure DevOps Starter automatically configures a full CI/CD pipeline in your Azure DevOps organization. Explore and customize the pipeline as needed. To familiarize yourself with the Azure DevOps build and release pipelines, do the following:
Go to the DevOps Starter dashboard.
At the top, select Build pipelines. A browser tab displays the build pipeline for your new project.
Point to the Status field, and then select the ellipsis (...). A menu displays several options, such as queueing a new build, pausing a build, and editing the build pipeline.
In this pane, you can examine the various tasks for your build pipeline. The build performs various tasks, such as fetching sources from the Git repo, restoring dependencies, and publishing outputs used for deployments.
At the top of the build pipeline, select the build pipeline name.
Change the name of your build pipeline to something more descriptive, select Save & queue, and then select Save.
Under your build pipeline name, select History. This pane displays an audit trail of your recent changes for the build. Azure DevOps keeps track of any changes made to the build pipeline, and it allows you to compare versions.
Select Triggers. DevOps Starter automatically creates a CI trigger, and every commit to the repo starts a new build. Optionally, you can choose to include or exclude branches from the CI process.
Select Retention. Depending on your scenario, you can specify policies to keep or remove a certain number of builds.
Select Build and Release, and then select Releases. DevOps Starter creates a release pipeline to manage deployments to Azure.
Select the ellipsis (...) next to your release pipeline, and then select Edit. The release pipeline contains a pipeline, which defines the release process.
Under Artifacts, select Drop. The build pipeline you examined previously produces the output that's used for the artifact.
At the right of the Drop icon, select Continuous deployment trigger. This release pipeline has an enabled CD trigger, which executes a deployment every time a new build artifact is available. Optionally, you can disable the trigger so that your deployments require manual execution.
At the left, select Tasks. Tasks are the activities your deployment process performs. In this example, a task was created to deploy to Azure App Service.
At the right, select View releases to display a history of releases.
Select the ellipsis (...) next to a release, and then select Open. You can explore several menus, such as a release summary, associated work items, and tests.
Select Commits. This view shows code commits that are associated with this deployment.
Select Logs. The logs contain useful information about the deployment process. You can view them both during and after deployments.
Clean up resources
When they are no longer needed, you can delete the Azure App Service instance and related resources that you created in this quickstart. To do so, use the Delete functionality on the DevOps Starter dashboard.
To learn more about modifying the build and release pipelines to meet the needs of your team, see: