-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Roy Razon
committed
Nov 23, 2023
1 parent
5956411
commit 9f43e9a
Showing
40 changed files
with
928 additions
and
567 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import { Flags } from '@oclif/core' | ||
import { InferredFlags } from '@oclif/core/lib/interfaces' | ||
import { BuildSpec, parseRegistry } from '@preevy/core' | ||
|
||
const helpGroup = 'BUILD' | ||
|
||
export const buildFlags = { | ||
'no-build': Flags.boolean({ | ||
description: 'Do not build images', | ||
helpGroup, | ||
allowNo: false, | ||
default: false, | ||
required: false, | ||
}), | ||
registry: Flags.string({ | ||
description: 'Image registry. If this flag is specified, the "build-context" flag defaults to "*local"', | ||
helpGroup, | ||
required: false, | ||
}), | ||
'registry-single-name': Flags.string({ | ||
description: 'Use single name for image registry, ECR-style. Default: auto-detect from "registry" flag', | ||
helpGroup, | ||
required: false, | ||
dependsOn: ['registry'], | ||
}), | ||
'no-registry-single-name': Flags.boolean({ | ||
description: 'Disable auto-detection for ECR-style registry single name', | ||
helpGroup, | ||
allowNo: false, | ||
required: false, | ||
exclusive: ['registry-single-name'], | ||
}), | ||
'no-registry-cache': Flags.boolean({ | ||
description: 'Do not add the registry as a cache source and target', | ||
helpGroup, | ||
required: false, | ||
dependsOn: ['registry'], | ||
}), | ||
load: Flags.boolean({ | ||
description: 'Load build results to the Docker server at the deployment target', | ||
helpGroup, | ||
required: false, | ||
}), | ||
builder: Flags.string({ | ||
description: 'Builder to use', | ||
helpGroup, | ||
required: false, | ||
}), | ||
'no-cache': Flags.boolean({ | ||
description: 'Do not use cache when building the images', | ||
helpGroup, | ||
allowNo: false, | ||
required: false, | ||
}), | ||
} as const | ||
|
||
export const parseBuildFlags = (flags: Omit<InferredFlags<typeof buildFlags>, 'json'>): BuildSpec | undefined => { | ||
if (flags['no-build']) { | ||
return undefined | ||
} | ||
|
||
return { | ||
builder: flags.builder, | ||
noCache: flags['no-cache'], | ||
cacheFromRegistry: !flags['no-registry-cache'], | ||
...flags.registry | ||
? { | ||
registry: parseRegistry({ | ||
registry: flags.registry, | ||
singleName: flags['no-registry-single-name'] ? false : flags['registry-single-name'], | ||
}), | ||
load: flags.load, | ||
} | ||
: { load: true }, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.