Skip to content

Commit

Permalink
feat(core): add --force flag to dev command
Browse files Browse the repository at this point in the history
This flag force-deploys services when the command starts (but after
that, doesn't force-deploy them on source changes).
  • Loading branch information
thsig committed Oct 25, 2021
1 parent edd5e3f commit 4312152
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion core/src/commands/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const devArgs = {
}

const devOpts = {
"force": new BooleanParameter({ help: "Force redeploy of service(s)." }),
"hot-reload": new StringsParameter({
help: deline`The name(s) of the service(s) to deploy with hot reloading enabled.
Use comma as a separator to specify multiple services. Use * to deploy all
Expand Down Expand Up @@ -85,6 +86,7 @@ export class DevCommand extends Command<DevCommandArgs, DevCommandOpts> {
garden dev --hot=foo-service,bar-service # enable hot reloading for foo-service and bar-service
garden dev --hot=* # enable hot reloading for all compatible services
garden dev --skip-tests= # skip running any tests
garden dev --force # force redeploy of services when the command starts
garden dev --name integ # run all tests with the name 'integ' in the project
garden test --name integ* # run all tests with the name starting with 'integ' in the project
`
Expand Down Expand Up @@ -165,6 +167,7 @@ export class DevCommand extends Command<DevCommandArgs, DevCommandOpts> {
devModeServiceNames,
hotReloadServiceNames,
skipTests,
forceDeploy: opts.force,
})

const results = await processModules({
Expand Down Expand Up @@ -204,6 +207,7 @@ export async function getDevCommandInitialTasks({
devModeServiceNames,
hotReloadServiceNames,
skipTests,
forceDeploy,
}: {
garden: Garden
log: LogEntry
Expand All @@ -213,6 +217,7 @@ export async function getDevCommandInitialTasks({
devModeServiceNames: string[]
hotReloadServiceNames: string[]
skipTests: boolean
forceDeploy: boolean
}) {
const moduleTasks = flatten(
await Bluebird.map(modules, async (module) => {
Expand All @@ -235,7 +240,7 @@ export async function getDevCommandInitialTasks({
module,
devModeServiceNames,
hotReloadServiceNames,
force: false,
force: forceDeploy,
forceBuild: false,
})

Expand Down
2 changes: 2 additions & 0 deletions docs/reference/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -897,6 +897,7 @@ Examples:
garden dev --hot=foo-service,bar-service # enable hot reloading for foo-service and bar-service
garden dev --hot=* # enable hot reloading for all compatible services
garden dev --skip-tests= # skip running any tests
garden dev --force # force redeploy of services when the command starts
garden dev --name integ # run all tests with the name 'integ' in the project
garden test --name integ* # run all tests with the name starting with 'integ' in the project

Expand All @@ -918,6 +919,7 @@ Examples:

| Argument | Alias | Type | Description |
| -------- | ----- | ---- | ----------- |
| `--force` | | boolean | Force redeploy of service(s).
| `--hot-reload` | `-hot` | array:string | The name(s) of the service(s) to deploy with hot reloading enabled. Use comma as a separator to specify multiple services. Use * to deploy all services with hot reloading enabled (ignores services belonging to modules that don&#x27;t support or haven&#x27;t configured hot reloading).
| `--skip-tests` | | boolean | Disable running the tests.
| `--test-names` | `-tn` | array:string | Filter the tests to run by test name across all modules (leave unset to run all tests). Accepts glob patterns (e.g. integ* would run both &#x27;integ&#x27; and &#x27;integration&#x27;).
Expand Down

0 comments on commit 4312152

Please sign in to comment.