【问题标题】:Integrate JFROG artifactory with Azure Web App and Azure DevOps pipelines将 JFROG 工件与 Azure Web App 和 Azure DevOps 管道集成
【发布时间】:2022-11-04 03:07:34
【问题描述】:

我正在尝试使用 Azure DevOps 中的 CI CD 将 JFROG 工件与 Azure Web 应用程序集成。所以工作流程会是这样的

  • 用户推送代码到github
  • Azure DevOps 运行 CI 并将工件/代码发送到 JFROG 工件
  • JFROG 更新 Azure Web App 上的应用程序

该应用程序全部使用 C#。我已经设法将它与 AKS 集成,但找不到将 JFROG 与 Azure App 集成的教程或指南。任何想法?

【问题讨论】:

    标签: azure azure-devops azure-web-app-service artifactory


    【解决方案1】:

    如上篇文章所述,这可以通过在 Azure DevOps 组织中安装 JFrog Artifactory 扩展来实现,但在您的管道中,您需要上传 (ArtifactoryUpload) 和下载 (ArtifactoryDownload) 任务。所以基本上,这就是你要做的:

    - task: DotNetCoreCLI@2
      displayName: Build WebApp
      inputs:
        projects: '**/*.csproj'
        arguments: '--configuration Release --no-restore'
    
    - task: ArtifactoryGenericUpload@2
      displayName: Publish webapp
      inputs:
        artifactoryService: 'artifactory'
        specSource: 'taskConfiguration'
        fileSpec: |
          {
            "files": [
              {
                "pattern": "$(Build.ArtifactStagingDirectory)/$(Build.BuildNumber)/*.zip",
                "target": "$(artifactory)/$(Build.BuildNumber)"
              }
            ]
          }
        collectBuildInfo: false
        buildName: '$(Build.DefinitionName)'
        buildNumber: '$(Build.BuildNumber)'
        failNoOp: true
    
    - task: ArtifactoryGenericDownload@3
      displayName: Download artifact
      inputs:
        connection: 'artifactory'
        specSource: 'taskConfiguration'
        fileSpec: |
          {
            "files": [
              {
                "pattern": "$(artifactory)/$(Build.BuildNumber)/*.zip",
                "target": "$(Build.ArtifactStagingDirectory)/"
              }
            ]
          }
        failNoOp: true
    
    - task: AzureRmWebAppDeployment@4
      displayName: Deploy AppService
      inputs:
        ConnectionType: 'AzureRM'
        azureSubscription: 'Azure Subscription'
        appType: 'webAppLinux'
        WebAppName: 'webapp'
        packageForLinux: '$(Build.ArtifactStagingDirectory)/$(Build.BuildNumber)/webapp.zip'
    

    【讨论】:

      【解决方案2】:

      当您希望将 Artifactory 与 Azure DevOps 集成时,可以通过安装 JFrog Artifactory 扩展 Visual Studio Marketplace,然后相应地配置构建脚本来实现。

      您可以参考下面的 JFrog wiki 页面,它可以帮助您实现您的用例: https://www.jfrog.com/confluence/display/JFROG/Artifactory+Azure+DevOps+Extension

      https://jfrog.com/screencast/jfrog-artifactory-on-azure/

      https://jfrog.com/webinar/effective-ci-cd-with-azure-devops-and-the-jfrog-platform/

      https://www.youtube.com/watch?v=E4_veZaFDmQ

      【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-08-09
      • 2020-07-15
      相关资源
      最近更新 更多