我正在构建一个新的基于 yaml 的构建过程,通过 terraform 进行配置,使用 Azure GIT 存储库。发布管道使用 yaml 文件(如下),我知道它的所有其余部分都有效,因为整个部署都有效,除了部署只是将 .zip 文件放到 site/wwwroot 目录中,而不是解压缩它。据我所知,这完全是关于文件最底部部署部分的最后两行。
此外,包和 zip 本身也很好,因为我能够通过 Azure CLI 在 VS Code 中手动部署代码并且它可以工作。
我是否需要其他东西来获得将 zip 内容解压缩到 wwwroot 目录的版本?
name: Deploy $(Date:yyyyMMdd)$(Rev:.r) # build numbering format
trigger: none
resources:
repositories:
- repository: templates
type: git
name: repo/branch
ref: refs/heads/main
pipelines:
- pipeline: build
project: ADOProject
source: buildpipelinename
trigger:
branches:
- dev
variables:
- name: tier_prefix
value: D
- name: env_identifier
value: dev
- name: workstream
value: liehadmin
- name: region_prefix
value: C
- name: rgp_identifier
value: OURRGP
- group: terraform (non-prod)
stages:
- stage: infrastructure # our terraform methods are called from here
condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual', 'Schedule', 'ResourceTrigger'))
displayName: UPDATE INFRASTRUCTURE
jobs:
- template: 'core/terraform.yaml@templates'
parameters:
tier_prefix: $(tier_prefix)
tf_key: $(workstream)-$(env_identifier)
module_name: 'web_1tier1region_S'
variable_file_path: "$(System.DefaultWorkingDirectory)/$(Build.Repository.Name)/pipelines/$(workstream)/$(workstream).$(env_identifier).tfvars.json"
- stage: deploy
dependsOn: [infrastructure]
displayName: DEPLOY APP
jobs:
# Track deployments on the environment.
- deployment: DeployWeb
displayName: deploy Web App
pool:
vmImage: 'windows-latest'
# Creates an environment if it doesn't exist.
environment: 'site-dev'
strategy:
# Default deployment strategy, more coming...
runOnce:
deploy:
steps:
- checkout: self
- bash: ls $BUILD_ARTIFACTSTAGINGDIRECTORY
- bash: ls $PIPELINE_WORKSPACE
- task: AzureRmWebAppDeployment@4
displayName: 'deploy $(tier_prefix)-$(region_prefix)-$(workstream)-UI-01'
inputs:
ConnectionType: 'AzureRM'
azureSubscription: 'subname'
# SlotName: 'slot'
appType: 'webApp'
WebAppName: '$(tier_prefix)-$(region_prefix)-$(workstream)-UI-01'
ResourceGroupName: '$(region_prefix)-Y-Z-$(rgp_identifier)-$(tier_prefix)-XXX-XX'
# DeployToSlotOrASEFlag: true
Package: '$(Pipeline.Workspace)/build/repo_name'
enableCustomDeployment: true
deploymentMethod: 'zipDeploy'