简体   繁体   English

azure DevOps 流水线 CI/CD

[英]azure DevOps pipeline CI/CD

I am using an Open-Source project Magda ( https://magda.io/docs/building-and-running ) and want to make an Azure CI/CD Pipeline.我正在使用一个开源项目 Magda ( https://magda.io/docs/building-and-running ) 并想制作一个 Azure CI/CD 管道。

For this project, there are some prerequisites like having sbt + yarn + docker + java installed.对于这个项目,有一些先决条件,比如安装了 sbt + yarn + docker + java。 How can I specify those requirements in the azure-pipelines.yml file.如何在azure-pipelines.yml文件中指定这些要求。

Is it possible in azure-pipelines.yml file, to just write scripts?是否可以在azure-pipelines.yml文件中只编写脚本? Without any use of jobs or tasks?不使用任何工作或任务? And what's the difference between them (Tasks,Jobs... ) (I'm currently starting with it, so I don't have much experience)以及它们之间有什么区别(Tasks,Jobs ...)(我目前是从它开始的,所以我没有太多经验)

That's my current azure-pipelines.yml file (if there is something wrong please tell me)那是我当前的azure-pipelines.yml文件(如果有问题请告诉我)

# Node.js
# Build a general Node.js project with npm.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript

trigger:
- release

pool:
  vmImage: 'ubuntu-latest'

steps:
- task: NodeTool@0
  inputs:
    versionSpec: '10.0.0'
  displayName: 'Install Node.js'

- script: |
    npm install
    npm run build
  displayName: 'npm install and build'


- script: |
    curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh
  displayName: 'install Helm '

- script: |
    yarn global add lerna
    yarn global add @gov.au/pancake 
    yarn install
  displayName: 'install lerna & pancake packages'

- script: |
    export NODE_OPTIONS=--max-old-space-size=8192
  displayName: 'set Env Variable '

- script: |
    lerna run build --stream --concurrency=1 --include-dependencies
    lerna run docker-build-local --stream --concurrency=4 --include-filtered-dependencies
 displayName: 'Build lerna '

I recommend you read this Key concepts for new Azure Pipelines users我建议您阅读此新 Azure 管道用户的关键概念

It is possible to put all your stuff in one script step, but now you have logical separation, and this helps navigate and read file than one really long step.可以将所有内容放在一个脚本步骤中,但现在您有了逻辑分离,这有助于导航和读取文件,而不是一个非常长的步骤。

Here you have some bascis from above mentioned documentation:在这里,您可以从上述文档中获得一些基础知识:

  • A trigger tells a Pipeline to run.触发器告诉管道运行。
  • A pipeline is made up of one or more stages.管道由一个或多个阶段组成。 A pipeline can deploy to one or more environments.管道可以部署到一个或多个环境。
  • A stage is a way of organizing jobs in a pipeline and each stage can have one or more jobs.阶段是在管道中组织作业的一种方式,每个阶段可以有一个或多个作业。
  • Each job runs on one agent.每个作业在一个代理上运行。 A job can also be agentless.工作也可以是无代理的。
  • Each agent runs a job that contains one or more steps.每个代理运行一个包含一个或多个步骤的作业。
  • A step can be a task or script and is the smallest building block of a pipeline.步骤可以是任务或脚本,是管道的最小构建块。
  • A task is a pre-packaged script that performs an action, such as invoking a REST API or publishing a build artifact.任务是执行操作的预打包脚本,例如调用 REST API 或发布构建工件。
  • An artifact is a collection of files or packages published by a run.工件是运行发布的文件或包的集合。

But I really recommend you to go through it.但我真的推荐你通过它 go。

For this project, there are some prerequisites like having sbt + yarn + docker + java installed.对于这个项目,有一些先决条件,比如安装了 sbt + yarn + docker + java。 How can i specifiy those requirements in the azure-pipelines.yml file.我如何在 azure-pipelines.yml 文件中指定这些要求。

If you are using Microsoft hosted agents you cannot specify demands如果您使用的是 Microsoft 托管代理,则无法指定需求

Demands and capabilities apply only to self-hosted agents.需求和能力仅适用于自托管代理。 When using Microsoft-hosted agents, you select an image for the hosted agent.使用 Microsoft 托管代理时,您为托管代理提供 select 映像。 You cannot use capabilities with hosted agents.您不能将功能与托管代理一起使用。

So if you need sth what is not inside the agent you can install it and use taht new piece of sfotware.因此,如果您需要代理程序中没有的东西,您可以安装它并使用新的软件。 Later when you job is finished agent is restroed to original version.稍后,当您的工作完成时,代理将恢复为原始版本。 If you go for self hosted agent you can specify demands and based on agents capabilities it can be assigned to your job.如果您为自托管代理提供 go,您可以指定需求并根据代理功能将其分配给您的工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Azure DevOps 存储库到 Azure 静态 HTML CI/CD 管道 - Azure DevOps Repo to Azure Static HTML CI/CD Pipeline Azure DevOps 数据工厂数据集和管道 CI/CD 参数 - Azure DevOps Data Factory Dataset and pipeline CI/CD Parameters Azure DevOps CI/CD 未在活动中部署我的管道触发器 state - Azure DevOps CI/CD not deploying my pipeline triggers in an Active state Azure DevOps 服务 - CI/CD - Azure Devops Services - CI/CD 如何在 Azure DevOps CI/CD 管道中使用 Azure SQL 始终加密 - How to use Azure SQL Always Encrypted in Azure DevOps CI/CD pipeline Azure Devops 中的简单 Azure Databricks CI/CD - Simple Azure Databricks CI/CD in Azure Devops 使用 CI/CD 管道将 PHP 应用程序从 Azure DevOps 部署到 AWS - Deploy PHP application from Azure DevOps to AWS using CI/CD pipeline 使用 Azure DevOps 设置 CI/CD 管道并计算估计成本以更新客户端 - Setting up CI / CD pipeline using Azure DevOps and also calculating the estimate costing in order to update the client 能否在 Azure DevOps 中触发 CD 管道之前组合多个 CI 构建? - Can you combine multiple CI builds prior to a CD pipeline being triggered in Azure DevOps? Pandas Python Not found 模块 - Azure devops Flask App CI/CD Pipeline - Pandas Python Not found module - Azure devops Flask App CI/CD Pipeline
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM