Azure DevOps 在代码部署前后运行 Powershell

时间:2021-03-15 07:21:08

标签: azure-devops azure-pipelines

是否可以在发布管道开始时执行一次 Powershell 任务?

这种情况是一个版本可能有多个目标,但是在将代码部署到每个目标之前和之后,我需要进行一次 API 调用 (Coudflare)。

我研究了无代理作业,但调用 API 任务不支持 Cloudflare。

1 个答案:

答案 0 :(得分:0)

如果您想使用 invoke api 任务在无代理作业中调用 Cloudflare API。您可以尝试创建一个 Generic service connection 以连接到 Cloudflare 服务器。

项目设置-->服务连接-->新建服务连接-->通用

enter image description here

然后就可以在 Invoke API 任务中使用 Generic 服务连接了。见this example

但是,如果您在发布管道的顶部添加一个在部署代码之前运行的 powershell 任务,并在部署任务之后添加另一个在部署代码后运行的 powershell 任务,会有什么问题吗?

steps:
- powershell:
- task: other tasks
  ...
- task: deploy task
- powershell:
相关问题