Skip to content
This repository was archived by the owner on Jun 23, 2020. It is now read-only.

Commit 4f6cc61

Browse files
Merge pull request #72 from oracle/kj-system-test-image
System test image creation
2 parents 6196c43 + 4e4a2af commit 4f6cc61

File tree

4 files changed

+77
-5
lines changed

4 files changed

+77
-5
lines changed

.gitignore

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ bin/
1717
*.dylib
1818
*.pyc
1919

20-
# Test binary, build with `go test -c`
21-
*.test
22-
2320
# Output of the go coverage tool, specifically when used with LiteIDE
2421
*.out
2522

@@ -37,4 +34,4 @@ test/system/runner.log
3734
*.retry
3835
ansible/hosts
3936

40-
.idea/
37+
.idea/

Dockerfile.test

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM wcr.io/oracle/oci-flexvolume-driver-system-test:1.0.0
2+
3+
COPY test/system /test/system
4+
5+
WORKDIR /test/system
6+
7+
CMD ["./runner.py"]

Makefile

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ BUILD := $(shell git describe --always --dirty)
2222
VERSION ?= ${BUILD}
2323
GOOS ?= linux
2424
GOARCH ?= amd64
25+
REGISTRY ?= wcr.io
26+
DOCKER_REGISTRY_USERNAME ?= oracle
27+
TEST_IMAGE ?= $(REGISTRY)/$(DOCKER_REGISTRY_USERNAME)/oci-flexvolume-driver-test
2528

2629
SRC_DIRS := cmd pkg # directories which hold app source (not vendored)
2730

@@ -73,6 +76,51 @@ build-integration-tests:
7376
-o ${BIN_DIR}/integration-tests \
7477
./test/integration
7578

79+
.PHONY: build-test-image
80+
build-test-image:
81+
docker build -t ${TEST_IMAGE}:${VERSION} -f Dockerfile.test .
82+
83+
.PHONY: push-test-image
84+
push-test-image: build-test-image
85+
docker login -u '$(DOCKER_REGISTRY_USERNAME)' -p '$(DOCKER_REGISTRY_PASSWORD)' $(REGISTRY)
86+
docker push ${TEST_IMAGE}:${VERSION}
87+
88+
.PHONY: system-test-config
89+
system-test-config:
90+
ifndef OCI_API_KEY
91+
ifndef OCI_API_KEY_VAR
92+
$(error "OCI_API_KEY or OCI_API_KEY_VAR must be defined")
93+
else
94+
$(eval OCI_API_KEY:=/tmp/oci_api_key.pem)
95+
$(eval export OCI_API_KEY)
96+
$(shell echo "$${OCI_API_KEY_VAR}" | openssl enc -base64 -d -A > $(OCI_API_KEY))
97+
endif
98+
endif
99+
ifndef INSTANCE_KEY
100+
ifndef INSTANCE_KEY_VAR
101+
$(error "INSTANCE_KEY or INSTANCE_KEY_VAR must be defined")
102+
else
103+
$(eval INSTANCE_KEY:=/tmp/instance_key)
104+
$(eval export INSTANCE_KEY)
105+
$(shell echo "$${INSTANCE_KEY_VAR}" | openssl enc -base64 -d -A > $(INSTANCE_KEY))
106+
$(shell chmod 600 $(INSTANCE_KEY))
107+
endif
108+
endif
109+
110+
.PHONY: system-test
111+
system-test: system-test-config
112+
docker run -it \
113+
-e OCI_API_KEY=$(OCI_API_KEY) \
114+
-v $(OCI_API_KEY):$(OCI_API_KEY) \
115+
-e INSTANCE_KEY=$(INSTANCE_KEY) \
116+
-v $(INSTANCE_KEY):$(INSTANCE_KEY) \
117+
-e MASTER_IP=$$MASTER_IP \
118+
-e SLAVE0_IP=$$SLAVE0_IP \
119+
-e SLAVE1_IP=$$SLAVE1_IP \
120+
-e WERCKER_API_TOKEN=$$WERCKER_API_TOKEN \
121+
-e HTTPS_PROXY=$$HTTPS_PROXY \
122+
${TEST_IMAGE}:${VERSION} ${TEST_IMAGE_ARGS}
123+
76124
.PHONY: version
77125
version:
78126
@echo ${VERSION}

wercker.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,31 @@ system-test:
4949
registry: https://wcr.io/v2
5050
username: $DOCKER_REGISTRY_USERNAME
5151
password: $DOCKER_REGISTRY_PASSWORD
52+
5253
steps:
54+
- script:
55+
name: set ENV vars
56+
code: |
57+
export VERSION=$(cat dist/VERSION.txt)
58+
echo "Pushing test version ${VERSION}"
59+
60+
- script:
61+
name: prepare
62+
code: |
63+
mkdir /test
64+
mv ./test/system /test/system
65+
66+
- internal/docker-push:
67+
repository: wcr.io/oracle/oci-flexvolume-driver-test
68+
tag: $VERSION
69+
working-dir: /test/system
70+
entrypoint: ./runner.py
71+
user: 65534 # nobody
72+
5373
- script:
5474
name: system test
5575
code: |
56-
cd test/system
76+
cd /test/system
5777
./runner.py
5878
5979
release:

0 commit comments

Comments
 (0)