Skip to content

Commit 27cfdae

Browse files
fix: Update Kubernetes deployment template to handle artifact name correctly
- Changed the default value of artifactName to a space to prevent template expansion errors caused by empty strings. - Simplified the condition for downloading Kubernetes manifests to ensure it only executes when the artifactName is not a space, improving clarity and reliability in the deployment process.
1 parent 5c46f4b commit 27cfdae

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

deployments/azure-pipelines/templates/deploy-k8s-job.yml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,29 +44,25 @@ parameters:
4444
default: 300
4545
- name: artifactName
4646
type: string
47-
default: ''
47+
default: ' ' # Use space as sentinel; empty string can cause "Unexpected value ''" in template expansion
4848
- name: artifactDownloadPath
4949
type: string
5050
default: '$(Pipeline.Workspace)'
51-
- name: pool
52-
type: object
53-
default: null
5451

5552
jobs:
5653
- job: DeployJob
5754
displayName: K8s Deployment
58-
pool: ${{ parameters.pool }}
5955
steps:
6056

6157
# --------------------------------------------------
6258
# -1. Optional: Download pipeline artifact (for CI+CD flows)
6359
# --------------------------------------------------
64-
- ${{ if ne(parameters.artifactName, '') }}:
65-
- task: DownloadPipelineArtifact@2
66-
displayName: 'Download K8s Manifests'
67-
inputs:
68-
artifactName: ${{ parameters.artifactName }}
69-
path: $(Pipeline.Workspace)
60+
- task: DownloadPipelineArtifact@2
61+
displayName: 'Download K8s Manifests'
62+
condition: and(succeeded(), ne('${{ parameters.artifactName }}', ' '))
63+
inputs:
64+
artifactName: ${{ parameters.artifactName }}
65+
path: $(Pipeline.Workspace)
7066

7167
# --------------------------------------------------
7268
# 0. Check Cluster Access

0 commit comments

Comments
 (0)