-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
123 lines (110 loc) · 3.91 KB
/
Makefile
File metadata and controls
123 lines (110 loc) · 3.91 KB
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
123
#___INFO__MARK_BEGIN_NEW__
###########################################################################
#
# Copyright 2025-2026 HPC-Gridware GmbH
#
# 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.
#
###########################################################################
#___INFO__MARK_END_NEW__
# OCS version to install inside the container (override: make run OCS_VERSION=9.0.8)
# Supported: 9.0.5, 9.0.6, 9.0.7, 9.0.8, 9.0.9, 9.0.10, 9.0.11, 9.1.0
OCS_VERSION ?= 9.1.0
IMAGE_NAME = go-clusterscheduler
CONTAINER_NAME = $(IMAGE_NAME)
PLATFORM = linux/amd64
PROJECT_DIR = /root/go/src/github.com/hpc-gridware/go-clusterscheduler
.PHONY: build run run-privileged test test-all test-integration simulate adapter run-rest clean
build:
docker build --platform=$(PLATFORM) -t $(IMAGE_NAME) .
run: build
mkdir -p ./installation
docker run --platform=$(PLATFORM) --rm -it -h master \
-e OCS_VERSION=$(OCS_VERSION) \
-p 7070:7070 -p 8888:8888 \
--name $(CONTAINER_NAME) \
-v $(CURDIR)/installation:/opt/ocs \
-v $(CURDIR):$(PROJECT_DIR) \
$(IMAGE_NAME)
run-privileged: build
mkdir -p ./installation
docker run --platform=$(PLATFORM) --rm -it -h master \
--privileged -v /dev/fuse:/dev/fuse --cap-add SYS_ADMIN \
-e OCS_VERSION=$(OCS_VERSION) \
-p 7070:7070 -p 8888:8888 \
--name $(CONTAINER_NAME) \
-v $(CURDIR)/installation:/opt/ocs \
-v $(CURDIR):$(PROJECT_DIR) \
$(IMAGE_NAME)
test: build
docker run --platform=$(PLATFORM) --rm \
--entrypoint /bin/bash \
-v $(CURDIR):$(PROJECT_DIR) \
$(IMAGE_NAME) \
-c "cd $(PROJECT_DIR) && go test ./pkg/helper/... ./pkg/accounting/... ./pkg/adapter/... -v"
test-all: build
docker run --platform=$(PLATFORM) --rm \
--entrypoint /bin/bash \
-v $(CURDIR):$(PROJECT_DIR) \
$(IMAGE_NAME) \
-c "cd $(PROJECT_DIR) && go test ./pkg/... -v"
test-integration: build
mkdir -p ./installation
docker run --platform=$(PLATFORM) --rm -it -h master \
-e OCS_VERSION=$(OCS_VERSION) \
-v $(CURDIR)/installation:/opt/ocs \
-v $(CURDIR):$(PROJECT_DIR) \
$(IMAGE_NAME)
simulate: build
rm -rf ./installation && mkdir -p ./installation
docker run --platform=$(PLATFORM) --rm -it -h master \
--privileged --cap-add SYS_ADMIN \
-e OCS_VERSION=$(OCS_VERSION) \
-p 8080:8080 -p 9464:9464 -p 8888:8888 \
--name $(CONTAINER_NAME) \
-v $(CURDIR)/installation:/opt/ocs \
-v $(CURDIR):$(PROJECT_DIR) \
$(IMAGE_NAME) \
/bin/bash -c "cd $(PROJECT_DIR)/cmd/simulator && \
GOFLAGS=-buildvcs=false go build . && \
sleep 30 && \
./simulator run ../../cluster.json && \
/bin/bash"
adapter: build
mkdir -p ./installation
docker run --platform=$(PLATFORM) --rm -it -h master \
-e OCS_VERSION=$(OCS_VERSION) \
-p 8282:8282 \
--name $(CONTAINER_NAME) \
-v $(CURDIR)/installation:/opt/ocs \
-v $(CURDIR):$(PROJECT_DIR) \
$(IMAGE_NAME) \
/bin/bash -c "cd $(PROJECT_DIR)/cmd/adapter && \
GOFLAGS=-buildvcs=false go build . && \
./adapter"
run-rest: build
mkdir -p ./installation
docker run --platform=$(PLATFORM) --rm -it -h master \
-e OCS_VERSION=$(OCS_VERSION) \
-p 7070:7070 -p 9464:9464 -p 9898:9898 \
--name $(CONTAINER_NAME) \
-v $(CURDIR)/installation:/opt/ocs \
-v $(CURDIR):$(PROJECT_DIR) \
$(IMAGE_NAME) \
/bin/bash -c "cd $(PROJECT_DIR)/cmd/adapter && \
GOFLAGS=-buildvcs=false go build . && \
./adapter --port 9898 & exec bash"
clean:
docker rm -f $(CONTAINER_NAME) || true
docker rmi $(IMAGE_NAME) || true
rm -rf ./installation