node.js - 如何仅在活动 LTS 甚至当前版本上运行 azure 管道?
问题描述
我目前在我的azure-pipelines.yml
:
trigger:
- master
pool:
vmImage: ubuntu-latest
strategy:
matrix:
node_14_x:
node_version: 14.x
node_16_x:
node_version: 16.x
steps:
- task: NodeTool@0
inputs:
versionSpec: $(node_version)
displayName: 'Install Node.js'
其中 v14.x 的 Node 是在撰写本文时活动的 LTS,而 v16.x 是在撰写本文时 Node 的当前(偶数)版本。
我想重构它,所以我不必手动更新版本,所以我正在寻找这样的东西(注意:下面不起作用):
trigger:
- master
pool:
vmImage: ubuntu-latest
strategy:
matrix:
node_active_LTS:
node_version: LTS_VERSION
node_current:
node_version: CURRENT_EVEN
steps:
- task: NodeTool@0
inputs:
versionSpec: $(node_version)
displayName: 'Install Node.js'
我一直提到even,这是因为 Node.js 奇怪的版本(例如 15.x)不打算支持很长时间。在这里阅读更多。
先感谢您!
解决方案
同意布鲁诺的观点。
Azure DevOps Pipeline 中没有自动执行此操作的现成方法。
有两个限制:
Azure Pipeline 中没有与 nodejs 版本相关的预定义变量。您不能直接在 node_version 字段中使用变量值(例如 LTS_VERSION 和 CURRENT_EVEN )。
在strategy字段中,不支持运行脚本或其他命令获取 node.js 的版本。
因此,没有任何开箱即用的方法可以在 Azure Devops 中自动实现 node.js 版本来代替手动设置。
推荐阅读
- hardware - 你能把MODBUS转换成CANBUS吗?
- mysql - 是否可以在没有复制滞后/停机时间的情况下运行 OPTIMIZE TABLE?
- python - 如何在小组赛后将所有文档的字段存储在结果中?
- flutter - 如何转换 int“TimeOfDay(00:00)” instring TimeOfDay
- ruby - 将函数从一个类传递给另一个类时出现未定义的方法错误
- r - 将图旋转 90 度以进行边际分布
- filtering - (Odoo)如何过滤保存在模型字段中的行/实体?
- c# - 根据 ObservableCollection 中项目的属性使用 CanExecute 创建命令
- windows - 更改 cygwin 主路径
- javascript - 如何从 nodejs 服务器 WebRTC 在 VLC 上创建链接