mirror of
https://github.com/goharbor/harbor
synced 2024-09-20 12:25:33 +00:00
Enable travis to update logs to GSR (#5949)
1, add encrypt file to store gsutil keys. 2, add function to call gsutil to update logs into harbor log bucket. Signed-off-by: wangyan <wy65701436@gmail.com>
This commit is contained in:
parent
1173955200
commit
6c00747390
87
.travis.yml
87
.travis.yml
|
@ -1,72 +1,67 @@
|
||||||
sudo: true
|
sudo: true
|
||||||
|
|
||||||
language: go
|
language: go
|
||||||
|
|
||||||
go:
|
go:
|
||||||
- 1.9.2
|
- 1.9.2
|
||||||
|
|
||||||
go_import_path: github.com/goharbor/harbor
|
go_import_path: github.com/goharbor/harbor
|
||||||
|
|
||||||
services:
|
services:
|
||||||
- docker
|
- docker
|
||||||
|
|
||||||
dist: trusty
|
dist: trusty
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- go: "1.9.2"
|
- go: 1.9.2
|
||||||
env:
|
env:
|
||||||
- UTTEST=true
|
- UTTEST=true
|
||||||
- go: "1.9.2"
|
- go: 1.9.2
|
||||||
env:
|
env:
|
||||||
- APITEST_DB=true
|
- APITEST_DB=true
|
||||||
- go: "1.9.2"
|
- go: 1.9.2
|
||||||
env:
|
env:
|
||||||
- APITEST_LDAP=true
|
- APITEST_LDAP=true
|
||||||
- go: "1.9.2"
|
- go: 1.9.2
|
||||||
env:
|
env:
|
||||||
- OFFLINE=true
|
- OFFLINE=true
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
- POSTGRESQL_HOST: localhost
|
- POSTGRESQL_HOST: localhost
|
||||||
- POSTGRESQL_PORT: 5432
|
- POSTGRESQL_PORT: 5432
|
||||||
- POSTGRESQL_USR: postgres
|
- POSTGRESQL_USR: postgres
|
||||||
- POSTGRESQL_PWD: root123
|
- POSTGRESQL_PWD: root123
|
||||||
- POSTGRESQL_DATABASE: registry
|
- POSTGRESQL_DATABASE: registry
|
||||||
- ADMINSERVER_URL: http://127.0.0.1:8888
|
- ADMINSERVER_URL: http://127.0.0.1:8888
|
||||||
- DOCKER_COMPOSE_VERSION: 1.22.0
|
- DOCKER_COMPOSE_VERSION: 1.22.0
|
||||||
- HARBOR_ADMIN: admin
|
- HARBOR_ADMIN: admin
|
||||||
- HARBOR_ADMIN_PASSWD: Harbor12345
|
- HARBOR_ADMIN_PASSWD: Harbor12345
|
||||||
- CORE_SECRET: tempString
|
- CORE_SECRET: tempString
|
||||||
- KEY_PATH: /data/secretkey
|
- KEY_PATH: "/data/secretkey"
|
||||||
- REDIS_HOST: localhost
|
- REDIS_HOST: localhost
|
||||||
- REG_VERSION: v2.6.2
|
- REG_VERSION: v2.6.2
|
||||||
- UI_BUILDER_VERSION: 1.6.0
|
- UI_BUILDER_VERSION: 1.6.0
|
||||||
|
addons:
|
||||||
addons:
|
|
||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
- google-chrome
|
- google-chrome
|
||||||
packages:
|
packages:
|
||||||
- google-chrome-stable
|
- google-chrome-stable
|
||||||
- google-chrome-beta
|
- google-chrome-beta
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
- curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
|
- openssl aes-256-cbc -K $encrypted_ed2284a9ecc3_key -iv $encrypted_ed2284a9ecc3_iv
|
||||||
- chmod +x docker-compose
|
-in gskey.sh.enc -out ./gskey.sh -d
|
||||||
- sudo mv docker-compose /usr/local/bin
|
- curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname
|
||||||
- IP=`ip addr s eth0 |grep "inet "|awk '{print $2}' |awk -F "/" '{print $1}'`
|
-s`-`uname -m` > docker-compose
|
||||||
- sudo sed -i '$a DOCKER_OPTS=\"--insecure-registry '$IP':5000\"' /etc/default/docker
|
- chmod +x docker-compose
|
||||||
- export IP=$IP
|
- sudo mv docker-compose /usr/local/bin
|
||||||
- sudo service docker restart
|
- IP=`ip addr s eth0 |grep "inet "|awk '{print $2}' |awk -F "/" '{print $1}'`
|
||||||
|
- sudo sed -i '$a DOCKER_OPTS=\"--insecure-registry '$IP':5000\"' /etc/default/docker
|
||||||
|
- export IP=$IP
|
||||||
|
- sudo service docker restart
|
||||||
install:
|
install:
|
||||||
- if [ "$UTTEST" == true ]; then bash ./tests/travis/ut_install.sh ; fi
|
- if [ "$UTTEST" == true ]; then bash ./tests/travis/ut_install.sh ; fi
|
||||||
- if [ "$APITEST_DB" == true ]; then bash ./tests/travis/api_common_install.sh $IP DB; fi
|
- if [ "$APITEST_DB" == true ]; then bash ./tests/travis/api_common_install.sh $IP
|
||||||
- if [ "$APITEST_LDAP" == true ]; then bash ./tests/travis/api_common_install.sh $IP LDAP; fi
|
DB; fi
|
||||||
|
- if [ "$APITEST_LDAP" == true ]; then bash ./tests/travis/api_common_install.sh $IP
|
||||||
|
LDAP; fi
|
||||||
script:
|
script:
|
||||||
- if [ "$UTTEST" == true ]; then bash ./tests/travis/ut_run.sh $IP; fi
|
- if [ "$UTTEST" == true ]; then bash ./tests/travis/ut_run.sh $IP; fi
|
||||||
- if [ "$APITEST_DB" == true ]; then bash ./tests/travis/api_run.sh DB $IP; fi
|
- if [ "$APITEST_DB" == true ]; then bash ./tests/travis/api_run.sh DB $IP; fi
|
||||||
- if [ "$APITEST_LDAP" == true ]; then bash ./tests/travis/api_run.sh LDAP $IP; fi
|
- if [ "$APITEST_LDAP" == true ]; then bash ./tests/travis/api_run.sh LDAP $IP; fi
|
||||||
- if [ "$OFFLINE" == true ]; then bash ./tests/travis/distro_installer.sh; fi
|
- if [ "$OFFLINE" == true ]; then bash ./tests/travis/distro_installer.sh; fi
|
||||||
|
|
BIN
gskey.sh.enc
Normal file
BIN
gskey.sh.enc
Normal file
Binary file not shown.
|
@ -1,6 +1,29 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -e
|
source gskey.sh
|
||||||
|
|
||||||
|
sudo gsutil version -l
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
# GS util
|
||||||
|
function uploader {
|
||||||
|
sudo gsutil cp $1 gs://$2/$1
|
||||||
|
sudo gsutil -D setacl public-read gs://$2/$1 &> /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
set +e
|
||||||
|
|
||||||
docker ps
|
docker ps
|
||||||
# run db auth api cases
|
# run db auth api cases
|
||||||
|
@ -11,3 +34,17 @@ fi
|
||||||
if [ "$1" = 'LDAP' ]; then
|
if [ "$1" = 'LDAP' ]; then
|
||||||
pybot -v ip:$2 -v HARBOR_PASSWORD:Harbor12345 /home/travis/gopath/src/github.com/goharbor/harbor/tests/robot-cases/Group0-BAT/API_LDAP.robot
|
pybot -v ip:$2 -v HARBOR_PASSWORD:Harbor12345 /home/travis/gopath/src/github.com/goharbor/harbor/tests/robot-cases/Group0-BAT/API_LDAP.robot
|
||||||
fi
|
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
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user