diff --git a/README.md b/README.md index 190ced7..6e4aa5a 100644 --- a/README.md +++ b/README.md @@ -38,19 +38,19 @@ or install it through command line: On `OSX`: ```bash -curl -sL https://github.com/coveo/tgf/releases/download/v1.15.1/tgf_1.15.1_macOS_64-bits.zip | bsdtar -xf- -C /usr/local/bin && chmod +x /usr/local/bin/tgf +curl -sL https://github.com/coveo/tgf/releases/download/v1.15.2/tgf_1.15.2_macOS_64-bits.zip | bsdtar -xf- -C /usr/local/bin && chmod +x /usr/local/bin/tgf ``` On `Linux`: ```bash -curl -sL https://github.com/coveo/tgf/releases/download/v1.15.1/tgf_1.15.1_linux_64-bits.zip | gzip -d > /usr/local/bin/tgf && chmod +x /usr/local/bin/tgf +curl -sL https://github.com/coveo/tgf/releases/download/v1.15.2/tgf_1.15.2_linux_64-bits.zip | gzip -d > /usr/local/bin/tgf && chmod +x /usr/local/bin/tgf ``` On `Windows` with Powershell: ```powershell -Invoke-WebRequest https://github.com/coveo/tgf/releases/download/v1.15.1/tgf_1.15.1_windows_64-bits.zip -OutFile tgf.zip +Invoke-WebRequest https://github.com/coveo/tgf/releases/download/v1.15.2/tgf_1.15.2_windows_64-bits.zip -OutFile tgf.zip ``` ## Configuration @@ -91,6 +91,7 @@ Key | Description | Default value | docker-image-tag | Identify the image tag (could specify specialized version such as k8s, full) | latest | docker-image-build | List of Dockerfile instructions to customize the specified docker image) | | docker-refresh | Delay before checking if a newer version of the docker image is available | 1h (1 hour) +| docker-options | Additional options to supply to the Docker command | | logging-level | Terragrunt logging level (only apply to Terragrunt entry point).
*Critical (0), Error (1), Warning (2), Notice (3), Info (4), Debug (5), Full (6)* | Notice | entry-point | The program that will be automatically launched when the docker starts | terragrunt | tgf-recommended-version | The minimal tgf version recommended in your context (should not be placed in `.tgf.config file`) | *no default* @@ -113,7 +114,7 @@ It then looks in your current folder and all its parents to find a file named '. default configuration. If not all configurable values are satisfied and you have an AWS configuration, it will then try to retrieve the missing elements from the AWS Parameter Store under the key '/default/tgf'. -Configurable values are: docker-image, docker-image-version, docker-image-tag, docker-refresh, recommended-image-version, required-image-version, logging-level, entry-point, tgf-recommended-version. +Configurable values are: docker-image, docker-image-version, docker-image-tag, docker-refresh, docker-options, recommended-image-version, required-image-version, logging-level, entry-point, tgf-recommended-version. You can get the full documentation at https://github.com/coveo/tgf/blob/master/README.md and check for new version at https://github.com/coveo/tgf/releases/latest. @@ -131,7 +132,7 @@ Any non conflicting argument will be passed to the entry point wherever it is lo tgf ls -- -D # Avoid -D to be interpretated by tgf as --debug-docker -VERSION: 1.15.1 +VERSION: 1.15.2 AUTHOR: Coveo @@ -158,7 +159,7 @@ Example: ```bash > tgf --current-version -tgf v1.15.1 +tgf v1.15.2 ``` Returns the current version of the tgf tool diff --git a/config.go b/config.go index 843a041..24153e9 100644 --- a/config.go +++ b/config.go @@ -26,6 +26,7 @@ const ( dockerImageTag = "docker-image-tag" dockerImageBuild = "docker-image-build" dockerRefresh = "docker-refresh" + dockerOptionsTag = "docker-options" loggingLevel = "logging-level" entryPoint = "entry-point" tgfVersion = "tgf-recommended-version" @@ -42,6 +43,7 @@ type tgfConfig struct { LogLevel string EntryPoint string Refresh time.Duration + DockerOptions []string RecommendedImageVersion string RequiredVersionRange string RecommendedTGFVersion string @@ -79,6 +81,7 @@ func (config tgfConfig) String() (result string) { ifNotZero(dockerImageBuild, buildScript) } + ifNotZero(dockerOptionsTag, config.DockerOptions) ifNotZero(recommendedImageVersion, config.RecommendedImageVersion) ifNotZero(requiredImageVersion, config.RequiredVersionRange) ifNotZero(dockerRefresh, config.Refresh) @@ -143,6 +146,8 @@ func (config *tgfConfig) SetValue(key, value string) { fmt.Fprintf(os.Stderr, warningString("Parameter %s should not contains the image name: %s\n", key, value)) } config.apply(key, ":"+value) + case dockerOptionsTag: + config.DockerOptions = append(config.DockerOptions, strings.Split(value, " ")...) case dockerImageBuild: // We concatenate the various levels of docker build instructions config.ImageBuild = strings.Join([]string{strings.TrimSpace(value), strings.TrimSpace(config.ImageBuild)}, "\n") diff --git a/docker.go b/docker.go index 8aee059..6546a9f 100644 --- a/docker.go +++ b/docker.go @@ -72,6 +72,8 @@ func callDocker(args ...string) int { "-v", fmt.Sprintf("%v:%v", convertDrive(home), homeWithoutVolume), "-e", fmt.Sprintf("HOME=%v", homeWithoutVolume), }...) + + dockerArgs = append(dockerArgs, config.DockerOptions...) } os.Setenv("TERRAGRUNT_CACHE", "/var/tgf") diff --git a/main.go b/main.go index 8ecfc4d..a3afa75 100644 --- a/main.go +++ b/main.go @@ -77,8 +77,8 @@ func main() { "parameterStoreKey": parameterFolder, "config": configFile, "options": color.GreenString(strings.Join([]string{ - dockerImage, dockerImageVersion, dockerImageTag, dockerImageBuild, - dockerRefresh, recommendedImageVersion, requiredImageVersion, loggingLevel, entryPoint, tgfVersion, + dockerImage, dockerImageVersion, dockerImageTag, dockerImageBuild, dockerRefresh, dockerOptionsTag, + recommendedImageVersion, requiredImageVersion, loggingLevel, entryPoint, tgfVersion, }, ", ")), "readme": link(gitSource + "/blob/master/README.md"), "latest": link(gitSource + "/releases/latest"),