Как автоматизировать распаковку почтового индекса, развернутого с помощью devops? - PullRequest
0 голосов
/ 27 сентября 2018

Я хочу настроить CI / CD для проекта API .NETCore2 с репозиторием Azure.

Я хочу, чтобы выпуск был развернут в папку на моем компьютере Windows c: \ mywebapi

Я настроил конвейер сборки для выполнения сборки и конвейер выпуска для развертывания.

Однако файлы попадают на мой компьютер как C: \ agent_work \ rX \ a \ myrelease \ drop \ WebApp.Zip целевой машины.Где X - номер выпуска.

Как мне автоматизировать последний шаг распаковки zip в папку c: \ mywebapi?

Вот сборка Yaml

    resources:
- repo: self
queue:
  name: Hosted VS2017
  demands: 
  - msbuild
  - visualstudio
  - vstest

#Your build pipeline references an undefined variable named ‘Parameters.solution’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972
#Your build pipeline references an undefined variable named ‘Parameters.solution’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972
#Your build pipeline references the ‘BuildPlatform’ variable, which you’ve selected to be settable at queue time. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab, and then select the option to make it settable at queue time. See https://go.microsoft.com/fwlink/?linkid=865971
#Your build pipeline references the ‘BuildConfiguration’ variable, which you’ve selected to be settable at queue time. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab, and then select the option to make it settable at queue time. See https://go.microsoft.com/fwlink/?linkid=865971
#Your build pipeline references the ‘BuildConfiguration’ variable, which you’ve selected to be settable at queue time. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab, and then select the option to make it settable at queue time. See https://go.microsoft.com/fwlink/?linkid=865971
#Your build pipeline references the ‘BuildPlatform’ variable, which you’ve selected to be settable at queue time. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab, and then select the option to make it settable at queue time. See https://go.microsoft.com/fwlink/?linkid=865971
#Your build pipeline references the ‘BuildConfiguration’ variable, which you’ve selected to be settable at queue time. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab, and then select the option to make it settable at queue time. See https://go.microsoft.com/fwlink/?linkid=865971
#Your build pipeline references an undefined variable named ‘Parameters.ArtifactName’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972
steps:
- task: NuGetToolInstaller@0
  displayName: 'Use NuGet 4.4.1'
  inputs:
    versionSpec: 4.4.1


- task: NuGetCommand@2
  displayName: 'NuGet restore'
  inputs:
    restoreSolution: '$(Parameters.solution)'


- task: VSBuild@1
  displayName: 'Build solution'
  inputs:
    solution: '$(Parameters.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
  displayName: 'Test Assemblies'
  inputs:
    testAssemblyVer2: |
     **\$(BuildConfiguration)\*test*.dll
     !**\obj\**

    platform: '$(BuildPlatform)'

    configuration: '$(BuildConfiguration)'


- task: PublishSymbols@2
  displayName: 'Publish symbols path'
  inputs:
    SearchPattern: '**\bin\**\*.pdb'

    PublishSymbols: false

  continueOnError: true

- task: PublishBuildArtifacts@1
  displayName: 'Publish Artifact'
  inputs:
    PathtoPublish: '$(build.artifactstagingdirectory)'

    ArtifactName: '$(Parameters.ArtifactName)'

picture of build

1 Ответ

0 голосов
/ 27 сентября 2018

Если вам просто нужно распаковать zip-файл в определенную папку (c:\mywebapi здесь), то вы можете использовать задачу Extract Files в конвейере сборки, выпуск конвейера не требуется.(См. Снимок экрана ниже, распакуйте в \\172.17.16.147\TestShare\0927 в приведенном ниже примере)

  1. Убедитесь, что ваша учетная запись службы сборки имеет правильное разрешение (read и write) для доступа к определенной папке (c:\mywebapi в вашем сценарии).
  2. Добавьте задачу Copy Files, чтобы скопировать файл WebApp.Zip в $(Build.SourcesDirectory)
  3. Добавьте задачу Extract Files, чтобы разархивировать файл

enter image description here


ОБНОВЛЕНИЕ :

Ну, по умолчанию во время сборки он генерирует только zip-файл иопубликовать Артефакт в качестве источника развертывания.

Чтобы развернуть приложение на целевом компьютере или веб-сайте, необходимо создать конвейер выпуска и связать источник артефакта, а затем использовать задачу IIS Web App Deploy для его развертывания.Если вы хотите развернуть виртуальное приложение, вам также необходимо указать имя виртуального приложения ...

enter image description here

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...