Release version
apiops verion v5.1.4
Question Details
unable to publish individual APIM even I configure the yaml:
trigger: none
parameters:
- name: API_MANAGEMENT_SERVICE_OUTPUT_FOLDER_PATH
type: string
displayName: Folder where the artifacts reside
default: "artifacts"
- name: COMMIT_ID
type: string
displayName: Choose "publish-all-artifacts-in-repo" only when you want to force republishing all artifacts (e.g. after build failure). Otherwise stick with the default behavior of "publish-artifacts-in-last-commit"
default: publish-artifacts-in-last-commit
values:
- publish-artifacts-in-last-commit
- publish-all-artifacts-in-repo
- name: SH01_API_NAMES
type: object
displayName: List of API folders to publish
default:
- name: CONFIGURATION_YAML_PATH
type: string
displayName: Optional configuration file
default: "$(Build.SourcesDirectory)/configuration.uat.yaml"
variables:
- group: apim-automation
- name: System.Debug
value: true
stages:
- stage: push_changes_to_uat_APIM
displayName: Push changes to Uat APIM
jobs:
How to change the settings to only publish certain API? Is it supported for this tool or latest version?
Expected behavior
The effect I want to achieve is to only publish the code of the corresponding API management project that has been modified in the git repo, while the code submitted through the git repo for other projects should not be published to the API management instance. In brief, I want to achieve the release of specified API projects through a single pipeline script, rather than publishing all APIs.
Actual behavior
My pipelines script has deployed all the code submitted through the git repo to the instance of API management
Reproduction Steps
- Establish the binding between the API management instance and the Azure Git repo
- Modify the corresponding code in sh01-kabsa, sh02-resource, and api-test
3.run piplines
Release version
apiops verion v5.1.4
Question Details
unable to publish individual APIM even I configure the yaml:
trigger: none
parameters:
type: string
displayName: Folder where the artifacts reside
default: "artifacts"
type: string
displayName: Choose "publish-all-artifacts-in-repo" only when you want to force republishing all artifacts (e.g. after build failure). Otherwise stick with the default behavior of "publish-artifacts-in-last-commit"
default: publish-artifacts-in-last-commit
values:
type: object
displayName: List of API folders to publish
default:
type: string
displayName: Optional configuration file
default: "$(Build.SourcesDirectory)/configuration.uat.yaml"
variables:
value: true
stages:
displayName: Push changes to Uat APIM
jobs:
job: push_changes_to_Uat_APIM
displayName: Push changes to Uat APIM
pool:
vmImage: ubuntu-latest
steps:
script: echo Provided configuration was $(Build.SourcesDirectory)/configuration.uat.yaml
displayName: Print the name of the yaml configuration file if provided
script: echo Provided app service name was $(APIM_NAME_UAT)
displayName: Print the name of the apim service name if provided
checkout: self
fetchDepth: 0
task: AzureCLI@2
displayName: Set publishing variables
inputs:
azureSubscription: "$(SERVICE_CONNECTION_NAME)"
scriptType: pscore
scriptLocation: inlineScript
inlineScript: |
Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
$VerbosePreference = "Continue"
$InformationPreference = "Continue"
addSpnToEnvironment: true
failOnStandardError: true
只保留 SH01_API_NAMES 指定的 API 文件夹
displayName: Filter only selected APIs
inputs:
targetType: "inline"
script: |
$ErrorActionPreference = "Stop"
New-Item -ItemType Directory -Force -Path $dstRoot | Out-Null
$apis = @()
foreach (
$src = Join-Path $srcRoot $api
if (Test-Path $src) {
Copy-Item $src $dstRoot -Recurse
$apis += $api
}
}
Write-Host "Filtered APIs: $($apis -join ',')"
# 覆盖原 artifacts/apis 目录
Remove-Item $srcRoot -Recurse -Force
Move-Item $dstRoot $srcRoot
replacetokens@3 task will need to be installed to use
${{ if ne(parameters.CONFIGURATION_YAML_PATH, '') }}:
displayName: "Perform namevalue secret substitution in $(Build.SourcesDirectory)/configuration.uat.yaml"
inputs:
targetFiles: $(Build.SourcesDirectory)/configuration.uat.yaml
encoding: "auto"
writeBOM: true
verbosity: "off"
actionOnMissing: "warn"
keepToken: false
tokenPrefix: "{#"
tokenSuffix: "#}"
task: PowerShell@2
displayName: Fetch publisher
inputs:
targetType: "inline"
script: |
Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
$VerbosePreference = "Continue"
$InformationPreference = "Continue"
failOnStderr: true
pwsh: true
task: PowerShell@2
displayName: Run publisher for Uat environment
inputs:
targetType: "inline"
script: |
Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
$VerbosePreference = "Continue"
$InformationPreference = "Continue"
failOnStderr: true$(Build.SourcesDirectory)/$ {{ parameters.API_MANAGEMENT_SERVICE_OUTPUT_FOLDER_PATH }}
pwsh: true
env:
AZURE_BEARER_TOKEN: $(AZURE_BEARER_TOKEN)
AZURE_CLIENT_ID: $(AZURE_CLIENT_ID)
AZURE_CLIENT_SECRET: $(AZURE_CLIENT_SECRET)
AZURE_TENANT_ID: $(AZURE_TENANT_ID)
AZURE_SUBSCRIPTION_ID: $(AZURE_SUBSCRIPTION_ID)
AZURE_RESOURCE_GROUP_NAME: $(RESOURCE_GROUP_NAME_UAT)
API_MANAGEMENT_SERVICE_OUTPUT_FOLDER_PATH:
API_MANAGEMENT_SERVICE_NAME: $(APIM_NAME_UAT)
${{ if eq( parameters['COMMIT_ID'], 'publish-artifacts-in-last-commit' ) }}:
COMMIT_ID: $(Build.SourceVersion)
CONFIGURATION_YAML_PATH: $(Build.SourcesDirectory)/configuration.uat.yaml
How to change the settings to only publish certain API? Is it supported for this tool or latest version?
Expected behavior
The effect I want to achieve is to only publish the code of the corresponding API management project that has been modified in the git repo, while the code submitted through the git repo for other projects should not be published to the API management instance. In brief, I want to achieve the release of specified API projects through a single pipeline script, rather than publishing all APIs.
Actual behavior
My pipelines script has deployed all the code submitted through the git repo to the instance of API management
Reproduction Steps
3.run piplines