summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Volkov <av903u@att.com>2018-10-24 14:21:09 -0700
committerAndrey Volkov <av903u@att.com>2018-10-24 14:21:09 -0700
commit96fb4e1abaafa5b4d95a1cc0ec7bef92593f5dd8 (patch)
tree61980f34f84dc51d47f2ed04d9a6502ab69e9537
parentf3b55fe64d45dba276a56806bf6683a3c8bd9a22 (diff)
Add tests targetHEADmaster
-rw-r--r--Makefile63
-rwxr-xr-xtools/install_packages.sh13
2 files changed, 76 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index a93b581..82290f2 100644
--- a/Makefile
+++ b/Makefile
@@ -12,7 +12,70 @@
12# See the License for the specific language governing permissions and 12# See the License for the specific language governing permissions and
13# limitations under the License. 13# limitations under the License.
14 14
15IMAGE_PREFIX ?= airshipit
16IMAGE_TAG ?= untagged
17IMAGE_NAME := aptly
18COMMIT ?= commit-id
19
20DOCKER_REGISTRY ?= quay.io
21PUSH_IMAGE ?= false
22
23HELM := $(BUILD_DIR)/helm
24
25PROXY ?= http://proxy.foo.com:8000
26NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local
27USE_PROXY ?= false
28
29UBUNTU_BASE_IMAGE ?= ubuntu:16.04
30
31IMAGE:=${DOCKER_REGISTRY}/${IMAGE_PREFIX}/$(IMAGE_NAME):${IMAGE_TAG}
32
33.PHONY: validate
34validate: lint tests
35
36.PHONY: tests
37tests: clean build
38 docker run -d \
39 --publish 8080:80 \
40 --volume $(shell pwd)/assets/nginx:/opt/nginx \
41 --name aptly \
42 ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG}
43 docker run --network host \
44 --name target \
45 --volume $(shell pwd)/tools:/opt \
46 $(UBUNTU_BASE_IMAGE) /opt/install_packages.sh
47
48.PHONY: clean
49clean:
50 docker rm -f aptly || true
51 docker rm -f target || true
52
15.PHONY: lint 53.PHONY: lint
16lint: 54lint:
17 shellcheck assets/*.sh 55 shellcheck assets/*.sh
18 hadolint Dockerfile 56 hadolint Dockerfile
57
58.PHONY: build
59build:
60ifeq ($(USE_PROXY), true)
61 docker build --network host -t $(IMAGE) \
62 --label "org.opencontainers.image.revision=$(COMMIT)" \
63 --label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \
64 --label "org.opencontainers.image.title=$(IMAGE_NAME)" \
65 -f Dockerfile \
66 --build-arg http_proxy=$(PROXY) \
67 --build-arg https_proxy=$(PROXY) \
68 --build-arg HTTP_PROXY=$(PROXY) \
69 --build-arg HTTPS_PROXY=$(PROXY) \
70 --build-arg no_proxy=$(NO_PROXY) \
71 --build-arg NO_PROXY=$(NO_PROXY) .
72else
73 docker build --network host -t $(IMAGE) \
74 --label "org.opencontainers.image.revision=$(COMMIT)" \
75 --label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \
76 --label "org.opencontainers.image.title=$(IMAGE_NAME)" \
77 -f Dockerfile .
78endif
79ifeq ($(PUSH_IMAGE), true)
80 docker push $(IMAGE)
81endif
diff --git a/tools/install_packages.sh b/tools/install_packages.sh
new file mode 100755
index 0000000..502d672
--- /dev/null
+++ b/tools/install_packages.sh
@@ -0,0 +1,13 @@
1#!/usr/bin/env bash
2
3set -o pipefail
4set -o errexit
5set -o xtrace
6
7apt update
8apt install -y curl
9curl -s localhost:8080/aptly_repo_signing.key | apt-key add -
10echo 'deb http://localhost:8080 xenial main' > /etc/apt/sources.list
11apt-get update
12apt-cache policy accountsservice
13apt-get install -y accountsservice