hereya-cli 0.75.0 → 0.76.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +59 -57
- package/dist/backend/cloud/cloud-backend.d.ts +1 -1
- package/dist/commands/deploy/index.d.ts +2 -0
- package/dist/commands/deploy/index.js +90 -1
- package/dist/commands/undeploy/index.d.ts +2 -0
- package/dist/commands/undeploy/index.js +81 -0
- package/dist/commands/workspace/executor/install/index.js +1 -0
- package/dist/commands/workspace/executor/uninstall/index.js +1 -0
- package/dist/executor/remote.js +10 -44
- package/dist/lib/config/common.d.ts +1 -0
- package/dist/lib/git-utils.d.ts +12 -0
- package/dist/lib/git-utils.js +27 -0
- package/dist/lib/remote-job-utils.d.ts +16 -0
- package/dist/lib/remote-job-utils.js +45 -0
- package/oclif.manifest.json +13 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ $ npm install -g hereya-cli
|
|
|
21
21
|
$ hereya COMMAND
|
|
22
22
|
running command...
|
|
23
23
|
$ hereya (--version)
|
|
24
|
-
hereya-cli/0.
|
|
24
|
+
hereya-cli/0.76.1 linux-x64 node-v24.14.0
|
|
25
25
|
$ hereya --help [COMMAND]
|
|
26
26
|
USAGE
|
|
27
27
|
$ hereya COMMAND
|
|
@@ -118,7 +118,7 @@ EXAMPLES
|
|
|
118
118
|
$ hereya add cloudy/docker_postgres
|
|
119
119
|
```
|
|
120
120
|
|
|
121
|
-
_See code: [src/commands/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
121
|
+
_See code: [src/commands/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/add/index.ts)_
|
|
122
122
|
|
|
123
123
|
## `hereya bootstrap INFRASTRUCTURETYPE`
|
|
124
124
|
|
|
@@ -143,7 +143,7 @@ EXAMPLES
|
|
|
143
143
|
$ hereya bootstrap local
|
|
144
144
|
```
|
|
145
145
|
|
|
146
|
-
_See code: [src/commands/bootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
146
|
+
_See code: [src/commands/bootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/bootstrap/index.ts)_
|
|
147
147
|
|
|
148
148
|
## `hereya config export-backend [FILE]`
|
|
149
149
|
|
|
@@ -165,7 +165,7 @@ EXAMPLES
|
|
|
165
165
|
$ hereya config export-backend ./path/to/export.json
|
|
166
166
|
```
|
|
167
167
|
|
|
168
|
-
_See code: [src/commands/config/export-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
168
|
+
_See code: [src/commands/config/export-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/config/export-backend/index.ts)_
|
|
169
169
|
|
|
170
170
|
## `hereya config get-backend`
|
|
171
171
|
|
|
@@ -182,7 +182,7 @@ EXAMPLES
|
|
|
182
182
|
$ hereya config get-backend
|
|
183
183
|
```
|
|
184
184
|
|
|
185
|
-
_See code: [src/commands/config/get-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
185
|
+
_See code: [src/commands/config/get-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/config/get-backend/index.ts)_
|
|
186
186
|
|
|
187
187
|
## `hereya config import-backend FILE`
|
|
188
188
|
|
|
@@ -202,7 +202,7 @@ EXAMPLES
|
|
|
202
202
|
$ hereya config import-backend ./path/to/cloud-backend.json
|
|
203
203
|
```
|
|
204
204
|
|
|
205
|
-
_See code: [src/commands/config/import-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
205
|
+
_See code: [src/commands/config/import-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/config/import-backend/index.ts)_
|
|
206
206
|
|
|
207
207
|
## `hereya config use-backend TYPE`
|
|
208
208
|
|
|
@@ -224,7 +224,7 @@ EXAMPLES
|
|
|
224
224
|
$ hereya config use-backend local
|
|
225
225
|
```
|
|
226
226
|
|
|
227
|
-
_See code: [src/commands/config/use-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
227
|
+
_See code: [src/commands/config/use-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/config/use-backend/index.ts)_
|
|
228
228
|
|
|
229
229
|
## `hereya delete-state`
|
|
230
230
|
|
|
@@ -250,7 +250,7 @@ EXAMPLES
|
|
|
250
250
|
$ hereya delete-state --workspace staging
|
|
251
251
|
```
|
|
252
252
|
|
|
253
|
-
_See code: [src/commands/delete-state/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
253
|
+
_See code: [src/commands/delete-state/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/delete-state/index.ts)_
|
|
254
254
|
|
|
255
255
|
## `hereya deploy`
|
|
256
256
|
|
|
@@ -258,7 +258,7 @@ Deploy a hereya project using the project deployment package
|
|
|
258
258
|
|
|
259
259
|
```
|
|
260
260
|
USAGE
|
|
261
|
-
$ hereya deploy -w <value> [--chdir <value>] [--debug]
|
|
261
|
+
$ hereya deploy -w <value> [--chdir <value>] [--debug] [--local]
|
|
262
262
|
|
|
263
263
|
FLAGS
|
|
264
264
|
-w, --workspace=<value> (required) name of the workspace to deploy the packages for
|
|
@@ -267,6 +267,7 @@ FLAGS
|
|
|
267
267
|
Alternatively, you can define the project root by setting the HEREYA_PROJECT_ROOT_DIR
|
|
268
268
|
environment variable.
|
|
269
269
|
--debug enable debug mode
|
|
270
|
+
--local force local execution (skip remote executor)
|
|
270
271
|
|
|
271
272
|
DESCRIPTION
|
|
272
273
|
Deploy a hereya project using the project deployment package
|
|
@@ -275,7 +276,7 @@ EXAMPLES
|
|
|
275
276
|
$ hereya deploy
|
|
276
277
|
```
|
|
277
278
|
|
|
278
|
-
_See code: [src/commands/deploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
279
|
+
_See code: [src/commands/deploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/deploy/index.ts)_
|
|
279
280
|
|
|
280
281
|
## `hereya devenv config`
|
|
281
282
|
|
|
@@ -295,7 +296,7 @@ EXAMPLES
|
|
|
295
296
|
$ hereya devenv config -w my-workspace
|
|
296
297
|
```
|
|
297
298
|
|
|
298
|
-
_See code: [src/commands/devenv/config/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
299
|
+
_See code: [src/commands/devenv/config/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/devenv/config/index.ts)_
|
|
299
300
|
|
|
300
301
|
## `hereya devenv install`
|
|
301
302
|
|
|
@@ -320,7 +321,7 @@ EXAMPLES
|
|
|
320
321
|
$ hereya devenv install -w my-workspace -p instanceType=t3.large
|
|
321
322
|
```
|
|
322
323
|
|
|
323
|
-
_See code: [src/commands/devenv/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
324
|
+
_See code: [src/commands/devenv/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/devenv/install/index.ts)_
|
|
324
325
|
|
|
325
326
|
## `hereya devenv project init PROJECT`
|
|
326
327
|
|
|
@@ -352,7 +353,7 @@ EXAMPLES
|
|
|
352
353
|
$ hereya devenv project init my-app -w my-workspace -t acme/node-starter -p region=us-east-1
|
|
353
354
|
```
|
|
354
355
|
|
|
355
|
-
_See code: [src/commands/devenv/project/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
356
|
+
_See code: [src/commands/devenv/project/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/devenv/project/init/index.ts)_
|
|
356
357
|
|
|
357
358
|
## `hereya devenv project uninit PROJECT`
|
|
358
359
|
|
|
@@ -378,7 +379,7 @@ EXAMPLES
|
|
|
378
379
|
$ hereya devenv project uninit my-app -w my-workspace --force
|
|
379
380
|
```
|
|
380
381
|
|
|
381
|
-
_See code: [src/commands/devenv/project/uninit/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
382
|
+
_See code: [src/commands/devenv/project/uninit/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/devenv/project/uninit/index.ts)_
|
|
382
383
|
|
|
383
384
|
## `hereya devenv ssh`
|
|
384
385
|
|
|
@@ -398,7 +399,7 @@ EXAMPLES
|
|
|
398
399
|
$ hereya devenv ssh -w my-workspace
|
|
399
400
|
```
|
|
400
401
|
|
|
401
|
-
_See code: [src/commands/devenv/ssh/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
402
|
+
_See code: [src/commands/devenv/ssh/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/devenv/ssh/index.ts)_
|
|
402
403
|
|
|
403
404
|
## `hereya devenv uninstall`
|
|
404
405
|
|
|
@@ -419,7 +420,7 @@ EXAMPLES
|
|
|
419
420
|
$ hereya devenv uninstall -w my-workspace
|
|
420
421
|
```
|
|
421
422
|
|
|
422
|
-
_See code: [src/commands/devenv/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
423
|
+
_See code: [src/commands/devenv/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/devenv/uninstall/index.ts)_
|
|
423
424
|
|
|
424
425
|
## `hereya doc PACKAGE`
|
|
425
426
|
|
|
@@ -452,7 +453,7 @@ EXAMPLES
|
|
|
452
453
|
$ hereya doc my-package --no-doc
|
|
453
454
|
```
|
|
454
455
|
|
|
455
|
-
_See code: [src/commands/doc/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
456
|
+
_See code: [src/commands/doc/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/doc/index.ts)_
|
|
456
457
|
|
|
457
458
|
## `hereya docker run IMAGE`
|
|
458
459
|
|
|
@@ -483,7 +484,7 @@ EXAMPLES
|
|
|
483
484
|
$ hereya docker run myapp:latest -- --rm -v ./data:/data
|
|
484
485
|
```
|
|
485
486
|
|
|
486
|
-
_See code: [src/commands/docker/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
487
|
+
_See code: [src/commands/docker/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/docker/run/index.ts)_
|
|
487
488
|
|
|
488
489
|
## `hereya down`
|
|
489
490
|
|
|
@@ -510,7 +511,7 @@ EXAMPLES
|
|
|
510
511
|
$ hereya down
|
|
511
512
|
```
|
|
512
513
|
|
|
513
|
-
_See code: [src/commands/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
514
|
+
_See code: [src/commands/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/down/index.ts)_
|
|
514
515
|
|
|
515
516
|
## `hereya env [NAME]`
|
|
516
517
|
|
|
@@ -541,7 +542,7 @@ EXAMPLES
|
|
|
541
542
|
$ hereya env -w dev -l
|
|
542
543
|
```
|
|
543
544
|
|
|
544
|
-
_See code: [src/commands/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
545
|
+
_See code: [src/commands/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/env/index.ts)_
|
|
545
546
|
|
|
546
547
|
## `hereya env set [NAME]`
|
|
547
548
|
|
|
@@ -568,7 +569,7 @@ EXAMPLES
|
|
|
568
569
|
$ hereya env set FOO -v bar -w dev
|
|
569
570
|
```
|
|
570
571
|
|
|
571
|
-
_See code: [src/commands/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
572
|
+
_See code: [src/commands/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/env/set/index.ts)_
|
|
572
573
|
|
|
573
574
|
## `hereya executor start`
|
|
574
575
|
|
|
@@ -601,7 +602,7 @@ EXAMPLES
|
|
|
601
602
|
HEREYA_TOKEN=<token> HEREYA_CLOUD_URL=https://my-cloud.example.com hereya executor start -w my-workspace
|
|
602
603
|
```
|
|
603
604
|
|
|
604
|
-
_See code: [src/commands/executor/start/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
605
|
+
_See code: [src/commands/executor/start/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/executor/start/index.ts)_
|
|
605
606
|
|
|
606
607
|
## `hereya flow add PACKAGE`
|
|
607
608
|
|
|
@@ -639,7 +640,7 @@ EXAMPLES
|
|
|
639
640
|
$ hereya flow add cloudy/docker_postgres -p DB_NAME=mydb -p DB_USER=admin
|
|
640
641
|
```
|
|
641
642
|
|
|
642
|
-
_See code: [src/commands/flow/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
643
|
+
_See code: [src/commands/flow/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/flow/add/index.ts)_
|
|
643
644
|
|
|
644
645
|
## `hereya flow docker run IMAGE`
|
|
645
646
|
|
|
@@ -669,7 +670,7 @@ EXAMPLES
|
|
|
669
670
|
$ hereya flow docker run --pin myapp:latest -- --rm
|
|
670
671
|
```
|
|
671
672
|
|
|
672
|
-
_See code: [src/commands/flow/docker/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
673
|
+
_See code: [src/commands/flow/docker/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/flow/docker/run/index.ts)_
|
|
673
674
|
|
|
674
675
|
## `hereya flow down`
|
|
675
676
|
|
|
@@ -703,7 +704,7 @@ EXAMPLES
|
|
|
703
704
|
$ hereya flow down --pin
|
|
704
705
|
```
|
|
705
706
|
|
|
706
|
-
_See code: [src/commands/flow/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
707
|
+
_See code: [src/commands/flow/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/flow/down/index.ts)_
|
|
707
708
|
|
|
708
709
|
## `hereya flow env [NAME]`
|
|
709
710
|
|
|
@@ -737,7 +738,7 @@ EXAMPLES
|
|
|
737
738
|
$ hereya flow env -l
|
|
738
739
|
```
|
|
739
740
|
|
|
740
|
-
_See code: [src/commands/flow/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
741
|
+
_See code: [src/commands/flow/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/flow/env/index.ts)_
|
|
741
742
|
|
|
742
743
|
## `hereya flow provid PACKAGE`
|
|
743
744
|
|
|
@@ -766,7 +767,7 @@ EXAMPLES
|
|
|
766
767
|
$ hereya flow provid hereya/postgres --pin
|
|
767
768
|
```
|
|
768
769
|
|
|
769
|
-
_See code: [src/commands/flow/provid/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
770
|
+
_See code: [src/commands/flow/provid/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/flow/provid/index.ts)_
|
|
770
771
|
|
|
771
772
|
## `hereya flow remove PACKAGE`
|
|
772
773
|
|
|
@@ -796,7 +797,7 @@ EXAMPLES
|
|
|
796
797
|
$ hereya flow remove cloudy/docker_postgres --profile staging
|
|
797
798
|
```
|
|
798
799
|
|
|
799
|
-
_See code: [src/commands/flow/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
800
|
+
_See code: [src/commands/flow/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/flow/remove/index.ts)_
|
|
800
801
|
|
|
801
802
|
## `hereya flow run CMD`
|
|
802
803
|
|
|
@@ -825,7 +826,7 @@ EXAMPLES
|
|
|
825
826
|
$ hereya flow run --pin -- npm test
|
|
826
827
|
```
|
|
827
828
|
|
|
828
|
-
_See code: [src/commands/flow/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
829
|
+
_See code: [src/commands/flow/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/flow/run/index.ts)_
|
|
829
830
|
|
|
830
831
|
## `hereya flow up`
|
|
831
832
|
|
|
@@ -859,7 +860,7 @@ EXAMPLES
|
|
|
859
860
|
$ hereya flow up --pin
|
|
860
861
|
```
|
|
861
862
|
|
|
862
|
-
_See code: [src/commands/flow/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
863
|
+
_See code: [src/commands/flow/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/flow/up/index.ts)_
|
|
863
864
|
|
|
864
865
|
## `hereya help [COMMAND]`
|
|
865
866
|
|
|
@@ -916,7 +917,7 @@ EXAMPLES
|
|
|
916
917
|
$ hereya import org/my-package -f state.tfstate -w my-workspace
|
|
917
918
|
```
|
|
918
919
|
|
|
919
|
-
_See code: [src/commands/import/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
920
|
+
_See code: [src/commands/import/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/import/index.ts)_
|
|
920
921
|
|
|
921
922
|
## `hereya init PROJECT`
|
|
922
923
|
|
|
@@ -950,7 +951,7 @@ EXAMPLES
|
|
|
950
951
|
$ hereya init myProject -w=dev -t=acme/node-starter -d=prod -p region=us-east-1
|
|
951
952
|
```
|
|
952
953
|
|
|
953
|
-
_See code: [src/commands/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
954
|
+
_See code: [src/commands/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/init/index.ts)_
|
|
954
955
|
|
|
955
956
|
## `hereya login [URL]`
|
|
956
957
|
|
|
@@ -979,7 +980,7 @@ EXAMPLES
|
|
|
979
980
|
$ hereya login --token=your-token https://cloud.hereya.dev
|
|
980
981
|
```
|
|
981
982
|
|
|
982
|
-
_See code: [src/commands/login/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
983
|
+
_See code: [src/commands/login/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/login/index.ts)_
|
|
983
984
|
|
|
984
985
|
## `hereya logout`
|
|
985
986
|
|
|
@@ -996,7 +997,7 @@ EXAMPLES
|
|
|
996
997
|
$ hereya logout
|
|
997
998
|
```
|
|
998
999
|
|
|
999
|
-
_See code: [src/commands/logout/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1000
|
+
_See code: [src/commands/logout/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/logout/index.ts)_
|
|
1000
1001
|
|
|
1001
1002
|
## `hereya provid PACKAGE`
|
|
1002
1003
|
|
|
@@ -1024,7 +1025,7 @@ EXAMPLES
|
|
|
1024
1025
|
$ hereya provid hereya/postgres --workspace staging
|
|
1025
1026
|
```
|
|
1026
1027
|
|
|
1027
|
-
_See code: [src/commands/provid/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1028
|
+
_See code: [src/commands/provid/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/provid/index.ts)_
|
|
1028
1029
|
|
|
1029
1030
|
## `hereya publish`
|
|
1030
1031
|
|
|
@@ -1047,7 +1048,7 @@ EXAMPLES
|
|
|
1047
1048
|
$ hereya publish --chdir=/path/to/package
|
|
1048
1049
|
```
|
|
1049
1050
|
|
|
1050
|
-
_See code: [src/commands/publish/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1051
|
+
_See code: [src/commands/publish/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/publish/index.ts)_
|
|
1051
1052
|
|
|
1052
1053
|
## `hereya remove PACKAGE`
|
|
1053
1054
|
|
|
@@ -1075,7 +1076,7 @@ EXAMPLES
|
|
|
1075
1076
|
$ hereya remove cloudy/docker_postgres
|
|
1076
1077
|
```
|
|
1077
1078
|
|
|
1078
|
-
_See code: [src/commands/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1079
|
+
_See code: [src/commands/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/remove/index.ts)_
|
|
1079
1080
|
|
|
1080
1081
|
## `hereya run CMD`
|
|
1081
1082
|
|
|
@@ -1101,7 +1102,7 @@ EXAMPLES
|
|
|
1101
1102
|
$ hereya run -w uat -- node index.js
|
|
1102
1103
|
```
|
|
1103
1104
|
|
|
1104
|
-
_See code: [src/commands/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1105
|
+
_See code: [src/commands/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/run/index.ts)_
|
|
1105
1106
|
|
|
1106
1107
|
## `hereya search QUERY`
|
|
1107
1108
|
|
|
@@ -1132,7 +1133,7 @@ EXAMPLES
|
|
|
1132
1133
|
$ hereya search database --json
|
|
1133
1134
|
```
|
|
1134
1135
|
|
|
1135
|
-
_See code: [src/commands/search/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1136
|
+
_See code: [src/commands/search/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/search/index.ts)_
|
|
1136
1137
|
|
|
1137
1138
|
## `hereya unbootstrap INFRASTRUCTURETYPE`
|
|
1138
1139
|
|
|
@@ -1157,7 +1158,7 @@ EXAMPLES
|
|
|
1157
1158
|
$ hereya unbootstrap local
|
|
1158
1159
|
```
|
|
1159
1160
|
|
|
1160
|
-
_See code: [src/commands/unbootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1161
|
+
_See code: [src/commands/unbootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/unbootstrap/index.ts)_
|
|
1161
1162
|
|
|
1162
1163
|
## `hereya undeploy`
|
|
1163
1164
|
|
|
@@ -1165,7 +1166,7 @@ Undeploy a hereya project by removing all resources.
|
|
|
1165
1166
|
|
|
1166
1167
|
```
|
|
1167
1168
|
USAGE
|
|
1168
|
-
$ hereya undeploy -w <value> [--chdir <value>] [--debug]
|
|
1169
|
+
$ hereya undeploy -w <value> [--chdir <value>] [--debug] [--local]
|
|
1169
1170
|
|
|
1170
1171
|
FLAGS
|
|
1171
1172
|
-w, --workspace=<value> (required) name of the workspace to undeploy the packages for
|
|
@@ -1174,6 +1175,7 @@ FLAGS
|
|
|
1174
1175
|
Alternatively, you can define the project root by setting the HEREYA_PROJECT_ROOT_DIR
|
|
1175
1176
|
environment variable.
|
|
1176
1177
|
--debug enable debug mode
|
|
1178
|
+
--local force local execution (skip remote executor)
|
|
1177
1179
|
|
|
1178
1180
|
DESCRIPTION
|
|
1179
1181
|
Undeploy a hereya project by removing all resources.
|
|
@@ -1182,7 +1184,7 @@ EXAMPLES
|
|
|
1182
1184
|
$ hereya undeploy
|
|
1183
1185
|
```
|
|
1184
1186
|
|
|
1185
|
-
_See code: [src/commands/undeploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1187
|
+
_See code: [src/commands/undeploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/undeploy/index.ts)_
|
|
1186
1188
|
|
|
1187
1189
|
## `hereya uninit PROJECT`
|
|
1188
1190
|
|
|
@@ -1210,7 +1212,7 @@ EXAMPLES
|
|
|
1210
1212
|
$ hereya uninit myProject -w dev -p prodWorkspace=prod
|
|
1211
1213
|
```
|
|
1212
1214
|
|
|
1213
|
-
_See code: [src/commands/uninit/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1215
|
+
_See code: [src/commands/uninit/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/uninit/index.ts)_
|
|
1214
1216
|
|
|
1215
1217
|
## `hereya up`
|
|
1216
1218
|
|
|
@@ -1237,7 +1239,7 @@ EXAMPLES
|
|
|
1237
1239
|
$ hereya up
|
|
1238
1240
|
```
|
|
1239
1241
|
|
|
1240
|
-
_See code: [src/commands/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1242
|
+
_See code: [src/commands/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/up/index.ts)_
|
|
1241
1243
|
|
|
1242
1244
|
## `hereya update [VERSION]`
|
|
1243
1245
|
|
|
@@ -1259,7 +1261,7 @@ EXAMPLES
|
|
|
1259
1261
|
$ hereya update 0.75.0
|
|
1260
1262
|
```
|
|
1261
1263
|
|
|
1262
|
-
_See code: [src/commands/update/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1264
|
+
_See code: [src/commands/update/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/update/index.ts)_
|
|
1263
1265
|
|
|
1264
1266
|
## `hereya workspace create NAME`
|
|
1265
1267
|
|
|
@@ -1284,7 +1286,7 @@ EXAMPLES
|
|
|
1284
1286
|
$ hereya workspace create dev
|
|
1285
1287
|
```
|
|
1286
1288
|
|
|
1287
|
-
_See code: [src/commands/workspace/create/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1289
|
+
_See code: [src/commands/workspace/create/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/workspace/create/index.ts)_
|
|
1288
1290
|
|
|
1289
1291
|
## `hereya workspace delete NAME`
|
|
1290
1292
|
|
|
@@ -1304,7 +1306,7 @@ EXAMPLES
|
|
|
1304
1306
|
$ hereya workspace delete dev
|
|
1305
1307
|
```
|
|
1306
1308
|
|
|
1307
|
-
_See code: [src/commands/workspace/delete/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1309
|
+
_See code: [src/commands/workspace/delete/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/workspace/delete/index.ts)_
|
|
1308
1310
|
|
|
1309
1311
|
## `hereya workspace env [NAME]`
|
|
1310
1312
|
|
|
@@ -1330,7 +1332,7 @@ EXAMPLES
|
|
|
1330
1332
|
$ hereya workspace env myEnv -w dev
|
|
1331
1333
|
```
|
|
1332
1334
|
|
|
1333
|
-
_See code: [src/commands/workspace/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1335
|
+
_See code: [src/commands/workspace/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/workspace/env/index.ts)_
|
|
1334
1336
|
|
|
1335
1337
|
## `hereya workspace env set`
|
|
1336
1338
|
|
|
@@ -1354,7 +1356,7 @@ EXAMPLES
|
|
|
1354
1356
|
$ hereya workspace env set -w my-workspace -n myVar -v my-value -i aws -s
|
|
1355
1357
|
```
|
|
1356
1358
|
|
|
1357
|
-
_See code: [src/commands/workspace/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1359
|
+
_See code: [src/commands/workspace/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/workspace/env/set/index.ts)_
|
|
1358
1360
|
|
|
1359
1361
|
## `hereya workspace env unset`
|
|
1360
1362
|
|
|
@@ -1375,7 +1377,7 @@ EXAMPLES
|
|
|
1375
1377
|
$ hereya workspace env unset -w my-workspace -n myVar
|
|
1376
1378
|
```
|
|
1377
1379
|
|
|
1378
|
-
_See code: [src/commands/workspace/env/unset/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1380
|
+
_See code: [src/commands/workspace/env/unset/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/workspace/env/unset/index.ts)_
|
|
1379
1381
|
|
|
1380
1382
|
## `hereya workspace executor install`
|
|
1381
1383
|
|
|
@@ -1394,7 +1396,7 @@ DESCRIPTION
|
|
|
1394
1396
|
Install a remote executor into a workspace
|
|
1395
1397
|
```
|
|
1396
1398
|
|
|
1397
|
-
_See code: [src/commands/workspace/executor/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1399
|
+
_See code: [src/commands/workspace/executor/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/workspace/executor/install/index.ts)_
|
|
1398
1400
|
|
|
1399
1401
|
## `hereya workspace executor token`
|
|
1400
1402
|
|
|
@@ -1411,7 +1413,7 @@ DESCRIPTION
|
|
|
1411
1413
|
Generate a workspace-scoped executor token for the remote executor
|
|
1412
1414
|
```
|
|
1413
1415
|
|
|
1414
|
-
_See code: [src/commands/workspace/executor/token/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1416
|
+
_See code: [src/commands/workspace/executor/token/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/workspace/executor/token/index.ts)_
|
|
1415
1417
|
|
|
1416
1418
|
## `hereya workspace executor uninstall`
|
|
1417
1419
|
|
|
@@ -1429,7 +1431,7 @@ DESCRIPTION
|
|
|
1429
1431
|
Uninstall the remote executor from a workspace
|
|
1430
1432
|
```
|
|
1431
1433
|
|
|
1432
|
-
_See code: [src/commands/workspace/executor/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1434
|
+
_See code: [src/commands/workspace/executor/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/workspace/executor/uninstall/index.ts)_
|
|
1433
1435
|
|
|
1434
1436
|
## `hereya workspace install PACKAGE`
|
|
1435
1437
|
|
|
@@ -1456,7 +1458,7 @@ EXAMPLES
|
|
|
1456
1458
|
$ hereya workspace install hereya/aws-cognito
|
|
1457
1459
|
```
|
|
1458
1460
|
|
|
1459
|
-
_See code: [src/commands/workspace/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1461
|
+
_See code: [src/commands/workspace/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/workspace/install/index.ts)_
|
|
1460
1462
|
|
|
1461
1463
|
## `hereya workspace list`
|
|
1462
1464
|
|
|
@@ -1480,7 +1482,7 @@ EXAMPLES
|
|
|
1480
1482
|
$ hereya workspace list --org personal
|
|
1481
1483
|
```
|
|
1482
1484
|
|
|
1483
|
-
_See code: [src/commands/workspace/list/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1485
|
+
_See code: [src/commands/workspace/list/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/workspace/list/index.ts)_
|
|
1484
1486
|
|
|
1485
1487
|
## `hereya workspace set-profile PROFILE`
|
|
1486
1488
|
|
|
@@ -1504,7 +1506,7 @@ EXAMPLES
|
|
|
1504
1506
|
$ hereya workspace set-profile prod-profile -w production
|
|
1505
1507
|
```
|
|
1506
1508
|
|
|
1507
|
-
_See code: [src/commands/workspace/set-profile/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1509
|
+
_See code: [src/commands/workspace/set-profile/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/workspace/set-profile/index.ts)_
|
|
1508
1510
|
|
|
1509
1511
|
## `hereya workspace uninstall PACKAGE`
|
|
1510
1512
|
|
|
@@ -1531,5 +1533,5 @@ EXAMPLES
|
|
|
1531
1533
|
$ hereya workspace uninstall hereya/aws-cognito
|
|
1532
1534
|
```
|
|
1533
1535
|
|
|
1534
|
-
_See code: [src/commands/workspace/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1536
|
+
_See code: [src/commands/workspace/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.76.1/src/commands/workspace/uninstall/index.ts)_
|
|
1535
1537
|
<!-- commandsstop -->
|
|
@@ -84,7 +84,7 @@ export declare class CloudBackend implements Backend {
|
|
|
84
84
|
setEnvVar(input: SetEnvVarInput): Promise<SetEnvVarOutput>;
|
|
85
85
|
submitExecutorJob(input: {
|
|
86
86
|
payload: object;
|
|
87
|
-
type: 'destroy' | 'provision' | 'resolve-env';
|
|
87
|
+
type: 'deploy' | 'destroy' | 'provision' | 'resolve-env' | 'undeploy';
|
|
88
88
|
workspace: string;
|
|
89
89
|
}): Promise<{
|
|
90
90
|
jobId: string;
|
|
@@ -5,7 +5,9 @@ export default class Deploy extends Command {
|
|
|
5
5
|
static flags: {
|
|
6
6
|
chdir: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
7
|
debug: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
|
+
local: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
9
|
workspace: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
10
|
};
|
|
10
11
|
run(): Promise<void>;
|
|
12
|
+
private deployRemotely;
|
|
11
13
|
}
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import { Command, Flags } from '@oclif/core';
|
|
2
2
|
import { getRendererClass, Listr, ListrLogger, ListrLogLevels } from 'listr2';
|
|
3
3
|
import path from 'node:path';
|
|
4
|
+
import { CloudBackend } from '../../backend/cloud/cloud-backend.js';
|
|
5
|
+
import { getCloudCredentials, loadBackendConfig } from '../../backend/config.js';
|
|
4
6
|
import { getBackend } from '../../backend/index.js';
|
|
5
7
|
import { getExecutor } from '../../executor/index.js';
|
|
6
8
|
import { getConfigManager } from '../../lib/config/index.js';
|
|
7
9
|
import { getEnvManager } from '../../lib/env/index.js';
|
|
10
|
+
import { gitUtils } from '../../lib/git-utils.js';
|
|
8
11
|
import { getLogger, getLogPath, isDebug, setDebug } from '../../lib/log.js';
|
|
9
12
|
import { getParameterManager } from '../../lib/parameter/index.js';
|
|
10
13
|
import { getProfileFromWorkspace } from '../../lib/profile-utils.js';
|
|
11
|
-
import {
|
|
14
|
+
import { pollExecutorJob } from '../../lib/remote-job-utils.js';
|
|
15
|
+
import { delay, runShell } from '../../lib/shell.js';
|
|
16
|
+
import { resolveWorkspaceName } from '../../lib/workspace-utils.js';
|
|
12
17
|
import { validateDeploymentWorkspace } from '../../lib/workspace-validation.js';
|
|
13
18
|
export default class Deploy extends Command {
|
|
14
19
|
static description = 'Deploy a hereya project using the project deployment package';
|
|
@@ -26,6 +31,10 @@ export default class Deploy extends Command {
|
|
|
26
31
|
default: false,
|
|
27
32
|
description: 'enable debug mode',
|
|
28
33
|
}),
|
|
34
|
+
local: Flags.boolean({
|
|
35
|
+
default: false,
|
|
36
|
+
description: 'force local execution (skip remote executor)',
|
|
37
|
+
}),
|
|
29
38
|
workspace: Flags.string({
|
|
30
39
|
char: 'w',
|
|
31
40
|
description: 'name of the workspace to deploy the packages for',
|
|
@@ -48,6 +57,24 @@ export default class Deploy extends Command {
|
|
|
48
57
|
if (!validation.isValid) {
|
|
49
58
|
this.error(validation.message);
|
|
50
59
|
}
|
|
60
|
+
const forceLocal = flags.local || process.env.HEREYA_LOCAL_EXECUTION === 'true';
|
|
61
|
+
if (!forceLocal) {
|
|
62
|
+
// Check remote deployment conditions
|
|
63
|
+
const resolvedWorkspaceName = resolveWorkspaceName(flags.workspace, loadConfigOutput.config.project);
|
|
64
|
+
const workspace$ = await backend.getWorkspace(resolvedWorkspaceName);
|
|
65
|
+
const metadata$ = await backend.getProjectMetadata?.({ project: loadConfigOutput.config.project });
|
|
66
|
+
const hasRemoteGit = metadata$?.found && metadata$.metadata.env?.hereyaGitRemoteUrl;
|
|
67
|
+
const hasRemoteExecutor = workspace$.found && !workspace$.hasError && workspace$.workspace.hasExecutor;
|
|
68
|
+
if (hasRemoteExecutor && hasRemoteGit) {
|
|
69
|
+
await this.deployRemotely({
|
|
70
|
+
gitBranch: await gitUtils.getCurrentGitBranch(projectRootDir),
|
|
71
|
+
project: loadConfigOutput.config.project,
|
|
72
|
+
projectRootDir,
|
|
73
|
+
workspace: flags.workspace,
|
|
74
|
+
});
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
51
78
|
const myLogger = new ListrLogger({ useIcons: false });
|
|
52
79
|
const task = new Listr([
|
|
53
80
|
{
|
|
@@ -73,6 +100,14 @@ export default class Deploy extends Command {
|
|
|
73
100
|
},
|
|
74
101
|
title: 'Loading project config',
|
|
75
102
|
},
|
|
103
|
+
{
|
|
104
|
+
skip: (ctx) => !ctx.configOutput.config.preDeployCommand,
|
|
105
|
+
async task(ctx) {
|
|
106
|
+
const command = ctx.configOutput.config.preDeployCommand;
|
|
107
|
+
await runShell('sh', ['-c', command], { directory: projectRootDir });
|
|
108
|
+
},
|
|
109
|
+
title: 'Running pre-deploy command',
|
|
110
|
+
},
|
|
76
111
|
{
|
|
77
112
|
async task(ctx) {
|
|
78
113
|
const backend = await getBackend();
|
|
@@ -415,4 +450,58 @@ export default class Deploy extends Command {
|
|
|
415
450
|
See ${getLogPath()} for more details`);
|
|
416
451
|
}
|
|
417
452
|
}
|
|
453
|
+
async deployRemotely(input) {
|
|
454
|
+
const myLogger = new ListrLogger({ useIcons: false });
|
|
455
|
+
// 1. Ensure clean working tree
|
|
456
|
+
const cleanCheck = await gitUtils.ensureCleanAndPushed({ cwd: input.projectRootDir });
|
|
457
|
+
if (!cleanCheck.clean) {
|
|
458
|
+
this.error(cleanCheck.reason);
|
|
459
|
+
}
|
|
460
|
+
myLogger.log(ListrLogLevels.STARTED, `Deploying to ${input.workspace} via remote executor (branch: ${input.gitBranch})`);
|
|
461
|
+
// 2. Get cloud backend for job submission
|
|
462
|
+
const backendConfig = await loadBackendConfig();
|
|
463
|
+
if (!backendConfig.cloud) {
|
|
464
|
+
this.error('Remote deployment requires cloud backend. Run `hereya login` first.');
|
|
465
|
+
}
|
|
466
|
+
const credentials = await getCloudCredentials(backendConfig.cloud.clientId);
|
|
467
|
+
if (!credentials) {
|
|
468
|
+
this.error('Cloud credentials not found. Run `hereya login` first.');
|
|
469
|
+
}
|
|
470
|
+
const resolvedWorkspaceName = resolveWorkspaceName(input.workspace, input.project);
|
|
471
|
+
const cloudBackend = new CloudBackend({
|
|
472
|
+
accessToken: credentials.accessToken,
|
|
473
|
+
clientId: backendConfig.cloud.clientId,
|
|
474
|
+
refreshToken: credentials.refreshToken,
|
|
475
|
+
url: backendConfig.cloud.url,
|
|
476
|
+
});
|
|
477
|
+
// 3. Submit deploy job
|
|
478
|
+
const submitResult = await cloudBackend.submitExecutorJob({
|
|
479
|
+
payload: {
|
|
480
|
+
gitBranch: input.gitBranch,
|
|
481
|
+
project: input.project,
|
|
482
|
+
workspace: input.workspace,
|
|
483
|
+
},
|
|
484
|
+
type: 'deploy',
|
|
485
|
+
workspace: resolvedWorkspaceName,
|
|
486
|
+
});
|
|
487
|
+
if (!submitResult.success) {
|
|
488
|
+
this.error(`Failed to submit remote deploy job: ${submitResult.reason}`);
|
|
489
|
+
}
|
|
490
|
+
// 4. Poll for results
|
|
491
|
+
const logger = {
|
|
492
|
+
debug: (msg) => myLogger.log(ListrLogLevels.OUTPUT, msg),
|
|
493
|
+
error: (msg) => myLogger.log(ListrLogLevels.OUTPUT, msg),
|
|
494
|
+
info: (msg) => myLogger.log(ListrLogLevels.OUTPUT, msg),
|
|
495
|
+
};
|
|
496
|
+
const pollResult = await pollExecutorJob({
|
|
497
|
+
cloudBackend,
|
|
498
|
+
jobId: submitResult.jobId,
|
|
499
|
+
logger,
|
|
500
|
+
workspace: resolvedWorkspaceName,
|
|
501
|
+
});
|
|
502
|
+
if (!pollResult.success) {
|
|
503
|
+
this.error(pollResult.reason);
|
|
504
|
+
}
|
|
505
|
+
myLogger.log(ListrLogLevels.COMPLETED, 'Remote deployment completed successfully');
|
|
506
|
+
}
|
|
418
507
|
}
|
|
@@ -5,7 +5,9 @@ export default class Undeploy extends Command {
|
|
|
5
5
|
static flags: {
|
|
6
6
|
chdir: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
7
|
debug: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
|
+
local: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
9
|
workspace: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
10
|
};
|
|
10
11
|
run(): Promise<void>;
|
|
12
|
+
private undeployRemotely;
|
|
11
13
|
}
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import { Command, Flags } from '@oclif/core';
|
|
2
2
|
import { getRendererClass, Listr, ListrLogger, ListrLogLevels } from 'listr2';
|
|
3
3
|
import path from 'node:path';
|
|
4
|
+
import { CloudBackend } from '../../backend/cloud/cloud-backend.js';
|
|
5
|
+
import { getCloudCredentials, loadBackendConfig } from '../../backend/config.js';
|
|
4
6
|
import { getBackend } from '../../backend/index.js';
|
|
5
7
|
import { getExecutor } from '../../executor/index.js';
|
|
6
8
|
import { getConfigManager } from '../../lib/config/index.js';
|
|
7
9
|
import { getEnvManager } from '../../lib/env/index.js';
|
|
10
|
+
import { gitUtils } from '../../lib/git-utils.js';
|
|
8
11
|
import { getLogger, getLogPath, isDebug, setDebug } from '../../lib/log.js';
|
|
9
12
|
import { getParameterManager } from '../../lib/parameter/index.js';
|
|
10
13
|
import { getProfileFromWorkspace } from '../../lib/profile-utils.js';
|
|
14
|
+
import { pollExecutorJob } from '../../lib/remote-job-utils.js';
|
|
11
15
|
import { delay } from '../../lib/shell.js';
|
|
16
|
+
import { resolveWorkspaceName } from '../../lib/workspace-utils.js';
|
|
12
17
|
import { validateDeploymentWorkspace } from '../../lib/workspace-validation.js';
|
|
13
18
|
export default class Undeploy extends Command {
|
|
14
19
|
static description = 'Undeploy a hereya project by removing all resources.';
|
|
@@ -26,6 +31,10 @@ export default class Undeploy extends Command {
|
|
|
26
31
|
default: false,
|
|
27
32
|
description: 'enable debug mode',
|
|
28
33
|
}),
|
|
34
|
+
local: Flags.boolean({
|
|
35
|
+
default: false,
|
|
36
|
+
description: 'force local execution (skip remote executor)',
|
|
37
|
+
}),
|
|
29
38
|
workspace: Flags.string({
|
|
30
39
|
char: 'w',
|
|
31
40
|
description: 'name of the workspace to undeploy the packages for',
|
|
@@ -48,6 +57,24 @@ export default class Undeploy extends Command {
|
|
|
48
57
|
if (!validation.isValid) {
|
|
49
58
|
this.error(validation.message);
|
|
50
59
|
}
|
|
60
|
+
const forceLocal = flags.local || process.env.HEREYA_LOCAL_EXECUTION === 'true';
|
|
61
|
+
if (!forceLocal) {
|
|
62
|
+
// Check remote undeployment conditions
|
|
63
|
+
const resolvedWorkspaceName = resolveWorkspaceName(flags.workspace, loadConfigOutput.config.project);
|
|
64
|
+
const workspace$ = await backend.getWorkspace(resolvedWorkspaceName);
|
|
65
|
+
const metadata$ = await backend.getProjectMetadata?.({ project: loadConfigOutput.config.project });
|
|
66
|
+
const hasRemoteGit = metadata$?.found && metadata$.metadata.env?.hereyaGitRemoteUrl;
|
|
67
|
+
const hasRemoteExecutor = workspace$.found && !workspace$.hasError && workspace$.workspace.hasExecutor;
|
|
68
|
+
if (hasRemoteExecutor && hasRemoteGit) {
|
|
69
|
+
await this.undeployRemotely({
|
|
70
|
+
gitBranch: await gitUtils.getCurrentGitBranch(projectRootDir),
|
|
71
|
+
project: loadConfigOutput.config.project,
|
|
72
|
+
projectRootDir,
|
|
73
|
+
workspace: flags.workspace,
|
|
74
|
+
});
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
51
78
|
const myLogger = new ListrLogger({ useIcons: false });
|
|
52
79
|
const task = new Listr([
|
|
53
80
|
{
|
|
@@ -277,4 +304,58 @@ export default class Undeploy extends Command {
|
|
|
277
304
|
See ${getLogPath()} for more details`);
|
|
278
305
|
}
|
|
279
306
|
}
|
|
307
|
+
async undeployRemotely(input) {
|
|
308
|
+
const myLogger = new ListrLogger({ useIcons: false });
|
|
309
|
+
// 1. Ensure clean working tree
|
|
310
|
+
const cleanCheck = await gitUtils.ensureCleanAndPushed({ cwd: input.projectRootDir });
|
|
311
|
+
if (!cleanCheck.clean) {
|
|
312
|
+
this.error(cleanCheck.reason);
|
|
313
|
+
}
|
|
314
|
+
myLogger.log(ListrLogLevels.STARTED, `Undeploying ${input.workspace} via remote executor (branch: ${input.gitBranch})`);
|
|
315
|
+
// 2. Get cloud backend for job submission
|
|
316
|
+
const backendConfig = await loadBackendConfig();
|
|
317
|
+
if (!backendConfig.cloud) {
|
|
318
|
+
this.error('Remote undeployment requires cloud backend. Run `hereya login` first.');
|
|
319
|
+
}
|
|
320
|
+
const credentials = await getCloudCredentials(backendConfig.cloud.clientId);
|
|
321
|
+
if (!credentials) {
|
|
322
|
+
this.error('Cloud credentials not found. Run `hereya login` first.');
|
|
323
|
+
}
|
|
324
|
+
const resolvedWorkspaceName = resolveWorkspaceName(input.workspace, input.project);
|
|
325
|
+
const cloudBackend = new CloudBackend({
|
|
326
|
+
accessToken: credentials.accessToken,
|
|
327
|
+
clientId: backendConfig.cloud.clientId,
|
|
328
|
+
refreshToken: credentials.refreshToken,
|
|
329
|
+
url: backendConfig.cloud.url,
|
|
330
|
+
});
|
|
331
|
+
// 3. Submit undeploy job
|
|
332
|
+
const submitResult = await cloudBackend.submitExecutorJob({
|
|
333
|
+
payload: {
|
|
334
|
+
gitBranch: input.gitBranch,
|
|
335
|
+
project: input.project,
|
|
336
|
+
workspace: input.workspace,
|
|
337
|
+
},
|
|
338
|
+
type: 'undeploy',
|
|
339
|
+
workspace: resolvedWorkspaceName,
|
|
340
|
+
});
|
|
341
|
+
if (!submitResult.success) {
|
|
342
|
+
this.error(`Failed to submit remote undeploy job: ${submitResult.reason}`);
|
|
343
|
+
}
|
|
344
|
+
// 4. Poll for results
|
|
345
|
+
const logger = {
|
|
346
|
+
debug: (msg) => myLogger.log(ListrLogLevels.OUTPUT, msg),
|
|
347
|
+
error: (msg) => myLogger.log(ListrLogLevels.OUTPUT, msg),
|
|
348
|
+
info: (msg) => myLogger.log(ListrLogLevels.OUTPUT, msg),
|
|
349
|
+
};
|
|
350
|
+
const pollResult = await pollExecutorJob({
|
|
351
|
+
cloudBackend,
|
|
352
|
+
jobId: submitResult.jobId,
|
|
353
|
+
logger,
|
|
354
|
+
workspace: resolvedWorkspaceName,
|
|
355
|
+
});
|
|
356
|
+
if (!pollResult.success) {
|
|
357
|
+
this.error(pollResult.reason);
|
|
358
|
+
}
|
|
359
|
+
myLogger.log(ListrLogLevels.COMPLETED, 'Remote undeployment completed successfully');
|
|
360
|
+
}
|
|
280
361
|
}
|
|
@@ -58,6 +58,7 @@ export default class WorkspaceExecutorUninstall extends Command {
|
|
|
58
58
|
logger: getLogger(task),
|
|
59
59
|
package: DEFAULT_EXECUTOR_PACKAGE,
|
|
60
60
|
skipDeploy: true,
|
|
61
|
+
workspace: flags.workspace,
|
|
61
62
|
});
|
|
62
63
|
if (!destroyOutput.success) {
|
|
63
64
|
throw new Error(destroyOutput.reason);
|
package/dist/executor/remote.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { pollExecutorJob } from '../lib/remote-job-utils.js';
|
|
1
2
|
import { LocalExecutor } from './local.js';
|
|
2
3
|
export class RemoteExecutor {
|
|
3
4
|
cloudBackend;
|
|
@@ -70,51 +71,16 @@ export class RemoteExecutor {
|
|
|
70
71
|
return { reason: `Failed to submit remote executor job: ${submitResult.reason}`, success: false };
|
|
71
72
|
}
|
|
72
73
|
const { jobId } = submitResult;
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
const statusResult = await this.cloudBackend.getExecutorJobStatus({
|
|
82
|
-
jobId,
|
|
83
|
-
lastStatus,
|
|
84
|
-
poll: true,
|
|
85
|
-
workspace: this.workspace,
|
|
86
|
-
});
|
|
87
|
-
if (!statusResult.success) {
|
|
88
|
-
return { reason: `Failed to get job status: ${statusResult.reason}`, success: false };
|
|
89
|
-
}
|
|
90
|
-
const { job } = statusResult;
|
|
91
|
-
lastStatus = job.status;
|
|
92
|
-
// Forward new logs
|
|
93
|
-
if (job.logs && job.logs.length > lastLogLength) {
|
|
94
|
-
const newLogs = job.logs.slice(lastLogLength);
|
|
95
|
-
if (newLogs.trim()) {
|
|
96
|
-
input.logger?.info?.(newLogs);
|
|
97
|
-
}
|
|
98
|
-
lastLogLength = job.logs.length;
|
|
99
|
-
}
|
|
100
|
-
// Check if job is done
|
|
101
|
-
if (job.status === 'completed') {
|
|
102
|
-
if (job.result) {
|
|
103
|
-
return job.result;
|
|
104
|
-
}
|
|
105
|
-
return { reason: 'Job completed but no result returned', success: false };
|
|
106
|
-
}
|
|
107
|
-
if (job.status === 'failed') {
|
|
108
|
-
const reason = job.result?.reason || 'Remote executor job failed';
|
|
109
|
-
return { reason, success: false };
|
|
110
|
-
}
|
|
111
|
-
// Small delay between polls (server-side long polling handles most of the wait)
|
|
112
|
-
// eslint-disable-next-line no-await-in-loop
|
|
113
|
-
await new Promise(resolve => {
|
|
114
|
-
setTimeout(resolve, 1000);
|
|
115
|
-
});
|
|
74
|
+
const pollResult = await pollExecutorJob({
|
|
75
|
+
cloudBackend: this.cloudBackend,
|
|
76
|
+
jobId,
|
|
77
|
+
logger: input.logger,
|
|
78
|
+
workspace: this.workspace,
|
|
79
|
+
});
|
|
80
|
+
if (!pollResult.success) {
|
|
81
|
+
return { reason: pollResult.reason, success: false };
|
|
116
82
|
}
|
|
117
|
-
return
|
|
83
|
+
return pollResult.result;
|
|
118
84
|
}
|
|
119
85
|
async resolveEnvRemotely(env, markSecret) {
|
|
120
86
|
const submitResult = await this.cloudBackend.submitExecutorJob({
|
package/dist/lib/git-utils.d.ts
CHANGED
|
@@ -3,6 +3,18 @@ export declare const gitUtils: {
|
|
|
3
3
|
* Clones a git repository using the hereya credential helper.
|
|
4
4
|
*/
|
|
5
5
|
cloneWithCredentialHelper(input: CloneWithCredentialHelperInput): Promise<CloneOutput>;
|
|
6
|
+
/**
|
|
7
|
+
* Checks that the working tree is clean and all commits are pushed.
|
|
8
|
+
* Returns { clean: true } if ready, or { clean: false, reason } with an explanation.
|
|
9
|
+
*/
|
|
10
|
+
ensureCleanAndPushed(input: {
|
|
11
|
+
cwd?: string;
|
|
12
|
+
}): Promise<{
|
|
13
|
+
clean: false;
|
|
14
|
+
reason: string;
|
|
15
|
+
} | {
|
|
16
|
+
clean: true;
|
|
17
|
+
}>;
|
|
6
18
|
/**
|
|
7
19
|
* Gets the current git branch name.
|
|
8
20
|
* @param cwd The working directory to execute git command in
|
package/dist/lib/git-utils.js
CHANGED
|
@@ -7,6 +7,33 @@ export const gitUtils = {
|
|
|
7
7
|
async cloneWithCredentialHelper(input) {
|
|
8
8
|
return cloneWithCredentialHelper(input);
|
|
9
9
|
},
|
|
10
|
+
/**
|
|
11
|
+
* Checks that the working tree is clean and all commits are pushed.
|
|
12
|
+
* Returns { clean: true } if ready, or { clean: false, reason } with an explanation.
|
|
13
|
+
*/
|
|
14
|
+
async ensureCleanAndPushed(input) {
|
|
15
|
+
// Check for uncommitted/unstaged changes
|
|
16
|
+
try {
|
|
17
|
+
const { stdout: status } = await runShell('git', ['status', '--porcelain'], { directory: input.cwd });
|
|
18
|
+
if (status.trim()) {
|
|
19
|
+
return { clean: false, reason: 'Uncommitted changes detected. Commit and push before deploying.' };
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
return { clean: false, reason: `Failed to check git status: ${error.message}` };
|
|
24
|
+
}
|
|
25
|
+
// Check for unpushed commits
|
|
26
|
+
try {
|
|
27
|
+
const { stdout: unpushed } = await runShell('git', ['log', '@{u}..', '--oneline'], { directory: input.cwd });
|
|
28
|
+
if (unpushed.trim()) {
|
|
29
|
+
return { clean: false, reason: 'Unpushed commits detected. Push before deploying.' };
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
// If no upstream is set, we can't check — that's fine for local-only repos
|
|
34
|
+
}
|
|
35
|
+
return { clean: true };
|
|
36
|
+
},
|
|
10
37
|
/**
|
|
11
38
|
* Gets the current git branch name.
|
|
12
39
|
* @param cwd The working directory to execute git command in
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CloudBackend } from '../backend/cloud/cloud-backend.js';
|
|
2
|
+
import { Logger } from './log.js';
|
|
3
|
+
export type PollJobResult = {
|
|
4
|
+
reason: string;
|
|
5
|
+
success: false;
|
|
6
|
+
} | {
|
|
7
|
+
result: any;
|
|
8
|
+
success: true;
|
|
9
|
+
};
|
|
10
|
+
export declare function pollExecutorJob(input: {
|
|
11
|
+
cloudBackend: CloudBackend;
|
|
12
|
+
jobId: string;
|
|
13
|
+
logger?: Logger;
|
|
14
|
+
timeoutMs?: number;
|
|
15
|
+
workspace: string;
|
|
16
|
+
}): Promise<PollJobResult>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export async function pollExecutorJob(input) {
|
|
2
|
+
const { cloudBackend, jobId, logger, workspace } = input;
|
|
3
|
+
const timeout = input.timeoutMs ?? 10 * 60 * 1000;
|
|
4
|
+
logger?.info?.(`Remote executor job submitted (${jobId}). Waiting for result...`);
|
|
5
|
+
const startTime = Date.now();
|
|
6
|
+
let lastLogLength = 0;
|
|
7
|
+
let lastStatus = 'pending';
|
|
8
|
+
while (Date.now() - startTime < timeout) {
|
|
9
|
+
// eslint-disable-next-line no-await-in-loop
|
|
10
|
+
const statusResult = await cloudBackend.getExecutorJobStatus({
|
|
11
|
+
jobId,
|
|
12
|
+
lastStatus,
|
|
13
|
+
poll: true,
|
|
14
|
+
workspace,
|
|
15
|
+
});
|
|
16
|
+
if (!statusResult.success) {
|
|
17
|
+
return { reason: `Failed to get job status: ${statusResult.reason}`, success: false };
|
|
18
|
+
}
|
|
19
|
+
const { job } = statusResult;
|
|
20
|
+
lastStatus = job.status;
|
|
21
|
+
if (job.logs && job.logs.length > lastLogLength) {
|
|
22
|
+
const newLogs = job.logs.slice(lastLogLength);
|
|
23
|
+
if (newLogs.trim()) {
|
|
24
|
+
logger?.info?.(newLogs);
|
|
25
|
+
}
|
|
26
|
+
lastLogLength = job.logs.length;
|
|
27
|
+
}
|
|
28
|
+
if (job.status === 'completed') {
|
|
29
|
+
if (job.result) {
|
|
30
|
+
return { result: job.result, success: true };
|
|
31
|
+
}
|
|
32
|
+
return { reason: 'Job completed but no result returned', success: false };
|
|
33
|
+
}
|
|
34
|
+
if (job.status === 'failed') {
|
|
35
|
+
const reason = job.result?.reason || 'Remote executor job failed';
|
|
36
|
+
return { reason, success: false };
|
|
37
|
+
}
|
|
38
|
+
// Small delay between polls (server-side long polling handles most of the wait)
|
|
39
|
+
// eslint-disable-next-line no-await-in-loop
|
|
40
|
+
await new Promise(resolve => {
|
|
41
|
+
setTimeout(resolve, 1000);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
return { reason: `Remote executor job timed out after ${Math.round(timeout / 60_000)} minutes`, success: false };
|
|
45
|
+
}
|
package/oclif.manifest.json
CHANGED
|
@@ -195,6 +195,12 @@
|
|
|
195
195
|
"allowNo": false,
|
|
196
196
|
"type": "boolean"
|
|
197
197
|
},
|
|
198
|
+
"local": {
|
|
199
|
+
"description": "force local execution (skip remote executor)",
|
|
200
|
+
"name": "local",
|
|
201
|
+
"allowNo": false,
|
|
202
|
+
"type": "boolean"
|
|
203
|
+
},
|
|
198
204
|
"workspace": {
|
|
199
205
|
"char": "w",
|
|
200
206
|
"description": "name of the workspace to deploy the packages for",
|
|
@@ -929,6 +935,12 @@
|
|
|
929
935
|
"allowNo": false,
|
|
930
936
|
"type": "boolean"
|
|
931
937
|
},
|
|
938
|
+
"local": {
|
|
939
|
+
"description": "force local execution (skip remote executor)",
|
|
940
|
+
"name": "local",
|
|
941
|
+
"allowNo": false,
|
|
942
|
+
"type": "boolean"
|
|
943
|
+
},
|
|
932
944
|
"workspace": {
|
|
933
945
|
"char": "w",
|
|
934
946
|
"description": "name of the workspace to undeploy the packages for",
|
|
@@ -2805,5 +2817,5 @@
|
|
|
2805
2817
|
]
|
|
2806
2818
|
}
|
|
2807
2819
|
},
|
|
2808
|
-
"version": "0.
|
|
2820
|
+
"version": "0.76.1"
|
|
2809
2821
|
}
|