Lädt...

🔧 Azure Pipelines


Nachrichtenbereich: 🔧 Programmierung
🔗 Quelle: dev.to

1. Introduction to Azure Pipelines

Image description

Azure Pipelines is a cloud service that automates the building and testing of your code and deploys it to any target. It works with any language, platform, and cloud.

Key Concepts:

  • Triggers: Events that initiate a pipeline run (e.g., code commits, scheduled times).
  • Pools: Groups of agents (virtual machines or containers) that execute pipeline jobs.
  • Tasks: Pre-built or custom actions performed in a pipeline (e.g., compiling code, running tests).
  • Steps: Ordered sequences of tasks within a job.
  • Variables: Values that can be used throughout the pipeline to customize behavior.
  • Artifacts: Files or packages produced by a pipeline run.
  • YAML Syntax: Pipelines are defined using YAML (YAML Ain't Markup Language) files.

YAML Syntax Basics:

  • Indentation is crucial for defining the structure.
  • Key-value pairs define settings.
  • Lists are defined with hyphens (-).

2. Java (Maven) Pipeline Explained

Purpose:

This pipeline automates the build, test, and deployment of a Java project using Apache Maven.

YAML File Breakdown:

# 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](https://docs.microsoft.com/azure/devops/pipelines/languages/java)
trigger:
- Test

pool: TT-Line Server

steps:
- task: Maven@3
  inputs:
    mavenPomFile: 'JobAPI/pom.xml'
    goals: 'clean compile process-resources package'
    publishJUnitResults: true
    testResultsFiles: '**/surefire-reports/TEST-*.xml'
    javaHomeOption: 'JDKVersion'
    jdkVersionOption: '1.8'
    mavenVersionOption: 'Default'
    mavenOptions: '-Xmx3072m'
    mavenAuthenticateFeed: false
    effectivePomSkip: false
    sonarQubeRunAnalysis: false

- task: CopyFiles@2
  inputs:
    SourceFolder: '$(Build.SourcesDirectory)/JobAPI'
    Contents: |
      pom.xml
      target/*.jar
    TargetFolder: '$(Build.ArtifactStagingDirectory)'
  condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))

- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: '$(Build.ArtifactStagingDirectory)'
    ArtifactName: 'drop'
    publishLocation: 'Container'
  condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))

- task: Maven@3
  inputs:
    mavenPomFile: 'JobAPI/pom.xml'
    goals: 'deploy'
    publishJUnitResults: true
    testResultsFiles: '**/surefire-reports/TEST-*.xml'
    javaHomeOption: 'JDKVersion'
    jdkVersionOption: '1.8'
    mavenVersionOption: 'Default'
    mavenOptions: '-Xmx3072m'
    mavenAuthenticateFeed: false
    effectivePomSkip: false
    sonarQubeRunAnalysis: false
  condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
  • trigger: - Test: Runs the pipeline when code is pushed to the Test branch.
  • pool: TT-Line Server: Uses a self-hosted agent pool named "TT-Line Server."
  • steps:: Defines the sequence of tasks.
    • Maven@3 (Clean, Compile, Package):
      • mavenPomFile: Specifies the path to the pom.xml file.
      • goals: Defines the Maven goals to execute (clean, compile, process-resources, package).
      • publishJUnitResults: Publishes JUnit test results.
      • testResultsFiles: Specifies the location of test result files.
      • javaHomeOption, jdkVersionOption, mavenVersionOption, mavenOptions: Configures the Java and Maven environment.
    • CopyFiles@2 (POM and JAR):
      • Copies the pom.xml and the generated JAR file to the artifact staging directory ($(Build.ArtifactStagingDirectory)).
      • condition: Prevents these tasks from running during pull requests.
    • PublishBuildArtifacts@1: Publishes the staged artifacts as "drop."
    • Maven@3 (Deploy):
      • Runs the maven deploy goal, to push the artifact to a maven repository.
  • condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')): Ensures specific steps only run on successful builds and not on pull requests.

Explanation of Maven Goals and Options:

  • clean: Deletes the target directory.
  • compile: Compiles the Java source code.
  • process-resources: Copies resources to the target directory.
  • package: Packages the compiled code into a JAR file.
  • deploy: pushes the artifact to a repository.
  • Xmx3072m: Allocates 3GB of memory to Maven.

Artifact Handling:

The pipeline copies the pom.xml and JAR file to the artifact staging directory and then publishes them as an artifact named "drop."

Deployment Explanation:

The second maven task with the deploy goal, will push the resulting jar file to a maven repository, that is configured inside of the pom.xml file.

3. .NET Core (.NET Framework) Pipeline Explained

Purpose:

This pipeline builds and tests an ASP.NET Core project targeting the full .NET Framework.

YAML File Breakdown:

# ASP.NET Core (.NET Framework)
# Build and test ASP.NET Core projects targeting the full .NET Framework.
# Add steps that publish symbols, save build artifacts, and more:
# [https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core](https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core)

trigger:
- Test

pool:
  vmImage: 'windows-latest'

variables:
  solution: '**/*.sln'
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Release'

steps:
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
  displayName: 'NuGet restore'
  inputs:
    command: 'restore'
    restoreSolution: '$(solution)'
    feedsToUse: config
    nugetConfigPath: 'TTLineIMSBackoffice/NuGet.Config'
    externalFeedCredentials: 'Telerik Nuget'

- task: VSBuild@1
  inputs:
    solution: '$(solution)'
    msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)/WebApp.zip" /p:DeployIisAppPath="Default Web Site"'
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

- task: VSTest@2
  inputs:
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: '$(Build.ArtifactStagingDirectory)'
    ArtifactName: 'drop'
    publishLocation: 'Container'
  • trigger: - Test: Triggers the pipeline on commits to the Test branch.
  • pool: vmImage: 'windows-latest': Uses a Microsoft-hosted Windows agent.
  • variables:: Defines pipeline variables.
    • solution: Path to the solution file.
    • buildPlatform: Build platform (Any CPU).
    • buildConfiguration: Build configuration (Release).
  • steps::
    • NuGetToolInstaller@1: Installs the NuGet tool.
    • NuGetCommand@2 (Restore):
      • Restores NuGet packages using the specified NuGet.Config file.
      • externalFeedCredentials: provides credentials to a telerik nuget feed.
    • VSBuild@1: Builds the solution using MSBuild.
      • msbuildArgs: Configures the build process, including creating a web package (WebApp.zip).
    • VSTest@2: Runs unit tests.
    • PublishBuildArtifacts@1: Publishes the build artifacts.
...

🔧 How to execute Azure Machine Learning service pipelines in Azure Data Factory | Azure Friday


📈 28.29 Punkte
🔧 Programmierung

🎥 Python on Azure: Part 3—CI/CD with Azure Pipelines | Azure Friday


📈 28.29 Punkte
🎥 Video | Youtube

🔧 Automating Azure VM Deployment with Terraform and Ansible in Azure DevOps Pipelines


📈 22.92 Punkte
🔧 Programmierung

🔧 Azure DevOps Series - Azure Pipelines


📈 22.92 Punkte
🔧 Programmierung

🔧 Securely Update a PostgreSQL Database on Azure Using Azure DevOps Pipelines


📈 22.92 Punkte
🔧 Programmierung

🎥 Using Azure Pipelines for Azure SQL Deployments | Data Exposed


📈 22.92 Punkte
🎥 Video | Youtube

🔧 Create dependent pipelines in your Azure Data Factory | Azure Friday


📈 22.92 Punkte
🔧 Programmierung

🎥 Build ETL pipelines collaboratively using Git integration in Azure Data Factory | Azure Friday


📈 22.92 Punkte
🎥 Video | Youtube

🎥 Build ETL pipelines collaboratively using Git integration in Azure Data Factory | Azure Friday


📈 22.92 Punkte
🎥 Video | Youtube

🔧 Connect(); 2018: Azure Pipelines, Azure Boards und GitHub


📈 22.92 Punkte
🔧 Programmierung

🔧 Azure Functions now supported as a step in Azure Data Factory pipelines


📈 22.92 Punkte
🔧 Programmierung

🔧 Azure DevOps: YAML-Verbesserungen bei Azure Pipelines und mehr


📈 22.92 Punkte
🔧 Programmierung

🕵️ CVE-2023-36437 | Microsoft Azure Pipelines Agent DevOps Server Privilege Escalation


📈 17.55 Punkte
🕵️ Sicherheitslücken

🔧 Deploying Apache Airflow in Azure to build and run data pipelines


📈 17.55 Punkte
🔧 Programmierung

🔧 Running and Approving Azure DevOps Pipelines from the terminal


📈 17.55 Punkte
🔧 Programmierung

🔧 Azure Pipelines - Release


📈 17.55 Punkte
🔧 Programmierung

🔧 Visual Studio Toolbox Live - DevOps with Azure Pipelines


📈 17.55 Punkte
🔧 Programmierung

🔧 Visual Studio Code using Azure Pipelines


📈 17.55 Punkte
🔧 Programmierung

🔧 Passing JSON Variables in Azure Pipelines


📈 17.55 Punkte
🔧 Programmierung

🔧 Secure software supply chain with Azure Pipelines artifact policies


📈 17.55 Punkte
🔧 Programmierung

📰 CI/CD Pipelines for Data Processing Applications on Azure Part 1: Container Instances


📈 17.55 Punkte
🔧 AI Nachrichten

🔧 Azure Devops Converting Classic Pipelines to Yaml Based Pipeline


📈 17.55 Punkte
🔧 Programmierung

🔧 Improved Continuous Delivery capabilities and caching for Azure Pipelines


📈 17.55 Punkte
🔧 Programmierung

🔧 How GitHub Actions can improve CI/CD and compares with Azure Pipelines


📈 17.55 Punkte
🔧 Programmierung

🔧 How to Deploy a Web App with CI/CD Pipelines on Azure App Service


📈 17.55 Punkte
🔧 Programmierung

🔧 Azure Pipelines - Build


📈 17.55 Punkte
🔧 Programmierung

📰 How to Securely Connect Synapse Pipelines to Azure Functions


📈 17.55 Punkte
🔧 AI Nachrichten

🔧 How to Deploy a Web App with CI/CD Pipelines on Azure App Service


📈 17.55 Punkte
🔧 Programmierung

🔧 Azure Pipelines - Build | Visual Studio Toolbox


📈 17.55 Punkte
🔧 Programmierung

🕵️ CVE-2022-45306 | Chocolatey Azure-Pipelines-Agent Package up to 2.211.1 C:\agent permission


📈 17.55 Punkte
🕵️ Sicherheitslücken

matomo