Skip to content
This repository has been archived by the owner on Jan 14, 2025. It is now read-only.

Commit

Permalink
Merge branch 'master' of https://github.com/mserranom/bbrun
Browse files Browse the repository at this point in the history
* 'master' of https://github.com/mserranom/bbrun:
  added --rm to docker execution
  • Loading branch information
mserranom committed Jul 17, 2018
2 parents f1a39bb + b876341 commit 83828aa
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/docker.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ function checkExists() {

function run(commands, image, dryRun, interactive, workDir) {
const cmd = interactive
? `run -P -it --entrypoint=/bin/bash -v ${pwd()}:${workDir} -w ${workDir} ${image}`
: `run -P -v ${pwd()}:${workDir} -w ${workDir} ${image} bash ${BUILD_SCRIPT}`;
? `run --rm -P -it --entrypoint=/bin/bash -v ${pwd()}:${workDir} -w ${workDir} ${image}`
: `run --rm -P -v ${pwd()}:${workDir} -w ${workDir} ${image} bash ${BUILD_SCRIPT}`;

if (dryRun) {
console.log(`docker command:\n\tdocker ${cmd}`);
Expand Down
32 changes: 16 additions & 16 deletions test/__snapshots__/integration.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
exports[`environment variables miltiple variables are added to the script 1`] = `
"executing step in \\"ubuntu\\"
docker command:
docker run -P -v PWD:/ws -w /ws ubuntu bash .bbrun.sh
docker run --rm -P -v PWD:/ws -w /ws ubuntu bash .bbrun.sh
build script:
export foo=bar
export var=env
Expand All @@ -15,7 +15,7 @@ build script:
exports[`environment variables single variable is added to the script 1`] = `
"executing step in \\"ubuntu\\"
docker command:
docker run -P -v PWD:/ws -w /ws ubuntu bash .bbrun.sh
docker run --rm -P -v PWD:/ws -w /ws ubuntu bash .bbrun.sh
build script:
export foo=bar
set -e
Expand All @@ -32,7 +32,7 @@ Malformed template, check https://confluence.atlassian.com/bitbucket/configure-b
exports[`no image template should use default atlassian image 1`] = `
"executing step in \\"atlassian/default-image:latest\\"
docker command:
docker run -P -v PWD:/ws -w /ws atlassian/default-image:latest bash .bbrun.sh
docker run --rm -P -v PWD:/ws -w /ws atlassian/default-image:latest bash .bbrun.sh
build script:
set -e
echo \\"testing stuff\\"
Expand All @@ -42,7 +42,7 @@ build script:
exports[`should resolve private image names 1`] = `
"executing step in \\"account-name/openjdk:8\\"
docker command:
docker run -P -v PWD:/ws -w /ws account-name/openjdk:8 bash .bbrun.sh
docker run --rm -P -v PWD:/ws -w /ws account-name/openjdk:8 bash .bbrun.sh
build script:
set -e
echo \\"testing stuff\\"
Expand All @@ -52,7 +52,7 @@ build script:
exports[`single step pipeline executes the default step with no arguments 1`] = `
"executing step in \\"ubuntu\\"
docker command:
docker run -P -v PWD:/ws -w /ws ubuntu bash .bbrun.sh
docker run --rm -P -v PWD:/ws -w /ws ubuntu bash .bbrun.sh
build script:
set -e
echo \\"testing stuff\\"
Expand All @@ -62,7 +62,7 @@ build script:
exports[`single step pipeline executes the step by name 1`] = `
"executing step \\"test\\" in \\"ubuntu\\"
docker command:
docker run -P -v PWD:/ws -w /ws ubuntu bash .bbrun.sh
docker run --rm -P -v PWD:/ws -w /ws ubuntu bash .bbrun.sh
build script:
set -e
echo \\"testing stuff\\"
Expand All @@ -72,7 +72,7 @@ build script:
exports[`template with multiple steps in the default pipeline should execute a named step in a branch 1`] = `
"executing step \\"master_step_2\\" in \\"atlassian/default-image:latest\\"
docker command:
docker run -P -v PWD:/ws -w /ws atlassian/default-image:latest bash .bbrun.sh
docker run --rm -P -v PWD:/ws -w /ws atlassian/default-image:latest bash .bbrun.sh
build script:
set -e
echo \\"master step 2\\"
Expand All @@ -82,7 +82,7 @@ build script:
exports[`template with multiple steps in the default pipeline should execute a single step by name 1`] = `
"executing step \\"step2\\" in \\"atlassian/default-image:latest\\"
docker command:
docker run -P -v PWD:/ws -w /ws atlassian/default-image:latest bash .bbrun.sh
docker run --rm -P -v PWD:/ws -w /ws atlassian/default-image:latest bash .bbrun.sh
build script:
set -e
echo \\"step2\\"
Expand All @@ -92,7 +92,7 @@ build script:
exports[`template with multiple steps in the default pipeline should execute a single step by name with spaces in the name 1`] = `
"executing step \\"Step Three\\" in \\"ubuntu\\"
docker command:
docker run -P -v PWD:/ws -w /ws ubuntu bash .bbrun.sh
docker run --rm -P -v PWD:/ws -w /ws ubuntu bash .bbrun.sh
build script:
set -e
echo \\"step3\\"
Expand All @@ -102,19 +102,19 @@ build script:
exports[`template with multiple steps in the default pipeline should execute all the default steps when no argument is provided 1`] = `
"executing step in \\"atlassian/default-image:latest\\"
docker command:
docker run -P -v PWD:/ws -w /ws atlassian/default-image:latest bash .bbrun.sh
docker run --rm -P -v PWD:/ws -w /ws atlassian/default-image:latest bash .bbrun.sh
build script:
set -e
echo \\"testing stuff\\"
executing step in \\"atlassian/default-image:latest\\"
docker command:
docker run -P -v PWD:/ws -w /ws atlassian/default-image:latest bash .bbrun.sh
docker run --rm -P -v PWD:/ws -w /ws atlassian/default-image:latest bash .bbrun.sh
build script:
set -e
echo \\"step2\\"
executing step in \\"ubuntu\\"
docker command:
docker run -P -v PWD:/ws -w /ws ubuntu bash .bbrun.sh
docker run --rm -P -v PWD:/ws -w /ws ubuntu bash .bbrun.sh
build script:
set -e
echo \\"step3\\"
Expand All @@ -124,13 +124,13 @@ build script:
exports[`template with multiple steps in the default pipeline should execute all the steps in a branch if no step provided 1`] = `
"executing step in \\"atlassian/default-image:latest\\"
docker command:
docker run -P -v PWD:/ws -w /ws atlassian/default-image:latest bash .bbrun.sh
docker run --rm -P -v PWD:/ws -w /ws atlassian/default-image:latest bash .bbrun.sh
build script:
set -e
echo \\"testing stuff in master branch\\"
executing step in \\"atlassian/default-image:latest\\"
docker command:
docker run -P -v PWD:/ws -w /ws atlassian/default-image:latest bash .bbrun.sh
docker run --rm -P -v PWD:/ws -w /ws atlassian/default-image:latest bash .bbrun.sh
build script:
set -e
echo \\"master step 2\\"
Expand All @@ -140,7 +140,7 @@ build script:
exports[`template with multiple steps in the default pipeline should understand asterisk branches 1`] = `
"executing step \\"branch step 2\\" in \\"atlassian/default-image:latest\\"
docker command:
docker run -P -v PWD:/ws -w /ws atlassian/default-image:latest bash .bbrun.sh
docker run --rm -P -v PWD:/ws -w /ws atlassian/default-image:latest bash .bbrun.sh
build script:
set -e
echo \\"testing stuff in any branch\\"
Expand All @@ -150,7 +150,7 @@ build script:
exports[`working directory is overriden 1`] = `
"executing step in \\"ubuntu\\"
docker command:
docker run -P -v PWD:/test_wd -w /test_wd ubuntu bash .bbrun.sh
docker run --rm -P -v PWD:/test_wd -w /test_wd ubuntu bash .bbrun.sh
build script:
set -e
echo \\"testing stuff\\"
Expand Down

0 comments on commit 83828aa

Please sign in to comment.