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.

  1. Sign in to the Azure portal.

  2. In the search box, type DevOps Starter, and then select. Click on Add to create a new one.

    The DevOps Starter dashboard

Select a sample app and Azure service

  1. Select the Ruby sample app.

  2. Select the Ruby on Rails application framework. When you're done, select Next.

  3. 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.

  4. Select the target service of your choice, and then select Next.

Configure Azure DevOps and an Azure subscription

  1. Create a new free Azure DevOps organization or choose an existing organization.

  2. Enter a name for your Azure DevOps project.

  3. 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.

    Dashboard view

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:

  1. 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.

  2. 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.

  3. At the left, go to the app/views/pages/home.html.erb file, and then select Edit.

  4. Make a change to the file. For example, modify some text within one of the div tags.

  5. Select Commit, and then save your changes.

  6. 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:

  1. Go to the DevOps Starter dashboard.

  2. At the top, select Build pipelines. A browser tab displays the build pipeline for your new project.

  3. 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.

  4. Select Edit.

  5. 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.

  6. At the top of the build pipeline, select the build pipeline name.

  7. Change the name of your build pipeline to something more descriptive, select Save & queue, and then select Save.

  8. 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.

  9. 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.

  10. Select Retention. Depending on your scenario, you can specify policies to keep or remove a certain number of builds.

  11. Select Build and Release, and then select Releases. DevOps Starter creates a release pipeline to manage deployments to Azure.

  12. Select the ellipsis (...) next to your release pipeline, and then select Edit. The release pipeline contains a pipeline, which defines the release process.

  13. Under Artifacts, select Drop. The build pipeline you examined previously produces the output that's used for the artifact.

  14. 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.

  15. 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.

  16. At the right, select View releases to display a history of releases.

  17. 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.

  18. Select Commits. This view shows code commits that are associated with this deployment.

  19. 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.

Next steps

To learn more about modifying the build and release pipelines to meet the needs of your team, see: