Skip to content

Commit ffd47e3

Browse files
committed
wip (4/4)
added additional options to containered runs
1 parent 15f215e commit ffd47e3

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

src/containered.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,16 @@ WORKDIR /app
4444
{preflight-commands}
4545
COPY --from=deployer-builder /app/deployer/target/release/deployer .
4646
{cache-strategy}
47-
CMD ["/app/deployer", "-v", "run", "{pipeline-name}", "--current", "--containered-run"{no-pipe}]
47+
CMD ["/app/deployer", "run", "{pipeline-name}", "--current", "--containered-run"{no-pipe}]
4848
4949
"#;
5050

5151
pub fn run_simple(env: &RunEnvironment, bash_c: String) -> anyhow::Result<()> {
5252
if !(CustomCommand {
53-
bash_c,
53+
bash_c: {
54+
log(format!("Given command: `{}`", bash_c));
55+
bash_c
56+
},
5457
ignore_fails: false,
5558
only_when_fresh: None,
5659
placeholders: None,
@@ -382,7 +385,7 @@ pub fn execute_pipeline_containered(
382385
if run_simple(
383386
env,
384387
format!(
385-
"{} run{}{} -v {:?}:/app/artifacts {}/{}",
388+
"{} run{}{}{} -v {:?}:/app/artifacts {}/{}",
386389
choose_executor(&opts, sudo),
387390
if opts.run_detached.is_some_and(|v| v) {
388391
" -d"
@@ -398,6 +401,11 @@ pub fn execute_pipeline_containered(
398401
} else {
399402
String::from("")
400403
},
404+
if opts.allow_internal_host_bind.is_some_and(|v| v) {
405+
" --add-host=host.docker.internal:host-gateway"
406+
} else {
407+
""
408+
},
401409
volume_path,
402410
config.project_name,
403411
pipeline.title

src/entities/containered_opts.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ pub struct ContaineredOpts {
5656
#[serde(skip_serializing_if = "Option::is_none")]
5757
pub port_bindings: Option<Vec<PortBinding>>,
5858

59+
/// Allow internal host bind.
60+
#[serde(skip_serializing_if = "Option::is_none")]
61+
pub allow_internal_host_bind: Option<bool>,
62+
5963
/// Use `containerd` image store for local cache.
6064
///
6165
/// This allows you to cleanup build cache via `deployer clean`.

0 commit comments

Comments
 (0)