azure-devops - Azure Devops handle special character in yaml
问题描述
I have problem with the Azure Devops yaml script, as it doesn't pick up my variable properly to build my ReactJS project. Below is the script, but somehow the build failed at git push, and the username does't get picked up
pool:
vmImage: 'Ubuntu 16.04'
steps:
- task: NodeTool@0
inputs:
versionSpec: '9.8.0'
displayName: 'Install Node.js'
- script: |
npm install --no-save
npm run build
git push https://"$(azure.Username)":$(azure.Password)@$(azure.AppName).scm.azurewebsites.net:443/$(azure.AppName).git master
displayName: 'npm install and build'
解决方案
我的解决方案根据下面的 yml 文件,您可以将变量设置为在其中包含“$”符号。另一种更好的方法是使用 Azure DevOps 本身中的步骤。
image: node:9.8.0
clone:
depth: full
pipelines:
default:
- step:
script:
- npm install --no-save
- npm run build
- git push https://$AZURE_LOGIN:$AZURE_PASSWORD@$AZURE_APP_NAME.scm.azurewebsites.net:443/$AZURE_APP_NAME.git master
推荐阅读
- swiftui - 为什么在 SwiftUI 中滚动后所选行不保持选中状态?
- ios - iOS UIPasterboard 不在设备上显示消息
- python - 如何在 Python 中仅从一个 Ray 进程启用打印?
- visual-studio-code - 无法更改 vscode 字体
- google-kubernetes-engine - GCP 上带有 GKE 的 Istio:无法重定向除 80 和 443 之外的 TCP 流
- angular - 使用 rxjs 获取子数组的第一个数组
- javascript - javascript中的Roku远程
- java - 如何让我的输出打印在同一行而不重复?
- python - 运行导入命令时有没有办法消除空白 kivy 弹出窗口?
- css - Nuxt SSR 中的条件样式表取决于存储值