【问题标题】:Azure Release Pipeline IISVirtualDirectory YAMLAzure 发布管道 IISVirtualDirectory YAML
【发布时间】:2021-12-20 10:59:48
【问题描述】:

我正在通过 Azure 创建此版本,并且它运行良好。我已经使用 YAML 创建了管道,并且我想将版本放在同一个文件中。为此,我使用“查看 YAML”方法来复制 YAML 模板并使用它。但不知何故,这条消息失败了:

ERROR ( message:Cannot find APP object with identifier "TEST01/". )
##[error]Process 'appcmd.exe' exited with code '1168'.

我想我错过了一些其他参数,或者我真的不知道如何使用 YAML 使用相同的方法。

这是代码:

trigger:
- develop

stages:
- stage:
  jobs:
  - job: Build
    displayName: Agent job 1
    pool:
      vmImage: ubuntu-latest
    steps:
    - checkout: self
    - task: ArchiveFiles@2
      displayName: Archive $(System.DefaultWorkingDirectory)
      inputs:
        rootFolderOrFile: "$(System.DefaultWorkingDirectory)"
        includeRootFolder: false
    - task: PublishBuildArtifacts@1
      displayName: 'Publish Artifact: drop'
  
- stage:
  jobs:
  - job: Deploy
    displayName: Deploy to IIS Dev
    pool:
      vmImage: windows-2019
    steps:
    - task: IISWebAppManagementOnMachineGroup@0
      displayName: 'IIS Web App Manage'
      inputs:
        IISDeploymentType: iISVirtualDirectory
        ParentWebsiteNameForVD: TEST01
        VirtualPathForVD: /admin/test
        PhysicalPathForVD: '%SystemDrive%\inetpub\_phpapps\test-center'

    - task: IISWebAppDeploymentOnMachineGroup@0
      displayName: 'IIS Web App Deploy'
      inputs:
        WebSiteName: "TEST01"
        VirtualApplication: "/admin/test"
        TakeAppOfflineFlag: True
        XmlVariableSubstitution: True

【问题讨论】:

    标签: azure azure-devops yaml azure-pipelines azure-pipelines-yaml


    【解决方案1】:

    经过一些研究和测试接缝,比如有一种关于部署/发布的新方法。

    如果您使用的是 Yaml 方法(定义阶段等),您需要将其与“环境”一起使用,而不是使用“管道 > 发布”并创建发布。创建群组或environment and use it

    这里少了两个步骤,一个是package,一个是env,应该部署在哪里。

    所以上述代码的解决方案如下:

    - stage: 'DeployTest'
      displayName: 'DeployTest'
      dependsOn: 'Build'
      condition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'develop'))
      jobs:
        - deployment: Test
          displayName: Test
          environment: 
            name: 'ENV-TEST-GROUP'    
            resourceType: VirtualMachine
          strategy:
            runOnce:
              deploy:
                steps:
                - task: IISWebAppManagementOnMachineGroup@0
                  displayName: 'IIS Web App Manage'
                  inputs:
                    IISDeploymentType: iISVirtualDirectory
                    ParentWebsiteNameForVD: TEST01
                    VirtualPathForVD: /admin/test
                    PhysicalPathForVD: '%SystemDrive%\inetpub\_phpapps\test-center'
    
                - task: IISWebAppDeploymentOnMachineGroup@0
                  displayName: 'IIS Web App Deploy'
                  inputs:
                    WebSiteName: "TEST01"
                    VirtualApplication: "/admin/test"
                    Package: $(Pipeline.Workspace)\drop\build_test.zip
                    TakeAppOfflineFlag: True
                    XmlVariableSubstitution: True
    
    
    

    【讨论】:

      猜你喜欢
      • 2019-02-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-08-15
      • 2021-05-03
      • 2020-07-18
      • 2020-03-21
      相关资源
      最近更新 更多