harbor/tests/ci/ut_install.sh
MinerYang 1f797fafc4
add lint with golangci-lint, remove golint (#16821)
Signed-off-by: yminer <yminer@vmmware.com>

test ut_install.sh

Signed-off-by: yminer <yminer@vmmware.com>

test ut_install.sh001

Signed-off-by: yminer <yminer@vmmware.com>

test ut_install002

Signed-off-by: yminer <yminer@vmmware.com>

use curl binary to download golangcilint instead of go get

Signed-off-by: yminer <yminer@vmmware.com>

test ut-ci make lint

Signed-off-by: yminer <yminer@vmmware.com>

check ci GO111MODULE

Signed-off-by: yminer <yminer@vmmware.com>

test ci go env

Signed-off-by: yminer <yminer@vmmware.com>

test ci goenv 002

Signed-off-by: yminer <yminer@vmmware.com>

test ci GO111MODULE=auto

Signed-off-by: yminer <yminer@vmmware.com>

ci test entire ut_install.sh

Signed-off-by: yminer <yminer@vmmware.com>

remove needless debug comment

Signed-off-by: yminer <yminer@vmmware.com>

Co-authored-by: yminer <yminer@vmmware.com>
2022-05-09 11:19:02 +08:00

42 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
set -x
set -e
sudo apt-get update && sudo apt-get install -y libldap2-dev
go get -d github.com/docker/distribution
go get -d github.com/docker/libtrust
go get golang.org/x/lint/golint
go get github.com/GeertJohan/fgt
go get github.com/dghubble/sling
go get github.com/stretchr/testify
go get golang.org/x/tools/cmd/cover
go get github.com/mattn/goveralls
go get -u github.com/client9/misspell/cmd/misspell
# binary will be $(go env GOPATH)/bin/golangci-lint
# go install/go get installation aren't guaranteed to work. We recommend using binary installation.
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.45.2
sudo service postgresql stop || echo no postgresql need to be stopped
sleep 2
sudo rm -rf /data/*
sudo go env -w GO111MODULE=auto
sudo -E env "PATH=$PATH" make go_check
sudo ./tests/hostcfg.sh
sudo ./tests/generateCerts.sh
sudo make build -e BUILDTARGET="_build_db _build_registry _build_prepare" -e PULL_BASE_FROM_DOCKERHUB=false -e BUILDBIN=true
docker run --rm -v /:/hostfs:z goharbor/prepare:dev gencert -p /etc/harbor/tls/internal
sudo MAKEPATH=$(pwd)/make ./make/prepare
sudo mkdir -p "/data/redis"
sudo mkdir -p /etc/core/ca/ && sudo mv ./tests/ca.crt /etc/core/ca/
sudo mkdir -p /harbor && sudo mv ./VERSION /harbor/UIVERSION
sudo ./tests/testprepare.sh
cd tests && sudo ./ldapprepare.sh && cd ..
env
docker images
sudo sed -i 's/__version__/dev/g' ./make/docker-compose.test.yml
cat ./make/docker-compose.test.yml
sudo mkdir -p ./make/common/config/registry/ && sudo mv ./tests/reg_config.yml ./make/common/config/registry/config.yml
sudo mkdir -p /storage && sudo chown 10000:10000 -R /storage