Fix #5956 issue: The APIs should not get chart information when Harbor is not installed with chart repo
This commit is contained in:
Daniel Jiang 2018-09-27 15:41:30 +08:00 committed by GitHub
commit 30950c3f8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 39 additions and 37 deletions

View File

@ -44,8 +44,8 @@ apt:
- google-chrome-stable
- google-chrome-beta
before_install:
- openssl aes-256-cbc -K $encrypted_ed2284a9ecc3_key -iv $encrypted_ed2284a9ecc3_iv
-in gskey.sh.enc -out ./gskey.sh -d
#- openssl aes-256-cbc -K $encrypted_ed2284a9ecc3_key -iv $encrypted_ed2284a9ecc3_iv
# -in gskey.sh.enc -out ./gskey.sh -d
- curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname
-s`-`uname -m` > docker-compose
- chmod +x docker-compose

View File

@ -420,13 +420,15 @@ func (p *ProjectAPI) populateProperties(project *models.Project) {
project.RepoCount = total
// Populate chart count property
count, err := chartController.GetCountOfCharts([]string{project.Name})
if err != nil {
log.Errorf("Failed to get total of charts under project %s: %v", project.Name, err)
p.CustomAbort(http.StatusInternalServerError, "")
}
if config.WithChartMuseum() {
count, err := chartController.GetCountOfCharts([]string{project.Name})
if err != nil {
log.Errorf("Failed to get total of charts under project %s: %v", project.Name, err)
p.CustomAbort(http.StatusInternalServerError, "")
}
project.ChartCount = count
project.ChartCount = count
}
}
// Put ...

View File

@ -1,29 +1,29 @@
#!/bin/bash
source gskey.sh
#source gskey.sh
sudo gsutil version -l
#sudo gsutil version -l
harbor_logs_bucket="harbor-ci-logs"
#harbor_logs_bucket="harbor-ci-logs"
# GC credentials
keyfile="/home/travis/harbor-ci-logs.key"
botofile="/home/travis/.boto"
echo -en $GS_PRIVATE_KEY > $keyfile
sudo chmod 400 $keyfile
echo "[Credentials]" >> $botofile
echo "gs_service_key_file = $keyfile" >> $botofile
echo "gs_service_client_id = $GS_CLIENT_EMAIL" >> $botofile
echo "[GSUtil]" >> $botofile
echo "content_language = en" >> $botofile
echo "default_project_id = $GS_PROJECT_ID" >> $botofile
#keyfile="/home/travis/harbor-ci-logs.key"
#botofile="/home/travis/.boto"
#echo -en $GS_PRIVATE_KEY > $keyfile
#sudo chmod 400 $keyfile
#echo "[Credentials]" >> $botofile
#echo "gs_service_key_file = $keyfile" >> $botofile
#echo "gs_service_client_id = $GS_CLIENT_EMAIL" >> $botofile
#echo "[GSUtil]" >> $botofile
#echo "content_language = en" >> $botofile
#echo "default_project_id = $GS_PROJECT_ID" >> $botofile
# GS util
function uploader {
sudo gsutil cp $1 gs://$2/$1
sudo gsutil -D setacl public-read gs://$2/$1 &> /dev/null
}
#function uploader {
# sudo gsutil cp $1 gs://$2/$1
# sudo gsutil -D setacl public-read gs://$2/$1 &> /dev/null
#}
set +e
#set +e
docker ps
# run db auth api cases
@ -36,15 +36,15 @@ if [ "$1" = 'LDAP' ]; then
fi
## --------------------------------------------- Upload Harbor CI Logs -------------------------------------------
outfile="integration_logs_$TRAVIS_BUILD_NUMBER_$TRAVIS_COMMIT.tar.gz"
sudo tar -zcvf $outfile output.xml log.html /var/log/harbor/*
if [ -f "$outfile" ]; then
uploader $outfile $harbor_logs_bucket
echo "----------------------------------------------"
echo "Download test logs:"
echo "https://storage.googleapis.com/harbor-ci-logs/$outfile"
echo "----------------------------------------------"
else
echo "No log output file to upload"
fi
#outfile="integration_logs_$TRAVIS_BUILD_NUMBER_$TRAVIS_COMMIT.tar.gz"
#sudo tar -zcvf $outfile output.xml log.html /var/log/harbor/*
#if [ -f "$outfile" ]; then
# uploader $outfile $harbor_logs_bucket
# echo "----------------------------------------------"
# echo "Download test logs:"
# echo "https://storage.googleapis.com/harbor-ci-logs/$outfile"
# echo "----------------------------------------------"
#else
# echo "No log output file to upload"
#fi