forked from stolostron/application-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
122 lines (104 loc) · 4.07 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
###############################################################################
# Licensed Materials - Property of IBM
# (c) Copyright IBM Corporation 2017, 2019. All Rights Reserved.
# US Government Users Restricted Rights - Use, duplication or disclosure
# restricted by GSA ADP Schedule Contract with IBM Corp.
#
# Contributors:
# IBM Corporation - initial API and implementation
###############################################################################
# Copyright (c) 2020 Red Hat, Inc.
# Copyright Contributors to the Open Cluster Management project
include build/Configfile
BROWSER ?= chrome
USE_VENDORIZED_BUILD_HARNESS ?=
ifndef USE_VENDORIZED_BUILD_HARNESS
-include $(shell curl -s -H 'Accept: application/vnd.github.v4.raw' -L https://api.github.com/repos/open-cluster-management/build-harness-extensions/contents/templates/Makefile.build-harness-bootstrap -o .build-harness-bootstrap; echo .build-harness-bootstrap)
else
-include vbh/.build-harness-bootstrap
endif
TEST_IMAGE_TAG ?= $(COMPONENT_VERSION)$(COMPONENT_TAG_EXTENSION)
default::
@echo "Build Harness Bootstrapped"
install:
npm install
lint:
npm run lint
prune:
npm prune --production
build-prod:
npm run build:production
unit-test:
if [ ! -d "test-output" ]; then \
mkdir test-output; \
fi
npm test
.PHONY: e2e-test
e2e-test:
if [ ! -d "test-output" ]; then \
mkdir test-output; \
fi
npm run test:$(BROWSER)
.PHONY: build-test-image
build-test-image:
@echo "Building $(COMPONENT_DOCKER_REPO)/$(COMPONENT_NAME)-tests:$(TEST_IMAGE_TAG)"
docker build . \
-f Dockerfile.cypress \
-t $(COMPONENT_DOCKER_REPO)/$(COMPONENT_NAME)-tests:$(TEST_IMAGE_TAG) \
.PHONY: run-test-image
run-test-image:
docker run \
-e BROWSER=$(BROWSER) \
-v $(shell pwd)/results/:/results/ \
$(COMPONENT_DOCKER_REPO)/$(COMPONENT_NAME)-tests:$(TEST_IMAGE_TAG)
.PHONY: run-test-image-pr
run-test-image-pr: # Suppress output as this contains sensitive information
@docker run \
-v $(shell pwd)/results/:/results/ \
-v $(HOME)/certificates/:/certificates/ \
--network host \
-e BROWSER=$(BROWSER) \
-e SLACK_TOKEN=$(SLACK_TOKEN) \
-e BUILD_WEB_URL=$(TRAVIS_BUILD_WEB_URL) \
-e GIT_REPO_SLUG=$(TRAVIS_REPO_SLUG) \
-e GIT_PULL_NUMBER=$(TRAVIS_PULL_REQUEST) \
-e CYPRESS_RBAC_TEST=$(CYPRESS_RBAC_TEST) \
-e CYPRESS_TEST_MODE=functional \
-e CYPRESS_JOB_ID=$(TRAVIS_JOB_ID) \
-e CYPRESS_BASE_URL=$(CYPRESS_BASE_URL) \
-e CYPRESS_OC_CLUSTER_URL=$(OC_CLUSTER_URL) \
-e CYPRESS_OC_CLUSTER_USER=$(OC_CLUSTER_USER) \
-e CYPRESS_OC_CLUSTER_PASS=$(OC_CLUSTER_PASS) \
-e CYPRESS_OC_CLUSTER_INGRESS_CA=$(OC_CLUSTER_INGRESS_CA) \
-e CYPRESS_MANAGED_OCP_URL=$(CYPRESS_MANAGED_OCP_URL) \
-e CYPRESS_MANAGED_OCP_USER=$(CYPRESS_MANAGED_OCP_USER) \
-e CYPRESS_MANAGED_OCP_PASS=$(CYPRESS_MANAGED_OCP_PASS) \
-e GITHUB_USER=$(GITHUB_USER) \
-e GITHUB_TOKEN=$(GITHUB_TOKEN) \
-e GITHUB_PRIVATE_URL=https://github.com/open-cluster-management/app-ui-e2e-private-git \
-e OBJECTSTORE_PRIVATE_URL=$(OBJECTSTORE_PRIVATE_URL) \
-e OBJECTSTORE_ACCESS_KEY=$(OBJECTSTORE_ACCESS_KEY) \
-e OBJECTSTORE_SECRET_KEY=$(OBJECTSTORE_SECRET_KEY) \
-e HELM_PRIVATE_URL=https://raw.githubusercontent.com/open-cluster-management/app-ui-e2e-private-helm/main \
-e HELM_USERNAME=$(GITHUB_USER) \
-e HELM_PASSWORD=$(GITHUB_TOKEN) \
-e HELM_CHART_NAME=mychart \
-e ANSIBLE_URL="${ANSIBLE_URL}" \
-e ANSIBLE_TOKEN="${ANSIBLE_TOKEN}" \
$(COMPONENT_DOCKER_REPO)/$(COMPONENT_NAME)-tests:$(TEST_IMAGE_TAG)
.PHONY: push-test-image
push-test-image:
make component/push COMPONENT_NAME=$(COMPONENT_NAME)-tests
.PHONY: pull-test-image
pull-test-image:
make component/pull COMPONENT_NAME=$(COMPONENT_NAME)-tests
.PHONY: publish-test-image
publish-test-image:
rm -rf pipeline
make pipeline-manifest/update COMPONENT_NAME=$(COMPONENT_NAME)-tests PIPELINE_MANIFEST_COMPONENT_SHA256=${TRAVIS_COMMIT} PIPELINE_MANIFEST_COMPONENT_REPO=${TRAVIS_REPO_SLUG} PIPELINE_MANIFEST_BRANCH=${TRAVIS_BRANCH}
.PHONY: build-image
build-image:
@echo "Building $(COMPONENT_DOCKER_REPO)/$(COMPONENT_NAME):$(IMAGE_TAG)"
docker build . \
-f Dockerfile \
-t $(COMPONENT_DOCKER_REPO)/$(COMPONENT_NAME):$(IMAGE_TAG) \