CI pipeline working fine by adding suggested changes. But not getting any value for helmChartVersion.
- bash: |
chartPackage=$(ls $(projectName)-*.tgz)
chartVersion=$(echo $(basename $chartPackage) | egrep -o '[0-9].*[0-9]')
chartVersionAlreadyExists=$(az acr helm list \
-n $(registryName) \
-u $(registryLogin) \
-p $(registryPassword) \
--query "$(projectName)[?version=='$chartVersion'].version" \
-o tsv)
if [ "$chartVersion" != "$chartVersionAlreadyExists" ]; then
az acr helm push \
-n $(registryName) \
-u $(registryLogin) \
-p $(registryPassword) \
$chartPackage
fi
echo $(jq -n --arg version "$chartVersion" '{helmChartVersion: $version}') > $(build.artifactStagingDirectory)/variables.json
name: helmPush
displayName: 'az acr helm push'
The problem is CD pipeline is not working at all.
- bash: |
az login \
--service-principal \
-u=$(aksSpId) \
-p='$(aksSpSecret)' \
--tenant=$(aksSpTenantId)
az aks get-credentials \
-n $(aks) \
-g $(rg)
echo " the value of login is $(registryLogin) "
echo "the value of password is $(registryPassword)"
echo " the value of namespace is $(k8sNamespace) "
echo "the value of project is $(projectName)"
echo "the value of registry server name is $(registryServerName)"
az acr login --name $(registryName) --username $(registryLogin) --password '$(registryPassword)'
az acr helm repo add \
--name $(registryName).azurecr.io/parrot \
--username $(registryLogin) \
--password '$(registryPassword)'
helm repo update
helm search repo cnlabacrcohort17
helmChartVersion=$(jq .helmChartVersion $(pipeline.workspace)/ci-pipeline/build-artifact/variables.json -r)
echo "the value of helm chart version $helmChartVersion"
helm registry login $(registryName).azurecr.io/parrot --username helmdemopush --password 'xxx'
helm repo update
az acr helm list -n $(registryName) -u $(registryLogin) -p $(registryPassword) --query "$(projectName)[?version=='$chartVersion'].version" -o tsv
#helm chart save $(pipeline.workspace)/ci-pipeline/build-artifact $(registryName).azurecr.io/cnlabacrcohort17:latest
helm chart push $(registryName).azurecr.io/cnlabacrcohort17:1.0.0
helm chart pull $(registryName).azurecr.io/cnlabacrcohort17/parrot:1.0.0
helm chart export $(registryName).azurecr.io/cnlabacrcohort17/parrot:1.0.0 --destination $(build.stagingdirectory)
helm install parrot \
--namespace $(k8sNamespace) \
--version 1.0.0 \
--set image.repository=cnlabacrcohort17/parrot \
--username helmdemopush \
--password 'xxx' \
--generate-name
--debug \
--wait
failOnStderr: true
displayName: 'deploy helm chart'
2022-09-28T13:49:22.2828588Z Update Complete. ⎈ Happy Helming!⎈
2022-09-28T13:49:22.3197055Z NAME CHART VERSION APP VERSION DESCRIPTION
2022-09-28T13:49:22.3198512Z cnlabacrcohort17/parrot 182 182 Parrot is Captain Kube's sidekick, who shows ev...
2022-09-28T13:49:22.3546146Z the value of helm chart version
2022-09-28T13:49:22.3862427Z WARNING! Using --password via the CLI is insecure. Use --password-stdin.
2022-09-28T13:49:23.3589479Z Login succeeded
2022-09-28T13:49:23.3950802Z Hang tight while we grab the latest from your chart repositories...
2022-09-28T13:49:24.0566941Z ...Successfully got an update from the "cnlabacrcohort17" chart repository
2022-09-28T13:49:24.0567965Z Update Complete. ⎈ Happy Helming!⎈
2022-09-28T13:49:24.3715024Z WARNING: This command is implicitly deprecated because command group 'acr helm' is deprecated and will be removed in a future release. Use 'helm v3' instead.
2022-09-28T13:49:25.9587089Z Error: Chart not found: cnlabacrcohort17.azurecr.io/cnlabacrcohort17:1.0.0
2022-09-28T13:49:25.9906672Z 1.0.0: Pulling from cnlabacrcohort17.azurecr.io/cnlabacrcohort17/parrot
2022-09-28T13:49:26.5240147Z Error: cnlabacrcohort17.azurecr.io/cnlabacrcohort17/parrot:1.0.0: not found
2022-09-28T13:49:26.5576891Z Error: Chart not found: cnlabacrcohort17.azurecr.io/cnlabacrcohort17/parrot:1.0.0
2022-09-28T13:49:26.5897116Z Error: failed to download "parrot" (hint: running `helm repo update` may help)
Not able to see any helm chart in ACR as well. Please help me out to resolve this issue. I am not getting why this is failing. Why Helm Install OR Helm Upgrade is not working in Azure CI-CD With AKS and ACR.