Azure管道构建阶段验证 [英] Azure pipeline build Stage verification

本文介绍了Azure管道构建阶段验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为我组织中的一个集中式Azure开发团队,我们希望确保使用标准扩展yaml模板构建某些技术类型的代码.多亏了扩展"功能和最近在环境级别引入的模板检查功能,我们现在能够验证开发人员yaml是否扩展了我们的标准yaml.但是此检查仅在构建阶段之后运行.我们可以在构建阶段之前以某种方式对此进行评估吗?

As a centralized azure devops team in my org , we want to ensure that code of certain technology type built using standard extended yaml template. Thanks to the "Extend" feature and recently introduced template check at environment level , we are now able to verify developers yamls if they are extending our standard yamls or not. But this check only runs after build stage. Can we somehow evaluate this before build stage?

推荐答案

我们可以在构建阶段之前以某种方式对此进行评估吗?

Can we somehow evaluate this before build stage?

恐怕,不,直到现在还不能成立,尤其是您的公司对YAML结构检查非常严格.

I'm afraid, no, it can not be true until now especially your company is very strict on YAML structure check.

直到现在,环境只能是YAML的部署作业中的目标.

Until now, Environment can only be target in deployment job of YAML.

换句话说,只有在其中配置-deployment:作业的阶段才能与 Environment 一起使用.

In another word, only the stage that configure the - deployment: job in it, can work with Environment.

实际上,如果您的公司政策允许,这里的解决方法是将-deployment:作业添加到 Build 阶段,但是将这些步骤留为空白.这样的示例:

If your company policy allow, in fact, here the work around is adding - deployment: job into Build stage but leave the steps as blank. Sample like this:

  - stage: build   
    jobs:
      - job: buildjob        
        steps:
          - checkout: none
          - task: oneLuckiGetPostmanScripts@1
            inputs:
              fileLocation: '$(Build.ArtifactStagingDirectory)/postman'
              apiKey: '$(postmankey)'
      - deployment: DeployWeb
        pool:
          vmImage: 'Ubuntu-16.04'
        # creates an environment if it doesn't exist
        environment: 'Verify'
  - stage: test  
    jobs:
      - job: testjob
        steps:
          - checkout: none
          - bash: |
             echo $(Build.ArtifactStagingDirectory)/postman
            displayName: 'dir'    
  - stage: deploy
    jobs:
      - deployment: DeployWeb
        displayName: deploy Web App
        pool:
          vmImage: 'Ubuntu-16.04'
        # creates an environment if it doesn't exist
        environment: 'Verify'
        strategy:
          runOnce:
            deploy:
              steps:
              - script: echo my first deployment

这可以实际执行您想要的操作.但是,恐怕您的政策不允许这样做.

This can actual do what you want. BUT I'm afraid your policy would not allow this.

这篇关于Azure管道构建阶段验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆