Skip to content

Commit

Permalink
Merge pull request #1043 from wisererik/master
Browse files Browse the repository at this point in the history
Covert openapi from 2.0 to 3.0
  • Loading branch information
wisererik committed Nov 8, 2019
2 parents 0da2142 + 63d4604 commit 13a7018
Show file tree
Hide file tree
Showing 10 changed files with 1,908 additions and 2,096 deletions.
34 changes: 6 additions & 28 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ go:
env:
matrix:
- TARGET=amd64
# - TARGET=arm64
# - TARGET=arm
# - TARGET=386
# - TARGET=ppc64le

services:
- docker
Expand All @@ -25,41 +21,23 @@ before_install:
- sudo apt-get install -y build-essential gcc
- sudo apt-get install -y librados-dev librbd-dev
- sudo apt-get install -y lvm2 tgt open-iscsi
- sudo docker pull p1c2u/openapi-spec-validator


matrix:
fast_finish: true
allow_failures:
- go: tip
- script: osds_verify
- script: osds_e2etest_build
exclude:
# - go: tip
# env: TARGET=arm
# - go: tip
# env: TARGET=arm64
# - go: tip
# env: TARGET=386
# - go: tip
# env: TARGET=ppc64le


install:
# Build OpenSDS Controller source code
- make all


jobs:
include:
- stage: "Test Jobs" # naming the Tests stage
script: make
name: "builds osds core components" # names the first Tests stage job
- script: make osds_verify
name: "verify osds" # names the second Tests stage job
- script: make osds_unit_test
name: "unit test opensds" # names the third Tests stage job
- script: make osds_integration_test
name: "integration test opensds" # names the fourth Tests stage job
- script: make osds_e2etest_build
name: "e2e_test" # names the fifth Tests stage job
script:
- ./install/CI/coverage
- ./install/CI/test

after_success:
- bash <(curl -s https://codecov.io/bash)
Expand Down
48 changes: 6 additions & 42 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ VERSION ?= $(shell git describe --exact-match 2> /dev/null || \
--always --dirty --abbrev=8)
BUILD_TGT := opensds-hotpot-$(VERSION)-linux-amd64

DOCKER_TAG ?= latest

PROTOC_VERSION ?= 3.8.0

all: build

ubuntu-dev-setup:
Expand Down Expand Up @@ -56,46 +52,14 @@ docker: build
cp $(BUILD_DIR)/bin/osdsdock ./cmd/osdsdock
cp $(BUILD_DIR)/bin/osdslet ./cmd/osdslet
cp $(BUILD_DIR)/bin/osdsapiserver ./cmd/osdsapiserver
docker build cmd/osdsdock -t opensdsio/opensds-dock:$(DOCKER_TAG)
docker build cmd/osdslet -t opensdsio/opensds-controller:$(DOCKER_TAG)
docker build cmd/osdsapiserver -t opensdsio/opensds-apiserver:$(DOCKER_TAG)
docker build cmd/osdsdock -t opensdsio/opensds-dock:latest
docker build cmd/osdslet -t opensdsio/opensds-controller:latest
docker build cmd/osdsapiserver -t opensdsio/opensds-apiserver:latest

test: build #osds_verify osds_unit_test osds_integration_test osds_e2eflowtest_build osds_e2etest_build
test: build
install/CI/test
# make osds_core
.PHONY: osds_core
osds_core:
cd osds && $(MAKE)

# unit tests
.PHONY: osds_unit_test
osds_unit_test:
cd osds && $(MAKE) unit_test

# verify
.PHONY: osds_verify
osds_verify:
cd osds && $(MAKE) verify

.PHONY: osds_integration_test
osds_integration_test:
cd osds && $(MAKE) integration_test

.PHONY: osds_e2etest_build
osds_e2etest_build:
cd osds && $(MAKE) e2etest_build

protoc_precheck:
@if ! which protoc >/dev/null; then\
echo "No protoc in $(PATH), consider visiting https://github.com/protocolbuffers/protobuf/releases to get the protoc(version $(PROTOC_VERSION))";\
exit 1;\
fi;
@if [ ! "libprotoc $(PROTOC_VERSION)" = "$(shell protoc --version)" ]; then\
echo "protoc version should be $(PROTOC_VERSION)";\
exit 1;\
fi

protoc: protoc_precheck

protoc:
cd pkg/model/proto && protoc --go_out=plugins=grpc:. model.proto

goimports:
Expand Down
12 changes: 8 additions & 4 deletions install/CI/test
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,14 @@ split_line(){
}

# Start the openapi-spec validation.
split_line "Start openapi-spec validation"
wget https://github.com/go-swagger/go-swagger/releases/download/v0.19.0/swagger_linux_amd64 -O swagger_linux_amd64
chmod +x ./swagger_linux_amd64 && ./swagger_linux_amd64 validate --stop-on-error openapi-spec/swagger.yaml
rm ./swagger_linux_amd64
split_line "Start openapi spec validation"
output=$(docker run -v $OPENSDS_DIR/openapi-spec/swagger.yaml:/swagger.yaml --rm p1c2u/openapi-spec-validator /swagger.yaml)
if [ "$output" != "OK" ]
then
echo "Faild to validate openapi spec"
echo "Got validation result: $output"
exit -1
fi

# Start unit test.
split_line "Start unit test"
Expand Down

0 comments on commit 13a7018

Please sign in to comment.