Skip to content

Commit 85acd84

Browse files
author
Naoki Kanazawa
committed
fix contest command
1 parent 2af5cf7 commit 85acd84

File tree

3 files changed

+38
-17
lines changed

3 files changed

+38
-17
lines changed

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,27 @@
22

33
## contestの初期化
44

5+
スコアサーバーで問題を開いたときにURLに書かれているUUIDがProblemIDになる
6+
https://dev.netcon.janog.gr.jp/problems/968fd81d-d511-4ab5-84db-13fc756f3d7c#answers
7+
8+
mapping.example.yaml
9+
```yaml
10+
- problem_id: 89bc780e-7a54-4015-8327-125564a7da50
11+
machine_image_name: image-aki
12+
- problem_id: d14ccfff-6410-4aea-a31d-d323f8050214
13+
machine_image_name: image-kit
14+
- problem_id: 6b0b1605-9021-4848-a4ab-246f22ffcb61
15+
machine_image_name: image-kny
16+
- problem_id: 8b8082f6-d7df-4555-ae25-feb07f857987
17+
machine_image_name: image-nas
18+
- problem_id: 968fd81d-d511-4ab5-84db-13fc756f3d7c
19+
machine_image_name: image-pea
20+
- problem_id: 227803fb-2fe1-4b89-a805-79e7679bf030
21+
machine_image_name: image-sc0
22+
- problem_id: 561d9876-7568-4096-b164-126cba6e4eb7
23+
machine_image_name: image-sc1
24+
```
25+
526
```bash
627
netcon contest init --vmms-credential ${CREDENTIAL} --mapping-file-path ./mapping.yaml --count 1
728
```

mapping.example.yaml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
- problem_id: UUID
2-
machine-image-id: image-aki
3-
- problem_id: UUID
4-
machine-image-id: image-kit
5-
- problem_id: UUID
6-
machine-image-id: image-kny
7-
- problem_id: UUID
8-
machine-image-id: image-nas
9-
- problem_id: UUID
10-
machine-image-id: image-pea
11-
- problem_id: UUID
12-
machine-image-id: image-sc0
13-
- problem_id: UUID
14-
machine-image-id: image-sc1
1+
- problem_id: 89bc780e-7a54-4015-8327-125564a7da50
2+
machine_image_name: image-aki
3+
- problem_id: d14ccfff-6410-4aea-a31d-d323f8050214
4+
machine_image_name: image-kit
5+
- problem_id: 6b0b1605-9021-4848-a4ab-246f22ffcb61
6+
machine_image_name: image-kny
7+
- problem_id: 8b8082f6-d7df-4555-ae25-feb07f857987
8+
machine_image_name: image-nas
9+
- problem_id: 968fd81d-d511-4ab5-84db-13fc756f3d7c
10+
machine_image_name: image-pea
11+
- problem_id: 227803fb-2fe1-4b89-a805-79e7679bf030
12+
machine_image_name: image-sc0
13+
- problem_id: 561d9876-7568-4096-b164-126cba6e4eb7
14+
machine_image_name: image-sc1

pkg/command/contest.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ func contestInitCommandFunc(cmd *cobra.Command, args []string) error {
9595
// 問題ごとに指定カウント分作成させた方が、途中でコケたときに扱いやすい
9696
// 作成が完了した問題は設定ファイルから削除すればよくなる
9797
for _, m := range ml {
98-
for count > 0 {
98+
c := count
99+
for c > 0 {
99100

100101
fmt.Printf("[INFO] creating... problemID: %s, machineImageName: %s\n", m.ProblemID, m.MachineImageName)
101102
i, err := cli.CreateInstance(m.ProblemID, m.MachineImageName)
@@ -105,9 +106,8 @@ func contestInitCommandFunc(cmd *cobra.Command, args []string) error {
105106
}
106107
fmt.Printf("[INFO] created: %#v\n", i)
107108

108-
count--
109+
c--
109110
}
110-
111111
}
112112

113113
fmt.Println("[INFO] success!!!!")

0 commit comments

Comments
 (0)