๐Ÿš€ Setting up a Git Repository and Build Pipeline in Azure DevOps ๐Ÿ› ๏ธ

๐Ÿš€ Setting up a Git Repository and Build Pipeline in Azure DevOps ๐Ÿ› ๏ธ

ยท

2 min read

In this blog, we'll walk you through the steps to create a Git repository within your Azure DevOps project and set up a build pipeline to streamline your development workflow. Let's get started! ๐Ÿ˜Š

  1. Create a GitHub Repository:

    • If you haven't already, create a new GitHub repository or use an existing one to host your source code.

    •     https://github.com/eddzaa/NCPL.git
      
  2. Create a Build Pipeline in Azure DevOps:

    • Navigate to the Pipelines tab in your Azure DevOps project.

    • Click on "Create Pipeline."

    • Choose your GitHub repository as the source for the pipeline.

  3. Select the GitHub Repository:

    • Azure DevOps will redirect you to GitHub to select the repository you want to use.

    • After selecting the repository, click "Install" to grant Azure DevOps access to it.

  4. Modify the YAML as Needed:

    • If the auto-detected YAML meets your requirements, you can leave it as it is.

    • If you need to modify the pipeline steps, triggers, or other configurations, make the necessary changes in the YAML.

        # Maven
        # Build your Java project and run tests with Apache Maven.
        # Add steps that analyze code, save build artifacts, deploy, and more:
        # https://docs.microsoft.com/azure/devops/pipelines/languages/java
        #new line for CI test
      
        trigger:
        - master
      
        pool:
          vmImage: ubuntu-latest
      
        steps:
        - task: Maven@3
          inputs:
            mavenPomFile: 'pom.xml'
            mavenOptions: '-Xmx3072m'
            javaHomeOption: 'JDKVersion'
            jdkVersionOption: '1.8'
            jdkArchitectureOption: 'x64'
            publishJUnitResults: true
            testResultsFiles: '**/surefire-reports/TEST-*.xml'
            goals: 'package'
        - task: CopyFiles@2
          inputs:
            Contents: '**/*.war'
            TargetFolder: '$(build.artifactstagingdirectory)'
        - task: PublishBuildArtifacts@1
          inputs:
            PathtoPublish: '$(Build.ArtifactStagingDirectory)'
            ArtifactName: 'webapp'
            publishLocation: 'Container'
      
  5. Monitor the Pipeline Run:

    • After triggering the pipeline, you can monitor its progress in real-time.

    • The pipeline run view will show you the individual steps being executed, their status, and any potential errors or failures.

  1. Configure Build Pipeline Triggers:

    • You can configure the build pipeline to trigger automatically on every push to the repository or manually.

    • For automatic triggers, the YAML configuration already specifies the trigger.

      Before:

      Changes:

  • Automatic trigger:

  1. ๐Ÿ” Step 5: Monitoring the Build Pipeline

    Monitoring the build pipeline is essential to catch any issues early on. Azure DevOps provides real-time insights into your pipeline's status:

    1. Go to "Pipelines" in the left sidebar and click on your pipeline.

    2. Here, you'll find a visual representation of your pipeline's status, showing successful runs or any errors/failures encountered during the build process.

By following these steps, you've successfully set up a Git repository and a build pipeline in Azure DevOps. Embrace the power of automation and continuous integration to enhance your development experience! ๐ŸŽ‰

Happy coding! ๐Ÿ’ป๐Ÿš€

Did you find this article valuable?

Support Edvin DevOps Blog by becoming a sponsor. Any amount is appreciated!

ย