diff --git a/CHANGELOG.md b/CHANGELOG.md index 66473b9..7c0d300 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [v2.0.0-alpha.16] +- Add `stage.*.container.skip_workspace` boolean parameter to skip mounting the current working directory when using the docker plugin + ## [v2.0.0-alpha.14] - Fixes `depends_on` not being respected on modules. diff --git a/internal/ci/stage_run.go b/internal/ci/stage_run.go index 2c53759..a495c05 100644 --- a/internal/ci/stage_run.go +++ b/internal/ci/stage_run.go @@ -587,8 +587,9 @@ func (s *Stage) executeDocker(conductor *Conductor, evalCtx *hcl.EvalContext, cm } logger.Trace("parsing container arguments") - binds := []string{ - fmt.Sprintf("%s:/workspace", cmd.Dir), + var binds []string + if !s.Container.SkipWorkspace { + binds = append(binds, fmt.Sprintf("%s:/workspace", cmd.Dir)) } logger.Trace("parsing container volumes") @@ -614,11 +615,11 @@ func (s *Stage) executeDocker(conductor *Conductor, evalCtx *hcl.EvalContext, cm logger.Trace("dry run check") if cfg.Behavior.DryRun { - fmt.Println(ui.Blue("docker:run.image"), ui.Green(image)) - fmt.Println(ui.Blue("docker:run.workdir"), ui.Green("/workspace")) - fmt.Println(ui.Blue("docker:run.volume"), ui.Green(cmd.Dir+":/workspace")) - fmt.Println(ui.Blue("docker:run.stdin"), ui.Green(s.Container.Stdin)) - fmt.Println(ui.Blue("docker:run.args"), ui.Green(cmd.String())) + fmt.Println(ui.Blue("# docker:run.image"), ui.Green(image)) + fmt.Println(ui.Blue("# docker:run.workdir"), ui.Green("/workspace")) + fmt.Println(ui.Blue("# docker:run.volume"), ui.Green(cmd.Dir+":/workspace")) + fmt.Println(ui.Blue("# docker:run.stdin"), ui.Green(s.Container.Stdin)) + fmt.Println(ui.Blue("# docker:run.args"), ui.Green(cmd.String())) return diags } diff --git a/internal/ci/stage_schema.go b/internal/ci/stage_schema.go index 6ec1c2f..a8c9b97 100644 --- a/internal/ci/stage_schema.go +++ b/internal/ci/stage_schema.go @@ -44,6 +44,9 @@ type StageContainer struct { // Volumes have a list of host path volume mapping which is bound on docker run Volumes StageContainerVolumes `hcl:"volume,block" json:"volumes"` + // SkipWorkspace allows you to skip mounting the workspace directory + SkipWorkspace bool `hcl:"skip_workspace,optional" json:"skip_workspace"` + // Ports have a list of ports that needs to be exposed from the container Ports StageContainerPorts `hcl:"port,block" json:"ports"`