团队服务文档(https://www.visualstudio.com/en-us/docs/build/define/repository#what-kinds-of-submodules-can-i-check-out)指出我可以做一个$ git add submodule如果
他们举了一个例子:
git submodule add /../../submodule.git mymodule
Run Code Online (Sandbox Code Playgroud)
如果我在同一个项目中引用 git 存储库,例如
git submodule add ./../other-repo mymodule
Run Code Online (Sandbox Code Playgroud)
它解决了正确的回购协议,但希望我提供凭据。构建失败并显示以下消息:
Cloning into 'mymodule'...
fatal: could not read Username for 'https://xxx.visualstudio.com': Invalid argument
Run Code Online (Sandbox Code Playgroud)
提供带有凭据的完整 URL ( https://user:password@xxx.visualstudio.com/.. ) 可以,但在我看来是一个糟糕的解决方案。
该文档建议这应该适用于相对 url 并且无需凭据。我错了吗?
使用 system.debug 运行: true
Entering OnPrepareEnvironment
Primary repository: xxx
Calculating build folder hash key.
Loading tracking config if exists: C:\a\SourceRootMapping\07a8b96d-d805-4646-83d3-e7b2fbe394c2\18\SourceFolder.json
Creating new tracking config.
Loading top-level tracking config …Run Code Online (Sandbox Code Playgroud) 我需要在项目 repo 中执行以下命令来进行构建
echo Building Software/linux_framework
source /opt/pkg/linux/settings.sh
cd Software/linux_framework
make images HARDWARE=../my_xsa/ BOARD=local
Run Code Online (Sandbox Code Playgroud)
来自我的 YAML 文件的片段:
pool:
name: Default
steps:
- script: echo Building Software/linux_framework
source /opt/pkg/linux/settings.sh
cd Software/linux_framework
make images HARDWARE=../my_xsa/ BOARD=local
displayName: 'Make Project'
Run Code Online (Sandbox Code Playgroud)
当我运行构建时,所有 4 个命令都在终端上回显。如何在同一个终端会话中将它们作为单独的命令执行
是否可以在 Azure 构建管道中读取实际的 GIT 提交消息?
我可以看到有一项将本地文件上传到 Azure 存储或 VM 的任务。但是我们如何从 blob 或文件共享下载到管道代理中呢?目前我正在使用带有 SAS URI 的 azcopy。Pipelines 中是否有一项任务可以使用服务连接来执行此操作?
我创建了主项目
https://dev.azure.com/GilbertHsu/pipeline_test
以 3 个项目作为主项目中的子模块
https://dev.azure.com/GilbertHsu/otherProjectA
https://dev.azure.com/GilbertHsu/otherProjectB
https://dev.azure.com/GilbertHsu/otherProjectC
其中使用每个项目的默认设置。在管道 azure-pipelines.yml 中:
jobs:
- job: MacOS
strategy:
matrix:
mac:
imageName: 'macOS-10.14'
pool:
vmImage: $(imageName)
steps:
- template: azure-pipelines-ci/macos.yml
Run Code Online (Sandbox Code Playgroud)
在 azure-pipelines-ci/macos.yml 中:
# macOS-specific:
# ref. https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabls=schema%2Cparameter-schema&tabs=schema%2Cparameter-schema#checkout
steps:
- checkout: self
clean: true
path: pipeline-test
submodules: true
Run Code Online (Sandbox Code Playgroud)
.gitmodules:
[submodule "otherProjectA"]
path = otherProjectA
url = ../../../otherProjectA/_git/otherProjectA
[submodule "otherProjectB"]
path = otherProjectB
url = ../../../otherProjectB/_git/otherProjectB
[submodule "otherProjectC"]
path = otherProjectC
url = ../../../otherProjectC/_git/otherProjectC
Run Code Online (Sandbox Code Playgroud)
当我触发管道时,它总是失败
Submodule 'otherProjectA' (https://GilbertHsu@dev.azure.com/GilbertHsu/otherProjectA/_git/otherProjectA) registered for path 'otherProjectA'
Submodule 'otherProjectB' …Run Code Online (Sandbox Code Playgroud) git azure-devops azure-pipelines-build-task azure-pipelines azure-pipelines-yaml
在构建和部署 docker image.Getting Unexpected value 'Steps' 在第 27 行之前,我试图将视频文件从 GPM 复制到 app/dist/asset/images 文件夹。
如果我删除了复制视频文件的步骤,YML 文件就可以正常工作。
azure-pipelines.yml
trigger:
branches:
include: ['*']
pool:
name: Default
# templates repo
resources:
repositories:
- repository: templates
type: git
name: comp.app.common.devops-templates
ref: master
# Global Variables
variables:
# necessary variables defined in this template
- template: azure-templates/vars/abc-vars.yml@templates
- name: dockerRepoName
value: 'docker-it/library/xyz'
# needed for k8 deployment
- name: helmReleaseName
value: xyz
stages:
- steps:
- bash: 'curl -o aa.mp4 https://gpm.mmm.com/endpoints/Application/content/xyz/bb.mp4'
workingDirectory: '$(System.DefaultWorkingDirectory)/_hh_app/drop/app/dist/assets/images'
displayName: 'Download Assets' …Run Code Online (Sandbox Code Playgroud) 我想从我的 Azure DevOps Pipeline 执行 AZ cli 命令。在我的 YAML 文件中,我有这个:
trigger:
- master
pool:
vmImage: 'ubuntu-latest'
variables:
buildConfiguration: 'Release'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.x'
architecture: 'x64'
# Updating pip to latest
- script: python -m pip install --upgrade pip
displayName: 'Upgrade pip'
# Updating to latest Azure CLI version.
- script: pip install --pre azure-cli --extra-index-url https://azurecliprod.blob.core.windows.net/edge
displayName: 'upgrade azure cli'
- script: az --version
displayName: 'Show Azure CLI version'
- script: az extension add -n azure-devops
displayName: …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用VariablesAzure Pipelines 中通过-Screen设置的变量作为模板参数的输入,但出现错误:
解析管道 YAML 时遇到错误:/azure-pipelines.yml(第 18 行,第 25 行):“androidIsLibrary”参数值“$(ANDROID_IS_LIBRARY)”不是有效的布尔值。
我在 Azure Pipelines 中构建了一个模板。模板采用几个参数。它看起来像这样:
parameters:
- name: androidIsLibrary
type: boolean
default: false
Run Code Online (Sandbox Code Playgroud)
我在变量组中设置了一个变量ANDROID_IS_LIBRARYvalue false。
我使用以下语句在管道中添加了变量组:
variables:
- group: adr-general-library
Run Code Online (Sandbox Code Playgroud)
之后,我包含了我的模板和参数,如下所示:
jobs:
- template: job--android--build_and_deploy.yml@templates
parameters:
androidIsLibrary: $(ANDROID_IS_LIBRARY)
Run Code Online (Sandbox Code Playgroud)
我在 Azure DevOps 文档中找不到这个特定用例的示例,所以我希望有人已经遇到过这个问题。我想将该模板与参数一起使用,但想将我的参数集中在一个变量组中。变量和参数比较多,直接把变量定义放到模板里不是解决办法。而且我也无法更改模板。
提前致谢
在 Azure DevOps 中运行发布管道时,我遇到了“发布管道工件”任务的问题。
我得到的错误是 Build Id is not valid
输出中的值与BUILD_BUILDID“初始化作业”中的值相匹配,这也是 repo 的最新提交 ID。
我有点困惑,因为“buildid”是一个用户无法修改的系统变量。
我不确定其余的工作是否相关,但运行如下:
1. Node.js tool installer (10.x)
2. npm (install)
3. Command line (webpack)
4. Copy files (to build.artifactstagingdirectory)
5. Archive files (to $(Build.ArtifactStagingDirectory)/client.zip)
6. Publish Pipeline Artifacts ($(Build.ArtifactStagingDirectory)/client.zip) - error
Run Code Online (Sandbox Code Playgroud)
发布管道工件日志:
2021-01-08T08:40:21.7105147Z ##[debug]Evaluating: succeeded()
2021-01-08T08:40:21.7105624Z ##[debug]Evaluating succeeded:
2021-01-08T08:40:21.7106468Z ##[debug]=> True
2021-01-08T08:40:21.7107158Z ##[debug]Result: True
2021-01-08T08:40:21.7108186Z ##[section]Starting: Publish Pipeline Artifact
2021-01-08T08:40:21.7116705Z ==============================================================================
2021-01-08T08:40:21.7117060Z Task : Publish Pipeline Artifacts
2021-01-08T08:40:21.7117393Z Description : Publish (upload) a file …Run Code Online (Sandbox Code Playgroud) 我在 Azure Devops 中创建了一个新的 YAML 管道。它几乎是另一个工作正常的管道的相同副本。
构建阶段工作正常,但是当它到达 terraform 脚本尝试执行时,我收到以下错误:
##[warning]There was a failure in sending the provision message: Unexpected response code from remote provider InternalServerError
,##[warning]There was a failure in sending the provision message: Unexpected response code from remote provider InternalServerError
,##[warning]There was a failure in sending the provision message: Unexpected response code from remote provider InternalServerError
,##[warning]There was a failure in sending the provision message: Unexpected response code from remote provider InternalServerError
,##[warning]There was a failure in sending the …Run Code Online (Sandbox Code Playgroud) azure-pipelines ×10
azure-devops ×8
azure ×3
git ×3
yaml ×2
azure-cli ×1
azure-repos ×1
devops ×1
terraform ×1
variables ×1
webpack ×1