我在 Azure DevOps 中使用多阶段 YAML 管道,并且在一个阶段中构建并将工件部署到其他阶段。我已经设置了拉取请求构建,每当推送新代码时,管道中的所有阶段都会运行,这是不可取的。
我想要的是,每当新代码被推送到任何分支时,我想要运行构建阶段并跳过部署阶段。默认情况下,此选项在经典管道中可用,因为构建和发布是早期的单独组件
我一直在尝试在 Azure 上部署使用 NextJS 构建的服务器端渲染的 React 应用程序。我设置了 Azure 管道并成功发布,但运行后,当我访问 azure 网站 URL 时,应用程序似乎没有加载。构建文件内容与客户端渲染的应用程序不同。请分享有关部署 SSR React 应用程序(在 Azure 上)的资源或说明。
我使用此资源来设置管道,没有遇到错误,但 URL 仍然未加载应用程序。
reactjs server-side-rendering azure-web-app-service azure-pipelines next.js
如何在签署 Android apk 时从“Azure Pipelines”访问存储在“Azure Secure Files”中的 .jks 文件?
我的想法只是调用 gradlew assembleRelease 在 Azure Pipeline 上生成并签署 apk。登录gradle配置如下:
signingConfigs {
register("release") {
storeFile(file(System.getenv("APK_KEYSTORE")))
storePassword(System.getenv("APK_KEYSTORE_PASSWORD"))
keyAlias(System.getenv("APK_KEY_ALIAS"))
keyPassword(System.getenv("APK_KEY_PASSWORD"))
}
}
Run Code Online (Sandbox Code Playgroud)
它可以在本地运行,但无法访问存储在 Azure 中“安全文件”中的 APK_KEYSTORE 文件
我已经尝试过并且有效的是这个Android 签名任务,但是我也需要在本地签名并生成 apk,所以我需要上面的这个示例
我正在使用 Azure 管道通过 GitVersion 设置版本号。这是管道:
- task: gitversion/setup@0
displayName: 'Setup GitVersion'
inputs:
versionSpec: '5.x'
- task: gitversion/execute@0
displayName: 'Run GitVersion'
inputs:
useConfigFile: true
configFilePath: 'GitVersion.yml'
Run Code Online (Sandbox Code Playgroud)
它似乎运行没有任何问题,但补丁号从未增加。+semver: patch当我添加到提交消息时它也不起作用。
FullSemVer似乎受到了影响:0.8.0+11
但我期待:0.8.11
这是GitVersion.yml文件
next-version: 0.7.0
assembly-versioning-scheme: MajorMinorPatch
assembly-file-versioning-scheme: MajorMinorPatchTag
assembly-informational-format: '{InformationalVersion}'
mode: ContinuousDelivery
increment: Patch
continuous-delivery-fallback-tag: ci
tag-prefix: '[vV]'
major-version-bump-message: '\+semver:\s?(breaking|major)'
minor-version-bump-message: '\+semver:\s?(feature|minor)'
patch-version-bump-message: '\+semver:\s?(fix|patch)'
no-bump-message: '\+semver:\s?(none|skip)'
legacy-semver-padding: 4
build-metadata-padding: 4
commits-since-version-source-padding: 4
commit-message-incrementing: Enabled
commit-date-format: 'yyyy-MM-dd'
ignore:
sha: []
merge-message-formats: {}
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助。
我有一个构建管道,我想在管道中添加手动干预,当手动干预完成后,用户可以单击恢复管道,但我想在构建管道中执行此操作。
我签入了这个https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/manual-validation?view=azure-devops&tabs=yaml但看起来我们需要使用阶段管道在发布管道中。但我希望这发生在构建管道中
我更熟悉 Terraform,我可以在其中执行以下操作:
module "storagemod" {
source = "git::https://MyProj@dev.azure.com/MyProj/Dataplatform/_git/myrepo//storage-account?ref=v0.2.0"
rg_name = "MyRG"
resource_name = "mynewdatalake"
.
.
.
}
Run Code Online (Sandbox Code Playgroud)
其中source上面引用的是我用来创建资源的 Terraform 模块的不同存储库。
该存储库是一个私有Azure 存储库(在 Azure DevOps 上),我可以访问它,因为我已经在管道的上一步中建立了 git 凭据:
module "storagemod" {
source = "git::https://MyProj@dev.azure.com/MyProj/Dataplatform/_git/myrepo//storage-account?ref=v0.2.0"
rg_name = "MyRG"
resource_name = "mynewdatalake"
.
.
.
}
Run Code Online (Sandbox Code Playgroud)
我如何使用 Azure Bicep 做类似的事情?我们正在尝试转向二头肌。
当然,我可以对 Git 标头进行相同的身份验证,但我该如何处理该模块呢?
如果它在同一个存储库上是本地的,我可以这样做:
module storagemod './storage/datalake.bicep' = {
name: 'createDataLakeAndContainers'
params: {
.
.
.
}
}
Run Code Online (Sandbox Code Playgroud)
我可以做这样的事情吗?
module storagemod …Run Code Online (Sandbox Code Playgroud) 我有一个脚本可以很好地执行各种依赖项安装和一些手动工作(NPM 安装,设置项目时需要执行的一些手动步骤)以在项目能够运行之前设置项目。该脚本在本地环境中运行得非常好。
我现在尝试在 Azure DevOps 中构建我的管道,我意识到我不能立即启动脚本。在脚本中运行npm install实际上并不是在我的项目文件夹中运行,但它始终在路径上运行/Users/runner/work
问题: 如何在项目文件夹中执行脚本?
我的脚本文件中的示例代码
set -e
# Setup project dependencies
npm install
# some mandatory manual work
.....
# Pod installation
cd ios
pod install
Run Code Online (Sandbox Code Playgroud)
我的 AzurePipelines.yml
- task: Bash@3
inputs:
targetType: 'inline'
script: |
sh $(System.DefaultWorkingDirectory)/projectFolder/setup.sh
failOnStderr: true
Run Code Online (Sandbox Code Playgroud)
来自 Azure 的问题日志(如您所见,由于路径不正确,npm 安装无法正常工作,因此管道内的进一步操作将失败)
npm WARN saveError ENOENT: no such file or directory, open '/Users/runner/work/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: …Run Code Online (Sandbox Code Playgroud) 在 Azure Devops 发布管道日志中,是否有选项可以将字体文本颜色更改为红色以表示例外。
azure-devops azure-pipelines azure-pipelines-release-pipeline
我知道可以在 azure pipelines yml 中有条件地设置变量。请参阅https://learn.microsoft.com/en-us/azure/devops/pipelines/process/expressions?view=azure-devops#conditional-insertion
是否也可以有条件地使用变量组?
假设如果管道运行变量已设置或具有特定值,则管道应使用变量组。如果不是,则不得使用该组。
谢谢
我有一个运行一系列阶段的管道 yaml 文件,每个阶段都运行一个已模板化的部署作业。代码本身非常简单:
模板.yaml
jobs:
- deployment: foo
...
Run Code Online (Sandbox Code Playgroud)
管道.yaml
stages:
- stage: Uno
displayName: Numero_uno
jobs:
- job: Foo
steps:
- template: template.yaml
parameters:
stuff: things
- stage: Dos
displayName: Numero_dos
jobs:
- job: Foo
steps:
- template: template.yaml
parameters:
stuff: things
Run Code Online (Sandbox Code Playgroud)
我发现我的一个阶段需要在其中运行一些额外的脚本,因此我想向这个特定阶段添加一些额外的作业:
- stage: Cuarenta_y_dos
displayName: Numero_cuarenta_y_dos
jobs:
- job: prep
steps:
- task: ...
- job: Foo
steps:
- template: template.yaml
parameters:
stuff: things
- job: unprep
steps:
- task: ...
Run Code Online (Sandbox Code Playgroud)
不过,这样做会破坏整个管道,因为我的模板是围绕可重用作业构建的,并且它会立即引发有关“意外值‘作业’”的错误。
我明白为什么会发生这种情况,但我不知道如何解决。我想做的事情可能吗?
azure-pipelines ×10
azure-devops ×6
azure ×3
android ×1
azure-bicep ×1
azure-pipelines-release-pipeline ×1
gitversion ×1
gradle ×1
next.js ×1
pipeline ×1
reactjs ×1
terraform ×1
yaml ×1