From 55c50f310dc72f0599a5da7d10b69b5fad962ef7 Mon Sep 17 00:00:00 2001 From: Steven Zou Date: Thu, 27 Sep 2018 13:22:25 +0800 Subject: [PATCH 1/2] Fix #5956 issue: The APIs should not get chart information when Harbor is not installed with chart repo Signed-off-by: Steven Zou --- src/core/api/project.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/core/api/project.go b/src/core/api/project.go index 6c49cb899..988a31456 100644 --- a/src/core/api/project.go +++ b/src/core/api/project.go @@ -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 ... From bb73e64f5d56bdfac6c62c037162933307b0483a Mon Sep 17 00:00:00 2001 From: Steven Zou Date: Thu, 27 Sep 2018 15:11:20 +0800 Subject: [PATCH 2/2] Revert the changes to the travis pipeline to fix the build failure Signed-off-by: Steven Zou --- .travis.yml | 4 +-- tests/travis/api_run.sh | 58 ++++++++++++++++++++--------------------- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/.travis.yml b/.travis.yml index f29ae779d..409f114d9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/tests/travis/api_run.sh b/tests/travis/api_run.sh index 8e1349fd3..32eccb4fc 100644 --- a/tests/travis/api_run.sh +++ b/tests/travis/api_run.sh @@ -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