-
Type:
Bug
-
Status: Done
-
Resolution: Done
-
Affects Version/s: 7.17.11
-
Fix Version/s: 7.31.10
-
Component/s: None
-
Labels:None
-
Severity:High
-
Location:External
Problem description:
When we upload a helm package (http-bin) to the test-helm-local repository (local repository) and try to see if the package has been indexed by downloading the virtual repository's index.yaml file (test-helm), we don't see the package name in the index.yaml file. The problem here is two async threads not following the correct order.
For example:
2021-04-29T19:32:43.654Z [jfrt ] [DEBUG] [27875de8bb62d2f1] [o.a.a.h.HelmServiceImpl:223 ] [_*_art-exec-38_* _] - Merging Helm repositories for helm
2021-04-29T19:32:44.064Z [jfrt ] [INFO ] [fab62e47b9422ce9] [o.a.a.h.HelmServiceImpl:250 ] [_*_art-exec-23_* _] - Finished Helm index calculation for helm-local
Where thread 38 merging the data before thread 23 finishes indexing the new package thus its caching the wrong virtual index.
Because of caching the wrong virtual index, the customer not seeing the package in the index.yaml file even after 1 minute.
Please go through this screen recording: https://recordit.co/AlICXRk2Dg
What is the expected behavior:
The expected behavior is that when we upload the package to the helm local repository and when we try to download the index.yaml file of the helm virtual repository, we should see the package name in the index.yaml file.
Let's assume it takes 5 to 10 seconds to index and gets into the virtual repository, so we should see at least after the indexing of virtual which should be after 5 to 10 seconds but because of caching wrong virtual index we were not able to see even after 1 minute.
Steps to reproduce:
- Install Artifactory 7.17.11 version
- Using Quick setup, create helm repositories that contain test-helm-local, test-helm-remote and test-helm
- From the terminal save the below script:
$cat helm-script.sh
#!/bin/bash
set -e
export BUILD_NUMBER=1
while true; do
VERSION="1.8.${BUILD_NUMBER}"
helm package --version "${VERSION}" --debug ./httpbin-master > /dev/null
CHART_ARCHIVE="httpbin-1.8.${BUILD_NUMBER}.tgz"
curl --fail -s -u${USERNAME}:${PASSWORD} -T "${CHART_ARCHIVE}" -X PUT "https://<servername>.jfrog.io/artifactory/test-helm-local/devops/test-chart/${CHART_ARCHIVE}" -O
echo "$(date +%H:%M:%S) - Char was published to Artifactory with version ${VERSION}"
# sleep 1
while true; do
if curl -sLu ${USERNAME}:${PASSWORD} 'https://<servername>.jfrog.io/artifactory/test-helm/index.yaml' -o /dev/stdout 2>&1 | grep -n "${CHART_ARCHIVE}" > /dev/null; then
echo -e "$(date +%H:%M:%S) - Chart was found in helm index\n"
break
else
echo "$(date +%H:%M:%S) - Chart was not found in index"
fi
done
rm -f "${CHART_ARCHIVE}"
((BUILD_NUMBER+=1))
done
Also, in order to run the above script, we need "httpbin-master" folder in the same directory where we have helm-script.sh. I am attaching the "httpbin-master" zip in the Jira.
Please go through the attached log files and screenshots in the Jira.