Skip to content

Commit 2646759

Browse files
allmightyspiffGitHub Enterprise
authored andcommitted
Merge pull request #790 from SoftLayer/pluginSupport
Plugin support
2 parents 526f352 + 30bfa9e commit 2646759

13 files changed

Lines changed: 621 additions & 31 deletions

File tree

.secrets.baseline

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"files": "(.*test.*)|(vendor)|(go.sum)|^.secrets.baseline$",
44
"lines": null
55
},
6-
"generated_at": "2023-07-17T15:25:40Z",
6+
"generated_at": "2023-08-29T21:40:56Z",
77
"plugins_used": [
88
{
99
"name": "AWSKeyDetector"
@@ -65,6 +65,16 @@
6565
}
6666
],
6767
"results": {
68+
"bin/buildAndDeploy.py": [
69+
{
70+
"hashed_secret": "82e725817f214b04e55d8136779d09dde4195560",
71+
"is_secret": false,
72+
"is_verified": false,
73+
"line_number": 307,
74+
"type": "Hex High Entropy String",
75+
"verified_result": null
76+
}
77+
],
6878
"cliChecker/cliOutput.txt": [
6979
{
7080
"hashed_secret": "59b189070af751d4e93a749ccffb4ccfd2de7ab5",
@@ -310,15 +320,15 @@
310320
"hashed_secret": "bbccdf2efb33b52e6c9d0a14dd70b2d415fbea6e",
311321
"is_secret": false,
312322
"is_verified": false,
313-
"line_number": 4791,
323+
"line_number": 4743,
314324
"type": "Secret Keyword",
315325
"verified_result": null
316326
},
317327
{
318328
"hashed_secret": "7d44c33cf9a82ab9bd5300d266784504e9772177",
319329
"is_secret": false,
320330
"is_verified": false,
321-
"line_number": 4792,
331+
"line_number": 4744,
322332
"type": "Secret Keyword",
323333
"verified_result": null
324334
}
@@ -328,7 +338,7 @@
328338
"hashed_secret": "bbccdf2efb33b52e6c9d0a14dd70b2d415fbea6e",
329339
"is_secret": false,
330340
"is_verified": false,
331-
"line_number": 5092,
341+
"line_number": 5148,
332342
"type": "Secret Keyword",
333343
"verified_result": null
334344
}
@@ -346,15 +356,15 @@
346356
"hashed_secret": "bbccdf2efb33b52e6c9d0a14dd70b2d415fbea6e",
347357
"is_secret": false,
348358
"is_verified": false,
349-
"line_number": 4791,
359+
"line_number": 4743,
350360
"type": "Secret Keyword",
351361
"verified_result": null
352362
},
353363
{
354364
"hashed_secret": "8927bd748f26a7258a01e318a7e1e7585458a228",
355365
"is_secret": false,
356366
"is_verified": false,
357-
"line_number": 4792,
367+
"line_number": 4744,
358368
"type": "Secret Keyword",
359369
"verified_result": null
360370
}
@@ -364,7 +374,7 @@
364374
"hashed_secret": "bbccdf2efb33b52e6c9d0a14dd70b2d415fbea6e",
365375
"is_secret": false,
366376
"is_verified": false,
367-
"line_number": 4791,
377+
"line_number": 4743,
368378
"type": "Secret Keyword",
369379
"verified_result": null
370380
}
@@ -374,7 +384,7 @@
374384
"hashed_secret": "bbccdf2efb33b52e6c9d0a14dd70b2d415fbea6e",
375385
"is_secret": false,
376386
"is_verified": false,
377-
"line_number": 4791,
387+
"line_number": 4743,
378388
"type": "Secret Keyword",
379389
"verified_result": null
380390
}
@@ -384,15 +394,15 @@
384394
"hashed_secret": "bbccdf2efb33b52e6c9d0a14dd70b2d415fbea6e",
385395
"is_secret": false,
386396
"is_verified": false,
387-
"line_number": 4791,
397+
"line_number": 4747,
388398
"type": "Secret Keyword",
389399
"verified_result": null
390400
},
391401
{
392402
"hashed_secret": "d3ac7a4ef1a838b4134f2f6e7f3c0d249d74b674",
393403
"is_secret": false,
394404
"is_verified": false,
395-
"line_number": 4792,
405+
"line_number": 4748,
396406
"type": "Secret Keyword",
397407
"verified_result": null
398408
}
@@ -402,15 +412,15 @@
402412
"hashed_secret": "bbccdf2efb33b52e6c9d0a14dd70b2d415fbea6e",
403413
"is_secret": false,
404414
"is_verified": false,
405-
"line_number": 4791,
415+
"line_number": 4743,
406416
"type": "Secret Keyword",
407417
"verified_result": null
408418
},
409419
{
410420
"hashed_secret": "d3ac7a4ef1a838b4134f2f6e7f3c0d249d74b674",
411421
"is_secret": false,
412422
"is_verified": false,
413-
"line_number": 4792,
423+
"line_number": 4744,
414424
"type": "Secret Keyword",
415425
"verified_result": null
416426
}
@@ -420,7 +430,7 @@
420430
"hashed_secret": "bbccdf2efb33b52e6c9d0a14dd70b2d415fbea6e",
421431
"is_secret": false,
422432
"is_verified": false,
423-
"line_number": 4791,
433+
"line_number": 4743,
424434
"type": "Secret Keyword",
425435
"verified_result": null
426436
}
@@ -430,7 +440,7 @@
430440
"hashed_secret": "bbccdf2efb33b52e6c9d0a14dd70b2d415fbea6e",
431441
"is_secret": false,
432442
"is_verified": false,
433-
"line_number": 4791,
443+
"line_number": 4743,
434444
"type": "Secret Keyword",
435445
"verified_result": null
436446
}
@@ -440,7 +450,7 @@
440450
"hashed_secret": "bbccdf2efb33b52e6c9d0a14dd70b2d415fbea6e",
441451
"is_secret": false,
442452
"is_verified": false,
443-
"line_number": 4791,
453+
"line_number": 4743,
444454
"type": "Secret Keyword",
445455
"verified_result": null
446456
}

README.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,24 @@ anything with `T("some string here")` uses the internationalization system. Defi
326326
The string passed into the `T()` function serves as the ID when looking these up. So the ID Will need to be present in all i18n files, it will also need a translation string.
327327

328328
[i18n4go](https://github.com/maximilien/i18n4go) is used to make sure all strings being transalted have translations. To test run this command.
329+
330+
For i18n4go, we specifically use v0.2.4 for now, so we have a prebuilt binary in `./bin/i18n4go`. If that binary needs to be rebuilt, use the SoftLayer fork at https://github.com/softlayer/i18n4go (which is set to the version we need, along with some updates since that version had a bug with --help).
331+
332+
This command will build the Mac (arm64) version. Replace GOOS and GOARCH with the OS/Architecture you need to build for.
333+
```
334+
~/go/src/github.ibm.com/softlayer/softlayer-cli/i18n4go (master)
335+
$> GOOS=darwin GOARCH=arm64 go build -o i18n4go_mac -ldflags "-s -w" i18n4go/i18n4go.go
336+
```
337+
329338
[go-i18n](https://github.com/nicksnyder/go-i18n/) is what is actually doing the translations, but its using an old v1 version.
339+
There should be copies of the binary in `./bin` but if you need to rebuild this:
340+
Make sure you are on the v0.2.4 branch since that is the latest version that works as expected. We need to update this.
341+
```
342+
~/go/src/github.com/maximilien/i18n4go (v0.2.4_dev)
343+
$> GOOS=linux GOARCH=amd64 go build -o out/i18n4go ./i18n4go/i18n4go.go
344+
```
345+
346+
330347
[go-bindata](https://github.com/jteeuwen/go-bindata) takes the json files, and turns them into a go binary.
331348

332349
### Basic Patterns and Tips
@@ -470,4 +487,19 @@ It("return error", func() {
470487
Expect(err).To(HaveOccurred())
471488
Expect(err.Error()).To(ContainSubstring("Failed to show hardware."))
472489
})
473-
```
490+
```
491+
492+
493+
# Plugin Support / Release Process
494+
After v1.4.1 `sl` will be a normal plugin, so where are the instructions to build the plugin.
495+
496+
0. Create a new version and tag it in github like normal.
497+
1. Build the binaries.
498+
```bash
499+
./bin/build-all
500+
for i in `ls --indicator-style=none out`; do echo "Uploading $i"; ibmcloud.exe cos upload --bucket softlayer-cli-binaries --file ./out/$i --key $i; done;
501+
```
502+
2. Run the Jenkins job https://wcp-cloud-foundry-jenkins.swg-devops.com/job/Publish%20Plugin%20to%20YS1/
503+
504+
## TODO
505+
Automate build with https://github.ibm.com/coligo/cli/tree/main/script

bin/build-all

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ build() {
99
local os=$1
1010
local arch=$2
1111

12-
GOOS=$os GOARCH=$arch $ROOT_DIR/bin/build
12+
GOOS=$os GOARCH=$arch go build -ldflags "-s -w" -o $ROOT_DIR/out/sl .
1313

14-
for f in ibmcloud; do
14+
for f in sl; do
1515
nf="$f-$os-$arch"
1616
if [ "$os" == "windows" ]; then
1717
nf="$nf.exe"
@@ -21,17 +21,30 @@ build() {
2121
done
2222
}
2323

24+
echo "Generating i18n resource file ..."
25+
if [[ "$OSTYPE" == "msys"* ]]; then
26+
# For SO windows
27+
./bin/go-bindata.exe -pkg resources -o plugin/resources/i18n_resources.go plugin/i18n/resources
28+
else
29+
./bin/go-bindata -pkg resources -o plugin/resources/i18n_resources.go plugin/i18n/resources
30+
fi
31+
echo "Done."
32+
33+
34+
echo "Building Binaries ..."
2435
# disable CGO for Linux
2536
CGO_ENABLED=0 build linux amd64
2637
CGO_ENABLED=0 build linux 386
2738
CGO_ENABLED=0 build linux arm64
2839

2940
build darwin amd64
41+
build darwin arm64
3042

3143
build linux ppc64le
3244
build linux s390x
3345

3446
build windows amd64
3547
build windows 386
3648

37-
shasum $ROOT_DIR/out/ibmcloud-*
49+
echo "Generating binary hases ..."
50+
shasum $ROOT_DIR/out/sl-*

0 commit comments

Comments
 (0)