You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This repository houses the code that powers the [ibmcloud-cli sl](https://github.ibm.com/Bluemix/bluemix-cli) command. Altough this project is packaged as a plugin, it is built directly into the ibmcloud-cli.
7
-
6
+
This repository houses the code that powers the [ibmcloud-cli sl](https://github.ibm.com/Bluemix/bluemix-cli) command.
8
7
9
8
# Project Setup
10
9
11
-
Your golang source directory should be setup as follows
12
-
13
-
```
14
-
~/go/src/github.ibm.com/ibmcloud-cli/bluemix-cli
15
-
~/go/src/github.ibm.com/SoftLayer/softlayer-cli
16
-
```
17
-
18
-
github.ibm.com/ibmcloud-cli/bluemix-cli should be branched off from the `dev` branch
19
-
github.ibm.com/SoftLayer/softlayer-cli should be branched off from the `master` branch
20
-
21
-
Edit github.ibm.com/Bluemix/bluemix-cli/go.mod and add this line to the `replace` section. This will force `go mod vendor` to read changes from your local directory instead of off github.ibm.com. You may also need to change `github.ibm.com/SoftLayer/softlayer-cli v0.0.1` to `github.ibm.com/SoftLayer/softlayer-cli latest` in the require section.
From there, make any changes you need to the code in `github.ibm.com/SoftLayer/softlayer-cli`. To actually see those changes apparent in `ibmcloud sl` you will need to switch directories to `github.ibm.com/Bluemix/bluemix-cli` and run `go build`
10
+
Clone the repo, then just run `go mod vendor` and `go build` and you should have a running binary for the `sl` plugin.
28
11
29
12
30
13
# Testing
31
14
Before making a pull request, make sure everything looks good with these tools.
32
-
Working directory: `github.ibm.com/SoftLayer/softlayer-cli`
15
+
Working directory: `$GO_PATH/src/github.ibm.com/SoftLayer/softlayer-cli`
33
16
34
17
### What the build runs
35
18
@@ -42,7 +25,8 @@ go test $(go list ./... | grep -v "fixtures" | grep -v "vendor")
42
25
43
26
This will test all the block commands, with verbose output
44
27
```
45
-
go test -v github.ibm.com/SoftLayer/softlayer-cli/plugin/commands/block
28
+
go test -v github.ibm.com/SoftLayer/softlayer-cli/plugin/commands/<command_group>
29
+
go test -v github.ibm.com/SoftLayer/softlayer-cli/plugin/managers
46
30
```
47
31
48
32
This will test only the block commands that have "Access Password" in their test name, and stop after 1 failure
@@ -335,11 +319,9 @@ This command will build the Mac (arm64) version. Replace GOOS and GOARCH with th
$> GOOS=linux GOARCH=amd64 go build -o out/i18n4go ./i18n4go/i18n4go.go
337
321
```
338
-
339
-
340
-
341
322
[go-bindata](https://github.com/jteeuwen/go-bindata) takes the json files, and turns them into a go binary.
342
323
324
+
343
325
### Basic Patterns and Tips
344
326
345
327
Where possible, you should try to minimize the number of unique strings we need to translate. To do this, make use of substitutions. For example:
@@ -358,68 +340,18 @@ T("This is some output for a {{.CMDTYPE}} command", subs)
358
340
359
341
### Useful Scripts
360
342
361
-
#### `./bin/catch-i18n-mismatch.sh`
362
-
363
-
If you get the following output, everything is fine
364
-
```
365
-
$ ./bin/catch-i18n-mismatch.sh
366
-
OKTotal time: 372.753966ms
367
-
```
368
-
369
-
If you get the following output, you need to edit the translation files
370
-
```
371
-
$> ./bin/catch-i18n-mismatch.sh
372
-
>>> |"IP address {{.IP}} is not found on your account. Please confirm IP and try again.\n" exists in the code, but not in en_US| <<<
373
-
>>> |" The server ID to remove from the security group" exists in the code, but not in en_US| <<<
374
-
>>> |" The test ID to remove from the security group" exists in en_US, but not in the code| <<<
375
-
====== ADD THESE =======
376
-
[
377
-
{"id": "IP address {{.IP}} is not found on your account. Please confirm IP and try again.\n", "translation": "IP address {{.IP}} is not found on your account. Please confirm IP and try again.\n"},
378
-
{"id": " The server ID to remove from the security group", "translation": " The server ID to remove from the security group"}
379
-
]
380
-
====== DEL THESE =======
381
-
[
382
-
{"id": " The test ID to remove from the security group", "translation": " The test ID to remove from the security group"}
383
-
]
384
-
```
385
-
386
-
387
-
#### `./bin/fixeverything_i18n.sh`
388
-
389
-
You can either do so manually, or run the following command which will do almost all the work for you
If you decided to edit the i18n files manually, make sure to run `bin/generate-i18n-resources` to build the required go source files. These sources files are what actually get built into the command, otherwise your translation additions wont show up.
343
+
#### `./bin/buildAndDeploy.py i18n`
408
344
345
+
Should in general take care of all these steps for you. The binaries for win/mac/linux should be in the repo.
409
346
```
410
-
# This command will generate/update i18n_resources.go file
Building I18N: ./bin/go-bindata.exe -pkg=resources -o=plugin/resources/i18n_resources.go plugin/i18n/resources
351
+
OK!
414
352
```
415
353
416
354
417
-
Removing and Adding translations automatically.
418
-
419
-
There are 2 files in `old-i18n` called `old-i18n/add_these.json` and `old-i18n/remove_these.json`. Dont commit changes to them, but do use them help automatically modify the translation files.
420
-
421
-
Run `./bin/split_i18n.py` (with python3.8 at least) to add everything in `add_these.json` and remove everything in `remove_these.json`.
422
-
423
355
424
356
# Vendor
425
357
@@ -487,13 +419,34 @@ It("return error", func() {
487
419
# Plugin Support / Release Process
488
420
After v1.4.1 `sl` will be a normal plugin, so where are the instructions to build the plugin.
489
421
490
-
0. Create a new version and tag it in github like normal.
5.`./bin/buildAndDeploy.py release` : Spins up the [Jenkins](https://wcp-cloud-foundry-jenkins.swg-devops.com/job/Publish%20Plugin%20to%20YS1/build) job to publish a release
444
+
445
+
446
+
ENV Variables that need to be set:
447
+
1.`JENKINS_TOKEN` : Auth token to run Jenkins. Username is hardcoded for me at the moment.
448
+
2.`IBMCLOUD_APIKEY` : API key for using `ibmcloud`. This is how we upload to COS. The COS plugin needs to be installed as well. `ibmcloud plugin install cloud-object-storage`
449
+
497
450
498
451
## TODO
499
452
Automate build with https://github.ibm.com/coligo/cli/tree/main/script
0 commit comments