Wednesday, 3 July 2024

CI/CD pipeline without directly writing YAML files

 Yes, it is possible to set up a CI/CD pipeline without directly writing YAML files by using the graphical user interfaces provided by CI/CD tools like Azure DevOps and GitHub Actions. Here's how you can do it:

Using Azure DevOps

Setting Up Continuous Integration (CI)

  1. Create a Pipeline:

    • Navigate to your Azure DevOps project.
    • Go to Pipelines > Pipelines > New Pipeline.
    • Select your repository source (e.g., GitHub, Azure Repos).
    • Authorize and select your repository.
  2. Configure the Pipeline:

    • Select the Classic Editor option to use the visual designer instead of YAML.
    • Choose the default agent pool (e.g., Azure Pipelines).
    • Add tasks to your pipeline using the visual designer:
      • Restore dependencies: Add a NuGet task to restore packages.
      • Build the project: Add a Visual Studio Build task.
      • Run tests: Add a Visual Studio Test task.
    • Save and run the pipeline.

Setting Up Continuous Deployment (CD)

  1. Create a Release Pipeline:

    • Go to Pipelines > Releases > New pipeline.
    • Select the build artifact from your CI pipeline.
    • Add stages for environments (e.g., Development, Staging, Production).
  2. Configure Deployment Tasks:

    • In each stage, add deployment tasks using the visual designer:
      • For Azure Web Apps, add an Azure App Service Deploy task.
    • Configure the task with necessary details (e.g., Azure subscription, app name, package path).
  3. Save and trigger the release:

    • Save the release pipeline.
    • Create a new release to deploy your application.

Using GitHub Actions

  1. GitHub Actions Wizard:

    • Navigate to your GitHub repository.
    • Go to the Actions tab.
    • GitHub will suggest pre-configured workflows based on your project's language.
    • Select a suggested workflow or click on Set up a workflow yourself.
    • You can use the visual editor to customize the workflow or start with a pre-built template.
  2. Add Workflow Steps:

    • Use the visual editor to add steps for build, test, and deploy.
    • For example, you can add a Run dotnet build step, a Run dotnet test step, and a deployment step using actions provided by GitHub.

Example with Azure DevOps Classic Editor

Pipeline Configuration:

  • NuGet Restore Task:

    • Task: NuGet
    • Command: restore
    • Path to solution: YourSolution.sln
  • Build Task:

    • Task: Visual Studio Build
    • Solution: YourSolution.sln
    • Configuration: Release
  • Test Task:

    • Task: Visual Studio Test
    • Test assemblies: **\*test*.dll
    • Test filter criteria: leave blank for all tests

Release Configuration:

  • Azure App Service Deploy Task:
    • Task: Azure App Service Deploy
    • Azure subscription: Select your subscription
    • App type: Web App
    • App name: YourAppName
    • Package or folder: $(System.DefaultWorkingDirectory)/**/*.zip

By using these visual tools, you can set up and manage your CI/CD pipelines without writing YAML configuration files, making it easier for those who prefer a graphical interface.

No comments:

Post a Comment