简体   繁体   English

Pulumi Azure 流水线任务

[英]Pulumi Azure Pipeline task

I'm new to Pulumi so I'm struggling at the moment trying to run it in my Azure release pipeline in order to create my infrastructure.我是 Pulumi 的新手,所以我目前正在努力尝试在我的 Azure 发布管道中运行它以创建我的基础架构。 During development I've used the local storage to store my pulumi state ( pulumi login --local ), I've created my stacks (dev being one of them) and I was able to easily test my deployment script against my azure subscription.在开发过程中,我使用本地存储来存储我的 pulumi state ( pulumi login --local ),我已经创建了我的堆栈(dev 是其中之一)并且我能够根据我的 azure 订阅轻松测试我的部署脚本。 Now I've pushed my code to source control, created by build pipeline (which works) and I'm trying to create my infrastructure from the release pipeline by using the Pulumi Azure Pipelines Task.现在,我已将我的代码推送到由构建管道(有效)创建的源代码管理,并且我正在尝试使用 Pulumi Azure 管道任务从发布管道创建我的基础结构。 I've managed to configure it to use the blob storage for the state file, but when running pulumi up --yes --skip-preview for the dev stack I get an error that the dev stack does not exist.我已经设法将它配置为使用 state 文件的 blob 存储,但是当为开发堆栈运行pulumi up --yes --skip-preview时,我收到一条错误消息,指出开发堆栈不存在。

Do I need to do a pulumi stack init dev on every "store" that I use?我需要在我使用的每个“商店”上做一个pulumi stack init dev吗? Aren't the Pulumi.stack_name.yaml files enough? Pulumi.stack_name.yaml 文件还不够吗?

Any advice on how to proceed is welcomed as the documentation on this is non existent or not clear.欢迎任何关于如何进行的建议,因为这方面的文档不存在或不清楚。

Thank you!谢谢!

The error is probably caused by the stack not existing in your blob storage.该错误可能是由于您的 blob 存储中不存在堆栈引起的。

If you use pulumi login --local .如果你使用pulumi login --local The stack will be managed in your local machine and is not synced to azure blob storage.堆栈将在您的本地计算机中进行管理,不会同步到 azure blob 存储。 Check here for more login options. 在此处查看更多登录选项。

In my test pipeline.在我的测试管道中。 I got error: no stack named 'dev' found.我收到错误消息:找不到名为“dev”的堆栈。 If dev does not exist on app.pulumi.com.如果 app.pulumi.com 上不存在 dev。 If i created the dev on app.pulumi.com(i use pulumi.com for storage), it worked as expected.如果我在 app.pulumi.com 上创建开发(我使用 pulumi.com 进行存储),它会按预期工作。

So please go to azure blob to check if the dev stack exists.所以请 go 到 azure blob 检查开发堆栈是否存在。 You need to create one on azure blob for your account if not exist.如果不存在,您需要在 azure blob 上为您的帐户创建一个。

If you want to migrate you local endpoints to azure blob.如果您想将本地端点迁移到 azure blob。 Please check the steps here .请检查此处的步骤。

Once the stack exists in your azure blob.一旦堆栈存在于您的 azure blob 中。 You can run pulumi up --yes --skip-preview directly in pulumi task of azure devopline.可以在azure devopline的pulumi任务中直接运行pulumi up --yes --skip-preview No need to run pulumi stack init dev Please make sure the login args is empty to use the online stack.无需run pulumi stack init dev请确保登录参数为空以使用在线堆栈。 If you specify --local , you will get the error too, for the stack does not exist in agent machine.如果你指定--local ,你也会得到错误,因为堆栈在代理机器中不存在。

在此处输入图像描述

You can also enable the option Create the stack if it does not exist to let the pulumi task create the stack if it is not found on your azure blob.您还可以启用选项Create the stack if it does not exist以让 pulumi 任务在您的 azure blob 上找不到堆栈时创建堆栈。

在此处输入图像描述

Here is the an example from Pulumi official documents to integrate with azure devops. 下面是 Pulumi 官方文档中与 azure devops 集成的示例。 Hope it helps!希望能帮助到你!

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM