Updated Makefile

ARMADA-29: CI/CD Armada Testing Framework Entrypoints defined

It does not appear the the docker run command to call tox tests/unit
is necessary.  The Makefile already includes several testing checks.

Added a few additional targets as specified in the upc-integration
code-convenstions to satisfy the clcp Makefile standards.

Change-Id: Ia920a856ed6d607fcf38d5f85dbb9a0c8aae4fa6
This commit is contained in:
One-Fine-Day 2018-03-02 16:51:09 -06:00 committed by vd789v
parent d857125de5
commit ec252e7069
7 changed files with 145 additions and 11 deletions

View File

@ -1,11 +1,27 @@
# Copyright 2018 AT&T Intellectual Property. All other rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# APP INFO
DOCKER_REGISTRY ?= quay.io
IMAGE_PREFIX ?= attcomdev
IMAGE_NAME ?= armada
IMAGE_TAG ?= latest
HELM ?= helm
LABEL ?= commit-id
PYTHON = python3
CHART = armada
IMAGE := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG}
# VERSION INFO
GIT_COMMIT = $(shell git rev-parse HEAD)
@ -17,8 +33,7 @@ ifdef VERSION
DOCKER_VERSION = $(VERSION)
endif
IMAGE_TAG ?= git-${GIT_SHA}
IMAGE := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG}
SHELL = /bin/bash
info:
@ -58,9 +73,8 @@ check-tox:
exit 2; \
fi
.PHONY: docker-build
images: check-docker
docker build --rm -t ${IMAGE} --label $(LABEL) .
.PHONY: images
images: check-docker build_armada
.PHONY: dry-run
dry-run: clean
@ -68,6 +82,24 @@ dry-run: clean
$(HELM) dep up charts/$(CHART)
$(HELM) template charts/$(CHART)
.PHONY: docs
docs: build_docs
.PHONY: run_images
run_images: run_armada
.PHONY: run_armada
run_armada: build_armada
./tools/armada_image_run.sh $(IMAGE)
.PHONY: build_docs
build_docs:
tox -e docs
.PHONY: build_armada
build_armada:
docker build -t $(IMAGE) --label $(LABEL) .
# make tools
.PHONY: protoc
protoc:

View File

@ -89,11 +89,6 @@ path to the private key that includes the name of the key itself.""")),
'tiller_release_roles',
default=['admin'],
help=utils.fmt('IDs of approved API access roles.')),
cfg.ListOpt(
'tiller_status_roles',
default=['admin'],
help=utils.fmt('IDs of approved API access roles.'))
]

View File

@ -211,6 +211,10 @@ To run the Python linter, execute::
$ tox -e pep8
or
$ make test-pep8
To lint Helm charts, execute::
$ make lint
@ -219,18 +223,58 @@ To run unit tests, execute::
$ tox -e py35
or
$ make test-unit
To run the test coverage job::
$ tox -e coverage
or
$ make test-coverage
To run security checks via `Bandit`_ execute::
$ tox -e bandit
or
$ make test-bandit
To build the docker images::
$ make images
To build all Armada charts, execute::
$ make charts
To build a helm template for the charts::
$ make dry-run
To run lint, charts, and image targets all at once::
$ make all
To render any documentation that has build steps::
$ tox -e docs
or
$ make docs
To build armada's image::
$ make run_armada
To build all images::
$ make run_images
To generate sample configuration and policy files needed for Armada deployment,
execute (respectively)::

View File

@ -19,7 +19,7 @@ set -ex
CMD="armada"
# Define port
PORT=${ARMADA_API_PORT:-8000}
ARMADA_API_PORT=${ARMADA_API_PORT:-8000}
# How long uWSGI should wait for each Armada response
ARMADA_API_TIMEOUT=${ARMADA_API_TIMEOUT:-"3600"}
# Number of uWSGI workers to handle API requests

View File

@ -6,3 +6,4 @@ pipeline = authtoken armada-api
[filter:authtoken]
paste.filter_factory = keystonemiddleware.auth_token:filter_factory
delay_auth_decision = True

61
tools/armada_image_run.sh Executable file
View File

@ -0,0 +1,61 @@
#!/bin/bash
#
# Copyright 2018 AT&T Intellectual Property. All other rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
IMAGE=$1
set -x
# Create container
function create {
docker run \
-v $(pwd)/etc:/etc \
-d \
--name armada-api-test \
-p 127.0.0.1:8000:8000 \
${IMAGE} \
server
}
# Verify container was successfully created
# If not successful, print out logs
function health_check {
GOOD="HTTP/1.1 204 No Content"
if curl\
-m 5 \
-v \
--silent \
127.0.0.1:8000/api/v1.0/health \
--stderr - \
| grep "$GOOD"
then
echo "Health Check Success"
exit 0
else
echo "Failed Health Check"
docker logs armada-api-test
exit 1
fi
}
# Remove container
function cleanup {
docker rm -fv armada-api-test
}
trap cleanup EXIT
create
health_check

View File

@ -22,6 +22,7 @@ commands =
[testenv:docs]
commands =
rm -rf doc/build
python setup.py build_sphinx
[testenv:genconfig]